Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How can I read a file into verilog?

file read verilog
0
Posted

How can I read a file into verilog?

0

The system task $readmemb (and also $readmemh) will read in a file. It takes 2 arguments, the file name and the memory structure name. It reads the file into the memory structure. Words are white space separated (space, tab, return, etc). The difference between $readmemb and $readmemh is that, memb reads in binary, and memh reads in hex. Here’s a sample code fragment: reg [13:0] Prog[4095:0]; // program to execute initial begin // Here, it would be a good idea to initialize the Prog array with // all zeros or something, just incase the read in file is // shorter than the array.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123