Altera_Forum
Honored Contributor
13 years agoerror when reading datas from a file
Hi everybody,
I'm actually trying to make a pixel generator from a text file and i have an error in modelsim : (vsim-3543) TEXTIO procedure READ(INTEGER) : Parameter L designates an empty string. my file seems like that : 3 1024 760 41 107 214 235 44 169 3 33 187 239 58 61 57 42 142 77 89 114 221 104 41 107 214 235 44 169 3 33 187 239 58 61 57 42 142 77 89 114 221 104 and my code is here: FILE myfile : TEXT OPEN READ_MODE IS "fluxvid.txt"; BEGIN PROCESS VARIABLE fNumber : INTEGER range 1 to 3; VARIABLE pnumber : INTEGER range 0 to 1024; VARIABLE lnumber : INTEGER range 0 to 768; variable buf : integer range 0 to 255; variable buf_temp : unsigned(11 downto 0); VARIABLE l: LINE; BEGIN READLINE(myfile,l); -- ... read a line ... READ(l, fNumber); -- ... read the 1st element ... READ(l, ipxl); -- ... and then the 2nd element READ(l, jpxl); -- ... and then the 3nd element IF (start_gen = '1') THEN -- frame loop FOR k IN 1 TO fNumber LOOP fVal <= '1'; data_com <= (others => '0'); WAIT FOR 100 ns; -- line loop FOR i IN 1 TO lnumber LOOP lVal <= '1'; -- pixel loop FOR j IN 1 TO pnumber LOOP READ(l, buf); buf_temp := TO_UNSIGNED(buf, 12); data_com <= STD_LOGIC_VECTOR(buf_temp); WAIT FOR 10 ns; END LOOP; lVal <= '0'; END LOOP; fVal <= '0'; WAIT FOR 100 ns; END LOOP; END IF; END PROCESS; Moreover, the data in the variable fNumber 41 instead of 3. I don't know where is my fault, i search on the web and didn't find the mistake. Thx you for your answers !