V
valentin tihomirov
Guest
[code:1:7fb1b2bea0]
// 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;
[/code:1:7fb1b2bea0]
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.
// 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;
[/code:1:7fb1b2bea0]
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.