J
Jim Wu
Guest
The attached code is kind of kludge, but it works, with modelsim 5.8eHi,
Well, let me know if you figure this one out. I had
a similar issue -- I wanted a Verilog simulation to
write out a TIFF file. I couldn't find a way to write
out a binary file, so wrote out ASCII data values to
text file and then post-processed it into a binary
TIFF file using a small program I wrote in C.
anyway.
HTH,
Jim
jimwu88NOOOSPAM@yahoo.com (remove capital letters)
http://www.geocities.com/jimwu88/chips
module wr_bin ();
reg [7:0] data;
integer fd;
integer i;
initial begin
fd = $fopen("test.bin", "wb");
for (i = 0; i < 256; i = i + 1) begin
data = i;
if (data == 0) begin
$fwriteb(fd, "%u", data);
$fseek(fd, 1, 0);
end
else
$fwriteb(fd, "%c", data);
end
$fclose(fd);
$display("Done");
$finish;
end
endmodule