delay - Can we use two wait statements in a single process in VHDL? -
i have create delay of 20 ms in process waiting in input button.
i wrote following code , gives error
wait until clk'event , clk='1'; wait 20 ms;
or, can use construct like:
wait 20 ms until clk'event , clk='1';
any highly appreciated.
you can wait event, time, or both (or neither--but unique case).
now, i'm not quite sure why first example gives error since valid sequential statement. have not provided complete example nor error code. so, answer here pretty basic.
first, wait
statement can occur sequential statement, meaning in process
(or called process
). so, if trying use concurrently, problem.
now, if using process
, must in process
without sensitivity list. is, following illegal:
process(clk) begin wait until clk'event , clk='1'; end process;
it must bare process, such as:
process begin wait until clk'event , clk='1'; end process;
a bit more on first example (properly placed in sequential context , compile):
process begin wait until clk'event , clk='1'; wait 20 ms; end process;
this code waits rising edge on clk
, , waits 20ms. these sequentially executed (hence sequential context in process).
your second statement needs tweaked compile. generally, wait
statement has form wait until <event> <time>
, both event
, time
optional. example:
process begin wait; -- no event, no time. wait forever. wait until clk'event , clk='1'; -- wait forever rising edge on 'clk' wait 20 ms; -- wait 20 ms wait until clk'event , clk='1' 20 ms; --wait 20 ms rising edge on 'clk' end process;
so, second example has order backward event , time.
finally, introductory text indicates waiting 20ms push button. hints trying create real logic. wait
statement synthesizable in limited use cases. , 1 of cases excluded waiting period of time. if need wait 20 ms, you'll need other way (such counting clocks). , if trying wait 20 ms button, it'll have combination of detecting change on pushbutton , counting clocks.
Comments
Post a Comment