library ieee;
use ieee.std_logic_1164.all;
entity testxx is
end entity;
architecture arch of testxx is
--The function to_string was taken from
--http://www-ee.uta.edu/Online/Zhu/spring_2007/tutorial/how_to_print_objexts.txt
function to_string(sv: Std_Logic_Vector) return string is
use Std.TextIO.all;
variable bv: bit_vector(sv'range) := to_bitvector(sv);
variable lp: line;
begin
write(lp, bv);
return lp.all;
end;
type tvector is array (7 downto 0)
of std_logic_vector(3 downto 0);
constant test_vectors: tvector := ("0000",
"0011",
"0101",
"0111",
"1001",
"1010",
"1100",
"1111");
begin
process
begin
for i in 7 downto 0 loop
report "loop_i=" & integer'image(i);
report "length="
& integer'image(test_vectors(i)'length);
report "vector=" & to_string(test_vectors(i));
wait for 10 ns;
end loop;
wait;
end process;
end architecture;
The output from modelsim is as follows:
# ** Note: loop_i=7
# Time: 0 ps Iteration: 0 Instance: /testxx
# ** Note: length=4
# Time: 0 ps Iteration: 0 Instance: /testxx
# ** Note: vector=0000
# Time: 0 ps Iteration: 0 Instance: /testxx
# ** Note: loop_i=6
# Time: 10 ns Iteration: 0 Instance: /testxx
# ** Note: length=4
# Time: 10 ns Iteration: 0 Instance: /testxx
# ** Note: vector=0011
# Time: 10 ns Iteration: 0 Instance: /testxx
# ** Note: loop_i=5
# Time: 20 ns Iteration: 0 Instance: /testxx
# ** Note: length=4
# Time: 20 ns Iteration: 0 Instance: /testxx
# ** Note: vector=0101
# Time: 20 ns Iteration: 0 Instance: /testxx
# ** Note: loop_i=4
# Time: 30 ns Iteration: 0 Instance: /testxx
# ** Note: length=4
# Time: 30 ns Iteration: 0 Instance: /testxx
# ** Note: vector=0111
# Time: 30 ns Iteration: 0 Instance: /testxx
# ** Note: loop_i=3
# Time: 40 ns Iteration: 0 Instance: /testxx
# ** Note: length=4
# Time: 40 ns Iteration: 0 Instance: /testxx
# ** Note: vector=1001
# Time: 40 ns Iteration: 0 Instance: /testxx
# ** Note: loop_i=2
# Time: 50 ns Iteration: 0 Instance: /testxx
# ** Note: length=4
# Time: 50 ns Iteration: 0 Instance: /testxx
# ** Note: vector=1010
# Time: 50 ns Iteration: 0 Instance: /testxx
# ** Note: loop_i=1
# Time: 60 ns Iteration: 0 Instance: /testxx
# ** Note: length=4
# Time: 60 ns Iteration: 0 Instance: /testxx
# ** Note: vector=1100
# Time: 60 ns Iteration: 0 Instance: /testxx
# ** Note: loop_i=0
# Time: 70 ns Iteration: 0 Instance: /testxx
# ** Note: length=4
# Time: 70 ns Iteration: 0 Instance: /testxx
# ** Note: vector=1111
# Time: 70 ns Iteration: 0 Instance: /testxx
No comments:
Post a Comment