The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl
Simulators >> Circuit Simulators >> VerilogA writing to text file
https://designers-guide.org/forum/YaBB.pl?num=1362179142

Message started by jjrice on Mar 1st, 2013, 3:05pm

Title: VerilogA writing to text file
Post by jjrice on Mar 1st, 2013, 3:05pm

I have a simple verilogA model that samples some nodes in my circuit and writes these out to  a text file for post processing with matlab, ie:

@(initial_step)
  fp=$fopen("/path/data.txt")
@(cross(V(clk) - Vt, +1))
  $fwrite(fp, formatstuff, datastuff)

I'd like to run monte-carlo on this circuit, and have this block write to a different file for each run so that I could analyze each in matlab, ie:

fp=$fopen( cat("/path/data", MonteCarloRunNumber, ".txt"))

Any ideas on how to accomplish this?

Title: Re: VerilogA writing to text file
Post by Geoffrey_Coram on Mar 12th, 2013, 8:36am

I don't see anything in the Verilog-AMS LRM that would let you do this -- no %-code for Monte-Carlo run.  You could check with your vendor to see if they've added any extensions.

I noticed in one simulator's documentation that there are some %-codes that you can use on the command line, including one that can be used to replace quoted strings within the netlist.  It's a little round-about, then, to open a file using the name provided by a string parameter of your verilog-a module, the parameter would get set to a (quoted string) value in the netlist, and then you replace the quoted string with the command-line argument, and you have to hope that the command-line replacement allows you to specify the Monte-Carlo run number.

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