Altera_Forum
Honored Contributor
13 years agoReading a file and storing the data into a record (VHDL)
Super Newb here....
So I am having issues of how to write a function that will input a line and break it into a record. I feel like it is something simple like how to store a line into an array but I dont fully understand So here is the code I wrote so far
Library ieee;
Use std.textio.all;
Use ieee.numeric_std.all;
Use ieee.std_logic_1164.all;
Use ieee.std_logic_unsigned.all;
Entity Project_Work is end;
Architecture code of Project_Work is
Variable L_In: Line;
File Blank_File: text is in "Blank.txt";
Begin
While not endfile (Blank_File) loop
readline(Blank_File,L_in);
End Loop;
Function PARSE_VEC (L_In: Line)
Return record is
Type in_vec is record
In_1: std_logic_vector(3 downto 0);
In_2: std_logic_vector(3 downto 0);
Parity: std_logic;
Expected_Out: std_logic_vector(7 downto 0);
End Record in_vec;
End PARSE_VEC;
So the text it see are like "0000 0000 0 00000000 1111 1101 1 11011011 0010 1100 1 00101001" Ant suggestions or ideas are great :)