The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 17th, 2024, 2:26am
Pages: 1
Send Topic Print
use of unix variables within verilogams (Read 2880 times)
idriss
Junior Member
**
Offline



Posts: 14

use of unix variables within verilogams
Oct 09th, 2008, 6:58am
 
Hello

I would like to open a file by using a unix variable in my path within a verilogams code.

for example I can use this $fopen(home/project/list.in);
but when I use $fopen($work/list.in); there is no error in compilation and elaboration,but the file is not open.
Is anybody knows how to open file using unix variable within verilogams
thakn you very much
Idris
Back to top
 
 
View Profile   IP Logged
jbdavid
Community Fellow
*****
Offline



Posts: 378
Silicon Valley
Re: use of unix variables within verilogams
Reply #1 - Oct 9th, 2008, 6:14pm
 
This is the way I do it..
Code:
initial begin
  $system("rm work.txt; echo $work >work.txt");
  workdirfile = $fopen("work.txt", "r");
  rstat = $fscanf(workdirfile, "%s",workdirstring);
  $fclose(workdirfile);
  infilestring = {workdirstring,"/list.in"};
  myinfile = $fopen(infilestring, "r");
end  



jbd
Back to top
 
 

jbdavid
Mixed Signal Design Verification
View Profile WWW   IP Logged
idriss
Junior Member
**
Offline



Posts: 14

Re: use of unix variables within verilogams
Reply #2 - Oct 10th, 2008, 6:41am
 
Hi jbd
Thank you very much for the tip,it works perfectly,but the thing I didn't find any litterature about this system function $system even in the verilog manual,where can I find a complete list of  systeme function of verilogams do you know that.

I have an other question jbd:
you see I would like to define timescale like this

`timescale time_unit/time_accuracy
so when i will be in a always block when I have a delay I just need to do #(delay/time_unit).....
So I can do like this

`define time_accuracy 1fs
`define time_unit 1fs
`timescale `time_unit/`time_accuracy

but the problem time_unit is in fs
or delay has to be divided in f and not in fs,becasue it's a real parameter.
do you have an idea how to get ride of the s in order to use with delay .

Regards
Idris
Back to top
 
 
View Profile   IP Logged
jbdavid
Community Fellow
*****
Offline



Posts: 378
Silicon Valley
Re: use of unix variables within verilogams
Reply #3 - Oct 16th, 2008, 1:58pm
 
$system was in the original Verilog-XL product, as its documented in that manual.. but it would be clumsy to standardize it, what would work on Windows (that new OS some folks were just starting to use back then) didn't work the same way in Unix.  So I guess MOST of the vendors implement this (ie cadence) but its not in the standard
Back to top
 
 

jbdavid
Mixed Signal Design Verification
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.