Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
13 years ago

The 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 lot

6 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    doesn't work

    --- Quote End ---

    is no clear problem specification.

    Presuming you are talking about Verilog for hardware synthesis rather than simulation, you are probably trying a non-synthesizable Verilog construct. Timing statements and level sensitive events are generally ignored for synthesis.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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 ... end