What does this do ?

Guest
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
 
-- **** 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
 
On Jan 4, 2:05 pm, KJ <kkjenni...@sbcglobal.net> wrote:
-- **** 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
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 ?
 
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,

<iqbalmuh@hotmail.co.uk> wrote in message
news:9ac02040-7db8-41b9-a7e4-2dbabc64e349@f10g2000hsf.googlegroups.com...
On Jan 4, 2:05 pm, KJ <kkjenni...@sbcglobal.net> wrote:
-- **** 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
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 ?
 
<iqbalmuh@hotmail.co.uk> wrote in message
news:9ac02040-7db8-41b9-a7e4-2dbabc64e349@f10g2000hsf.googlegroups.com...
Yes but what IS the number value ?
I guess 3. But you could simulate it and find out...

HTH, Syms.
 
On Jan 4, 8:10 am, iqbal...@hotmail.co.uk wrote:
On Jan 4, 2:05 pm, KJ <kkjenni...@sbcglobal.net> wrote:

-- **** 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

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
 

Welcome to EDABoard.com

Sponsor

Back
Top