Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wait until rising_edge(clk) vs if rising_edge(clk)

Tags:

vhdl

I came across two styles of process statements in VHDL.

process(clk)
begin
    if rising_edge(clk)
...do something...

The other one is

process
begin
    wait until rising_edge(clk)
    ...do something...

What are the pros and cons of each method?

like image 645
wahab Avatar asked Oct 31 '22 18:10

wahab


2 Answers

Assuming the ... part of the second example does not have any wait statement, the two forms are semantically equivalent.

They will behave identically in simulation.

However, the first form is the recommended style for synthesis and will be deemed more readable by many.

like image 142
wap26 Avatar answered Nov 15 '22 09:11

wap26


Both forms are equivalent for synthesis in Vivado. The second wait form can be considered more compact as it "saves" an indentation level.

like image 32
kraigher Avatar answered Nov 15 '22 09:11

kraigher