3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-03-23 04:49:15 +00:00
yosys/tests/csa_tree/csa_tree_sim.ys
2026-03-18 12:36:31 +01:00

72 lines
1.5 KiB
Text

read_verilog <<EOT
module sim_add4(
input [7:0] a, b, c, d,
output [7:0] y
);
assign y = a + b + c + d;
endmodule
EOT
hierarchy -auto-top
proc
csa_tree
sat -set a 1 -set b 2 -set c 3 -set d 4 -prove y 10
sat -set a 0 -set b 0 -set c 0 -set d 0 -prove y 0
sat -set a 255 -set b 1 -set c 0 -set d 0 -prove y 0
sat -set a 100 -set b 50 -set c 25 -set d 25 -prove y 200
sat -set a 255 -set b 255 -set c 255 -set d 255 -prove y 252
design -reset
read_verilog <<EOT
module sim_sub_mixed(
input [7:0] a, b, c, d,
output [7:0] y
);
assign y = a + b - c + d;
endmodule
EOT
hierarchy -auto-top
proc
csa_tree
sat -set a 10 -set b 20 -set c 5 -set d 3 -prove y 28
sat -set a 0 -set b 0 -set c 0 -set d 0 -prove y 0
sat -set a 100 -set b 50 -set c 30 -set d 10 -prove y 130
sat -set a 1 -set b 1 -set c 255 -set d 1 -prove y 4
design -reset
read_verilog <<EOT
module sim_sub_all(
input [7:0] a, b, c, d,
output [7:0] y
);
assign y = a - b - c - d;
endmodule
EOT
hierarchy -auto-top
proc
csa_tree
sat -set a 100 -set b 10 -set c 20 -set d 30 -prove y 40
sat -set a 0 -set b 0 -set c 0 -set d 0 -prove y 0
sat -set a 255 -set b 1 -set c 1 -set d 1 -prove y 252
design -reset
read_verilog <<EOT
module sim_double_neg(
input [7:0] a, b, c,
output [7:0] y
);
wire [7:0] ab = a - b;
assign y = c - ab;
endmodule
EOT
hierarchy -auto-top
proc
csa_tree
sat -set a 30 -set b 20 -set c 10 -prove y 0
sat -set a 50 -set b 25 -set c 100 -prove y 75
sat -set a 0 -set b 0 -set c 0 -prove y 0
sat -set a 255 -set b 1 -set c 1 -prove y 3
design -reset