08-12-2015 04:58 AM
I'm currently developing a small test bench where a bitmap file is read (using std.textio.all). I have managed to read the bmp file and I can write all characters to a new bmp file except 0 (nul character). By opening the input bmp file in notepad++ I can see the nul characters and by using the attribute image on the read variable in the test bench I can see that the nul character has been read properly. The nul characters can, however, not be found in the new bmp file I write to. Here is my simple test bench:
test_proc: process (clk) variable line_read : line; variable line_write : line; variable char_buf : character; file input_file : text OPEN read_mode IS "input_image.bmp"; -- Image to read from file output_file : text OPEN write_mode IS "output_image.bmp"; -- Image to write to begin if rising_edge(clk) then readline(input_file, line_read); -- Bitmap only consists of one line. while line_read'length > 0 loop read(line_read, char_buf); write(line_write, char_buf); end loop; writeline(output_file, line_write); assert false report "NONE! Simulation Finished" severity failure; end if; end process;
Is it possible to write the nul character to a file using VHDL?
08-14-2015 02:30 PM
wrote a bunch of function handling the type 'character', maybe you could try something like:
08-15-2015 10:07 PM
05-25-2017 12:55 PM
I'm having the exact same problem and it seems like it might be a problem with iSim. I'm running iSim 14.7 and whenever I try to write character'val(0) to a file, it's writing binary 00001010 to the file instead of binary 00000000. Everything else appears to work.
Is there a work around for this or just a bug in iSim? I'm trying to write binary files instead of ascii versions of binary files because it's a very inefficient way to write data to a file.