How do I read binary file data in a test bench?

P

Pete Fraser

Say I have a binary file containing compressed video.
I want to present the dut in my test bench with a byte
from the file at the dut's standard_logic_vector input,
every clock period.

What's the cleanest way to do this?
Can I use a binary file, or do I need to convert it to:

"xxxxxxxx"
"xxxxxxxx"
"xxxxxxxx"

with one 8-bit slv per line.

Is this simulator specific (I'll be using Modelim PE).

Thanks
 
M

Mike Treseler

Pete said:
That worked nicely, but I can't work out how to
convert from character to std_logic_vector.

function char2std(arg:character)
return std_logic_vector is begin
return std_logic_vector(to_unsigned(character'pos(arg),8));
end char2std;

-- Mike Treseler
 

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

No members online now.

Forum statistics

Threads
474,164
Messages
2,570,898
Members
47,439
Latest member
shasuze

Latest Threads

Top