aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEddie Hung <eddie@fpgeh.com>2019-08-28 12:21:15 -0700
committerEddie Hung <eddie@fpgeh.com>2019-08-28 12:21:15 -0700
commitebd0a1875b74460da10d9b114e97c1468d8542db (patch)
tree01118cbc5f2b758b3adc5539486a601c53149d77 /tests
parent32eef26ee277b79736e135a8800625543dd6080a (diff)
downloadyosys-ebd0a1875b74460da10d9b114e97c1468d8542db.tar.gz
yosys-ebd0a1875b74460da10d9b114e97c1468d8542db.tar.bz2
yosys-ebd0a1875b74460da10d9b114e97c1468d8542db.zip
Use equiv_opt for latches
Diffstat (limited to 'tests')
-rw-r--r--tests/ice40/latches.ys11
-rw-r--r--tests/ice40/latches_tb.v57
2 files changed, 10 insertions, 58 deletions
diff --git a/tests/ice40/latches.ys b/tests/ice40/latches.ys
index fe0d1f70e..f3562559e 100644
--- a/tests/ice40/latches.ys
+++ b/tests/ice40/latches.ys
@@ -1,6 +1,15 @@
read_verilog latches.v
+design -save read
+
+proc
+async2sync # converts latches to a 'sync' variant clocked by a 'super'-clock
+flatten
+synth_ice40
+equiv_opt -assert -map +/ice40/cells_sim.v synth_ice40 # equivalency check
+design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
+
+design -load read
synth_ice40
cd top
select -assert-count 4 t:SB_LUT4
select -assert-none t:SB_LUT4 %% t:* %D
-write_verilog latches_synth.v
diff --git a/tests/ice40/latches_tb.v b/tests/ice40/latches_tb.v
deleted file mode 100644
index b0585264b..000000000
--- a/tests/ice40/latches_tb.v
+++ /dev/null
@@ -1,57 +0,0 @@
-module testbench;
- reg clk;
-
- initial begin
- // $dumpfile("testbench.vcd");
- // $dumpvars(0, testbench);
-
- #5 clk = 0;
- repeat (10000) begin
- #5 clk = 1;
- #5 clk = 0;
- end
- end
-
-
- reg [2:0] dinA = 0;
- wire doutB,doutB1,doutB2;
- reg lat,latn,latsr = 0;
-
- top uut (
- .clk (clk ),
- .a (dinA[0] ),
- .pre (dinA[1] ),
- .clr (dinA[2] ),
- .b (doutB ),
- .b1 (doutB1 ),
- .b2 (doutB2 )
- );
-
- always @(posedge clk) begin
- #3;
- dinA <= dinA + 1;
- end
-
- always @*
- if ( clk )
- lat <= dinA[0];
-
-
- always @*
- if ( !clk )
- latn <= dinA[0];
-
-
- always @*
- if ( dinA[2] )
- latsr <= 1'b0;
- else if ( dinA[1] )
- latsr <= 1'b1;
- else if ( clk )
- latsr <= dinA[0];
-
- assert_dff lat_test(.clk(clk), .test(doutB), .pat(lat));
- assert_dff latn_test(.clk(clk), .test(doutB1), .pat(latn));
- assert_dff latsr_test(.clk(clk), .test(doutB2), .pat(latsr));
-
-endmodule