The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl
Design Languages >> Verilog-AMS >> use of unix variables within verilogams
https://designers-guide.org/forum/YaBB.pl?num=1223560691

Message started by idriss on Oct 9th, 2008, 6:58am

Title: use of unix variables within verilogams
Post by idriss on Oct 9th, 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

Title: Re: use of unix variables within verilogams
Post by jbdavid on 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

Title: Re: use of unix variables within verilogams
Post by idriss on 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

Title: Re: use of unix variables within verilogams
Post by jbdavid on 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

The Designer's Guide Community Forum » Powered by YaBB 2.2.2!
YaBB © 2000-2008. All Rights Reserved.