MSAKARIM
Full Member level 3
I'm trying to write some data to an output file in VHDL but i have this error during SIMULATION step :
My code is:
" ** Failure: (vsim-4) ****** Memory allocation failure. *****
#
# Attempting to allocate 2147483664 bytes
#
# Please check your system for available memory and swap space.
# Time: 0 ps Iteration: 0 Process: /padtofile/line__30 "
My code is:
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 library IEEE; use IEEE.STD_LOGIC_1164.all; use IEEE.NUMERIC_STD.All; use IEEE.STD_LOGIC_UNSIGNED.ALL; USE IEEE.STD_LOGIC_TEXTIO.ALL; USE STD.TEXTIO.ALL; entity Padtofile is generic( block_size : integer := 1024; --bits length_bits : integer := 128 );--bits port(message: in std_logic_vector(63 downto 0)); end Padtofile; architecture Behavioral of Padtofile is signal clock,endoffile : bit := '0'; signal linenumber : integer:=1; begin clock <= not (clock) after 1 ns; process variable mod_val: integer; variable padding_length : integer; variable padded_length : integer; variable message_length: std_logic_vector((length_bits - 1) downto 0 ) := (others=>'0'); variable padded_message: std_logic_vector ((padded_length - 1) downto 0) := (others => '0'); Variable padding: std_logic_vector ((padding_length) downto 0) := (others => '0'); file outfile : text is out "Pad.txt"; --declare output file variable outline : line; --line number declaration begin --padding message mod_val:= (message'length) mod block_size; padding_length := ((block_size-129)+(block_size - mod_val)); padded_length := ( message'length + (1 + padding_length) + length_bits); message_length := std_logic_vector(to_unsigned(message'length,length_bits)); padding := "1" & std_logic_vector(to_unsigned(0,padding_length)); padded_message := message & padding & message_length; wait until clock = '0' and clock'event; if(endoffile='0') then write(outline, padded_message, right, block_size); writeline(outfile, outline); -- write line to external file. linenumber <= linenumber + 1; else null; end if; end process; end Behavioral;