V
valentin tihomirov
Guest
I would like to restrict the space of characters.:
subtype TMYCHAR is character ('a', '1', '.'); -- not supported
I would like the interpriter to understand that the elements are characters
so that character'pos attribute were applicable to them for ASCII code
retreival. Like
constant C: character := TMYCHAR'val(1);
constant I: intger := character'pos(C); -- must be x61
Unfortunately, VHDL supports only ranges rather than enumerations in the
specification of subtype. How would you perform the convertion:
type TMYCHAR is ('a', '1', '.');
constant C: character := TMYCHAR'val(1);
I fail to write a function TMYCHAR elements with characters
function GET_ASCII(MC: TMYCHAR) return character is
begin
for C in character'left to character'right loop
if C = MC then -- incompareble types
return character'pos(C);
end if;
end loop;
end;
thanks in advance
subtype TMYCHAR is character ('a', '1', '.'); -- not supported
I would like the interpriter to understand that the elements are characters
so that character'pos attribute were applicable to them for ASCII code
retreival. Like
constant C: character := TMYCHAR'val(1);
constant I: intger := character'pos(C); -- must be x61
Unfortunately, VHDL supports only ranges rather than enumerations in the
specification of subtype. How would you perform the convertion:
type TMYCHAR is ('a', '1', '.');
constant C: character := TMYCHAR'val(1);
I fail to write a function TMYCHAR elements with characters
function GET_ASCII(MC: TMYCHAR) return character is
begin
for C in character'left to character'right loop
if C = MC then -- incompareble types
return character'pos(C);
end if;
end loop;
end;
thanks in advance