Unverified Commit c5f1e079 by Miodrag Milanović Committed by GitHub

Merge pull request #28 from SergeyDegtyar/master

Fix failed tests for dffe cell
parents cd025088 f9f4d7b7
...@@ -11,10 +11,10 @@ module testbench; ...@@ -11,10 +11,10 @@ module testbench;
#5 clk = 0; #5 clk = 0;
end end
$display("OKAY"); $display("OKAY");
end end
reg [2:0] dinA = 0; reg [2:0] dinA = 0;
wire doutB,doutB1,doutB2,doutB3,doutB4; wire doutB,doutB1,doutB2,doutB3,doutB4;
reg dff,ndff,adff,adffn,dffe = 0; reg dff,ndff,adff,adffn,dffe = 0;
...@@ -30,12 +30,12 @@ module testbench; ...@@ -30,12 +30,12 @@ module testbench;
.b3 (doutB3 ), .b3 (doutB3 ),
.b4 (doutB4 ) .b4 (doutB4 )
); );
always @(posedge clk) begin always @(posedge clk) begin
#3; #3;
dinA <= dinA + 1; dinA <= dinA + 1;
end end
always @( posedge clk, posedge dinA[1], posedge dinA[2] ) always @( posedge clk, posedge dinA[1], posedge dinA[2] )
if ( dinA[2] ) if ( dinA[2] )
dff <= 1'b0; dff <= 1'b0;
...@@ -43,7 +43,7 @@ module testbench; ...@@ -43,7 +43,7 @@ module testbench;
dff <= 1'b1; dff <= 1'b1;
else else
dff <= dinA[0]; dff <= dinA[0];
always @( negedge clk, negedge dinA[1], negedge dinA[2] ) always @( negedge clk, negedge dinA[1], negedge dinA[2] )
if ( !dinA[2] ) if ( !dinA[2] )
ndff <= 1'b0; ndff <= 1'b0;
...@@ -51,27 +51,27 @@ module testbench; ...@@ -51,27 +51,27 @@ module testbench;
ndff <= 1'b1; ndff <= 1'b1;
else else
ndff <= dinA[0]; ndff <= dinA[0];
always @( posedge clk, posedge dinA[2] ) always @( posedge clk, posedge dinA[2] )
if ( dinA[2] ) if ( dinA[2] )
adff <= 1'b0; adff <= 1'b0;
else else
adff <= dinA[0]; adff <= dinA[0];
always @( posedge clk, negedge dinA[2] ) always @( posedge clk, negedge dinA[2] )
if ( !dinA[2] ) if ( !dinA[2] )
adffn <= 1'b0; adffn <= 1'b0;
else else
adffn <= dinA[0]; adffn <= dinA[0];
always @( posedge clk, posedge dinA[2] ) always @( posedge clk)
if ( dinA[2] ) if ( dinA[2] )
dffe <= dinA[0]; dffe <= dinA[0];
assert_dff dff_test(.clk(clk), .test(doutB), .pat(dff)); assert_dff dff_test(.clk(clk), .test(doutB), .pat(dff));
assert_dff ndff_test(.clk(clk), .test(doutB1), .pat(ndff)); assert_dff ndff_test(.clk(clk), .test(doutB1), .pat(ndff));
assert_dff adff_test(.clk(clk), .test(doutB2), .pat(adff)); assert_dff adff_test(.clk(clk), .test(doutB2), .pat(adff));
assert_dff adffn_test(.clk(clk), .test(doutB3), .pat(adffn)); assert_dff adffn_test(.clk(clk), .test(doutB3), .pat(adffn));
assert_dff dffe_test(.clk(clk), .test(doutB4), .pat(dffe)); assert_dff dffe_test(.clk(clk), .test(doutB4), .pat(dffe));
endmodule endmodule
...@@ -5,9 +5,9 @@ module adff ...@@ -5,9 +5,9 @@ module adff
end end
always @( posedge clk, posedge clr ) always @( posedge clk, posedge clr )
if ( clr ) if ( clr )
`ifndef BUG `ifndef BUG
q <= 1'b0; q <= 1'b0;
`else `else
q <= d; q <= d;
`endif `endif
else else
...@@ -21,9 +21,9 @@ module adffn ...@@ -21,9 +21,9 @@ module adffn
end end
always @( posedge clk, negedge clr ) always @( posedge clk, negedge clr )
if ( !clr ) if ( !clr )
`ifndef BUG `ifndef BUG
q <= 1'b0; q <= 1'b0;
`else `else
q <= d; q <= d;
`endif `endif
else else
...@@ -35,11 +35,11 @@ module dffe ...@@ -35,11 +35,11 @@ module dffe
initial begin initial begin
q = 0; q = 0;
end end
always @( posedge clk, posedge en ) always @( posedge clk)
if ( en ) if ( en )
`ifndef BUG `ifndef BUG
q <= d; q <= d;
`else `else
q <= 1'b0; q <= 1'b0;
`endif `endif
endmodule endmodule
......
...@@ -63,8 +63,8 @@ module testbench; ...@@ -63,8 +63,8 @@ module testbench;
adffn <= 1'b0; adffn <= 1'b0;
else else
adffn <= dinA[0]; adffn <= dinA[0];
always @( posedge clk, posedge dinA[2] ) always @( posedge clk )
if ( dinA[2] ) if ( dinA[2] )
dffe <= dinA[0]; dffe <= dinA[0];
......
...@@ -35,7 +35,7 @@ module dffe ...@@ -35,7 +35,7 @@ module dffe
initial begin initial begin
q = 0; q = 0;
end end
always @( posedge clk, posedge en ) always @( posedge clk)
if ( en ) if ( en )
`ifndef BUG `ifndef BUG
q <= d; q <= d;
......
...@@ -63,8 +63,8 @@ module testbench; ...@@ -63,8 +63,8 @@ module testbench;
adffn <= 1'b0; adffn <= 1'b0;
else else
adffn <= dinA[0]; adffn <= dinA[0];
always @( posedge clk, posedge dinA[2] ) always @( posedge clk)
if ( dinA[2] ) if ( dinA[2] )
dffe <= dinA[0]; dffe <= dinA[0];
......
...@@ -35,7 +35,7 @@ module dffe ...@@ -35,7 +35,7 @@ module dffe
initial begin initial begin
q = 0; q = 0;
end end
always @( posedge clk, posedge en ) always @( posedge clk)
if ( en ) if ( en )
`ifndef BUG `ifndef BUG
q <= d; q <= d;
......
...@@ -63,8 +63,8 @@ module testbench; ...@@ -63,8 +63,8 @@ module testbench;
adffn <= 1'b0; adffn <= 1'b0;
else else
adffn <= dinA[0]; adffn <= dinA[0];
always @( posedge clk, posedge dinA[2] ) always @( posedge clk )
if ( dinA[2] ) if ( dinA[2] )
dffe <= dinA[0]; dffe <= dinA[0];
......
...@@ -35,7 +35,7 @@ module dffe ...@@ -35,7 +35,7 @@ module dffe
initial begin initial begin
q = 0; q = 0;
end end
always @( posedge clk, posedge en ) always @( posedge clk )
if ( en ) if ( en )
`ifndef BUG `ifndef BUG
q <= d; q <= d;
......
...@@ -63,8 +63,8 @@ module testbench; ...@@ -63,8 +63,8 @@ module testbench;
adffn <= 1'b0; adffn <= 1'b0;
else else
adffn <= dinA[0]; adffn <= dinA[0];
always @( posedge clk, posedge dinA[2] ) always @( posedge clk )
if ( dinA[2] ) if ( dinA[2] )
dffe <= dinA[0]; dffe <= dinA[0];
......
...@@ -35,7 +35,7 @@ module dffe ...@@ -35,7 +35,7 @@ module dffe
initial begin initial begin
q = 0; q = 0;
end end
always @( posedge clk, posedge en ) always @( posedge clk )
if ( en ) if ( en )
`ifndef BUG `ifndef BUG
q <= d; q <= d;
......
...@@ -63,8 +63,8 @@ module testbench; ...@@ -63,8 +63,8 @@ module testbench;
adffn <= 1'b0; adffn <= 1'b0;
else else
adffn <= dinA[0]; adffn <= dinA[0];
always @( posedge clk, posedge dinA[2] ) always @( posedge clk )
if ( dinA[2] ) if ( dinA[2] )
dffe <= dinA[0]; dffe <= dinA[0];
......
...@@ -35,7 +35,7 @@ module dffe ...@@ -35,7 +35,7 @@ module dffe
initial begin initial begin
q = 0; q = 0;
end end
always @( posedge clk, posedge en ) always @( posedge clk )
if ( en ) if ( en )
`ifndef BUG `ifndef BUG
q <= d; q <= d;
......
...@@ -63,8 +63,8 @@ module testbench; ...@@ -63,8 +63,8 @@ module testbench;
adffn <= 1'b0; adffn <= 1'b0;
else else
adffn <= dinA[0]; adffn <= dinA[0];
always @( posedge clk, posedge dinA[2] ) always @( posedge clk )
if ( dinA[2] ) if ( dinA[2] )
dffe <= dinA[0]; dffe <= dinA[0];
......
...@@ -35,7 +35,7 @@ module dffe ...@@ -35,7 +35,7 @@ module dffe
initial begin initial begin
q = 0; q = 0;
end end
always @( posedge clk, posedge en ) always @( posedge clk )
if ( en ) if ( en )
`ifndef BUG `ifndef BUG
q <= d; q <= d;
......
...@@ -63,8 +63,8 @@ module testbench; ...@@ -63,8 +63,8 @@ module testbench;
adffn <= 1'b0; adffn <= 1'b0;
else else
adffn <= dinA[0]; adffn <= dinA[0];
always @( posedge clk, posedge dinA[2] ) always @( posedge clk )
if ( dinA[2] ) if ( dinA[2] )
dffe <= dinA[0]; dffe <= dinA[0];
......
...@@ -64,7 +64,7 @@ module testbench; ...@@ -64,7 +64,7 @@ module testbench;
else else
adffn <= dinA[0]; adffn <= dinA[0];
always @( posedge clk, posedge dinA[2] ) always @( posedge clk )
if ( dinA[2] ) if ( dinA[2] )
dffe <= dinA[0]; dffe <= dinA[0];
......
...@@ -64,7 +64,7 @@ module testbench; ...@@ -64,7 +64,7 @@ module testbench;
else else
adffn <= dinA[0]; adffn <= dinA[0];
always @( posedge clk, posedge dinA[2] ) always @( posedge clk)
if ( dinA[2] ) if ( dinA[2] )
dffe <= dinA[0]; dffe <= dinA[0];
......
...@@ -63,8 +63,8 @@ module testbench; ...@@ -63,8 +63,8 @@ module testbench;
adffn <= 1'b0; adffn <= 1'b0;
else else
adffn <= dinA[0]; adffn <= dinA[0];
always @( posedge clk, posedge dinA[2] ) always @( posedge clk )
if ( dinA[2] ) if ( dinA[2] )
dffe <= dinA[0]; dffe <= dinA[0];
......
...@@ -35,7 +35,7 @@ module dffe ...@@ -35,7 +35,7 @@ module dffe
initial begin initial begin
q = 0; q = 0;
end end
always @( posedge clk, posedge en ) always @( posedge clk )
if ( en ) if ( en )
`ifndef BUG `ifndef BUG
q <= d; q <= d;
......
...@@ -63,8 +63,8 @@ module testbench; ...@@ -63,8 +63,8 @@ module testbench;
adffn <= 1'b0; adffn <= 1'b0;
else else
adffn <= dinA[0]; adffn <= dinA[0];
always @( posedge clk, posedge dinA[2] ) always @( posedge clk )
if ( dinA[2] ) if ( dinA[2] )
dffe <= dinA[0]; dffe <= dinA[0];
......
...@@ -47,7 +47,7 @@ module dffe ...@@ -47,7 +47,7 @@ module dffe
initial begin initial begin
q = Z; q = Z;
end end
always @( posedge clk, posedge en ) always @( posedge clk )
if ( en ) if ( en )
`ifndef BUG `ifndef BUG
q <= d; q <= d;
......
...@@ -63,8 +63,8 @@ module testbench; ...@@ -63,8 +63,8 @@ module testbench;
adffn <= 1'b0; adffn <= 1'b0;
else else
adffn <= dinA[0]; adffn <= dinA[0];
always @( posedge clk, posedge dinA[2] ) always @( posedge clk )
if ( dinA[2] ) if ( dinA[2] )
dffe <= dinA[0]; dffe <= dinA[0];
......
...@@ -47,7 +47,7 @@ module dffe ...@@ -47,7 +47,7 @@ module dffe
initial begin initial begin
q = Z; q = Z;
end end
always @( posedge clk, posedge en ) always @( posedge clk )
if ( en ) if ( en )
`ifndef BUG `ifndef BUG
q <= d; q <= d;
......
...@@ -63,8 +63,8 @@ module testbench; ...@@ -63,8 +63,8 @@ module testbench;
adffn <= 1'b0; adffn <= 1'b0;
else else
adffn <= dinA[0]; adffn <= dinA[0];
always @( posedge clk, posedge dinA[2] ) always @( posedge clk )
if ( dinA[2] ) if ( dinA[2] )
dffe <= dinA[0]; dffe <= dinA[0];
......
...@@ -35,7 +35,7 @@ module dffe ...@@ -35,7 +35,7 @@ module dffe
initial begin initial begin
q = 0; q = 0;
end end
always @( posedge clk, posedge en ) always @( posedge clk )
if ( en ) if ( en )
`ifndef BUG `ifndef BUG
q <= d; q <= d;
......
...@@ -63,8 +63,8 @@ module testbench; ...@@ -63,8 +63,8 @@ module testbench;
adffn <= 1'b0; adffn <= 1'b0;
else else
adffn <= dinA[0]; adffn <= dinA[0];
always @( posedge clk, posedge dinA[2] ) always @( posedge clk )
if ( dinA[2] ) if ( dinA[2] )
dffe <= dinA[0]; dffe <= dinA[0];
......
...@@ -35,7 +35,7 @@ module dffe ...@@ -35,7 +35,7 @@ module dffe
initial begin initial begin
q = 0; q = 0;
end end
always @( posedge clk, posedge en ) always @( posedge clk )
if ( en ) if ( en )
`ifndef BUG `ifndef BUG
q <= d; q <= d;
......
...@@ -63,8 +63,8 @@ module testbench; ...@@ -63,8 +63,8 @@ module testbench;
adffn <= 1'b0; adffn <= 1'b0;
else else
adffn <= dinA[0]; adffn <= dinA[0];
always @( posedge clk, posedge dinA[2] ) always @( posedge clk )
if ( dinA[2] ) if ( dinA[2] )
dffe <= dinA[0]; dffe <= dinA[0];
......
...@@ -35,7 +35,7 @@ module dffe ...@@ -35,7 +35,7 @@ module dffe
initial begin initial begin
q = 1'bZ; q = 1'bZ;
end end
always @( posedge clk, posedge en ) always @( posedge clk )
if ( en ) if ( en )
`ifndef BUG `ifndef BUG
q <= d; q <= d;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment