Hi to all,
I am trying to read a text file has some values in character type as
follow:
26
30
34
30
20
8
11
11
12
12
but what I am getting wrong values as follow:
50
49
10
51
48
10
51
based in the following code:
library ieee;
USE ieee.std_logic_1164.all;
USE ieee.numeric_bit.ALL;
USE std.textio.all;
Entity feeder Is
port ( start: in std_logic;
pixel_value: out bit_vector(7 downto 0)
);
END feeder;
Architecture Behavior OF feeder Is
TYPE frame_txt IS FILE OF character;
TYPE frame_array IS ARRAY (natural RANGE <>) OF bit_vector(7 DOWNTO 0);
SIGNAL read_frame_array : frame_array(0 to 25343);
begin
read_file: PROCESS (start) IS
FILE file_in : frame_txt OPEN read_mode IS "
/afs/cad/u/s/m/smb34/vlsi2/frame1.txt"; -- open the frame file for
reading
VARIABLE char_buffer : character;
BEGIN
IF start'EVENT AND start = '1' THEN
FOR i IN read_frame_array'RANGE LOOP
read(file_in, char_buffer);
read_frame_array(i) <=
bit_vector(to_unsigned(character'POS(char_buffer), 8));
pixel_value <= read_frame_array(i);
--frame_array_byte(i) <=
CONV_STD_LOGIC_VECTOR(character'pos(char_buffer), 8);
END LOOP; -- i
file_close(file_in);
END IF;
END PROCESS read_file;
End Behavior;
please, let me know what i have done wrong, so i can read the right
values out of the file?!