Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 analysis 

Last post Thu, Sep 26 2013 2:11 AM by Andrew Beckett. 29 replies.
Started by yeong 26 Jun 2013 08:54 PM. Topic has 29 replies and 2113 views
Page 2 of 2 (30 items) < Previous 1 2
Sort Posts:
  • Wed, Jul 3 2013 8:29 PM

    • yeong
    • Not Ranked
    • Joined on Thu, Jun 27 2013
    • Posts 15
    • Points 240
    Re: analysis using ocean Reply

    Andrew,

    I want to print my output as follows:

    corner temp iled i differential_psrr etc etc
    tt_lib    -40   1m 1u 60.34  xx xx  

    I tried to use fprintf instead of ocnPrint. Simulation completed without error, however there is no data in the output file. There is no problem using ocnPrint, just need to organise it a bit in excel.

    This is what i use:

    fprintf(out "corner\ttemp\tiled\ti\tdifferential_psrr\n")

    fprintf(out "%s\t%d\t%g\t%g\t%g\%g\n") 

    Also, I have quite a bit of expressions, how can i output the data in a more efficient manner?

    • Post Points: 20
  • Thu, Jul 4 2013 6:25 AM

    Re: analysis using ocean Reply

    yeong:

     I have to use  sprintf(myResultsDir "/xxx%s_%d%g" corner y1 y2) instead. In this case the file name matches the variable.

     Any reason why? 

     

    This is because the SKILL variables in your script are called y1 and y2. I wasn't looking at your previous code when I replied - I assumed you had SKILL variables (not design variables, which correspond to spectre parameters) called iled and temp etc.

    Regards,

    Andrew.

     

    • Post Points: 5
  • Thu, Jul 4 2013 6:27 AM

    Re: analysis using ocean Reply

    yeong:
    fprintf(out "%s\t%d\t%g\t%g\t%g\%g\n") 

    If this is what you are using, it ought to fail with an error, because there are no arguments corresponding to each % keyword in the formatting string. 

    Andrew.

    • Post Points: 20
  • Thu, Jul 4 2013 5:39 PM

    • yeong
    • Not Ranked
    • Joined on Thu, Jun 27 2013
    • Posts 15
    • Points 240
    Re: analysis using ocean Reply

    sorry, i forgot to include the arguments in the post.

    fprintf(out "%s\t%d\t%g\t%g\t%g\%g\n" corner temp y1 y2 differential_psrr ) 

    the arguments as declared in the script previously.

     

    • Post Points: 5
  • Thu, Jul 4 2013 5:57 PM

    • yeong
    • Not Ranked
    • Joined on Thu, Jun 27 2013
    • Posts 15
    • Points 240
    Re: analysis using ocean Reply

    this is the script. simulation runs fine, but no data in test.txt

    ocnWaveformTool('wavescan )
    simulator( 'spectre )
    out=outfile("test.txt" "w")
    design(     "/xxx/spectre/schematic/netlist/netlist")
    ;resultsDir( "/xxx/spectre/schematic" )
    analysis('ac ?start "1"  ?stop"1G"  ?dec "50"  )
    analysis('dc ?saveOppoint t  )
    desVar(       "cap_factor" 1  )
    desVar(       "iled" 16m      )
    desVar(       "i" 848u  )
    option(     'temp  "150.0" 
    )
    saveOption( 'subcktprobelvl "5" )
    temp( 150.0 ) 
    myCors=list("ff_lib" "tt_lib" "ss_lib")
    foreach(corner myCors
    modelFile(
    list("/xxx.scs" corner)
    )
    foreach(y1 '(150)
    temp(y1)
    foreach(y2 '(1m 10m)
    desVar("iled" y2)
    foreach(y3 '(1u 5u)
    desVar("i" y3)

    sprintf(myResultsDir "/xxx%s_%d%g" corner y1 y2) 
    run()

    differnetial_psrr = dB20((VF("/psrr") - VF("/ref")))
    plot( differnetial_psrr ?expr '( "differnetial psrr" ) )
    differential_psrr_3dB_BW = cross(dB20(VF("/psrr")) (value(dB20(VF("/psrr"))1) + 3) 1 "either" nil nil)
    ;plot( differential_psrr_3dB_BW ?expr '( "differential_psrr_3dB BW" ))
    differential_psrr_dB_DC = value(dB20((VF("/psrr") -VF("/ref"))) 1)
    ;plot( differential_psrr_dB_DC ?expr '( "differential_psrr_dB_DC" ))
    differential_psrr_dB_max = ymax(dB20((VF("/psrr") -VF("/ref"))))
    ctr = VAR("ctr")
    iled = VAR("iled")

    fprintf(out "corner\ttemp\tiled\ti\tdifferential_psrr\n")
    fprintf(out "%s\t%d\t%g\t%g\t%g\%g\n" corner temp iled y3 differential_psrr )

    ))))

     

    • Post Points: 20
  • Fri, Jul 5 2013 5:40 AM

    Re: analysis using ocean Reply

    Probably this is because you're not closing the file. In SKILL (as in many other languages), writing ASCII files is buffered (for efficiency reasons) so that it doesn't flush to disk until the buffer is full (or when the file is closed).

    So two choices:

    1. Call close(out) at the end (in fact you should do this anyway to avoid having lots of open file handles lying around)
    2. If you want the output to update more frequently (for example, so that you can see the file contents during a loop where running the simulations takes some time), you can flush the buffers by calling drain(out)

    Regards,

    Andrew.

    • Post Points: 20
  • Mon, Jul 8 2013 1:42 AM

    • yeong
    • Not Ranked
    • Joined on Thu, Jun 27 2013
    • Posts 15
    • Points 240
    Re: analysis using ocean Reply

    Thanks Andrew, it works perfectly.

     I'm also interested to list all the variable corner temp iled i differential_psrr in a list and fprint them

     variable=list(
    corner
    temp
    i
    )

    foreach(val variable
    fprintf(out "%g\t"  val)

    )

    error mgs:
    Error fprintf/sprintf: format spec. incompatible with data -40

    Corner is a string, temp is decimal, and i is a floating number, how can i lump different outout togther?

     

     

     

    • Post Points: 20
  • Mon, Jul 8 2013 3:05 AM

    Re: analysis using ocean Reply

    How about:

    foreach(val variable
      fprintf(out if(numberp(val) "%N\t" "%s\t") val)
    )

    Regards,

    Andrew.

     

     

    • Post Points: 20
  • Mon, Jul 8 2013 7:54 PM

    • yeong
    • Not Ranked
    • Joined on Thu, Jun 27 2013
    • Posts 15
    • Points 240
    Re: analysis using ocean Reply

    What is %N use for?

    foreach(val variable
      fprintf(out if(numberp(val) "%N\t" "%s\t") val)
    )

     that return: synatx error encountered in input

    i tried using:

     foreach(val variable

      fprintf(out if(numberp(val) "%g\t%s\t") val)
    )

     and that return: type template = "ptg" 

     

    • Post Points: 20
  • Tue, Jul 9 2013 1:07 AM

    Re: analysis using ocean Reply

    I'm not sure what you did incorrectly, because the first form is entirely correct and valid for as long as I can remember in SKILL. I just cut and paste it, and it worked fine. For example:

    variable='("hello" 4.2 27)
    out=stdout
    foreach(val variable
      fprintf(out if(numberp(val) "%N\t" "%s\t") val)
    )

    this worked perfectly. The "%N" (as covered in the documentation for fprintf/printf) is for displaying any kind of number (float or integer). What the code above does is either use %N or %s as the format depending on whether it's a number or not.

    Your second code won't work because it either gives a format which has two format strings, but only one argument, or it returns nil (if not a number) which will give the type template error.

    Kind Regards,

    Andrew.

    • Post Points: 20
  • Tue, Jul 9 2013 2:39 AM

    • yeong
    • Not Ranked
    • Joined on Thu, Jun 27 2013
    • Posts 15
    • Points 240
    Re: analysis using ocean Reply

    The script works fine after i tweak the variable values to be all float number. and use %g instead of %N.

    Does it have to do with the version? I'm using version 5.1.0 

    I tried the example in CIW,

    variable='("hello" 4.2 27)
    out=stdout
    foreach(val variable
      fprintf(out if(numberp(val) "%N\t" "%s\t") val)

    ) 

    Here's the output

    ("hello" 4.2 27)
    port:"*stdout*"
    hello
    *Error*  fprintf/sprintf: illegal format spec. -"%N\t"

     A bit of tweaking :

    variable='("hello" 4.2 2.7)
    out=stdout
    foreach(val variable
      fprintf(out if(numberp(val) "%g\t" "%s\t") val)

    )  

     output as below

    ("hello" 4.2 27)
    port:"*stdout*"
    hello 4.2 2.7
    ("hello" 4.2 2.7)

    y

    • Post Points: 20
  • Tue, Jul 9 2013 2:45 AM

    Re: analysis using ocean Reply

    Sorry, my mistake. It was "%n" that has been there for years, not "%N". %N uses a more compact notation. So you can either change the %N to %n, or use this code instead:

    foreach(val variable
      fprintf(out "%s\t" if(numberp(val) aelEngNotation(val) val))
    )

    Depending on which looks the nicest to you!

    Regards,

    Andrew.

    • Post Points: 35
  • Mon, Jul 15 2013 11:41 PM

    • yeong
    • Not Ranked
    • Joined on Thu, Jun 27 2013
    • Posts 15
    • Points 240
    Re: analysis using ocean Reply

    Thanks andrew.

    It works well now.

    • Post Points: 5
  • Thu, Sep 26 2013 1:11 AM

    • yeong
    • Not Ranked
    • Joined on Thu, Jun 27 2013
    • Posts 15
    • Points 240
    Re: analysis using ocean Reply

    Hello Andrew,

     When using  foreach(val variable

      fprintf(out if(numberp(val) "%n\t" "%s\t") val)

    )

     can i increase the number resolution?

    There is output but it came out as 0.0000, the value i'm expecting is 2e-9 (for example) 

     y 

    • Post Points: 20
  • Thu, Sep 26 2013 2:11 AM

    Re: analysis using ocean Reply

    The %n sequence means "use %d if an integer, or %f if a floating point number". In IC615 you can use %N which means "use %d if an integer, or %g if a floating point number". So %N would do what you want; similarly if you know the value is a flonum, you can just use %g. Or if you always want it in exponential format, you could use %e.

    Regards,

    Andrew.

    • Post Points: 5
Page 2 of 2 (30 items) < Previous 1 2
Sort Posts:
Started by yeong at 26 Jun 2013 08:54 PM. Topic has 29 replies.