I'm hoping someone can explain how to properly implement gate delays for a combinational function in SystemVerilog. Why is it ok to implement time delays using #(1) in an always block but not an always_comb? The code below gives this error ...
Statements in an always_comb shall not include those that block, have blocking timing or event controls, >or forkjoin statements.
module compare( input logic [3:0] a,
input logic [3:0] b,
output logic eq );
always_comb
if (a != b)
#(1) eq = 1'b0;
else
#(1) eq = 1'b1;
endmodule
Changing always_comb to always gets rid of the error and implements the delays. But how would you simulate a propagation delay and retain the always_comb? I tried to implement a specify block in this module by adding ...
specify
(a => eq) = (1);
(b => eq) = (1);
endspecify
... and this will implement the time delay ... but only if I change the type of a and b from logic to wire. Is there a way to implement the delay, retain always_comb and keep a and b as logic? What makes always_comb so different? I'm only just beginning to learn SystemVerilog, so any insight would be greatly appreciated.