The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl
Simulators >> AMS Simulators >> VerilogA filewrite Vs VerilogAMS Filewrite
https://designers-guide.org/forum/YaBB.pl?num=1491700375

Message started by subtr on Apr 8th, 2017, 6:12pm

Title: VerilogA filewrite Vs VerilogAMS Filewrite
Post by subtr on Apr 8th, 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.
:(

Title: Re: VerilogA filewrite Vs VerilogAMS Filewrite
Post by Geoffrey_Coram on 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.)

Title: Re: VerilogA filewrite Vs VerilogAMS Filewrite
Post by Andrew Beckett on Apr 10th, 2017, 10:08am

Or do you just need to use $fflush() to flush the output?

Andrew

Title: Re: VerilogA filewrite Vs VerilogAMS Filewrite
Post by subtr on Apr 11th, 2017, 10:15pm

Hi Andrew,

Thank you very much.

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

Seems to work. :)

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