Altera_Forum
Honored Contributor
14 years agoError reading file
Hi I'm trying to read a text file which is basically many lines of 1s and 0s, e.g.
1 0 1 1 0 At the moment if I include the file I get the following error message when I try to compile: Error (10170): Verilog HDL syntax error at data_file.txt(1) near text "1"; expecting an identifier, or "endmodule", or a parallel statement and the cursor is on the first line of the added file. There are many bits in this file so I need to change the verilog method of reading I suppose, but I don't know how. The syntax I'm trying to use is: // include file (outside module description) `include "C:\*path*\data_file.txt" integer fileID; initial begin fileID = $fopen("data_file.txt", "r"); end I have also tried to read it without the include line with: fileID = $fopen("*path*data_file.txt", "r"); but then I get error message: Error (10174): Verilog HDL Unsupported Feature error at datafile9.v(21): system function "$fopen" is not supported for synthesis Any help would be very much appreciated.