Electronic – Does a package exist to carry out intense string manipulation in VHDL

vhdl

I am writing a VHDL code for a MIPS32. My idea is that for simulation purpose the testbench shall replace the instruction memory with a behavioral model which will read the program instructions from an ASCII file written as assembly instructions and convert them to 32 bit words and store them in a std_logic_vector. Thereafter, the input value from the program counter shall decide which of these values in the vector are output.

To this end the behavioral model shall have to read each line in the text file, determine if it contains an actual instruction e.g add, lw, sw e.t.c and then find out the operands given for that instruction and generate an equivalent 32 bit binary instruction. It shall also have to determine if the instruction is valid or has syntax error during this parsing and token generation process. For this purpose I shall require some serious string manipulation functions in VHDL. However, I don't see them in textio which only contains functions to read/write files and not play with string data type.

Best Answer

There are string libraries on the net like:

But the normal flow is as follows:

  1. compile your MIPS program (e.g. with gcc and cross platform compiling to a *.elf file.
  2. convert your .elf file to a memory file (.mem, *.hex, *.mif)
  3. load that memory file into your MIPS's boot memory
  4. simulate your program and CPU