The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
May 5th, 2024, 11:12am
Pages: 1
Send Topic Print
How to do line-manuplating after read in data file (Read 3183 times)
yaxazaa
New Member
*
Offline



Posts: 6

How to do line-manuplating after read in data file
Apr 15th, 2006, 12:09pm
 
My question is how I do line by line manuplation in Verilog-A after I read in a data file contains two columns. For example: data file name is data.dat contains:
1 10
2 20
3 30

etc;

in Verilog-A:

integrer infile;
real x[0:100], y[0:100]
real z[0:100];

......

infile = $fopen("$path/data.dat");

Then What I am going to do is to assign column one as x, column two as y, and z = pow(y,x/20). HOw should I do it? Can someone help?

Thanks.
Back to top
 
 
View Profile   IP Logged
jbdavid
Community Fellow
*****
Offline



Posts: 378
Silicon Valley
Re: How to do line-manuplating after read in data
Reply #1 - Apr 15th, 2006, 3:50pm
 
for details look at $fread $fscanf functions.. you may want to refer to Verilog-2004 manual (or Verilog-AMS 2.2 )
manual for all the details on reading files..
Jonathan
Back to top
 
 

jbdavid
Mixed Signal Design Verification
View Profile WWW   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1998
Massachusetts, USA
Re: How to do line-manuplating after read in data
Reply #2 - Apr 25th, 2006, 5:37am
 
It looks like the data file might be formatted in a way that $table_model would work.  This was added in LRM 2.2, but was already available in some simulators.  Check your simulator documentation.
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   IP Logged
Pages: 1
Send Topic Print
Copyright 2002-2024 Designer’s Guide Consulting, Inc. Designer’s Guide® is a registered trademark of Designer’s Guide Consulting, Inc. All rights reserved. Send comments or questions to editor@designers-guide.org. Consider submitting a paper or model.