Paul said:
In VHDL I'm forever writing process statements to produce
1) a simple clocked FF
2) As above with async reset
3) As above with clock enable
I must write things like
process (clk, reset)
begin
if (reset = '1') then
signal <= '0';
elsif (rising_edge(clk)) then
if (enable = '1') then
signal <= next_signal_value;
end if;
end if;
end process;
At the risk of looking stupid, surely there is a simpler way.
signal <= next_signal_value when (rising_edge(clk)); -- ??
Lets refer to the following template as REF (the one you listed is
actually the templace for a FF with clock enable):
process (clk, reset)
begin
if (reset = '1') then
Async assignments
elsif (rising_edge(clk)) then
Sync assigmnents
end if;
end process;
There are, indeed, many ways of writing this that are equivalent.
The truly important question, however, is what can you be sure will be
recognized as a FF all synthesizers that see your code. This may or may
not include your shortened version. I agree that REF is wordy BUT it is
recognized by all synthesizers I've dealt with recently (really old
synthesizers often required WAIT statements but I don't think any of
those are still around). Further, REF is embedded in many editors so
it's not really a great hardship to use it. Synthesis tools are based to
a very large extent on pattern recognition. If you don't supply them
with a pattern that they recognize, the results will probably not be
optimal. This is less of an issue for FPGAs than for ASICs but there can
still be detrimental effects. This is the reason for the little-known
(and possibly little-followed) spec on synthesizable VHDL, 1076.6 - VHDL
Register Transfer Level Synthesis.
If you want to create a test case with all the methods you can think of
and then run it through all the synthesizers that exist, you could
create a list of constructs that work, at that moment. But I personally
feel that this would just be "busywork" since REF is a perfectly
acceptable (albeit verbose) template and, since REF is the only
"standard" that I am aware of that all synthesizers seem to agree on
(and is supported in 1076.6), I would be reluctant to use anything else
because it might just stop working in the next rev of the tool.