How to Read a file into verilog test bench and pass it to the verilog code

Status
Not open for further replies.

gadagkar.rohit

Junior Member level 2
Joined
Apr 7, 2010
Messages
23
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Location
San Jose
Activity points
1,439
Hi,

I need to generate a signal from MATLAB and store the data into a file and then use that file as an input to verilog code.

i just need to know how to read a file in verilog. and in what format should the file be to be able to be read in verilog.

can someone please help me with that.
 

$readmemh() is very usful for such tasks.
Need to define an array, the file should hold hex values (in text, not a binary file), readmemh loads the values into the array.
google readmemh and you'll find a few examples.
 

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