2 use ieee.std_logic_1164.all;
5 port (o : out std_logic_vector(0 to 31));
8 architecture behav of const01 is
9 type slv_array is array (natural range <>) of std_logic_vector(7 downto 0);
11 function conv (v : std_logic_vector) return slv_array is
12 variable r : slv_array(0 to v'length / 8 - 1);
14 for i in 0 to r'length-1 loop
15 r (i) := v(v'length - (i*8) - 1 downto v'length - (i*8) - 8);
20 constant init : std_logic_vector (31 downto 0) := x"01020304";
21 constant res : slv_array (0 to 3) := conv (init);
23 o (0 to 7) <= res (0);
24 o (8 to 15) <= res (1);
25 o (16 to 23) <= res (2);
26 o (24 to 31) <= res (3);