Guest
Hi everyone,
I have a simulation mismatch in Modelsim when using variables and
signals.
for example:
a variable supposed to take its value from another one in a process,
on the rising edge actually takes the value as it would be outside of
the process.
but if I take those variables and declare them as signals, then they
take the values as expected.
Sample code:
process(clk)
variable a : std_logic_vector(7 downto 0);
variable b : std_logic;
begin
if rising_edge(clk) then
a := my_signal;
b := a(7) and other_signal; -- b takes the value in the same clock
cycle as a
-- if signals, b
takes the value in the next clock cycle
end if;
end process;
Why this difference?
Thank you!
Ben
I have a simulation mismatch in Modelsim when using variables and
signals.
for example:
a variable supposed to take its value from another one in a process,
on the rising edge actually takes the value as it would be outside of
the process.
but if I take those variables and declare them as signals, then they
take the values as expected.
Sample code:
process(clk)
variable a : std_logic_vector(7 downto 0);
variable b : std_logic;
begin
if rising_edge(clk) then
a := my_signal;
b := a(7) and other_signal; -- b takes the value in the same clock
cycle as a
-- if signals, b
takes the value in the next clock cycle
end if;
end process;
Why this difference?
Thank you!
Ben