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?
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
read_ok = $fscanf(input_file,"%h\n",data);
$display("%g: Read $%h from input file. read_ok = %d",$time,data,read_ok);