| AR# |
33732 |
| Part |
SW-ISE Simulator |
| Last Modified |
2009-10-30 00:00:00.0 |
| Status |
Active |
| Keywords |
$fscanf, $feof, return codes |
Description
Keywords: $fscanf, $feof, return codes
I am expecting ISim to return "-1" when $fscanf reaches EOF of the text file I am attempting to read in. However, ISim continues to read the last line.
How can I properly identify EOF using the $fscanf function?
Solution
This is a known issue in all updates of ISE Simulator 11. This issue is currently under investigation to better address this condition in a future release of the ISE Simulator.
To work around this issue, use the $feof Verilog function to catch EOF. For example:
initial while(!$feof(input_file)) begin
#10;
read_ok = $fscanf(input_file,"%h\n",data);
$display("%g: Read $%h from input file. read_ok = %d",$time,data,read_ok);
end