Forum Discussion
Altera_Forum
Honored Contributor
13 years agoconver froms td_logic_vector to integer
hai every one i'm new to vhdl code and i got problem how to use decimal value instead of binary for example right_m<="1010001010"; left_m <="1011101110"; i want to conver...
Altera_Forum
Honored Contributor
13 years ago --- Quote Start --- Don't use library std_logic_arith. It's a bad practice of vhdl. use instead numeric_std: library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; signal left_m : unsigned(9 downto 0) ; signal right_m : unsigned(9 downto 0) ; right_m<=to_unsigned(650, 10); left_m <=to_unsigned(750, 10); You cast the numbers to unsigned. The first parameter is the number and the second the bits amount. --- Quote End --- It could be easily converted to std_logic vector: right_m<= std_logic_vector(to_unsigned(650, 10)); left_m <= std_logic_vector(to_unsigned(750, 10));