pylab_ml.common.file_io.readVlogMemFile
- readVlogMemFile(fileName, memSize=0, defaultvalues=None, bitwidth=None, debug=False)[source]
Read a file with memory data in verilog hex format.
- eg. readVlogMemFile(‘memory.v’) will read the memory data from the file ‘memory.v’ in verilog hex format and return the starting address and a list of memory data.
The function will read the file line by line, parse the address and data values in verilog hex format, and fill a list with the memory data. The function will also determine the memory size and bit width from the data in the file if memSize and bitwidth parameters are not provided.
- Parameters:
fileName (string) – The name of the verilog file containing memory data.
memSize (int) – The number of memory addresses. If 0, the size will be calculated from the data in the file.
defaultvalues (int) – The default values for the memory array if no data is read.
bitwidth (int) – The bit width of the data.
debug (bool) – If True, it prints out the data loaded.
- Returns:
int – startadr : The starting address of the memory data.
list – data : A list of memory data, with None entries for unused/initialized values.