Forum Discussion
Altera_Forum
Honored Contributor
15 years agoI have tried to create a separate entity for this function, however I get many errors when doing this. Mainly to do with
For simplicity purposes say I was trying to read a file which had one input Q and then went through an inverter and wrote to a file the output Y. Would this work? constant tx_data_sz : integer := 4096; type type1 is array (0 to tx_data_sz-1) of signed(5 downto 0); procedure read_rx_data(signal I: out type1) is file file1 : text open read_mode is "; variable line1 : line; variable input_tmp : integer := 0; variable j : integer := 0; begin while(not endfile(file1)) loop readline(file1,line1); I(j) <= to_signed(input_tmp,10); j := j + 1; end loop; assert false report "finished reading I data" severity note; file_close(file1); end procedure; Y <= NOT I; procedure write_tx_data(signal Y: in type1) is file file1 : text open write_mode is "output.txt"; variable line1 : line; begin for j in 0 to tx_data_sz-1 loop write(line1,to_integer(Y(j))); writeline(file1,line1); end loop; assert false report "finished writing shaped I/Y data" severity note; file_close(file1); end procedure; Thanks for your help!