A width parameter turns one adder into a family of adders. The flow elaborates the same source at each width and checks each result.
Each run below holds a single top module with one addition. The generic netlist of each run therefore holds exactly one $add cell.
Width | Ports | Generic netlist |
|---|---|---|
4 | Two 4-bit inputs, one 5-bit sum | Exactly one |
8 | Two 8-bit inputs, one 9-bit sum | Exactly one |
The script reads the parameterised adder inline, runs generic synthesis, and asserts the adder count at each width. It ends with one log PASS line.
read_verilog <<EOV
module top #(parameter W = 4) (input [W-1:0] a, b, output [W:0] s);
assign s = a + b;
endmodule
EOV
hierarchy -top top
proc
opt_clean
check
select -assert-count 1 t:$add
stat
design -reset
read_verilog <<EOV
module top #(parameter W = 8) (input [W-1:0] a, b, output [W:0] s);
assign s = a + b;
endmodule
EOV
hierarchy -top top
proc
opt_clean
check
select -assert-count 1 t:$add
stat
log PASS: width-parameterised adder gives one adder cell at widths 4 and 8stat prints the generic census into the log for human readers. select -assert-count pins the counts, so a wrong claim fails the run instead of the review.
Assertion | What it pins |
|---|---|
| The 4-bit run holds exactly one generic adder. |
| The 8-bit run holds exactly one generic adder. |
| The netlist is structurally sound before counting. |
Neither. Each run still holds exactly one $add cell, so the proof is width-independent.
stat if select carries the proof?stat writes the census into the log for humans. select turns the key counts into failures when they are wrong.