3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-05-25 19:36:21 +00:00
yosys/tests/arith_tree/arith_tree_defaults.ys
2026-05-18 13:44:40 +02:00

78 lines
1.5 KiB
Text

# Idempotence
read_verilog <<EOT
module idem_add4(
input [3:0] a, b, c, d,
output [3:0] y
);
assign y = a + b + c + d;
endmodule
EOT
hierarchy -auto-top
proc
arith_tree
select -assert-count 2 t:$fa
select -assert-count 1 t:$add
arith_tree
select -assert-count 2 t:$fa
select -assert-count 1 t:$add
design -reset
read_verilog <<EOT
module idem_mac(
input [3:0] a, b,
input [7:0] c,
output [7:0] y
);
assign y = a * b + c;
endmodule
EOT
hierarchy -auto-top
proc
alumacc
opt
arith_tree
select -assert-count 3 t:$fa
select -assert-count 1 t:$add
select -assert-count 0 t:$macc t:$macc_v2 %u
select -assert-count 0 t:$mul
arith_tree
select -assert-count 3 t:$fa
select -assert-count 1 t:$add
select -assert-count 0 t:$macc t:$macc_v2 %u
select -assert-count 0 t:$mul
design -reset
read_verilog <<EOT
module default_smoke(
input [15:0] a, b, c, d,
output [15:0] y
);
assign y = a + b + c + d;
endmodule
EOT
hierarchy -auto-top
proc
equiv_opt arith_tree
design -load postopt
select -assert-count 2 t:$fa
select -assert-count 2 t:$fa c:*emit_compressor_42* %i
select -assert-count 1 t:$add a:adder_arch=parallel_prefix %i
design -reset
read_verilog <<EOT
module default_narrow(
input [14:0] a, b, c, d,
output [14:0] y
);
assign y = a + b + c + d;
endmodule
EOT
hierarchy -auto-top
proc
equiv_opt arith_tree
design -load postopt
select -assert-count 2 t:$fa
select -assert-count 2 t:$fa c:*emit_compressor_42* %i
select -assert-count 1 t:$add
select -assert-count 0 t:$add a:adder_arch %i
design -reset