variable : Integer to STD_logic conversion in Altera

J

Joseph

Hi all,

I have been doing some development using Quartus.

In a counter process an integer variable has been declared and used.
The variable needs to be sent to the output which is a
STD_LOGIC_VECTOR. Using the numeric_std package how this can be
accomplished as I have some problems when it comes to type
conversions. I want to avoid using the _arith package.

Regards,

Joseph A. Zammit
 
A

Andy Rushton

Joseph said:
Hi all,

I have been doing some development using Quartus.

In a counter process an integer variable has been declared and used.
The variable needs to be sent to the output which is a
STD_LOGIC_VECTOR. Using the numeric_std package how this can be
accomplished as I have some problems when it comes to type
conversions. I want to avoid using the _arith package.

Depending on whether you want the std_logic_vector to be signed or unsigned:

slv_out <= std_logic_vector(to_signed(integer_in));
or
slv_out <= std_logic_vector(to_unsigned(integer_in));
 
T

Tricky

Hi all,

I have been doing some development using Quartus.

In a counter process an integer variable has been declared and used.
The variable needs to be sent to the output which is a
STD_LOGIC_VECTOR. Using the numeric_std package how this can be
accomplished as I have some problems when it comes to type
conversions. I want to avoid using the _arith package.

Regards,

Joseph A. Zammit

Why not just change the output port to be an integer (assuming its not
a top level port)?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top