N
Novlednes
Hi,
I'm trying to pipeline the multi-dimensional array T in the following
code snippet. The pipelining is done in process p_Pipe. However, there
is a driver on T(0) in process p_Sim. No problem you would think,
since the for loop in p_Pipe only addresses elements T(1), T(2) and T
(3). For some reason, my simulator (Modelsim) appears to translate the
for loop in a driver on T(0) as well, leading to all Xs on T(0). But
when unfolding the for loop in individual assignments (see the inline
comments) for T(1), T(2) and T(3), there is no problem anymore: the
pipeline behaves as expected.
What I cannot put my finger on, is why the individual assignments
behave differently than the for loop? Does anyone have some insights
on that?
library IEEE;
use IEEE.std_logic_1164.all;
entity tb_MultiDimArray is
end tb_MultiDimArray;
architecture Simulation of tb_MultiDimArray is
subtype t_Word is std_logic_vector(31 downto 0);
type t_T is array(0 to 3) of t_Word;
signal Clk : std_logic := '1';
signal T : t_T := (others => (others => '1'));
begin
p_Clock : process
begin
loop
Clk <= not Clk; -- do not forget to initialize the clock !
wait for 5 ns;
end loop;
end process p_Clock;
p_Pipe : process(Clk)
begin
if rising_edge(Clk) then
-- T(1) <= T(0);
-- T(2) <= T(1);
-- T(3) <= T(2);
for i in 0 to 2 loop
T(i+1) <= T(i);
end loop;
end if; -- rising_edge
end process p_Pipe;
p_Sim: process
begin
wait until falling_edge(Clk);
T(0) <= (others => '0');
wait; -- Will wait forever.
end process p_Sim;
end Simulation;
I'm trying to pipeline the multi-dimensional array T in the following
code snippet. The pipelining is done in process p_Pipe. However, there
is a driver on T(0) in process p_Sim. No problem you would think,
since the for loop in p_Pipe only addresses elements T(1), T(2) and T
(3). For some reason, my simulator (Modelsim) appears to translate the
for loop in a driver on T(0) as well, leading to all Xs on T(0). But
when unfolding the for loop in individual assignments (see the inline
comments) for T(1), T(2) and T(3), there is no problem anymore: the
pipeline behaves as expected.
What I cannot put my finger on, is why the individual assignments
behave differently than the for loop? Does anyone have some insights
on that?
library IEEE;
use IEEE.std_logic_1164.all;
entity tb_MultiDimArray is
end tb_MultiDimArray;
architecture Simulation of tb_MultiDimArray is
subtype t_Word is std_logic_vector(31 downto 0);
type t_T is array(0 to 3) of t_Word;
signal Clk : std_logic := '1';
signal T : t_T := (others => (others => '1'));
begin
p_Clock : process
begin
loop
Clk <= not Clk; -- do not forget to initialize the clock !
wait for 5 ns;
end loop;
end process p_Clock;
p_Pipe : process(Clk)
begin
if rising_edge(Clk) then
-- T(1) <= T(0);
-- T(2) <= T(1);
-- T(3) <= T(2);
for i in 0 to 2 loop
T(i+1) <= T(i);
end loop;
end if; -- rising_edge
end process p_Pipe;
p_Sim: process
begin
wait until falling_edge(Clk);
T(0) <= (others => '0');
wait; -- Will wait forever.
end process p_Sim;
end Simulation;