3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-08-08 20:21:25 +00:00

Allow initial blocks to be disabled during tests

Wrap initial blocks with a NO_INIT so that tests for archs without register initialization feature don't fail.
This commit is contained in:
Patrick Urban 2021-09-24 21:50:26 +02:00 committed by Marcelina Kościelnicka
parent 0a72952d5f
commit acb993b27b
6 changed files with 20 additions and 4 deletions

View file

@ -1,7 +1,9 @@
module adff( input d, clk, clr, output reg q );
`ifndef NO_INIT
initial begin
q = 0;
end
`endif
always @( posedge clk, posedge clr )
if ( clr )
q <= 1'b0;
@ -10,9 +12,11 @@ module adff( input d, clk, clr, output reg q );
endmodule
module adffn( input d, clk, clr, output reg q );
`ifndef NO_INIT
initial begin
q = 0;
end
`endif
always @( posedge clk, negedge clr )
if ( !clr )
q <= 1'b0;
@ -21,9 +25,11 @@ module adffn( input d, clk, clr, output reg q );
endmodule
module dffs( input d, clk, pre, clr, output reg q );
`ifndef NO_INIT
initial begin
q = 0;
end
`endif
always @( posedge clk )
if ( pre )
q <= 1'b1;
@ -32,9 +38,11 @@ module dffs( input d, clk, pre, clr, output reg q );
endmodule
module ndffnr( input d, clk, pre, clr, output reg q );
`ifndef NO_INIT
initial begin
q = 0;
end
`endif
always @( negedge clk )
if ( !clr )
q <= 1'b0;