Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
21611 Discussions

Testbench: Read from Text File

Altera_Forum
Honored Contributor II
1,825 Views

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. thanks
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
729 Views

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
0 Kudos
Altera_Forum
Honored Contributor II
729 Views

Thanks. It helps

0 Kudos
Reply