Forum Discussion
Altera_Forum
Honored Contributor
11 years agoWriting nul character to file
Hi!
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?11 Replies
- Altera_Forum
Honored Contributor
--- Quote Start --- irfanview (http://www.irfanview.com/) supports PPM, both for reading and writing. In supports batch conversions and can be used from the command line so (in theory) it could be integrated in an automatic testbench script. --- Quote End --- This is great, until someone else checks out the project after you've left the company and you didnt leave any information about how to view files. Bitmaps are just natively supported everywhere.