Connectivity Proofs from connect.csv
Turn each row of the chip's wiring table into a property. A formal tool proves every one with the blocks left out. See what it can see, and what it cannot.
You Will Be Able To
- Explain how one row of connect.csv becomes one property, and why every block is an empty box in the proof.
- Say why a proof suits wiring and why a simulation test does not.
- Read a proof's result: proved, an unconstrained wire, or a counterexample with its values.
- Name what a connectivity proof cannot check.
- Lesson
- V8.1
- Time
- 26 min
- Runs on
- Your browser
- Check
- 5 questions
The night before a tape-out review, someone asks the question nobody likes. "Has every wire between the blocks been checked?" The UART test passes. The DMA test passes. But there are hundreds of wires, and a passing test touches only some of them.
This lesson is about the one tool that can answer yes for all of them at once.
- Control / FSM
- Test
- Bus
- Manager
- Peripheral
- Control
- Data
- A row
One line names a driver, a load, a width, the load's clock and power domain, and any crossing.
- Two products
The generator writes the wire into the top level, and writes a property that says the two ends are equal.
- Empty boxes
Every block is replaced by a box whose outputs can take any value. Only the wiring between them is real.
- One answer per row
The solver tries every value of every free output at once. Each property is proved, or it fails with a trace of values.
Read the diagram as text
- connect.csv row: u_uart.rx_ready, u_dma.rx_ready, 1, clk_sys, ...
- top-gen.mjs: the generator
- Generated top level: blocks as empty boxes
- Property: u_dma.rx_ready == u_uart.rx_ready
- SymbiYosys: every value at once
- Proved, or a counterexample: per row
- connect.csv row → top-gen.mjs: one line of data
- top-gen.mjs → Generated top level: the wire
- top-gen.mjs → Property: the check
- Generated top level → SymbiYosys: free block outputs
- Property → SymbiYosys: assert
- SymbiYosys → Proved, or a counterexample: answer
tools/soc/ap_soc/top-gen.mjs writes gen/rtl/ap_soc.sv and gen/formal/ap_soc_connect_formal.sv from the same tables (facts §27.11).
Before You Start
Read The Specification Is Data and Where You May Look first. The Formal track's Connectivity lesson teaches the method; this page uses it on ap_soc.
| Question | |
|---|---|
| 1 | What does one row of connect.csv become in a proof? |
| 2 | Why are the blocks empty boxes during the proof? |
| 3 | Why is a proof the right tool for wiring, and a test the wrong one? |
| 4 | What does a counterexample tell you, and what does "unconstrained" mean? |
| 5 | What can a connectivity proof never see? |
The Idea: Check the Wires Between Blocks
Every block of ap_soc arrives tested by its own bench. What no block bench can test is the wire that leaves it. Does the UART's "byte ready" really reach the DMA? Does the fourth pad really carry the SPI select? A block bench never sees where its output goes.
The wiring of ap_soc is written down as data, in connect.csv: one row for each wire. The top level is generated from that table. A connectivity proof checks the generated top against the same table, row by row. It needs no test program and no stimulus, because it does not run the blocks at all.
That is the trick. Leave the blocks out, keep only the wires, and ask a formal tool whether each wire joins what the table says. With nothing inside the blocks, the question is small, and the answer covers every value at once.
New Words
| Word | Meaning |
|---|---|
| Connectivity proof | A formal check that each wire of a table joins the two ends it names, for every value, with no stimulus. |
| Empty box | A block replaced by nothing but its ports, whose outputs may take any value in the proof (a free output). |
| Property | A statement the tool must prove always holds; here, "this load equals that driver". |
| Counterexample | Values of the free signals under which a property fails, shown as a short trace. |
| Unconstrained wire | A load the table names but no submitted row describes; nothing checks it. |
| Conditional connection | A wire that exists only when a select has one value, such as a pad's function in PINMUX. |
The Smallest Example: Four Rows by Hand
Take a toy top level with four free outputs and four loads. The table says the UART's rx_ready drives the DMA's rx_ready, and tx_room drives tx_room. Two interrupt wires go to inputs 1 and 2. In the toy, the first two wires are crossed.
| Row (driver -> load) | In the top level | Is there a value where they differ? | Result |
|---|---|---|---|
| u_uart.rx_ready -> u_dma.rx_ready | driven by tx_room | yes: rx_ready 0, tx_room 1 | counterexample |
| u_uart.tx_room -> u_dma.tx_room | driven by rx_ready | yes: the same values | counterexample |
| u_uart.irq -> u_plic.irq[1] | as written | no | holds |
| u_gpio.irq -> u_plic.irq[2] | as written | no | holds |
A toy. The runnable example below checks it on Icarus over all 16 values; the real tool reasons about every value symbolically.
Notice what a crossed pair does. Both rows fail, and each failure points at one load. A test that sent one byte might have passed: the DMA waits on both flags, and both rise at some point.
The Rules
Rule 1: One row is one property.
The property says the load equals the driver: destination == source. A slice row checks only those bits.
Rule 2: Blocks are empty boxes.
Their outputs are free, so the tool must prove each equality for every value they could take.
Rule 3: A row that holds proves its wire.
No stimulus can leave a value out, because the tool covers all of them.
Rule 4: A missing row proves nothing.
A load with no row is unconstrained: a wrong wire there passes. Completeness is the hard part.
Rule 5: A pad function is a conditional row.
It must hold only when PINMUX selects that function: "if IO3 select is 2, then the SPI input equals pad 3".
Rule 6: The proof sees wires, nothing more.
Block behaviour, timing, synchronizer delay and metastability are outside it.
Sources for These Rules
Connectivity checking with formal tools, from a table of connections turned into assertions: MEHTA-DV 10.9.
The chip's tables and generator: tools/soc/ap_soc/connect.csv, irq.csv, pins.csv, top-gen.mjs; the harness gen/formal/ap_soc_connect_formal.sv (facts §27.11, plan §3.10 E4).
The site's wiring parts and proof: tools/soc-conn-parts.mjs and tools/soc-conn.mjs (SymbiYosys with Boolector, depth 2; facts §27.21). Crossings are proved to and from the synchronizer only.
The Lab: Two Rows, Then a Pad
This site splits the chip's wiring into 62 parts and proves one part at a time. The smallest is the DMA's two request inputs. Here are its rows, exactly as a learner would submit them:
from,to,width,clock,power,cross,note
u_uart.rx_ready,u_dma.rx_ready,1,clk_sys,PD_MAIN,,
u_uart.tx_room,u_dma.tx_room,1,clk_sys,PD_MAIN,,On the good wiring both rows are proved. Rule 3 at work: no stimulus was written. The site then runs the same rows on two altered copies of the top, and all three runs take 0.90 s together. In each copy, one input of the DMA is driven by the inverse of its wire. Each fails:
altered chip A: counterexample
Step 0 u_uart.rx_ready=0 u_dma.rx_ready=1 u_uart.tx_room=0 u_dma.tx_room=0
altered chip B: counterexample
Step 0 u_uart.rx_ready=0 u_dma.rx_ready=0 u_uart.tx_room=0 u_dma.tx_room=1Read the first trace: u_uart.rx_ready = 0, yet u_dma.rx_ready = 1. The tool found a value where the load is not its driver, and named both ends. Leave the first row out, and the proof says so before anything else:
one row submitted: 1 unconstrained wire.Pads are where rules 5 and 6 matter. Part pad-io3 has eight rows. Most are conditional: each holds only when PINMUX selects its function. One of them says the SPI data input equals pad 3 whenever IO3 select is 2.
from,to,width,clock,power,cross,note
u_gpio.pad_oe[3],u_pads.io_oe[3],1,clk_sys,PD_MAIN,IO3==1,
u_gpio.pad_out[3],u_pads.io_out[3],1,clk_sys,PD_MAIN,IO3==1,
u_pads.io_in[3],u_gpio.pad_in[3],1,clk_sys,PD_MAIN,,
1'b0,u_pads.io_oe[3],1,clk_sys,PD_MAIN,IO3==0,
1'b0,u_pads.io_oe[3],1,clk_sys,PD_MAIN,IO3==2,
1'b0,u_pads.io_oe[3],1,clk_sys,PD_MAIN,IO3==3,
u_pads.io_in[3],u_spi.miso,1,clk_sys,PD_MAIN,IO3==2,
u_pads.io_in[3],u_sync_capture.d,1,clk_sys,PD_MAIN,IO3==3&IO1!=3,The first altered chip of this part is the seeded fault Q064, met in the fundamentals module. Its serial input samples the clock pad. The proof fails at once. In its first step IO3==2 is 1, pad 3 is 1, and the SPI input is 0. No SPI frame was needed to find it.
The whole chip has the same treatment at stage E4. Its generated harness holds 437 properties. 329 cover the wires of connect.csv and irq.csv, 18 the sources of ap_plic, and 90 the pad functions. That is every wire with a load, in one run.
Why It Is Built This Way
Why not test the wiring in simulation? Because a test proves only the values it drove. A 32-bit bus has more than four billion values, and a crossed bit pair shows only when the two bits differ. A test touches a few values on a few wires. The proof touches all values on every described wire.
Why leave the blocks out? With real blocks inside, the tool would have to reason about a processor, a DMA and a bus fabric. With empty boxes, each property is a few gates deep, so every part proves in under a second. The block benches already checked the insides.
Why generate the top and the properties from one table? Because a hand-written top and a hand-written check can agree with each other and both be wrong. One table makes the intent single. The proof then checks that the generator, and every later hand edit, kept it.
Traps
The first trap is a proof of the wrong table. A team proves the top against connect.csv, but connect.csv itself copied a typo from the block's datasheet. Every property holds, and the chip is still miswired. The proof checks the top against the table, never the table against the intent. Review the table as hard as the RTL.
The second trap is the quiet hole. A designer adds a wire by hand in the top level and forgets the table. The proof still passes, because no row describes that load. That is why the site's proof counts unconstrained destinations, and why the E4 generator refuses a load with no driver.
The third trap is asking a wiring proof about time. A request crosses from the always-on clock through two flip-flops. The proof checks the wire into the synchronizer and the wire out of it. Whether the request arrives two edges later, and survives metastability, needs a sequential property or a crossing check.
At Scale
This section looks ahead. ap_soc has a few hundred wires; a large chip has far more.
Tables from tools
Large chips keep connectivity in spreadsheets or IP-XACT, written by integration tools, often with tens of thousands of rows.
Generated properties
Commercial connectivity apps read those tables and generate the properties, as top-gen.mjs does here.
Every change re-proved
Each late fix, or ECO, re-runs the proof. A wire moved for timing must still join the same two ends.
Try It
Run it: the crossed pair fails both its rows, and the other two hold.
Change CROSSED to 0 (the predict question below). What does every row print?
Which free values make the first row fail? Find them in the loop.
row u_uart.rx_ready -> u_dma.rx_ready: counterexample row u_uart.tx_room -> u_dma.tx_room: counterexample row u_uart.irq -> u_plic.irq[1]: holds row u_gpio.irq -> u_plic.irq[2]: holdsCheck Yourself
Common Mistakes
Wrong Count the wiring as checked because the block tests pass through it.
A test proves only the values and wires it touched; a crossed pair can hide behind values that agree.
Fix Prove each row of the table, with the blocks as empty boxes.
Wrong Accept a proof without counting the loads that have no row.
A load with no row is unconstrained; any wire there passes.
Fix Require every destination of the part to have a row.
Wrong Ask the wiring proof whether a synchronized request arrives in time.
The proof checks the wire into and out of the synchronizer, not the delay through it.
Fix Use a sequential property or a crossing check for timing.
Remember
- Each row of connect.csv becomes one property: load equals driver.
- Blocks are empty boxes, so the proof covers every value with no stimulus.
- A missing row checks nothing; count the unconstrained loads.
- Pad functions are conditional rows; time and synchronizers are outside the proof.