another array ranges mystery

V

valentin tihomirov

Code:
// declarations
// lots of declarations
// VHDL is all ablout declarations

type TPASSWORD is array (0 to 6) of CHARACTER;
type TLETTERS is array (NATURAL range <>) of CHARACTER;
constant LETTERS: TLETTERS := ('k', 'a', 'l');

type TCOUNTER is range LETTERS'range; -- letter iterator
type TINDEX is range PASSWORD'range;
type TCOUNTERS is array (TINDEX) of TCOUNTER; -- iterate all letters in
the pwd
variable COUNTERS: TCOUNTERS;
variable I: TINDEX;

variable C: TCOUNTER;
variable L: CHARACTER;



// a small piece of code

assign_outputs: for I in TINDEX loop
-- PASSWORD(I) <= LETTERS(COUNTERS(I));
C := COUNTERS(I);      // ok
L := LETTERS(C);         // error
PASSWORD(I) <= L;     //error
end loop;


QQ:
The double error message is: "the index types in the reference to the array
object are incompatible with its range type". I do not understand. The
counter's value must be in range of LETTERS by definition. The same about I,
it is the index in the PASSWORD array. So, what is going on? Is it realy my
fault, is it expected vhdl complaint behaviour or is it a mistake made by
tool?

Thanks.
 
V

valentin tihomirov

got subtypes. thanks. understanding works better talking to myself on the
public forums.
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,008
Latest member
HaroldDark

Latest Threads

Top