processing .bmp file using verilog testbench

Status
Not open for further replies.

pforpashya

Member level 2
Joined
Jan 12, 2010
Messages
42
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
जगा व जगू द्या
Activity points
1,609
can some body give me idea how to read .bmp file using a verilog testbench & a 32 bit register & again we have to dump this image after reading from testbench..

thank you......
 

maybe convert the bmp from a binary to an hexadecimal represented ascii file, and then read it into verilog with $readmemh. Use google to find a utility.

The ASCII file may require massaging via a Perl script to get it into a format that verilog can parse.
 

Hi pforpashya,

You can do it like this:

Code:
module test;

  integer fileId, i;
  reg [7:0]  aaa [0:1000];

  initial begin
    // Read
    fileId = $fopen("mypicIn.bmp", "rb");
    $fread(aaa, fileId);
    for(i = 0; i < 1000; i = i + 1)
      $display("%h",aaa[i]);
    $fclose(fileId);

  end

endmodule

But this is verilog 2k feature. So don't forget to enable v2k.

Best Regards,
Tiksan
http://syswip.com/
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…