Altera_Forum
Honored Contributor
15 years agoposedge clock delay : Quartus II vs. ModelSim
Hi,
I wish to execute a simple code, which is: to expand a 1-bit signal into a 16-bit signed register. however, the assignment should happen after 1 clock cycle delay. I wrote the following code, in verilog: always @ (posedge clock) begin Vsw_16bit <= @ (posedge clock) (sw_node) ? (16'sd32767) : (16'sd0); end I verified it in ModelSim, it worked correctly. But when I pasted the same code in Quartus II and ran a Funtional simulation, there was simply no delay. The assignment happened at the very first clock edge. Needless to say, even the Timing simulation didn't work. I changed my code, to the following: always @ (sw_node) begin Vsw_16bit <= repeat (2) @ (posedge clock) (sw_node) ? (16'sd32767) : (16'sd0); end Even this code supplied the expected 1 clock cycle delay in ModelSim. But again, when I checked it in Quartus Functional simualtion, the assignment happened at the very instant my sw_node changed value. It didn't wait for any clock edge this time. why doesn't quartus wait for any clock edge inside the always statement ? Isn't it a valid Verilog construct ? Moreover, Quartus didn't even show any compilation errors for it. How are we supposed to delay assignments then ?