The Specification Is Data

Most of a chip's specification is tables: addresses, registers, wires, pins, interrupts. Kept as data files, they build the RTL and the tests. Learn to read them as the thing under test, and run a test made straight from them.

You Will Be Able To

  • Name the files of ap_soc's hand-off package and what each one decides.
  • Read a row of each file and find the fact a test needs.
  • Turn rows of data into a chip test, and read a failing row as a disagreement.
  • Explain why a test made from the same data as the RTL can agree with a wrong design.
Lesson
V2.1
Time
24 min
Runs on
Your browser
Check
5 questions

Integration week. The designer says GPIO is interrupt source 2, and the firmware header says 3. The document says 2 in one table and 3 in another. Nobody is lying. Each copied the number from somewhere, and the copies drifted.

The Hand-Off Package Around the ChipStep through the files. Each one is a table; each table feeds the RTL and the tests that check it.
  • External
  • Processor
  • Pads
  • Debug
  • Data
  • Interrupt
  • Debug
The Hand-Off Package Around the ChipStep through the files. Each one is a table; each table feeds the RTL and the tests that check it. external map.json 16 regions: base,size, kind external regs/*.json 64 registers in 10files processor ap_soc v1.5 the RTL under test external connect.csv 357 wires: from, to,width, clock, power pads pins.csv 35 rows: pad, PINMUXvalue, function external irq.csv 16 interrupt sources debug Generated checks register sweep, mapwalk, wiring proofs decodersregister blockstop levelpin muxinterrupt mapcheck
  1. external map.json16 regions: base, size, kind
    • decoders → ap_soc v1.5
  2. processor ap_soc v1.5the RTL under test
  3. external regs/*.json64 registers in 10 files
    • register blocks → ap_soc v1.5
  4. external connect.csv357 wires: from, to, width, clock, power
    • top level → ap_soc v1.5
  5. pads pins.csv35 rows: pad, PINMUX value, function
    • pin mux → ap_soc v1.5
  6. external irq.csv16 interrupt sources
    • interrupt map → ap_soc v1.5
  7. debug Generated checksregister sweep, map walk, wiring proofs
    • check → ap_soc v1.5
  1. The map

    Where every block lives, and which addresses belong to nobody.

  2. The registers

    Every register: offset, fields, access, reset value. A tool makes the register RTL and the C header from them.

  3. Wires, pins, interrupts

    Which output drives which input, which pad carries which function, which wire is which interrupt source.

  4. Checks from the same tables

    The same rows become tests: read every reset value, probe every hole, prove every wire. A disagreement is a bug in the chip or in the data.

Read the diagram as text
  • map.json: 16 regions: base, size, kind
  • regs/*.json: 64 registers in 10 files
  • ap_soc v1.5: the RTL under test
  • connect.csv: 357 wires: from, to, width, clock, power
  • pins.csv: 35 rows: pad, PINMUX value, function
  • irq.csv: 16 interrupt sources
  • Generated checks: register sweep, map walk, wiring proofs
  • map.json → ap_soc v1.5: decoders
  • regs/*.json → ap_soc v1.5: register blocks
  • connect.csv → ap_soc v1.5: top level
  • pins.csv → ap_soc v1.5: pin mux
  • irq.csv → ap_soc v1.5: interrupt map
  • Generated checks → ap_soc v1.5: check

Row counts measured from the files in tools/soc/ap_soc/ by our script.

Before You Start

Read The Generated Header and The Chip-Level Verification Plan first. The Memory Map explains regions and holes.

Five questions this page answers
Question
1Why does a chip keep its specification as data?
2Which file of the package decides what?
3How do you read one row of each?
4How does a table of data become a chip test?
5When can a test made from the data miss a bug?

The Idea: One Table, Many Readers

A chip specification has two kinds of content. Some is behaviour: how the DMA moves a byte, when the watchdog bites. Much more is tables: where UART0 lives, what DIV resets to, which wire is interrupt 2, which pad carries UART TX. Those tables have many readers: the RTL, the C header, the bench, the document and the plan.

If each reader types its own copy, the copies drift, as in the opening scene. So chip teams keep each table once, as a data file, and generate the rest. The ap_soc chip does this: tools make the decoders, the register blocks, the top level and the pin mux from its files.

For verification this changes the question. The files become part of the thing under test. A check asks: does the chip do what the row says? And when the answer is no, someone must decide which one is wrong.

New Words

New words on this page
WordMeaning
Hand-off packageThe data files that describe the chip for everyone who builds or checks it.
map.jsonThe address map: each region's name, base, size and kind (memory, device, reserved).
regs/*.jsonOne file per block: every register's offset, fields, access and reset value.
connect.csvEvery wire of the top level: from, to, width, clock domain, power domain.
pins.csv and irq.csvWhich function each pad carries for each PINMUX value; which wire is each interrupt source.
Generated checkA test or proof made by a tool from the rows of a data file.

The Smallest Example: One Row of Each File

Read one row of each file and say what it decides.

One row each, from tools/soc/ap_soc/
FileRowWhat it decides
map.jsonUART0: base 0x10000000, size 0x00001000, deviceUART0 answers in that 4 KiB window
regs/uart.jsonDIV: offset 0x10, field cycles 15:0, rw, reset 0x10DIV reads 16 after reset
irq.csv2,GPIO,u_gpio.irq,clk_sys,GPIO's request is ap_plic source 2, in the clk_sys domain
pins.csvIO0,2,uart_tx,out,...PINMUX value 2 on pad IO0 gives UART TX
connect.csvu_dm.haddr,u_fabric.m_haddr[31:0],32,clk_sysThe debug module drives manager 0's address

Whole files: map.json 16 regions, regs 64 registers, connect.csv 357 rows. Also pins.csv 35, irq.csv 16, blocks.csv 31 (30 instances and the top).

Each row is a promise and a test at once. The DIV row promises a reset value; a test reads 0x1000_0010 after reset and expects 0x10. The irq.csv row promises a wire; a test makes GPIO ask and expects claim 2.

The Rules

  1. Rule 1: Each table lives in one file.

    RTL, header, document and tests are made from it, never typed again.

  2. Rule 2: Every row is a check.

    A reset value, a hole, a wire or a pad function is something a test can prove.

  3. Rule 3: A failing row is a disagreement.

    The chip or the data is wrong; the specification decides which.

  4. Rule 4: Check the data against its source.

    A test made from wrong data agrees with RTL made from the same wrong data.

Sources for These Rules

The package and its generators: docs/soc-verification-plan.md section 3.2 (data files); tools/soc/ap_soc/regs/README.md; top-gen.mjs.

The register numbers: docs/soc/ap_soc-facts.md sections 27.3 to 27.6 (the facts file is the source the data is checked against).

Keeping register and map tables as data that generate RTL, headers and tests is common practice; standard formats are IP-XACT and SystemRDL. Not tied to one book of the library.

Now Run It: A Test Made from the Files

A short script read gen/ap_soc_regmodel.csv (made from regs/*.json) and map.json, and wrote 62 rows for the bus-manager seat. Of these, 44 read a reset value, 11 read a register that must answer ERROR, and 7 probe holes and reserved pages. Here are the first rows.

Rows of the generated table: who, op, address, data, mask, expected value, delay, repeat.
core r 02000000 00000000 00000001 00000000 0 1
core r 02004000 00000000 ffffffff ffffffff 0 1
core r 02004004 00000000 ffffffff ffffffff 0 1
core r 0c000004 00000000 00000007 00000000 0 1
core r 0c000008 00000000 00000007 00000000 0 1
core r 0c00000c 00000000 00000007 00000000 0 1

The table ran on the chip with no processor: verdict=pass after 260 cycles and 64 transfers, visited = 1ff6. Rules 1 and 2 at work: nobody typed an address or a reset value.

Then one row was changed to what an older register file said: core r 10000010 00000000 0000ffff 00000008 0 1. The run failed at once, and the bench said why.

Measured on our bench (soc_tb on Verilator 5.052 2026-09-05, bus-manager seat).
BENCH 61: seat: read 10000010 = 00000010, expected 00000008 (mask 0000ffff)

That is rule 3. The chip says 16; the row says 8. The facts file, the specification of this chip, says DIV resets to 16, so the data was wrong, not the chip.

Why It Is Built This Way

The other way is a specification in prose, with tables inside documents. People read it well; tools cannot. Every reader retypes the numbers, and each change must be made in every copy. The drift in the opening scene is the usual result.

Data files cost something too. Someone must write the generators, and a mistake in a file now spreads everywhere at once. So the package of ap_soc is checked against the facts file by its own gate. And some checks must come from somewhere else.

The Trap: The Test That Agrees with the Design

Suppose regs/uart.json says DIV resets to 8, and the specification says 16. The register RTL is generated from the file, so it resets to 8. A sweep generated from the same file expects 8. It passes, on a wrong chip.

Generated checks prove that the chip matches the data. They cannot prove that the data matches the intent. So keep a few checks that do not come from the files. A smoke program written by hand, firmware from the software team and a review of the files against the specification are three. The practice problems ask you to read the files the way such a review does.

At Scale

ap_soc~12 blocks
Phone-class SoChundreds of blocks

This section looks ahead. ap_soc has six small files.

  1. Standard formats

    Industry keeps registers in standard formats, such as IP-XACT or SystemRDL, so tools from different vendors can read them. The idea is the same as regs/*.json.

  2. Thousands of rows

    A large chip has tens of thousands of registers and wires. Nobody reads them all; generated checks do, and reviews sample them.

  3. Versions

    The package changes during the project. Each RTL drop names the package version it was made from, so a failing row can be traced to a change.

Try It

Run the slice: it reads PINMUX = 0x6 through rows of pins.csv.

Set PINMUX to 0x0A and predict the function of IO1.

Set PINMUX so that IO4 gets value 3 (bits 9:8). Predict what IO4 carries.

RUNIcarus Verilog · in your browser
Edit the code, then run it
Expected: IO0: PINMUX value 2 -> uart_tx IO1: PINMUX value 1 -> gpio IO2: PINMUX value 0 -> released (input, no function) IO3: PINMUX value 0 -> released (input, no function) IO4: PINMUX value 0 -> released (input, no function) IO5: PINMUX value 0 -> released (input, no function)

Check Yourself

Predict the outputPINMUX is 0x0E5A. What is the last line the slice prints?
// Rows of pins.csv for IO0 to IO5, typed in as data: pad, PINMUX value, function.
// A PINMUX word gives each pad two bits; this reads which function each pad gets.
module tb;
  localparam logic [31:0] PINMUX = 32'h00000e5a;
  function automatic string function_of(int pad, int sel);
    case ({pad[3:0], sel[1:0]})
      {4'd0, 2'd1}: return "gpio";
      {4'd0, 2'd2}: return "uart_tx";
      {4'd0, 2'd3}: return "pwm";
      {4'd1, 2'd1}: return "gpio";
      {4'd1, 2'd2}: return "uart_rx";
      {4'd1, 2'd3}: return "capture";
      {4'd2, 2'd1}: return "gpio";
      {4'd2, 2'd2}: return "spi_sclk";
      {4'd2, 2'd3}: return "pwm";
      {4'd3, 2'd1}: return "gpio";
      {4'd3, 2'd2}: return "spi_miso";
      {4'd3, 2'd3}: return "capture";
      {4'd4, 2'd1}: return "gpio";
      {4'd4, 2'd2}: return "spi_mosi";
      {4'd4, 2'd3}: return "event_in";
      {4'd5, 2'd1}: return "gpio";
      {4'd5, 2'd2}: return "spi_cs_n";
      default: return "released (input, no function)";
    endcase
  endfunction
  initial
    for (int pad = 0; pad < 6; pad++)
      $display("IO%0d: PINMUX value %0d -> %s", pad, (PINMUX >> (2 * pad)) & 3, function_of(pad, (PINMUX >> (2 * pad)) & 3));
endmodule
ConceptWhy does a chip keep its register table as a data file?
ConceptA generated row fails: the chip reads 16 where the row expects 8. What do you do first?
ConceptThe register RTL and a sweep are both made from a regs file with a wrong reset value. What does the sweep report?
ConceptWhich file says that pad IO1 carries UART RX when its PINMUX field is 2?

Common Mistakes

Wrong Copy a reset value from the document into a test.

The copy drifts when the register changes.

Fix Read it from the data file, or the header made from it.

Wrong Trust a generated sweep to find a wrong reset value.

It was made from the same data as the RTL, so both agree.

Fix Review the data against the specification, and keep checks that come from elsewhere.

Wrong Fix a failing generated row by changing the expected value.

The chip might be the one that is wrong.

Fix Decide from the specification which side is wrong, then fix that side.

Remember

  • Most of a chip specification is tables; ap_soc keeps them as data files.
  • The same files generate the RTL and the checks, so nothing is typed twice.
  • Every row is a check; a failing row is a disagreement the specification settles.
  • Checks made from the data cannot find a mistake in the data: keep some from elsewhere.

Practice

Report a problem with this page