Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to read one line at a time from a file in Verilog?

Status
Not open for further replies.

bharat_in

Member level 4
Joined
Oct 5, 2006
Messages
78
Helped
9
Reputation
18
Reaction score
7
Trophy points
1,288
Activity points
1,716
Does anyone know how to read one line at a time fron a file, in verilog?
readmemh reads the whole file, but i just want to read one line at a time.
Any idea?
 

Re: verilog file read

You can now do 'C' type file reading in verilog.
Example:

integer r, file, start, count;
r = $fread(myfile, mem[0], start, count);

Hope it helps,
kr,
Avi
http://www.vlsiip.com
 

Re: verilog file read

$fgets(line,fd);
will read line by line from the file descriptor "fd", and stores in the reg vector "line".
one thing is that, you should be careful in declaring the width of the reg_vector "line".
such, that the width should be more enough to store the line....

i think, this will help you....
 

verilog file read

Recently i was reading verilog LRM for this, and i came to know about
"fscanf".

Usign it I can read one line at a time, that too in my convinient format(i.e. hex)....

Anyway, thanks a lot for your replies...
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top