RANGE attribute use

S

Shannon

The newbie is back!

Why can't I do this:

type table_array IS ARRAY (0 to 16) of STD_LOGIC_VECTOR(11 downto 0);
signal table: table_array;
....

FOR i in 1 to table'RANGE loop
....


Shannon
 
K

KJ

Shannon said:
The newbie is back!

Why can't I do this:

type table_array IS ARRAY (0 to 16) of STD_LOGIC_VECTOR(11 downto 0);
signal table: table_array;
...

FOR i in 1 to table'RANGE loop
...
Because the correct syntax is...
FOR i in table'RANGE loop
KJ
 
S

Shannon

The newbie is back!




Because the correct syntax is...
FOR i in table'RANGE loop
KJ

Almost.

An allowed syntax is:

FOR i in 1 to 10 Loop

Correct?

if table'range = 10 then why couldn't I say

FOR i in 1 to table'range Loop

?
 
A

Allan Herriman

Almost.

An allowed syntax is:

FOR i in 1 to 10 Loop

Correct?

Good so far.
if table'range = 10 then why couldn't I say

No. table'range isn't "10". It is a range 1 to 10. It includes both
the left and right limits, and the direction (to or downto).

Regards,
Allan
 
S

Shannon

Good so far.


No. table'range isn't "10". It is a range 1 to 10. It includes both
the left and right limits, and the direction (to or downto).

Regards,
Allan

Darn! You were too fast for me Allan. I feel so dumb. I thought
RANGE meant "max". I'll just use 'right or 'high. duh...I feel
silly. In my defense I'm trying to code and take care of my two year
old and 11 month old kids at the same time...It has an effect on your
concentration.

Shannon
 

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
474,170
Messages
2,570,925
Members
47,464
Latest member
Bobbylenly

Latest Threads

Top