1

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"),

2 Answers 2

2

There are two aspects of the VHDL language - one is used for prototyping and simulation, the other is synthesizable to hardware. In software its not a problem to have dynamic memory and to allocate arbitrary length strings.

In your case you are expecting from the language to process your text string and map it to schematic of gates without having any constraint and this is not possible.

Maybe you can make your life easier by representing the screen as e.g. 80x25 cells with ASCII code and color code for each cell. Then you can output your data in some fixed length char chunks.

Choosing the length of the chunk depends on how you get the data to be output. Also note that currently you are trying to output a text chunk and its color in parallel.

You may also encode color+count+bits_for_N_chars in your record, then the record size will be fixed and you will not have this problem.

Sign up to request clarification or add additional context in comments.

1 Comment

The GitHub project design at the moment can be updated to have a custom color for each text_line component and then manually or make a function to position them. A separate array could even be made to map a color to each character (which actually sounds pretty good in my mind atm, a derivative of what you suggested). The question is, what is the best implementation for this feature that makes it easy to set up and start drawing on the screen. Thanks for the lead.
2

I think what you're trying to do here is a typical software approach: you want to send a message containing all necessary data straight-away.

You should think about how critical your timing really needs to be: * Do you need to process text and color all in parallel? * What do you currently do about "memory allocation" in c and how will that have to be adapted for a hardware approach?

IMHO, you will realize that you need some static memory that some user logic writes to. This will have to have some encoding. Then the user logic gives a start signal to display the message, i.e. now the vga controller will read from its internal memory (where user logic just wrote the encoded string) and display this on the screen.

Now, for smaller display sizes, it might be sensible to have the full character array mapped externally, so user logic can directly write character and color code in one write cycle to a desired location. Your controller could then periodically update the screen at some desired refresh rate.

Of course, for larger display sizes, this approach will likely not scale, because exposing all available character positions will require a large address bus and expose the underlying logic to the user, which is not desirable in the long run: Your implementation changes and the interface might be broken.

EDIT: Possibly take a look at VGA cores on opencores or the like to get a general idea for an appropriate interface.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.