RANGE attribute use

S

Shannon

Guest
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
 
"Shannon" <sgomes@sbcglobal.net> wrote in message
news:1188685323.809674.305580@57g2000hsv.googlegroups.com...
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
 
On Sep 1, 5:15 pm, "KJ" <kkjenni...@sbcglobal.net> wrote:
"Shannon" <sgo...@sbcglobal.net> wrote in message

news:1188685323.809674.305580@57g2000hsv.googlegroups.com...> 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
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

?
 
On Sun, 02 Sep 2007 02:36:33 -0000, Shannon <sgomes@sbcglobal.net>
wrote:

On Sep 1, 5:15 pm, "KJ" <kkjenni...@sbcglobal.net> wrote:
"Shannon" <sgo...@sbcglobal.net> wrote in message

news:1188685323.809674.305580@57g2000hsv.googlegroups.com...> 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

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
 
On Sep 1, 9:05 pm, Allan Herriman <allanherri...@hotmail.com> wrote:
On Sun, 02 Sep 2007 02:36:33 -0000, Shannon <sgo...@sbcglobal.net
wrote:



On Sep 1, 5:15 pm, "KJ" <kkjenni...@sbcglobal.net> wrote:
"Shannon" <sgo...@sbcglobal.net> wrote in message

news:1188685323.809674.305580@57g2000hsv.googlegroups.com...> 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

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

Welcome to EDABoard.com

Sponsor

Back
Top