• 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. RF Design
  3. Using Montecarlo simulation for finding Rise and fall tile...

Stats

  • Locked Locked
  • Replies 25
  • Subscribers 63
  • Views 25741
  • 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

Using Montecarlo simulation for finding Rise and fall tile of a SETTLING waveform

RFQuery
RFQuery over 12 years ago

 Dear All,

I want to do MONTE_CARLO simulation for my circuit for finding rise time and fall time.

The output is settling after 800u s.

I have to do some pre-processing before finding the last expression. The expressions I used as below.

But it did NOT work.

Can anybody tell how to find risetime and falltime of the waveform using MONTE-Carlo simulation if one needs some house-keeping processing of the waveform.

 .......

analysis('dc ?saveOppoint t  )
analysis('tran ?stop "1u"  ?errpreset "moderate"  ?maxstep "5p" 
        ?method "euler"  ?strobeperiod "5p"  )
desVar(      "frf" 6G    )
desVar(      "prf" -20    )
desVar(      "frf2" 6.1G    )
desVar(      "w" 20u    )
desVar(   "sigma" 3)
option(    'temp  "27.0"
    'iabstol  "1e-14"
    'vabstol  "1e-4"
)
saveOption( 'currents "selected" )
saveOption( 'save "all" )
temp( 27.0 )
monteCarlo( ?numIters "1" ?startIter "1"
    ?analysisVariation 'processAndMismatch ?sweptParam "None"
    ?sweptParamVals "27" ?saveData nil
    ?nomRun "yes" ?append nil
    ?saveProcessParams t
)
CLOCK_DUTY_PERIOD=2.5e-10
CLIP_START=0.8u
CLIP_END=0.9u

clip_I_P=clip( v("/MIXER_I_P" ?result 'tran) CLIP_START CLIP_END)
plot(clip_I_P)
MIN_VALUE=ymin(clip_I_P) + 0.02
MAX_VALUE=ymax(clip_I_P)- 0.03
UPPER_THRESOLD=MIN_VALUE + ( (MAX_VALUE-MIN_VALUE)*0.9 )
LOWER_THRESHOLD=MIN_VALUE + ( (MAX_VALUE-MIN_VALUE)*0.1 )
RISE_UPPER= cross( clip_I_P UPPER_THRESOLD 2 'rising )
RISE_LOWER= cross( clip_I_P LOWER_THRESHOLD 2 'rising )

monteExpr("RISE_TIME" "abs(RISE_UPPER-RISE_LOWER)")

monteRun()
  • Cancel
  • Andrew Beckett
    Andrew Beckett over 12 years ago

    It looks as if it is probably working OK. Look in the file mcparam in the monteCarlo directory - this should list (on each row) the name of the parameter (and some additional information) corresponding to each column in the mcdata file. You will be seeing the statistical parameters in this file too - so that's why you're getting additional values. There's a surprisingly large number of statistcal parameters, but maybe that's just what there really are in  the statistics block in the model files.

    The mcdata file should have one row per monte carlo iteration.

    The message about subckts is just one of those odd things that happens sometimes - I think that's been cured in a later version of spectre (I'm not 100% sure, but I didn't see it).

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • RFQuery
    RFQuery over 12 years ago

     Dear Andrew,

    Thanks a lot for your help.

     

    I just want to run my input.scs file using spectre command like you did. Can you please tell me how I can do that.

    In my case after montecarlo run by the ocean, I am not seeing any histogram plot being plotted automatically Can you please tell why it is so and how it can be fixed.

    Kind Regards

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 12 years ago

    I just ran spectre input.scs (you might need to give the -I argument to provide any include paths). The only reason I did it this way was because it was quicker for me to put together a simple testcase that I could share without needing any schematics.

    The histograms don't get plotted automatically in OCEAN - you'd need to do (after the monteRun()):

    monteResults()
    histogram("RISE_TIME_27")

    You can see the available names from the monteResults() output.

    ocnHelp('histogram)

    will tell you the other optional arguments for the histogram() function.

    Regards,

    Andrew.

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • RFQuery
    RFQuery over 12 years ago

     Dear Andrew,

    I did some modification to the code in .artilinit file.

    It is NOT working at all.

    Can you please have a look at it and tell whether it should work or not.

     procedure(MyRiseTime(signal CLOCK_DUTY_PERIOD CLIP_START CLIP_END)
      let((clip_I_P MIN_VALUE MAX_VALUE UPPER_THRESHOLD LOWER_THRESHOLD RISE_UPPER RISE_LOWER)
        clip_I_P=clip( signal CLIP_START CLIP_END)
        MIN_VALUE=ymin(clip_I_P) + 0.02
        MAX_VALUE=ymax(clip_I_P)- 0.03
        UPPER_THRESOLD=MIN_VALUE + ( (MAX_VALUE-MIN_VALUE)*0.9 )
        LOWER_THRESHOLD=MIN_VALUE + ( (MAX_VALUE-MIN_VALUE)*0.1 )
        RISE_UPPER= cross( clip_I_P UPPER_THRESOLD 2 'rising )
        RISE_LOWER= cross( clip_I_P LOWER_THRESHOLD 2 'rising )
        RISE_TIME=abs(RISE_UPPER-RISE_LOWER)
        ;;abs(RISE_UPPER-RISE_LOWER)
        if( (RISE_TIME >= CLOCK_DUTY_PERIOD)   then
            CLIP_START = CLIP_START + (CLOCK_DUTY_PERIOD*1.5)
            clip_I_P=clip( v("/MIXER_I_P" ?result 'tran) CLIP_START CLIP_END)
            w = newWindow()
            plot(clip_I_P)
            RISE_UPPER= cross( clip_I_P UPPER_THRESOLD 2 'rising )
            printf("%e \n", RISE_UPPER)
            RISE_LOWER= cross( clip_I_P LOWER_THRESHOLD 2 'rising )
            printf("%e \n", RISE_LOWER)
            abs(RISE_UPPER-RISE_LOWER)
        else
                abs(RISE_UPPER-RISE_LOWER)     
         )
      )
    )

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • RFQuery
    RFQuery over 12 years ago

    My Monte expression is :

     monteExpr("RISE_TIME" sprintf(nil "MyRiseTime(v(\"/MIXER_I_P\" ?result 'tran) %g %g %g)" CLOCK_DUTY_PERIOD CLIP_START CLIP_END))

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • RFQuery
    RFQuery over 12 years ago

    My monteexpression is abelow:-

    monteExpr("RISE_TIME" sprintf(nil "MyRiseTime(v(\"/MIXER_I_P\" ?result 'tran) %g %g %g)" CLOCK_DUTY_PERIOD CLIP_START CLIP_END)) 

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 12 years ago

    No, that should not work. Your function is plotting things - and that makes no sense. This function is called by the simulator during each iteration of the monte carlo as a background process - it invokes the "artil" executable to do this. artil has no ability to plot anything, and so the calls to newWindow(), plot(), etc would fail.

    Even if it did work, you'd end up with many windows being opened (if you did a reasonable number of statistical points), which I'm sure you'd find annoying...

    The functions called from monteExpr can only compute a scalar result - they cannot do anything more complex like plot anything.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • RFQuery
    RFQuery over 12 years ago

     Dear Andrew,

    I commented the plot() and printf() commands.

    And ran the ocean. But it didn't work.

    it is showing the following errors

    subckts: writing subcircuits to rawfile.
    \o
    \o
    \o Error found by spectre during Monte Carlo analysis `mc1'.
    \o
    \o     ERROR (SPECTRE-8003): subckts: Error evaluating ocean expression
    \o         `RISE_TIME=MyRiseTime(v("/MIXER_I_P" ?result 'tran)
    \o             2.5e-10 8e-07 9e-07)'.
    \o
    \o
    \o
    \o Unsuccessfully evaluated export statements (based on return code).
    \o
    \o Analysis `mc1' was terminated prematurely due to an error

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • RFQuery
    RFQuery over 12 years ago

    Dear Andrew,

    The idea of doing this if-else waveform is that:-

    As the wave is settling, one can't predict the time instant where the start of the wave is clipped at the middle of the clock period.

    Without the if-else, I sometimes found some wave getting clipped at the middle of the rising edge which gives me erroneous results.

    Kind Regards,

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 12 years ago

    Without seeing your data, it's really hard to debug (as I keep saying - customer support is the best avenue for this). The most likely scenario is that the cross() function is returning nil in some cases, and hence the subtraction is failing. Maybe if you do:

            RISE_UPPER= cross( clip_I_P UPPER_THRESOLD 2 'rising ) || 0.0
            RISE_LOWER= cross( clip_I_P LOWER_THRESHOLD 2 'rising ) || 0.0

    then it will succeed (albeit giving the wrong answers) but it might highlight where the problem is. If you save the waveform data from the monte carlo by adding ?savefamilyplots "yes" to the monteCarlo() call in your OCEAN script, then you can look at the waveforms for each point and check them after the event.

    The code change above says to either return the cross() value, or if cross returned nil, it will set RISE_UPPER or RISE_LOWER to 0.0.

    Regards,

    Andrew.

    • 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