0

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
VKkaps
  • 159
  • 3
  • 21

1 Answers1

1

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.

scary_jeff
  • 4,314
  • 13
  • 27
  • that takes care of the error message but still returns the wrong value even when the correct value is 1. All it returns is 0 for every case – VKkaps Aug 06 '15 at 14:16
  • That sounds like a new question to me. – scary_jeff Aug 06 '15 at 14:25
  • the issue is with the conversion integer'image(to_integer(unsigned(CountTemp))), not the initialization of CountTemp. The simlulation waveform is showing CountTemp as a non-zero unsigned integer value but the report statement is returning a zero everytime because it doesn't like the conversion – VKkaps Aug 06 '15 at 14:30
  • maybe this will help explain what I'm trying to do better.....https://groups.google.com/forum/#!topic/comp.lang.vhdl/ZkyIUFlulj4 – VKkaps Aug 06 '15 at 14:43
  • I don't know of a standard way to print in binary. You could try `to_hstring()` to print in hex, but if the integer conversion returns zero, I don't see that any other printing method will show anything different. It seems more likely that you're not printing what you think you are, or that there's some other error somewhere else. – scary_jeff Aug 06 '15 at 14:48