Re: VHDL testbench: read BMP Files?

A

Allan Herriman

Jonathan said:
In most simulators, and using VHDL-93, you can declare a FILE OF CHARACTER
which will allow you to read standard Unix or Windows byte-stream files.
READ(F, C); will read the next character into C; CHARACTER'POS(C) will
then return its byte value.

Note that this is not guaranteed to be portable across simulators,
but it works OK in my experience.

If using a simulator that supports Tcl/Tk, it might be possible to use
the Tcl/Tk Img package that can read an image file (.bmp, .gif, .jpg,
whatever) into a pixmap image type. This can then be fed pixel by pixel
into the testbench.
I think this may be easier than trying to decode (or generate) the
various file formats in VHDL.

http://aspn.activestate.com/ASPN/docs/ActiveTcl/ActiveTcl8.4.1.0-html/img/index.htm

Regards,
Allan.
 
A

Allan Herriman

Allan said:
If using a simulator that supports Tcl/Tk, it might be possible to use
the Tcl/Tk Img package that can read an image file (.bmp, .gif, .jpg,
whatever) into a pixmap image type. This can then be fed pixel by pixel
into the testbench.
I think this may be easier than trying to decode (or generate) the
various file formats in VHDL.

http://aspn.activestate.com/ASPN/docs/ActiveTcl/ActiveTcl8.4.1.0-html/img/index.htm

Better still, you can use Tk to display the "Before" and "After" images
directly from your simulator.

Allan.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top