File Operations in verilog Test- Bench.
$fopen, $fclose, $fdisplay, $fscanf
are discussed on this page with examples.
How to open a file
to read text:
read_file = $fopen(“readme.txt”, r);
The highlighted text in blue is used to show the command which will tell Verilog compiler to read the text file readme.txt.
How to Open a file to write
text:
write_file = $fopen(“readme.txt”, w);
The highlighted text in blue is used to show the command which will tell Verilog compiler to write to the text file readme.txt after erasing all the data from it. Other similar option wb
.