A
Al
Guest
hi all,
I have a very simple task, which is to fill an array of data with some
binary stram I have in hand. This is needed because I need to pick up
single elements of this array and send them through a dedicated protocol
to my DUT.
To do this I wanted to use a function which takes the binary values and
write in the correct way to the array.
Unfortunately it doesn't work through ModelSim.
I attach the code:
-- declaration
....
type inoutbuf is array (0 to 300) of std_logic_vector (15 downto 0);
signal setup_buf : inoutbuf;
function fill_setup (setup_reg : std_logic_vector (23 downto 0))
return inoutbuf;
....
-- body
function fill_setup (setup_reg : std_logic_vector (23 downto 0))
return inoutbuf is
variable buf : inoutbuf;
begin
for i in 0 to 5 loop
buf (i) := (others => '0');
end loop;
buf (0) := std_logic_vector (conv_unsigned (unsigned (setup_reg
(3 downto 0)), 16));
buf (1) := std_logic_vector (conv_unsigned (setup_reg (4), 16));
buf (2) := std_logic_vector (conv_unsigned (setup_reg (5), 16));
buf (3) := std_logic_vector (conv_unsigned (unsigned (setup_reg
(16 downto 6)), 16));
buf (4) := std_logic_vector (conv_unsigned (unsigned (setup_reg
(19 downto 17)), 16));
buf (5) := std_logic_vector (conv_unsigned (unsigned (setup_reg
(23 downto 20)), 16));
return buf;
end fill_setup;
When I call it I simply type:
buf <= fill_setup (setup_val);
where buf is an inoutbuf.
Why buf is always zero????
I'm sure I'm doing a very stupid mistake, thank you all
Al
--
Alessandro Basili
CERN, PH/UGC
Hardware Designer
I have a very simple task, which is to fill an array of data with some
binary stram I have in hand. This is needed because I need to pick up
single elements of this array and send them through a dedicated protocol
to my DUT.
To do this I wanted to use a function which takes the binary values and
write in the correct way to the array.
Unfortunately it doesn't work through ModelSim.
I attach the code:
-- declaration
....
type inoutbuf is array (0 to 300) of std_logic_vector (15 downto 0);
signal setup_buf : inoutbuf;
function fill_setup (setup_reg : std_logic_vector (23 downto 0))
return inoutbuf;
....
-- body
function fill_setup (setup_reg : std_logic_vector (23 downto 0))
return inoutbuf is
variable buf : inoutbuf;
begin
for i in 0 to 5 loop
buf (i) := (others => '0');
end loop;
buf (0) := std_logic_vector (conv_unsigned (unsigned (setup_reg
(3 downto 0)), 16));
buf (1) := std_logic_vector (conv_unsigned (setup_reg (4), 16));
buf (2) := std_logic_vector (conv_unsigned (setup_reg (5), 16));
buf (3) := std_logic_vector (conv_unsigned (unsigned (setup_reg
(16 downto 6)), 16));
buf (4) := std_logic_vector (conv_unsigned (unsigned (setup_reg
(19 downto 17)), 16));
buf (5) := std_logic_vector (conv_unsigned (unsigned (setup_reg
(23 downto 20)), 16));
return buf;
end fill_setup;
When I call it I simply type:
buf <= fill_setup (setup_val);
where buf is an inoutbuf.
Why buf is always zero????
I'm sure I'm doing a very stupid mistake, thank you all
Al
--
Alessandro Basili
CERN, PH/UGC
Hardware Designer