Home > Community > Forums > Custom IC Design > Ocean Script error--branch distance too far from generated code

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: *

 Ocean Script error--branch distance too far from generated code 

Last post Thu, Oct 1 2009 2:54 PM by lunren. 8 replies.
Started by lunren 01 Oct 2009 12:09 PM. Topic has 8 replies and 4621 views
Page 1 of 1 (9 items)
Sort Posts:
  • Thu, Oct 1 2009 12:09 PM

    • lunren
    • Top 500 Contributor
    • Joined on Thu, Oct 1 2009
    • Posts 21
    • Points 315
    Ocean Script error--branch distance too far from generated code Reply

    I met a very wired question these days related to a error: branch distance too far from generated code.  Attached please find my ocean script. I will try to discribe the problem in detail, hope some super guys such as Andrew Beckett and skillUser see it and give me some hints.

    In the attached script, it does not work because of the error: branch distance too far from generated code. If I deleted (not just commented them out):

         selectResults('noise)
         rmsNoise=rmsNoise( 1 10G )
         plot( sqrt(iinteg(VN2())) ?expr list("Noise_integ") )

    The script works.

    If I uncommented lines:

         LoopGaindB20 = db(mag(getData("loopGain" ?result "stb")))
         plot( LoopGaindB20 ?expr '( "Loop Gain dB20" ) )

    It does not work, the same error reported.

    If I only commented line: plot( LoopGaindB20 ?expr '( "Loop Gain dB20" ) )

    It works.

    If I commented lines: LoopGainPhase = phaseDegUnwrapped(getData("loopGain" ?result "stb"))
                                   plot(LoopGainPhase)

    and uncommented lines: LoopGaindB20 = db(mag(getData("loopGain" ?result "stb")))
                                        plot( LoopGaindB20 ?expr '( "Loop Gain dB20" ) )
    it works. However, based on this, if I added lines:

         selectResults('noise)
         rmsNoise=rmsNoise( 1 10G )
         plot( sqrt(iinteg(VN2())) ?expr list("Noise_integ") )

    it does not work and the same error reported.

    ocnWaveformTool( 'wavescan )
    simulator( 'spectre )
    design(  "/home/dexue/simulation/sim_ldo_D/spectre/schematic/netlist/netlist")

    I should mention that the whole script works once when everything is uncommented or deleted.

    By the way, how to measure the DC gain when I use stb to simulate the feedback loop? It seems Gain_DC = value (db(mag(getData("loopGain" ?result "stb"))) 1)  does not work. Thanks in advance.

     

    ; load("/home/dexue/managed/MandalayBay/Entheto/ocean/30mA_ldo_typeD_cn.ocn")
    corner = list( "tt_high" )
    ;corner = list( "ss_high" "ff_high" "sf_high" "fs_high" )
    ;corner = list( "tt_high" "ss_high" "ff_high" "sf_high" "fs_high" "tt_low" "ss_low" "ff_low" "sf_low" "fs_low")
    vsup = list( 3.6 )
    ;vsup = list(3.42 3.78 )
    bip = list( "tt_bjt" )
    ;bip = list( "ff_bjt" "ss_bjt" )
    res = list( "res3t_typ" )
    ;res = list( "res3t_low" "res3t_high" )
    temp = list( 37.0 )
    ;temp = list( 5.0 60.0)
    ilo=list( 16m )
    ;ilo=list( 5m 30m)
    clo=list( 100p )
    ;clo=list( 10p 200p )

    foreach( cn corner
      foreach( vd vsup
        foreach( bp bip
          foreach( tp temp
            foreach( re res
              foreach( il ilo
                foreach( cl clo
        
         a = resultsDir( sprintf( nil "/home/dexue/simulation/entheto/30mA_ldo_typeD/spectre/30mA_ldo_typeD_cn/%s+%g+%s+%g+%s+%g+%g" cn vd bp tp re il cl ) )
         b = list( "/home/dexue/managed/pdk/tower18_2008_12/model/tsl018_bjt.scs" sprintf( nil "%s" bp ))
         c = list( "/home/dexue/managed/pdk/tower18_2008_12/model/tsl018_res.scs" sprintf( nil "%s" re ))
         d = list( "/home/dexue/managed/pdk/tower18_2008_12/model/tls018_corner.scs" sprintf( nil "%s" cn ))
         printf( "%L\n" a )
         modelFile( b c d )
         ic("/I1/vstart2" 3.3 "/I1/crbiasp" 3.3 "/I1/bias2" 0 "/I1/bias1" 0 "/I1/vbiasn" 0 "/I1/vcascn" 0 "/I1/VRcascp" 3.3 "/I1/VRbiasp" 3.3 "/I1/vstart" 3.3 )
         analysis('ac ?start "1"  ?stop "10G" )
    ;     analysis('dc ?saveOppoint t )
         analysis('dc ?saveOppoint t ?param "temp"  ?start "5"
                    ?stop "60"  ?lin "100"  )
         analysis('noise ?start "1"  ?stop "10G"  ?p "/v3p2"
                    ?n ""  ?oprobe ""  ?iprobe ""  )
         analysis('stb ?start "1"  ?stop "10G"  ?probe "I0.IPRB0" )
         analysis('tran ?stop "55u" ?errpreset "conservative"  )   

         saveOption( 'currents "all" )
         saveOption( 'nestlvl "3" )
         saveOption( 'pwr "devices" )
         saveOption( 'save "allpub" )
                  
         save( 'v "/v3p2" "/Power_in" )
         save( 'i "/R17/MINUS" )
         desVar( "Vtr" vd )   
         desVar( "power_in" vd )
         desVar( "iload" il )
         desVar( "cload" cl )
         desVar( "ilow" 5m )
         desVar( "ihigh" 30m )
         desVar( "culow" 5m )
         desVar( "cuhigh" 30m )

         option( 'dochecklimit "no" 'scale "1.0e-6" 'temp tp 'iabstol  "1e-12" 'vabstol  "1e-6" 'reltol  "1e-3")
    ;     option( 'dochecklimit "no" 'scale "1.0e-6" 'temp tp 'iabstol  "1e-16" 'vabstol  "1e-9" 'reltol  "1e-6")
         temp( tp )
         run()
        
         p = outfile( "/home/dexue/simulation/entheto/30mA_ldo_typeD/30mA_ldo_typeD_results" "a")
         DATA = sprintf( nil "%s %g %s %g %s $g %g" cn vd bp tp re il cl )
        
         selectResults('dc)
         v3p2 = VDC("/v3p2")
         plot( v("/v3p2") )

         selectResults('ac)
         plot( dB20(VF("/v3p2")) ?expr list("PSRR") )
         PSRR_1k = value(dB20(VF("/v3p2")) 1K)
         PSRR_DC = value(dB20(VF("/v3p2")) 1)

         selectResults('stb)
         LoopGainPhase = phaseDegUnwrapped(getData("loopGain" ?result "stb"))
         plot(LoopGainPhase)
    ;     LoopGaindB20 = db(mag(getData("loopGain" ?result "stb")))
    ;     plot( LoopGaindB20 ?expr '( "Loop Gain dB20" ) )
    ;     Gain_DC = value (db(mag(getData("loopGain" ?result "stb"))) 1) 
          PM = getData("phaseMargin" ?result "stb_margin")
          GM = getData("gainMargin" ?result "stb_margin") 
          UGBW = getData("phaseMarginFreq" ?result "stb_margin")

         selectResults('tran)
         plot( v("/Power_in") ?expr list("VAA_in") )
         plot( i("/R17/MINUS") )
         plot( v("/v3p2") )

         selectResults('noise)
         rmsNoise=rmsNoise( 1 10G )
         plot( sqrt(iinteg(VN2())) ?expr list("Noise_integ") )

    ;     fprintf(p "%g %g %g %g %g %g %g\n" rmsNoise PSRR_1k PSRR_DC Gain_DC PM GM UGBW )
         fprintf(p "%g %g %g %g %g %g\n" rmsNoise PSRR_1k PSRR_DC PM GM UGBW )
         close(p)


            )
           )
          )
         )
        )
       )
      )

    • Post Points: 35
  • Thu, Oct 1 2009 12:36 PM

    • skillUser
    • Top 10 Contributor
    • Joined on Fri, Sep 19 2008
    • Austin, TX
    • Posts 2,567
    • Points 15,575
    Re: Ocean Script error--branch distance too far from generated code Reply

    Which subversion are you using?

    Thank you for the praise by the way!

    Lawrence.

    • Post Points: 5
  • Thu, Oct 1 2009 1:00 PM

    Re: Ocean Script error--branch distance too far from generated code Reply

    What subversion are you using? My guess is that this could well be the problem described in this Sourcelink Solution. The symptoms are a little different, but I can imagine the root cause could be similar - essentially prior to this fix, plot was a macro which generated a rather large piece of code, which in some cases caused a code too large error, but it may well produce a similar problem to this. After the fix, plot is still a macro, but the code is much more compact. The fix was in 5.10.41.500.5.124.

    I just found another service request which was getting the same error as you were - and R&D at the time said it was due to the same problem - the plot() macro producing a large code segment. Later on I encouraged the R&D group responsible for OCEAN to make plot() more compact, which resulted in the problem being fixed.

    A workaround would be to use awvPlotWaveform instead of plot. The arguments are a little different - you'd have to replace all the plot() calls with calls similar to:

      awvPlotWaveform(currentWindow() list(signal1 signal2) ?expr '("name1" "name"))

    and call

      newWindow()

    before the first call.

    Regards,

    Andrew.


    • Post Points: 20
  • Thu, Oct 1 2009 1:11 PM

    • lunren
    • Top 500 Contributor
    • Joined on Thu, Oct 1 2009
    • Posts 21
    • Points 315
    Re: Ocean Script error--branch distance too far from generated code Reply

    Our subversion is: 5.10.41_USR6.127.29

    I will try Andrew's suggestion to see what will happened.

     By the way, I want to measure the DC gain of the stb simulation (I know how to meansure DC gain in AC simultion), can you give me some hints?

     Thanks.

    • Post Points: 20
  • Thu, Oct 1 2009 1:40 PM

    Re: Ocean Script error--branch distance too far from generated code Reply

    Hmm. That suggests you're using a recent enough version, because ISR 124 was a couple of months before USR6, I think.

    Actually, I just consulted the original CCR on this, and tested my testcase on IC5141 USR6, and the fix was not integrated into USR6 but made a hotfix soon after.

    I believe the approach you were taking to find the DC loopgain was correct - get the loopgain from the stb results, and take the value at low frequency. Note you don't have to do db(mag(...)) - it's sufficient to do db(...) because db is defined as 20*log10(mag(...))  (so it won't do a complex log).

    Regards,

    Andrew.

    • Post Points: 20
  • Thu, Oct 1 2009 2:08 PM

    • lunren
    • Top 500 Contributor
    • Joined on Thu, Oct 1 2009
    • Posts 21
    • Points 315
    Re: Ocean Script error--branch distance too far from generated code Reply

    Andrew, thanks a lot for the quick reply. I still have several issues:

    1) awvPlotWaveform works. However, I do not want to plot several curves in one window. I want to plot different curves in different subWindows. With plot comand, I use currentSubwindwo(sw_x) to plot curve in this specific window. However, with command awvPlotWaveform, I can not use in this way:

    awvPlotWaveform(currentSubwindow(sw_x) list(signal1) ?expr '("name1" ). It seems that currentSubwindow() does not work for awvPlotWaveform command. If I use awvPlotWaveform(currentWindow() list(signal1) ?expr '("name1" )), several curvers will go to one subwindow, for example PSRR, LoopGain and LoopPhase. I want them go to their own windows because the loop will run more than a hundred times.

    2) the expression db(mag(...))  is directly copied from the automatically generated ocean script (related to stb simulation). I tried db(...), the reported error is: not a function -db(getData ("Loop Gain" ?result "stb")). If I use db(mag(...)), the same error came out.

    3) Can our company update the CCR related the plot bugs?

     Thanks,

    Lunren

    • Post Points: 5
  • Thu, Oct 1 2009 2:13 PM

    • lunren
    • Top 500 Contributor
    • Joined on Thu, Oct 1 2009
    • Posts 21
    • Points 315
    Re: Ocean Script error--branch distance too far from generated code Reply

    Actually, our EDA engineer just checked and found that CCR 537825 is already in our USR6.

    Which CCR number are you talking? Can you give me the number?

    Thanks

    • Post Points: 20
  • Thu, Oct 1 2009 2:33 PM

    Re: Ocean Script error--branch distance too far from generated code Reply

    That's the CCR number. However, I believe there was an integration problem - I think something only got partially fixed in USR6, so the CCR number got listed in the list of fixed CCRs, but in fact it was not fully fixed.

    If I try my example in USR6, I get:

     *Error* unknown: Value Stack Overflow!!! (possibly due to too many args in a call, too deeply nested calls, or too large a function)
    *Error* load: error while loading file - "/scratch/andrewb/experiments/SRNUM/codesizetest/testplot.il"

    But with the latest ISR ( 5.10.41.500.6.138 ) I don't get this problem, and can use an example with even more plot() calls in.

    If you want to use the awvPlotWaveform() workaround, you should use:

    awvPlotWaveform(currentWindow() ?subwindow currentSubwindow() list(sig1) ?expr '("signal1"))

    Regards,

    Andrew.

     

    • Post Points: 20
  • Thu, Oct 1 2009 2:54 PM

    • lunren
    • Top 500 Contributor
    • Joined on Thu, Oct 1 2009
    • Posts 21
    • Points 315
    Re: Ocean Script error--branch distance too far from generated code Reply

    Thanks a lot and have a good day!

    • Post Points: 5
Page 1 of 1 (9 items)
Sort Posts:
Started by lunren at 01 Oct 2009 12:09 PM. Topic has 8 replies.