Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)

Read from a text file

Altera_Forum
Honored Contributor II
6,914 Views

Hello, 

I'm trying to read a text file with VHDL to generate some automatic input codes. 

I made a project just to test this entity, but my output is always with value 'Z'. 

 

my text file contains only one line and the line contains this 

"11111111" 

 

Observation : the cod.txt was created with QuartusII and is included to the project! 

 

i think quartus can't open or read the file or something like that 

 

thanks in advance 

 

 

library std; library ieee; use std.textio.all; use ieee.std_logic_1164.all; entity readfile is port(clock : in std_logic; --output : out std_logic_vector(7 downto 0); output : out std_logic ); end readfile; architecture logic of readfile is --signal aux: std_logic_vector(7 downto 0); begin process(clock) variable inline:line; variable character_variable:character; variable end_of_line:boolean; file myfile:text is "cod.txt"; begin if(clock'event and clock = '1') then readline(myfile,inline); read(inline,character_variable,end_of_line); for i in 0 to 7 loop read(inline,character_variable,end_of_line); case character_variable is when '0' => output <= '0'; when '1' => output <= '1'; when others => output <= 'Z'; end case; end loop; --output <= aux; end if; end process; end logic;
0 Kudos
23 Replies
Altera_Forum
Honored Contributor II
544 Views

Ohhhhhhhhhhhhhhhhh 

so the problem is the Quartus Software... 

the modelSim from altera can read it then?
0 Kudos
Altera_Forum
Honored Contributor II
544 Views

 

--- Quote Start ---  

the modelSim from altera can read it then? 

--- Quote End ---  

 

Read the above posts... everything has been said. 

 

P.S.: The Atera edition has all basic ModelSim features.
0 Kudos
Altera_Forum
Honored Contributor II
544 Views

Thanks eveyrone for this big help!

0 Kudos
Reply