• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC Design
  3. SpectreMDL: creating own subroutines for repetitive tas...

Stats

  • Locked Locked
  • Replies 3
  • Subscribers 126
  • Views 14326
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

SpectreMDL: creating own subroutines for repetitive tasks

vivkr
vivkr over 13 years ago

Hello everyone,

I use SpectreMDL measure expressions to get numbers out of my batch simulations. As you may guess, one often ends up making the same measurements, e.g. max, min, avg, various crossing points etc. on many signals.

Now, at present, I do this by writing out all the measure statements for a signal and then doing copy-modify-paste to finally get all measure expressions for all signals of interest. 

Surely, there is a more efficient method to do that. Is there any way to declare a set of measurement routines as part of a user-defined function or subroutine which might be called to act upon different signals. Ideally, one would be able to support wildcards so as to automatically assign signal-specific names to the measures.

E.g. if I were to define my subroutine like this

 

subroutine my_measurements {

export real meas1 = <meas1_expression>

export real meas2 = <meas2_expression>

..

export real measN = <measN_expression}

}

and call this one, say

do my_measurements { sig1, sig2, ...sigL }, 

then I'd automatically have the measurements

sig1_meas1, sig1_meas2, ...sig1_measN

sig2_meas1, sig2_meas2, ...

..., sigL_measN

Is there any chance of getting stuff done like this or is this a pipe dream? I'd even be happy if I could atleast define a subroutine and call it to do:

[sig1_meas1, sig1_meas2, ..sig1_measL] = my_subroutine(sig1), where everything is explicitly typed and the subroutine doesn't need to automatically assign the names.

Vivek

  • Cancel
  • Quek
    Quek over 13 years ago

    Hi Vivek

    Yes, it can be done using a measurement alias. Please search for "Using a measurement alias" in $MMSIMHOME/doc/mdlref/mdlref.pdf. Here is an example from the manual: Normal 0 false false false EN-US JA X-NONE

    /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;}

    alias measurement falldelay {

       input real transtop=2u    // This variable is given a default value.

       input real prop_thresh    // This variable has no default value.

       run tran(stop=transtop)   // A run statement is required.

       export real prop_delay_fall=deltax(sig1=V(inp), sig2=V(out),

       dir1=’fall, n1=1, start1=0, thresh1=prop_thresh,

       dir2=’fall, n2=2, start2=0, thresh2=prop_thresh)

    }

     run falldelay(transtop=1u, prop_thresh=2)


    Best regards
    Quek

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • vivkr
    vivkr over 13 years ago

     Quek,

    I think you misunderstood my question. The example you show above will simply run a fresh TRAN analysis and write out fixed measure outputs performed on fixed, pre-defined signals. So, if I wanted to run the same set of measurements on 100 different signals, then I would need to key in all those expressions 100 times over and over. That's what I want to avoid. I want to make a measurement module or a function, which may be called to act upon different signals.

    So, somewhere in my MDL file or within the measurement alias, I want to declare a function or subroutine which looks like this

    EXAMPLE:

    [max_signal, min_signal, average_signal, ....] = my_measure_function(input_signal)

    {

    max_signal = definition of max_signal

    min_signal = definition of min_signal

    ...

    }

    Inside my measure alias, I'd now do:

    alias measurement {

    [max1, min1, average1, ...] = my_measure_function(sig1)

    [max2, min2, average2, ...] = my_measure_function(sig2)

     ...

    }

    Can you see that such a modular  approach would not only save a lot of typing (and associated errors/omissions), it would also be very easy to use especially when dozens of signals are being evaluated.

    I cannot believe that it would not be possible, just how?

    Best regards,

    Vivek

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Quek
    Quek over 13 years ago

    1024x768

    Normal 0 false false false EN-US JA X-NONE /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;}

    Hi Vivek

    I think it is really not possible to do it. Each alias measurement section must have a "run" cmd. If foreach loops are supported inside the measurement section, then we can do something like this:

     alias measurement test {
       input net sig1
       input net sig2
       ...
       input net sig9
       run tran(stop=1u)
       foreach net from {sig1,sig2,sig3,...,sig9} {
          export real myOut=max(V(net))
       }
    }

    run test(sig1=net1,sig2=net2,sig3=net3,...,sig9=net9)

    But unfortunately currently foreach loops are not supported inside measurement section. This feature is being implemented through CCR969523. You can file a service request with your local Cadence support and request for a duplicated CCR to be created.

    I think using ocean would be much more simpler:

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; measurements.il ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    procedure( CCSmeasure(runDir @rest myNets)
       let( (wave)
          openResults(runDir)
          selectResults('tran)
          outPort=outfile("./myMeasurements")
          foreach( net myNets
             printf("Processing net: %s\n" net)
             wave=getData(net)
             fprintf(outPort "Max value of net %L: %g\n" net ymax(wave))
         ) ;foreach
         close(outPort)
         printf("Job completed\n")
       ) ;let
    ) ;procedure

    CCSmeasure("/your-path/psf" list("net1" "net2" "net3"))
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    terminal>ocean < measurements.il

     

    Best regards
    Quek

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information