I'm trying to understand an always
block construct that I'm seeing a lot. This is all in the context of trying to synthesize some hardware in an FPGA, not simulation.
Sample code:
reg out;
always @(posedge clk or posedge reset) begin
if (reset)
out <= 0;
else
out <= in;
end
What if this block is triggered by a posedge on reset
? In that case, we're saying that, by definition, reset is changing. How can we then test the value of reset? It would seem to me that the value of reset
should be undefined at the time of it's rising edge. For example, how can we be sure that setup and hold times are observed?