Altera_Forum
Honored Contributor
13 years ago"HREAD" is used but not declared"-Read text image data Error
Hi,
I try simulate testbench code for read text image data (project example). I have includes all the package required (textio), but when I compile it I get this error: "Error (10482): VHDL error at INPIMAGE.VHD(150): object "HREAD" is used but not declared". Why this error occur? :confused: I just follow the same code as example. Need helps from anyone expert with textio library. Below is the pieces of the code. library WORK; use WORK.MDCT_PKG.all; use WORK.MDCTTB_PKG.all; use WORK.RNG.all; entity INPIMAGE is port ( clk : in STD_LOGIC; odv1 : in STD_LOGIC; dcto1 : in STD_LOGIC_VECTOR(OP_W-1 downto 0); odv : in STD_LOGIC; dcto : in STD_LOGIC_VECTOR(COE_W-1 downto 0); rst : out STD_LOGIC; imageo : out STD_LOGIC_VECTOR(IP_W-1 downto 0); dv : out STD_LOGIC; testend : out BOOLEAN ); end INPIMAGE; architecture SIM of INPIMAGE is constant PERIOD : TIME := 1 us /(CLK_FREQ_C); signal rst_s : STD_LOGIC; signal test_inp : INTEGER; signal test_stim : INTEGER; signal test_out : INTEGER; signal xcon_s : INTEGER; signal ycon_s : INTEGER; signal error_dct_matrix_s : I_MATRIX_TYPE; signal error_dcto1_matrix_s : I_MATRIX_TYPE; signal imageo_s : STD_LOGIC_VECTOR(IP_W-1 downto 0); signal dv_s : STD_LOGIC; begin rst <= rst_s after HOLD_TIME; imageo <= imageo_s after HOLD_TIME; dv <= dv_s after HOLD_TIME; -------------------------- -- input image stimuli -------------------------- INPIMAGE_PROC: process variable i : INTEGER := 0; variable j : INTEGER := 0; variable INSERT_DELAYS : BOOLEAN := FALSE; variable unf: Uniform := InitUniform(7, 0.0, 2.0); variable rnd: real := 0.0; variable xi : INTEGER := 0; ------------------------------------- -- wait for defined number of clock cycles ------------------------------------- procedure waitposedge(clocks : in INTEGER) is begin for i in 1 to clocks loop wait until clk='1' and clk'event; end loop; end waitposedge; ------------------------------------- -- wait on clock rising edge ------------------------------------- procedure waitposedge is begin wait until clk='1' and clk'event; end waitposedge; -------------------------------------- -- read text image data -------------------------------------- procedure read_image is file infile : TEXT open read_mode is FILEIN_NAME_C; variable inline : LINE; variable tmp_int : INTEGER := 0; variable y_size : INTEGER := 0; variable x_size : INTEGER := 0; variable x_blocks8 : INTEGER := 0; variable y_blocks8 : INTEGER := 0; variable matrix : I_MATRIX_TYPE; variable x_blk_cnt : INTEGER := 0; variable y_blk_cnt : INTEGER := 0; variable n_lines_arr : N_LINES_TYPE; variable line_n : INTEGER := 0; variable pix_n : INTEGER := 0; variable x_n : INTEGER := 0; variable y_n : INTEGER := 0; begin READLINE(infile,inline); READ(inline,y_size); READLINE(infile,inline); READ(inline,x_size); y_blocks8 := y_size / N; x_blocks8 := x_size / N; assert MAX_IMAGE_SIZE_X > x_size report "E02: Input image x size exceeds maximum value!" severity Failure; if y_size rem N > 0 then assert false report "E03: Image height dimension is not multiply of N!" severity Failure; end if; if x_size rem N > 0 then assert false report "E03: Image width dimension is not multiply of N!" severity Failure; end if; for y_blk_cnt in 0 to y_blocks8-1 loop -- read N input lines and store them to buffer for y_n in 0 to N-1 loop READLINE(infile,inline); HREAD(inline,n_lines_arr(y_n)(0 to x_size*IP_W-1)); end loop; y_n := 0; Any helps greatly appreciated. Thank you