0
count := to_integer( unsigned ( values(i)));

Error: ERRORS: HDLParsers: 854 - The expression can not be converted to type unsigned

Preconditions:

  • imports

    library ieee;
    use ieee.std_logic_1164.all;
    use ieee.math_real.all;
    
  • count declared as

    variable count : integer range 0 to 255 := 0;
    
  • values declared as

    values: in std_logic_vector(7 downto 0);
    
  • Assignement operator <= tested without success yet.

1 Answers1

0

values(i) is of type std_logic. You cannot type cast an std_logic into an unsigned. This seems like an odd thing to be doing, perhaps if you could explain why you are trying to do this, I could provide an alternative.

scary_jeff
  • 4,314
  • 13
  • 27
  • this passage is included into a process which operates as BCD converter. I want to convert the binary input (`std_logic_vector`) into a integer variable (`count`) with a for loop, considering one bit per loop and adding its decimal value on the variable count iteratively. It would be something like this, but we were just doing some tests: `count := count + to_integer(unsigned(values(i)))*(2**i)` – Davide Pimpinella Nov 28 '16 at 10:18
  • @DavidePimpinella maybe it would be worth adding your whole `process` to the question. Alternatively, there are many existing questions on binary to BCD conversion. – scary_jeff Nov 28 '16 at 10:43