G
guenter
Guest
Is it allowed to pass a member of a std_logic_vector to the rising_edg
function?
When doing this, isim doen's detect all changes, while modelsim does.
The code below toggles bits of a 3-bit vector. Bit 1 of the vector is
checked for rising and falling edges by directly passing vec(1) t
reising_edge(). Bit 1 is also assigned to a scalar signal which is als
checked for edges:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity top is
end top;
architecture Behavioral of top is
signal vec : std_logic_vector(2 downto 0) := "000";
signal sig : std_logic := '0';
begin
gen: process is
begin
vec <= "000" after 1 ns,
"010" after 2 ns,
"000" after 3 ns,
"101" after 4 ns,
"111" after 5 ns,
"101" after 6 ns;
wait for 6 ns;
wait;
end process gen;
sig <= vec(1);
watch_bit1a: process is
begin
wait until rising_edge(vec(1));
report "rising edge on vec" severity note;
end process watch_bit1a;
watch_bit1b: process is
begin
wait until falling_edge(vec(1));
report "falling edge on vec" severity note;
end process watch_bit1b;
watch_bit1c: process is
begin
wait until rising_edge(sig);
report "rising edge on sig" severity note;
end process watch_bit1c;
watch_bit1d: process is
begin
wait until falling_edge(sig);
report "falling edge on sig" severity note;
end process watch_bit1d;
end Behavioral;
Simulating with modelsim reports all edges:
# ** Note: rising edge on vec Time: 2 ns Iteration: 0 Instance: /top
# ** Note: rising edge on sig Time: 2 ns Iteration: 1 Instance: /top
# ** Note: falling edge on vec Time: 3 ns Iteration: 0 Instance: /top
# ** Note: falling edge on sig Time: 3 ns Iteration: 1 Instance: /top
# ** Note: rising edge on vec Time: 5 ns Iteration: 0 Instance: /top
# ** Note: rising edge on sig Time: 5 ns Iteration: 1 Instance: /top
# ** Note: falling edge on vec Time: 6 ns Iteration: 0 Instance: /top
# ** Note: falling edge on sig Time: 6 ns Iteration: 1 Instance: /top
isim only reports those edges that make bit 1 different from the remainin
bits:
at 2 ns: Note: rising edge on vec (/top/).
at 2 ns(1): Note: rising edge on sig (/top/).
at 3 ns(1): Note: falling edge on sig (/top/).
at 5 ns(1): Note: rising edge on sig (/top/).
at 6 ns: Note: falling edge on vec (/top/).
at 6 ns(1): Note: falling edge on sig (/top/).
I can imagine that passing vec(1) to rising_edge is not really allowe
since it is of type std_logic_vector(1 downto 1) instead of std_logic.
What do you think about this? Is isim more accurate with the standard or i
is simply a bug?
regards
Guenter
---------------------------------------
Posted through http://www.FPGARelated.com
function?
When doing this, isim doen's detect all changes, while modelsim does.
The code below toggles bits of a 3-bit vector. Bit 1 of the vector is
checked for rising and falling edges by directly passing vec(1) t
reising_edge(). Bit 1 is also assigned to a scalar signal which is als
checked for edges:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity top is
end top;
architecture Behavioral of top is
signal vec : std_logic_vector(2 downto 0) := "000";
signal sig : std_logic := '0';
begin
gen: process is
begin
vec <= "000" after 1 ns,
"010" after 2 ns,
"000" after 3 ns,
"101" after 4 ns,
"111" after 5 ns,
"101" after 6 ns;
wait for 6 ns;
wait;
end process gen;
sig <= vec(1);
watch_bit1a: process is
begin
wait until rising_edge(vec(1));
report "rising edge on vec" severity note;
end process watch_bit1a;
watch_bit1b: process is
begin
wait until falling_edge(vec(1));
report "falling edge on vec" severity note;
end process watch_bit1b;
watch_bit1c: process is
begin
wait until rising_edge(sig);
report "rising edge on sig" severity note;
end process watch_bit1c;
watch_bit1d: process is
begin
wait until falling_edge(sig);
report "falling edge on sig" severity note;
end process watch_bit1d;
end Behavioral;
Simulating with modelsim reports all edges:
# ** Note: rising edge on vec Time: 2 ns Iteration: 0 Instance: /top
# ** Note: rising edge on sig Time: 2 ns Iteration: 1 Instance: /top
# ** Note: falling edge on vec Time: 3 ns Iteration: 0 Instance: /top
# ** Note: falling edge on sig Time: 3 ns Iteration: 1 Instance: /top
# ** Note: rising edge on vec Time: 5 ns Iteration: 0 Instance: /top
# ** Note: rising edge on sig Time: 5 ns Iteration: 1 Instance: /top
# ** Note: falling edge on vec Time: 6 ns Iteration: 0 Instance: /top
# ** Note: falling edge on sig Time: 6 ns Iteration: 1 Instance: /top
isim only reports those edges that make bit 1 different from the remainin
bits:
at 2 ns: Note: rising edge on vec (/top/).
at 2 ns(1): Note: rising edge on sig (/top/).
at 3 ns(1): Note: falling edge on sig (/top/).
at 5 ns(1): Note: rising edge on sig (/top/).
at 6 ns: Note: falling edge on vec (/top/).
at 6 ns(1): Note: falling edge on sig (/top/).
I can imagine that passing vec(1) to rising_edge is not really allowe
since it is of type std_logic_vector(1 downto 1) instead of std_logic.
What do you think about this? Is isim more accurate with the standard or i
is simply a bug?
regards
Guenter
---------------------------------------
Posted through http://www.FPGARelated.com