Verilog readmemh (or readmemb) function.
Program. File operation using ‘readmemh’ for reading hex values from test files.
Step. Verilog code example for file operations.
Step. Declare a array of 4 word deep and 20 locations wide to store 5 hexadecimal values.
Step. Use ‘readmemh’ command to read hexadecimal values.
Step. Declare an integer to set a pointer to read values from test file.
Step. Display the values from the text file on the compiler screen.
Readmemb is similar to readmemh with only difference of binary interpretation of the text file. Required format of input text file is binary.