What does this do ?

I

iqbalmuh

Hi,

Can anyone tell me what this bit of code is doing ?

-- declarations
-------------------------------------------------------------------------------------------
signal phase : std_logic_vector(6 downto 0);

type INTEGER_ARRAY is array ( natural range <> ) of integer;

constant NUMERATOR : INTEGER_ARRAY(7 downto 0) := (7,30,7,7, 30, 30,
30,30);

variable phase_next : std_logic_vector(6 downto 0);
--------------------------------------------------------------------------------------------

-- **** problem code **********

phase_next := phase + NUMERATOR(conv_integer(std));

Obviously the conv_integer(std) part of the code is being used to
access the array NUMERATOR but I don't understand exactly how since no
number value is being specified to key into the array.

Thanks
 
K

KJ

-- **** problem code **********

phase_next := phase + NUMERATOR(conv_integer(std));

Obviously the conv_integer(std) part of the code is being used to
access the array NUMERATOR but I don't understand exactly how since no
number value is being specified to key into the array.
conv_integer returns an integer value...that is the "number value is
being specified to key into the array."

KJ
 
I

iqbalmuh

conv_integer returns an integer value...that is the "number value is
being specified to key into the array."

KJ

Yes but what IS the number value ?

That's the bit I don't understand ie. what is the value of 'std' which
is being converted by 'conv_integer ?
 
A

Andy

Yes but what IS the number value ?

That's the bit I don't understand ie. what is the value of 'std' which
is being converted by 'conv_integer ?

From the context "std" is a std_logic_vector whose contents are being
transformed into an integer to index the array. Where does "std" come
from? It is not shown elsewhere in the code you posted, so how are we
to know?.

Andy
 
X

Xin Xiao

hi

you have not declared "std", that's the problem. it should be a
std_logic_vector and it will be converted to integer.

hth,

conv_integer returns an integer value...that is the "number value is
being specified to key into the array."

KJ

Yes but what IS the number value ?

That's the bit I don't understand ie. what is the value of 'std' which
is being converted by 'conv_integer ?
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top