I need to design a record with an unconstrained string that has this effect (below). Right now that type does not synthesize because of a Type for a record element may not be an unconstrained array error.
type type_textChunk is
record
text: string;
color: std_logic_vector(7 downto 0); -- "111" & "111" & "11"
end record;
type type_textPassage is array(natural range <>) of type_textChunk;
This way I can have a text block with multiple sections of variable length and color in it. This will be used in a text module for VGA display.
I already have working version that does not use this new found design. You can find it on GitHub under the name FP(V)GA-Text. It currently uses a generic on the component which defines the length of the string but is not suitable to draw a sentence of multiple colors easily (manual positioning of multiple components could mimic this effect, although painstaking)
I understand that infinite hardware is not possible but I want this to be re-usable and generic as possible in order to suit everyone's needs. If this is not the right way to go about my plan then how do I design this functionality in.
It looks like there is a topic on the subject but only a VHDL-2008 solution. I am using Xilinx 14.5 which I believe does not support VHDL-2008 because is it is producing that error.
A possible solution may be a "&" concatenating function for the custom type that repositions the right side element relatively to the left side element to line it up correctly... This is not ideal though.
Update (7/17/2013)
I had a huge flaw in my design. I was making a whole new gigantic font ROM for every text_line element. This has been fixed by creating a shared fontROM and an arbiter to interface to the text_line elements. This version is on GitHub project. Another feature that has been added is a color map. Since you can not have a unconstrained item in a record I had to split it up.
type type_textColorMap is array(natural range <>) of std_logic_vector(7 downto 0);
There is a color for each character. I wish you could use others => ... syntax but it doesn't like it in the entity instantiation so you have to use a bit more combersome and less maintainable syntax. A goal syntax would be something like: colorMap => (others => "111" & "111" & "11", 2 => "111" & "000" & "00"),
But you have to use:
colorMap => (10 downto 0 => "111" & "111" & "11"),
or mix and match the colors by:
colorMap => (7 downto 4 => "111" & "111" & "11", 3 downto 2 => "111" & "000" & "00", 1 downto 0 => "111" & "111" & "11"),