I am quite new to VHDL and as my first project I created a 20x7 LED display with rotating text. Right now all the STD_LOGIC_VECTOR
s which printed on the display are set manually.
I was wondering if there is a possibility to get STD_LOGIC_VECTOR
representation of rows from a string (or char?). I found usable font, but I don't know where to start...
to implement something like what you asked for in the later comments, you first need a translation function char2int for the addressing of your array. example:
function char2int (chr: character) return integer is
variable i: integer;
begin
case chr is
when 'H' => i:=0;
when 'A' => i:=1;
when 'L' => i:=2;
when 'O' => i:=3;
when others => i:=4;
end case;
return i;
end char2int;
then the main function is as you suggested in your C-example:
function string_to_bitfile(constant txt_str: string) return text_type is
variable txt: text_type;
begin
for i in 0 to (txt_str'length-1) loop
for j in 0 to 5 loop
txt(6*i+j):=font(char2int(txt_str(i)),j);
end loop;
end loop;
return txt;
end string_to_bitfile;