问答 #33732 - ISE Simulator (ISim) - $fscanf does not return "-1" upon EOF (end of file)

全部最近问答记录

搜索问答数据库


 

ISE Simulator (ISim) - $fscanf does not return "-1" upon EOF (end of file)

问答编号# 33732
型号 SW-ISE Simulator
最后更新日期 2009-10-30 00:00:00.0
记录状态 Active
关键词 $fscanf, $feof, return codes

疑问描述

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?

解决方案

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

 
 
/csi/footer.htm