1
0

Async Reg: Doesn't properly reset for Verilator.

This commit is contained in:
Megan Wachs 2017-12-01 17:43:01 -08:00
parent 9df3604007
commit a97add954a

View File

@ -45,21 +45,28 @@ module AsyncResetReg (
input clk, input clk,
input rst); input rst);
initial begin
`ifdef RANDOMIZE `ifdef RANDOMIZE
integer initvar; integer initvar;
reg [31:0] _RAND; reg [31:0] _RAND;
initial begin _RAND = {1{$random}};
`endif
if (rst) begin
`ifdef verilator
q = 1'b0;
`endif
end
`ifdef RANDOMIZE
`ifndef verilator `ifndef verilator
#0.002 begin end
`endif `endif
`ifdef RANDOMIZE_REG_INIT `ifdef RANDOMIZE_REG_INIT
_RAND = {1{$random}}; else begin
if (~rst) begin #0.002 begin end
q = _RAND[0]; q = _RAND[0];
end end
`endif `endif
end
`endif // `ifdef RANDOMIZE `endif // `ifdef RANDOMIZE
end
always @(posedge clk or posedge rst) begin always @(posedge clk or posedge rst) begin