Integer to std_logic_vector?

S

Sebastian Eggers

Guest
Hi,

i have to count several values from 0 to 99, at the moment i do it in an
array of integer 0 to 99.

As output-port i use a std_logic_vector(6 downto 0), but i may change
this if necessary.

How can i convert the integer to the vector? i have no idea and not
found any solutions yet. Any hint would be helpful

thanks
Sebastian
 
use the conversion functions in the ieee numeric package or the
std_logic package
 
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;

conv_std_logic_vector(7, 9);

converts integer 7 to a std_logic_vector with 9 bits.

Rgds
André
 
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;

conv_std_logic_vector(7, 9);

converts integer 7 to a std_logic_vector with 9 bits.
Nope! Please stop using std_logic_arith package.

use ieee.numeric_std.all

std_logic_vector(to_unsigned(natural_number, nb_bits));

Nico
 

Welcome to EDABoard.com

Sponsor

Back
Top