M
Mike Treseler
Andy said:Mike,
I've seen your template, and although I prefer not to split everything
out into separate procedures for init, update, and output, I really
like the concept of a single process, even/especially for combo
outputs.
Note that I use the template for
new rtl IP in level two entities.
I do use more than one entity in most designs.
Internal registers and combinational nodes (if any)
are all declared as variables.
All port outputs are registered.
However, if there are storage elements that you do not want/need to
reset (like clb rams that cannot be reset), leaving them out of the
"init" process/clause will result in a clock disable on reset (using
synplicity at least) for those elements, which is seldom wanted either.
Synplicity warns you when this happens, but it cannot be avoided in
your template. Note that the clock disable is required to generate
hardware that behaves like the RTL in such cases, since if the reset is
active, the clocked clause will not execute.
If I have to infer a vendor ram, I will
use the recommended template and, until now, had not
considered trying to make these things fit into one
of my structured entities.
I have found that, putting the init code at the end of the process, in
its own if-then clause, allows you to specify only those storage
elements that need reset, without the clock disable on those elements
left unreset.
Interesting. I'll have a look.
I ran into a similar problem when developing the templates,
whenever there was any mismatch in how an output variable
and it's associated output port is reset or updated.
This is one reason I settled on the v_rst template
that resets only variables and outputs only variables.
For an example of a clock enable/disables handled
inside the template, see the "if bit_done then"
clauses in the reference design.
\For example:
process (reset, clock) is
...
begin
if rising_edge(clock) then
update; -- update internal variables (regs or combos)
end if;
if reset then
init; -- reset desired flops
end if;
output; -- assign output signals
Note that I don't declare or use any signals.
Output assignments are all "port gets variable"
out_port <= out_port_v;
end process;
Note that you don't get a friendly reminder during synthesis that you
dropped a register from your init clause, but at least it works without
the clock disable.
Andy Jones
Thanks for sharing the ideas!
-- Mike Treseler