Altera_Forum
Honored Contributor
13 years agoThe wait function
Hello,
I was wondering, can I use the wait function in Verilog? It seems like it simply doesn't work My syntax is wait (event) begin ... end Thanks a lotHello,
I was wondering, can I use the wait function in Verilog? It seems like it simply doesn't work My syntax is wait (event) begin ... end Thanks a lotalways
wait (event) begin ... end That's ok!Be careful with
always wait(for_expression_to_be_true) begin ... end You will get a simulation hang once for_expression_to_be_true becomes true, unless the code inside the begin/end does something to make for_expression_to_be_true become false.for_expression_to_be_true also can be an input, such as, clk .etc;
Then you really want to use @(clk) or @(posdedge clk), instead of wait(clk). @(expression) means 'wait for a change in expression'.
Otherwise, you would have to write always wait(!clk) wait(clk) begin ... endOhmm......Thanks a lot!