How to read a text file in verilog


I Cant read a text file where i have an array of 256*256 hex values..... the error am getting is # ** Warning: (vsim-7) Failed to open readmem file " D:Documents and SettingsSudhirDesktopmatlab.txt" in read mode. # Invalid argument. (errno = EINVAL) : E:/Modeltech_xe/examples/testbench_liftsample.v(31) pls help me in this regard

Asked By: sudhirkv
On: Mar 23, 2006 2:29:45 PM

Comments(5)



http://www.knowledgetreasure.com/karthiazhagu/weblog/362.html THis link provides verilog code to read data from text file. It provides two ways of reading the data from text file.
hi............. i dont known how to how to write the code for 512*512 grayscale image in verilog. if anybody knows please help me.......
instead of providing full path for your file that you are reading, paste that file in the same directory as that of your verilog code file. If you are using Modelsim place it in the 'work' directory and then give only the name of the file that you are reading
thanks for ur reply... and upto my knowlewdege the syntax is correct i guess.. and i have given the path of that file properly with proper backslash also.... i will paste the code here and pls let me know where a went wrong module teseting_simpleand; reg a,b; wire c; reg [1:0]matrix[0:3]; //integer n; simple_nand sn(a,b,c); initial begin $dumpfile("sudhir.vcd"); $dumpvars; end initial begin $display("newnand gate has been invoked"); $readmemb("D:\Documents and Settings\Sudhir\Desktop\sample.txt",matrix); end endmodule and in the text file i have given o o ie zero with tab.. and am getting the error message as no such file or directory.. cud you pls help me
1st check out the syntax 2nd check whether that file is present in the same directory or not if not u specify the path. 3rd check the size of memory u have defined in the program whether it suits to file or not..
You have to be logged in to be able to post a comment. To login Click Here. First time? Signup It just takes a few minutes to sign up.
Members with Most Replies
Find Job Openings