VKkaps
VKkaps

Reputation: 159

Reporting std_logic_vector as an unsigned integer in ISim?

here's the libararies I'm using:

library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.NUMERIC_STD.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

the signal:

signal CountTemp : std_logic_vector(15 downto 0);

and the report statement:

report "Actual CountTemp: " & integer'image(to_integer(unsigned(CountTemp)));

I'm recieving this error:

 at 30 ns, Instance /TESTFILE_tb/ : Warning: NUMERIC_STD.TO_INTEGER: metavalue detected, returning 0

Upvotes: 0

Views: 8963

Answers (1)

scary_jeff
scary_jeff

Reputation: 4374

Errors containing metavalue detected mean that you passed in a parameter (in this case unsigned(CountTemp)) that contained bits with states other than 0 or 1.

Try initialising your counter:

signal CountTemp : std_logic_vector(15 downto 0) := (others => '0');

Since without this, the value of CountTemp will be "UUUUUUUUUUUUUUUU", i.e. a metavalue.

Alternatively, make sure that you have assigned something to your signal prior to passing it to to_integer.

Upvotes: 1

Related Questions