wait until clk = '1';
requires less typing than
if clk = '1' then
end if;
and, furthremore, causes less confusion than the conditional. I wonder
why people keep reproducing this awkward IF pattern instead of wait
until. Single wait until synthesizes well, even in xilinx tools now.
I've checked that may times.
Hi,
wait until clk = '1';
actually creates latches, which most of us are trying to avoid.
What you probably mean is:
wait until rising_edge(clk);
And to answer rickmans question too:
Yes this coding style makes it hard, if not impossible to implement a (async) reset.
However, there are many applications that neither need this.
There's also this famous paper from Xilinx suggestiong to avoid async resets when possible.
But of course, if one needs it, the well known
if reset then
elsif rising_edge(clk)
does the job pretty well, and for thos who whant to save time typing code:
Use EMACS with VHDL mode.
Then 90% of the code is writing itself.
Just make sure you have a reliable TAB button on your keyboard.
Have a nice synthesis
Eilert
[/QUOTE]
I think this is one of the rare instances where you're wrong.
wait until clk = '1';
is equivalent to
wait on clk until clk = '1';
which is the same as
wait until rising_edge(clk)
if clk can only be '0' or '1'.
Likewise the OP's
if clk = '1' then
in a process where clk was the only thing in the sensitivity list
should have the same behavior as any of that, or of the more traditional
if rising_edge(clk) then
I've used the "wait until" form in synthesizable code a couple times.
It seems to work, at least on modern synthesizers, and it's nice to save
one level of indentation, but it's not a huge deal one way or another.
It does make an async reset pretty impossible, for what that's worth in
whichever circumstances.
I think my biggest problem with it stylistically is that it's simply
not canonical. The synthesizer can take in all manner of things that,
handed off to someone who didn't write them, would cause
consternation. The goal of writing code is to produce something that
not only performs correctly, but is intuitively and obviously correct
to anyone who sits down to read it. Part of that is doing commonly
done things in the way they're commonly done.