diff options
author | Eddie Hung <eddie@fpgeh.com> | 2020-01-16 09:15:42 -0800 |
---|---|---|
committer | Eddie Hung <eddie@fpgeh.com> | 2020-01-16 09:15:42 -0800 |
commit | 2245afa142b34ce88763b7d48016428c9523948e (patch) | |
tree | 2d80844a4a147aed4977d9440957d48cedfba759 | |
parent | e30b6bbbf8b5eaa8a16718d10ac6ab99da8e2b91 (diff) | |
download | yosys-2245afa142b34ce88763b7d48016428c9523948e.tar.gz yosys-2245afa142b34ce88763b7d48016428c9523948e.tar.bz2 yosys-2245afa142b34ce88763b7d48016428c9523948e.zip |
More rigorous test
-rw-r--r-- | tests/sat/clk2fflogic.ys | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/tests/sat/clk2fflogic.ys b/tests/sat/clk2fflogic.ys index cdbeb022b..6d6d9e490 100644 --- a/tests/sat/clk2fflogic.ys +++ b/tests/sat/clk2fflogic.ys @@ -1,4 +1,4 @@ -read_verilog <<EOT +read_verilog -icells <<EOT module top(input clk, d, s, r, output reg [17:0] q); always @(posedge clk or posedge s) if ( s) q[ 0] <= 1'b1; else q[ 0] <= d; always @(posedge clk or negedge s) if (!s) q[ 1] <= 1'b1; else q[ 1] <= d; @@ -9,14 +9,22 @@ always @(negedge clk or negedge s) if (!s) q[ 5] <= 1'b1; else q[ 5] <= d; always @(negedge clk or posedge r) if ( r) q[ 6] <= 1'b0; else q[ 6] <= d; always @(negedge clk or negedge r) if (!r) q[ 7] <= 1'b0; else q[ 7] <= d; +// Seems like proc_dlatch always sets {SET,CLR}_POLARITY to true always @(posedge clk or posedge s or posedge r) if ( r) q[ 8] <= 1'b0; else if ( s) q[ 8] <= 1'b1; else q[ 8] <= d; -always @(posedge clk or posedge s or negedge r) if (!r) q[ 9] <= 1'b0; else if ( s) q[ 9] <= 1'b1; else q[ 9] <= d; -always @(posedge clk or negedge s or posedge r) if ( r) q[10] <= 1'b0; else if (!s) q[10] <= 1'b1; else q[10] <= d; -always @(posedge clk or negedge s or negedge r) if (!r) q[11] <= 1'b0; else if (!s) q[11] <= 1'b1; else q[11] <= d; +//always @(posedge clk or posedge s or negedge r) if (!r) q[ 9] <= 1'b0; else if ( s) q[ 9] <= 1'b1; else q[ 9] <= d; +//always @(posedge clk or negedge s or posedge r) if ( r) q[10] <= 1'b0; else if (!s) q[10] <= 1'b1; else q[10] <= d; +//always @(posedge clk or negedge s or negedge r) if (!r) q[11] <= 1'b0; else if (!s) q[11] <= 1'b1; else q[11] <= d; +$dffsr #(.CLK_POLARITY(1'h1), .CLR_POLARITY(1'h0), .SET_POLARITY(1'h1), .WIDTH(32'd1)) ppn (.CLK(clk), .CLR(r), .D(d), .Q(q[ 9]), .SET(s)); +$dffsr #(.CLK_POLARITY(1'h1), .CLR_POLARITY(1'h1), .SET_POLARITY(1'h0), .WIDTH(32'd1)) pnp (.CLK(clk), .CLR(r), .D(d), .Q(q[10]), .SET(s)); +$dffsr #(.CLK_POLARITY(1'h1), .CLR_POLARITY(1'h0), .SET_POLARITY(1'h0), .WIDTH(32'd1)) pnn (.CLK(clk), .CLR(r), .D(d), .Q(q[11]), .SET(s)); + always @(negedge clk or posedge s or posedge r) if ( r) q[12] <= 1'b0; else if ( s) q[12] <= 1'b1; else q[12] <= d; -always @(negedge clk or posedge s or negedge r) if (!r) q[13] <= 1'b0; else if ( s) q[13] <= 1'b1; else q[13] <= d; -always @(negedge clk or negedge s or posedge r) if ( r) q[14] <= 1'b0; else if (!s) q[14] <= 1'b1; else q[14] <= d; -always @(negedge clk or negedge s or negedge r) if (!r) q[15] <= 1'b0; else if (!s) q[15] <= 1'b1; else q[15] <= d; +//always @(negedge clk or posedge s or negedge r) if (!r) q[13] <= 1'b0; else if ( s) q[13] <= 1'b1; else q[13] <= d; +//always @(negedge clk or negedge s or posedge r) if ( r) q[14] <= 1'b0; else if (!s) q[14] <= 1'b1; else q[14] <= d; +//always @(negedge clk or negedge s or negedge r) if (!r) q[15] <= 1'b0; else if (!s) q[15] <= 1'b1; else q[15] <= d; +$dffsr #(.CLK_POLARITY(1'h0), .CLR_POLARITY(1'h0), .SET_POLARITY(1'h1), .WIDTH(32'd1)) npn (.CLK(clk), .CLR(r), .D(d), .Q(q[13]), .SET(s)); +$dffsr #(.CLK_POLARITY(1'h0), .CLR_POLARITY(1'h1), .SET_POLARITY(1'h0), .WIDTH(32'd1)) nnp (.CLK(clk), .CLR(r), .D(d), .Q(q[14]), .SET(s)); +$dffsr #(.CLK_POLARITY(1'h0), .CLR_POLARITY(1'h0), .SET_POLARITY(1'h0), .WIDTH(32'd1)) nnn (.CLK(clk), .CLR(r), .D(d), .Q(q[15]), .SET(s)); always @(posedge clk) q[16] <= d; always @(negedge clk) q[17] <= d; @@ -29,6 +37,25 @@ select -assert-count 2 t:$dff design -save gold simplemap +select -assert-count 1 t:$_DFF_NN0_ +select -assert-count 1 t:$_DFF_NN1_ +select -assert-count 1 t:$_DFF_NP0_ +select -assert-count 1 t:$_DFF_NP1_ +select -assert-count 1 t:$_DFF_PN0_ +select -assert-count 1 t:$_DFF_PN1_ +select -assert-count 1 t:$_DFF_PP0_ +select -assert-count 1 t:$_DFF_PP1_ +stat +select -assert-count 1 t:$_DFFSR_NNN_ +select -assert-count 1 t:$_DFFSR_NNP_ +select -assert-count 1 t:$_DFFSR_NPN_ +select -assert-count 1 t:$_DFFSR_NPP_ +select -assert-count 1 t:$_DFFSR_PNN_ +select -assert-count 1 t:$_DFFSR_PNP_ +select -assert-count 1 t:$_DFFSR_PPN_ +select -assert-count 1 t:$_DFFSR_PPP_ +select -assert-count 1 t:$_DFF_N_ +select -assert-count 1 t:$_DFF_P_ design -stash gate design -import gold -as gold |