Altera_Forum
Honored Contributor
9 years agoReading a file content with quartus
Hi everybody,
I need to read a value from an external file at compilation time and I don´t achieve to do it with quartus. The same code works for Xilinx Ise but I´m not able to do it with Quartus. The code also works fine with Modelsim. I have made many changes at code and search solutions on the web but nothing. This is the begining of the function I use to read the content of the file ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- use std.textio.all; ------------------------------------------------------------------------------- -- function to get version from 'version.txt' file impure function get_version return std_logic_vector is file data_file: text open READ_MODE is "version.txt"; variable rd_line : line; begin -- check that file is not empty assert(not endfile(data_file)) report "*** ERROR: File is empty" severity error; -- read 1st line and convert it to string readline(vers_file, rd_line); ................................................. ................................................. ................................................. ................................................. end get_version; ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- The problem is that I don´t get to read or locate the file. At compilation time it doesn't give me the report error but I know that it does't correctly read the file because if I put a file name it doesn´t exist, It seems to do the same (nothing). I have been searching for any example, but I didn´t found it. Can anyone help me?