H
Harrkev
Guest
Hi. I am working on verilog whose purpose is to handle graphical
data. I am trying to have my verilog testbench read data from the
RAM, and actually generate a .BMP file.
Here is the problem. I can output hex values like this:
reg [7:0] data;
$fwrite(file,"%s",data);
This woks fine --- unless the data is happens to be 8'h00 (which
happens a LOT in the header of a .bmp file), and then the data that
gets written to disk is 8'h20 (ascii space).
I even tried this:
if (data == 8'h0) $fwrite(file,"\000");
else $fwrite(file,"%s",data);
And the zeroed data does not even get written. I am using NC-Verilog
06.20-s004.
My backup plan is to dump the data in ascii hex, and have perl do all
of the heavy lifting. Not elegant, but fuctional. I would rather not
have to do this. Any ideas on how I can get Verilog to do what I
want?
Thanks.
data. I am trying to have my verilog testbench read data from the
RAM, and actually generate a .BMP file.
Here is the problem. I can output hex values like this:
reg [7:0] data;
$fwrite(file,"%s",data);
This woks fine --- unless the data is happens to be 8'h00 (which
happens a LOT in the header of a .bmp file), and then the data that
gets written to disk is 8'h20 (ascii space).
I even tried this:
if (data == 8'h0) $fwrite(file,"\000");
else $fwrite(file,"%s",data);
And the zeroed data does not even get written. I am using NC-Verilog
06.20-s004.
My backup plan is to dump the data in ascii hex, and have perl do all
of the heavy lifting. Not elegant, but fuctional. I would rather not
have to do this. Any ideas on how I can get Verilog to do what I
want?
Thanks.