Forum Discussion
Altera_Forum
Honored Contributor
16 years agoTestbench: Read from Text File
I have a set of test patterns in text file to be used in test bench written in verilog. test pattern will be sent to top module one by one for every posedge of clock once the ena is high.
Is there related function or syntax to implement the above task? Pls give some simple example. thanks2 Replies
- Altera_Forum
Honored Contributor
Thanks. It helps
- Altera_Forum
Honored Contributor
Depends on your testpattern format. The easiest is to use $readmemh/b and read it into a Verilog memory. More fancier approach would be to use $fopen, $fscanf/$fgets etc.
A quick google search for $readmem would give you some syntax to start with. We cover this in good detail during our comprehensive functional verification course. Regards Srini cvcblr.com/blog