Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

What does this coding do ?

Status
Not open for further replies.

thecoder

Newbie level 1
Joined
Jan 4, 2008
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,291
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
 

What does this do ?

If you look at the end of the constant NUMERATOR line, you will see that is has a series of numbers. Those are the value inside the array. For example, NUMERATOR(0) will return a 7, NUMERATOR(1) will return 30, etc.

std probably is a std_logic_vector. That is why it needs a conv_integer since the array index has to be an integer.

I am not sure which part of the code you don't understand but I hope this help.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top