T
Tim Hubberstey
Guest
Jonathan Bromley wrote:
their synthesis results won't work. The real "gotcha"s, IMHO, happen
when you run a clock through a "wire" for some reason.
I've never been 100% clear on just when delta delays get introduced, so
someone please tell me I get something wrong in what follows.
Connections made during instantiation via a port map do not introduce a
delta delay but connections inside an architecture, even a "wire" like
"a<=b" do. A result of this is that you have to be careful about some
kinds of structures that may make sense from a structured
programming/code re-use viewpoint.
In particular, be careful of using generics and generates to choose
which input is used as a clock. e.g.:
if generic_use_clock_a generate
module_clock <= input_clock_a;
end generate;
if generic_use_clock_b generate
module_clock <= input_clock_b;
end generate;
This kind of thing adds a delta delay to your module's clock. The
consequence of this is your clocked processes may now be scheduled at
the same time as inputs that are clocked outputs of other modules. This
results in a race condition with indeterminate results since the order
of execution of events with identical deltas is left up to the
simulator. I've seen cases with multiple inputs from another module
where some inputs will be treated as "arriving" at a process before the
clock, and others after. Even more interesting is that this before/after
order may change following a recompile. The consequence is a debugging
nightmare.
--
Tim Hubberstey, P.Eng. . . . . . Hardware/Software Consulting Engineer
Marmot Engineering . . . . . . . VHDL, ASICs, FPGAs, embedded systems
Vancouver, BC, Canada . . . . . . . . . . . http://www.marmot-eng.com
Someone creating gated clocks (hopefully) knows that care is needed orNote, however, that each concurrent assignment introduces a
delta-cycle delay (roughly the same as the delay between executing a
nonblocking assignment in Verilog and its signal being updated). By
contrast, the Verilog continuous assignment effectively uses blocking
assignment and introduces no delay whatsoever (unless you specify
one, of course). This is VERY important if you try to create gated
clocks.
their synthesis results won't work. The real "gotcha"s, IMHO, happen
when you run a clock through a "wire" for some reason.
I've never been 100% clear on just when delta delays get introduced, so
someone please tell me I get something wrong in what follows.
Connections made during instantiation via a port map do not introduce a
delta delay but connections inside an architecture, even a "wire" like
"a<=b" do. A result of this is that you have to be careful about some
kinds of structures that may make sense from a structured
programming/code re-use viewpoint.
In particular, be careful of using generics and generates to choose
which input is used as a clock. e.g.:
if generic_use_clock_a generate
module_clock <= input_clock_a;
end generate;
if generic_use_clock_b generate
module_clock <= input_clock_b;
end generate;
This kind of thing adds a delta delay to your module's clock. The
consequence of this is your clocked processes may now be scheduled at
the same time as inputs that are clocked outputs of other modules. This
results in a race condition with indeterminate results since the order
of execution of events with identical deltas is left up to the
simulator. I've seen cases with multiple inputs from another module
where some inputs will be treated as "arriving" at a process before the
clock, and others after. Even more interesting is that this before/after
order may change following a recompile. The consequence is a debugging
nightmare.
--
Tim Hubberstey, P.Eng. . . . . . Hardware/Software Consulting Engineer
Marmot Engineering . . . . . . . VHDL, ASICs, FPGAs, embedded systems
Vancouver, BC, Canada . . . . . . . . . . . http://www.marmot-eng.com