3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-06-19 04:13:39 +00:00

opt_lut: new pass, to combine LUTs for tighter packing.

This commit is contained in:
whitequark 2018-12-05 00:23:22 +00:00
parent 1719aa88ac
commit 9e072ec21f
8 changed files with 320 additions and 1 deletions

1
tests/opt/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
*.log

3
tests/opt/ice40_carry.v Normal file
View file

@ -0,0 +1,3 @@
module SB_CARRY (output CO, input I0, I1, CI);
assign CO = (I0 && I1) || ((I0 || I1) && CI);
endmodule

18
tests/opt/opt_lut.v Normal file
View file

@ -0,0 +1,18 @@
module top(
input [8:0] a,
input [8:0] b,
output [8:0] o1,
output [2:0] o2,
input [2:0] c,
input [2:0] d,
output [2:0] o3,
output [2:0] o4,
input s
);
assign o1 = (s ? 0 : a + b);
assign o2 = (s ? a : a - b);
assign o3 = (s ? 4'b1111 : d + c);
assign o4 = (s ? d : c - d);
endmodule

15
tests/opt/opt_lut.ys Normal file
View file

@ -0,0 +1,15 @@
read_verilog opt_lut.v
synth_ice40
ice40_unlut
design -save preopt
opt_lut
design -stash postopt
design -copy-from preopt -as preopt top
design -copy-from postopt -as postopt top
equiv_make preopt postopt equiv
techmap -map ice40_carry.v
prep -flatten -top equiv
equiv_induct
equiv_status -assert

6
tests/opt/run-test.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/bash
set -e
for x in *.ys; do
echo "Running $x.."
../../yosys -ql ${x%.ys}.log $x
done