G
goouse99
Am Mittwoch, 17. Juli 2013 18:29:38 UTC+2 schrieb Rob Gaddi:
Hi Rob,
just tested it in ISE 13.1.
It really gives a FF, there's always more to learn about VHDL.
I understand the reasoning behind the processes with only clock on the sensitivity list. But actually the synthesis tools ignore the sensitivity list, so it can not have any effect to the created logic.
Moreover, VHDL-2008 just came up with "process(all)" to simplify things, and what if you want to have resets? What if you have just one input signal and want to create something purely combinatorical?
As you pointed out
wait until clk = '1';
is just a simplification of
wait on clk until clk = '1';
The signals behind the "on" are a sensitivity list and therefore event triggered. So it makes some sense to create a FF. I just wonder why the sensitivity list here isn't ignored. Even this leads to a FF:
wait until (Clock = '1' and Clock2 = '1');
A gated clock, that is!
wait on Clock until (Clock = '1' and Clock2 = '1');
Gives the same gated clock. But Clock2 is not on the sensitivity list.
Is this a clue that the sensitivity list is ignored here too?
How to implement a Clock Enable with wait until?
wait until rising_edge(Clock) and Clock2 = '1';
So, this works, but isn't this a contradiction?
While the sole clk='1' is edge sensitive, and Clock2 ='1' before has been seen as a second clock input, now it is seen as a CE. Weird! Any logical explanation someone?
wait on Clock2 until rising_edge(Clock) and Clock2 = '1'; --FF with CE
This again gives a FF with CE(clock2). So the Event triggering by the sensitivity list is truly ignored in synthesis.
___________
I agree, code readability for the common engineer should be a major concern.
While the example of
wait until clk = '1';
works, the majority, like me just lately, would be alerted since they would suspect Latches to appear.
The alternative, if one chooses to use wait until for some reason, is much simpler recognized to be edge sensitive:
wait until rising_edge(clk);
So just a few characters more saves from much confusion when it comes to code maintainance etc.
I wonder if someone who explicitely wanted to build a latch for some reason ever stumbled about this syntax and cursed the tools to hell since no latch would appear.
Kind regards
Eilert
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.
--
Rob Gaddi, Highland Technology -- www.highlandtechnology.com
Email address domain is currently out of order. See above to fix.
Hi Rob,
just tested it in ISE 13.1.
It really gives a FF, there's always more to learn about VHDL.
I understand the reasoning behind the processes with only clock on the sensitivity list. But actually the synthesis tools ignore the sensitivity list, so it can not have any effect to the created logic.
Moreover, VHDL-2008 just came up with "process(all)" to simplify things, and what if you want to have resets? What if you have just one input signal and want to create something purely combinatorical?
As you pointed out
wait until clk = '1';
is just a simplification of
wait on clk until clk = '1';
The signals behind the "on" are a sensitivity list and therefore event triggered. So it makes some sense to create a FF. I just wonder why the sensitivity list here isn't ignored. Even this leads to a FF:
wait until (Clock = '1' and Clock2 = '1');
A gated clock, that is!
wait on Clock until (Clock = '1' and Clock2 = '1');
Gives the same gated clock. But Clock2 is not on the sensitivity list.
Is this a clue that the sensitivity list is ignored here too?
How to implement a Clock Enable with wait until?
wait until rising_edge(Clock) and Clock2 = '1';
So, this works, but isn't this a contradiction?
While the sole clk='1' is edge sensitive, and Clock2 ='1' before has been seen as a second clock input, now it is seen as a CE. Weird! Any logical explanation someone?
wait on Clock2 until rising_edge(Clock) and Clock2 = '1'; --FF with CE
This again gives a FF with CE(clock2). So the Event triggering by the sensitivity list is truly ignored in synthesis.
___________
I agree, code readability for the common engineer should be a major concern.
While the example of
wait until clk = '1';
works, the majority, like me just lately, would be alerted since they would suspect Latches to appear.
The alternative, if one chooses to use wait until for some reason, is much simpler recognized to be edge sensitive:
wait until rising_edge(clk);
So just a few characters more saves from much confusion when it comes to code maintainance etc.
I wonder if someone who explicitely wanted to build a latch for some reason ever stumbled about this syntax and cursed the tools to hell since no latch would appear.
Kind regards
Eilert