Hi, for all. I'm using Altera software - Quartus II v 5.1 and i have a problem with reading text file. My code is below:
library ieee;
use ieee.std_logic_1164.all;
--use ieee.std_logic_textio.all;
USE std.TEXTIO.ALL;
ENTITY files IS
PORT( go : IN std_logic);
END files;
ARCHITECTURE simple OF files IS
BEGIN
PROCESS(go)
FILE infile : TEXT IS IN "C:\infile.txt";
FILE outfile : TEXT IS OUT "C:\outfile.txt";
VARIABLE out_line, my_line : LINE;
VARIABLE int_val : INTEGER;
BEGIN
WHILE NOT( ENDFILE(infile)) LOOP
-- read a line from the input file
READLINE( infile, my_line);
-- read a value from the line
READ( my_line, int_val);
-- square the value
int_val := int_val **2;
-- write the squared value to the line
WRITE( out_line, int_val);
-- write the line to the output file
WRITELINE( outfile, out_line);
END LOOP;
END PROCESS;
END simple;
First when i'm using use ieee.std_logic_textio.all package, Quartus show this error:
Error (10481): VHDL Use Clause error at files.vhd(3): design library "ieee" does not contain primary unit "std_logic_textio"
second, when i dont use this package, Quartus say:
Error (10536): VHDL Loop Statement error at files.vhd(16): loop must terminate at or before 10000 iterations
Could you help me?
Thank you
library ieee;
use ieee.std_logic_1164.all;
--use ieee.std_logic_textio.all;
USE std.TEXTIO.ALL;
ENTITY files IS
PORT( go : IN std_logic);
END files;
ARCHITECTURE simple OF files IS
BEGIN
PROCESS(go)
FILE infile : TEXT IS IN "C:\infile.txt";
FILE outfile : TEXT IS OUT "C:\outfile.txt";
VARIABLE out_line, my_line : LINE;
VARIABLE int_val : INTEGER;
BEGIN
WHILE NOT( ENDFILE(infile)) LOOP
-- read a line from the input file
READLINE( infile, my_line);
-- read a value from the line
READ( my_line, int_val);
-- square the value
int_val := int_val **2;
-- write the squared value to the line
WRITE( out_line, int_val);
-- write the line to the output file
WRITELINE( outfile, out_line);
END LOOP;
END PROCESS;
END simple;
First when i'm using use ieee.std_logic_textio.all package, Quartus show this error:
Error (10481): VHDL Use Clause error at files.vhd(3): design library "ieee" does not contain primary unit "std_logic_textio"
second, when i dont use this package, Quartus say:
Error (10536): VHDL Loop Statement error at files.vhd(16): loop must terminate at or before 10000 iterations
Could you help me?
Thank you