G
googler
Guest
In my RTL (DUT) I have something like this:
trireg (medium) PAD;
reg [1:0] pad_delay = 2'b00;
bufif1 #pad_delay (PAD, abc, xyz);
The reason I have pad_delay defined as a reg is because for some tests
I am forcing it to 2'b01 from inside the test. But for most other
tests, I would like to have it as 2'b00, which is why it has been
initialized to 2'b00 in the above code. My question is, is this a
right thing to do? The simulations are working fine, but I am not sure
if the initialization of pad_delay to 2'b00 will happen when it
undergoes synthesis. And if that does not happen, then I suppose
pad_delay will have the value 'X' and things will go wrong. Please let
me know if I am correct in thinking this, or if the above code does
not have this problem. If the above is not correct, then what is a
right way to do it?
Thanks for any input.
PS:
As an aside, I want to add this too. At first I had pad_delay as
'parameter':
parameter [1:0] pad_delay = 2'b00;
This worked fine for one simulation, but after that I started getting
load error in Modelsim, which complained that a 'force' statement
cannot be executed on 'parameter' object (which I am doing in a few
tests). So I changed 'parameter' to 'reg'. Strange, but as I observed,
the simulator behaved differently on two different runs.
trireg (medium) PAD;
reg [1:0] pad_delay = 2'b00;
bufif1 #pad_delay (PAD, abc, xyz);
The reason I have pad_delay defined as a reg is because for some tests
I am forcing it to 2'b01 from inside the test. But for most other
tests, I would like to have it as 2'b00, which is why it has been
initialized to 2'b00 in the above code. My question is, is this a
right thing to do? The simulations are working fine, but I am not sure
if the initialization of pad_delay to 2'b00 will happen when it
undergoes synthesis. And if that does not happen, then I suppose
pad_delay will have the value 'X' and things will go wrong. Please let
me know if I am correct in thinking this, or if the above code does
not have this problem. If the above is not correct, then what is a
right way to do it?
Thanks for any input.
PS:
As an aside, I want to add this too. At first I had pad_delay as
'parameter':
parameter [1:0] pad_delay = 2'b00;
This worked fine for one simulation, but after that I started getting
load error in Modelsim, which complained that a 'force' statement
cannot be executed on 'parameter' object (which I am doing in a few
tests). So I changed 'parameter' to 'reg'. Strange, but as I observed,
the simulator behaved differently on two different runs.