The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Mar 29th, 2024, 8:20am
Pages: 1
Send Topic Print
VerilogA filewrite Vs VerilogAMS Filewrite (Read 2624 times)
subtr
Community Member
***
Offline

Analog Enthusiast

Posts: 72
India
VerilogA filewrite Vs VerilogAMS Filewrite
Apr 08th, 2017, 6:12pm
 
I believe someone would have noticed that the verilogAMS running in ams simulator writes into file as and when the simulation runs, while the verilogA which runs on spectre writes all data at once towards the end of the file. I would like to know if it's possible to make the verilogA write continuously so that even if simulation crashes, the probed data I want is writen safely. In fact for noise test intermediate check can be done only if some data is written. This can easily give us the information as to whether we need to continue the simulation or kill it.

I have a verilogA which is written as below :


   $strobe(" Cross Time = %9.9g \n", $abstime);
     Cross_point= $abstime*1e9 ;
   $fwrite(fp,"%9.9g \n",Cross_point);  


The verilogAMS code for punching out the edges into a file is :

       always @(posedge osc_in) begin
               $fwrite(file,"%f\n",$realtime);
       end

I'm finding that AMS simulator takes much more time to run than spectre and hence would like to use verilogA, while it doesn't write real time. If it's possible to do file write real time, it would be great.
Sad
Back to top
 
 

Regards
Subtr
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1998
Massachusetts, USA
Re: VerilogA filewrite Vs VerilogAMS Filewrite
Reply #1 - Apr 10th, 2017, 7:58am
 
I suspect the information is being written to the file, but not flushed until the end. You might try using fopen/fclose around the fwrite; this will be slower, but you should get your data when you want it. (I think you can fopen in append mode.)
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   IP Logged
Andrew Beckett
Senior Fellow
******
Offline

Life, don't talk to
me about Life...

Posts: 1742
Bracknell, UK
Re: VerilogA filewrite Vs VerilogAMS Filewrite
Reply #2 - Apr 10th, 2017, 10:08am
 
Or do you just need to use $fflush() to flush the output?

Andrew
Back to top
 
 
View Profile WWW   IP Logged
subtr
Community Member
***
Offline

Analog Enthusiast

Posts: 72
India
Re: VerilogA filewrite Vs VerilogAMS Filewrite
Reply #3 - Apr 11th, 2017, 10:15pm
 
Hi Andrew,

Thank you very much.

$fwrite(fptr,"TEXT");
$fflush(fptr);

Seems to work. Smiley
Back to top
 
 

Regards
Subtr
View Profile   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.