Functions used for writing and reading from file in verilog.
- fopen
- fclose
- fscanf – read from file as per format
- fwrite – write to file as per format
- fdisplay -write to file
Above Function are similar to C programming file handling. Difference of fwrite and fdisplay is that fwrite does not insert newline after each statement display while fdisplay does insert newline.
To write and read memory , new system functions are provided are
- writememh
- readmemh
These functions used to load/dump memory directly. Below is example.
reg [99:0] memory [0:1000]
writememh (“file_name”,memory);
File should have number of lines equals to depth of memory and each line should have bits equal to depth of memory.
Please provide comments to improve blog.