J
jens
Guest
Most of us are familiar with this synchronous process template...
synchronous_process_template: process(clock, reset)
begin
if reset = '1' then
-- initialize registers here
elsif rising_edge(clock) then
-- assign registers here
end if;
end process synchronous_process_template;
However one problem with it is if there are multiple signals being
assigned, but not all of them need the reset. If not all signals are
being reset, then a gated clock is created for those signals (which
will cause some compilers to puke and is a bad idea even if it doesn't
puke). One option is to use two processes (one with reset and one
without), but that doesn't always work that well, especially if there
are variables that all signals need access to.
Here's an alternate synchronous process template...
alternate_synchronous_process_template: process(clock, reset)
begin
if rising_edge(clock) then
-- assign all registers here
end if;
if reset = '1' then
-- initialize some or all registers here
end if;
end process alternate_synchronous_process_template;
For example...
if rising_edge(clock) then
s1 <= <whatever>;
s2 <= <whatever>;
end if;
if reset = '1' then
s1 <= (others => '0');
end if;
This template makes it possible to reset signal s1 but not s2. Running
it through Xilinx tools yielded the desired RTL results (and identical
to a two-process model).
synchronous_process_template: process(clock, reset)
begin
if reset = '1' then
-- initialize registers here
elsif rising_edge(clock) then
-- assign registers here
end if;
end process synchronous_process_template;
However one problem with it is if there are multiple signals being
assigned, but not all of them need the reset. If not all signals are
being reset, then a gated clock is created for those signals (which
will cause some compilers to puke and is a bad idea even if it doesn't
puke). One option is to use two processes (one with reset and one
without), but that doesn't always work that well, especially if there
are variables that all signals need access to.
Here's an alternate synchronous process template...
alternate_synchronous_process_template: process(clock, reset)
begin
if rising_edge(clock) then
-- assign all registers here
end if;
if reset = '1' then
-- initialize some or all registers here
end if;
end process alternate_synchronous_process_template;
For example...
if rising_edge(clock) then
s1 <= <whatever>;
s2 <= <whatever>;
end if;
if reset = '1' then
s1 <= (others => '0');
end if;
This template makes it possible to reset signal s1 but not s2. Running
it through Xilinx tools yielded the desired RTL results (and identical
to a two-process model).