I am trying to read a text file in Matlab and convert it into bits. I then want to access and store them in a register in my module in Verilog. I then use these bits inside the module. Can I do this? If yes, how?
There are a couple of ways to read a text file into Verilog and strore numeric values into a variable. The easiest way is to use the $readmemb
system task and store the values into a reg
array.
Another way which is a little more work, but is also more flexible, is to use the $fopen
system task. Refer to the IEEE Verilog Std (1800-2009, for example).