• 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. Simulation fails to start when using variable1=calcVal(...

Stats

  • Locked Locked
  • Replies 4
  • Subscribers 126
  • Views 2526
  • 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

Simulation fails to start when using variable1=calcVal()+variable

msharma
msharma over 2 years ago

In my explorer, I have an 'ac' testbench and an 'tran' testbench. I am using the ac simulation to quickly get the circuit bandwidth, and adjust the input frequency in the tran sim based on the ac simulation. But for a corner, I need to add or subtract a small constant (ac_temp_factor). Here are my expressions:


fsin=calcVal("bw3db_ac" "testLib:calcVal_TEST:ac" ?getFirstSweepPoint   t)+1.0*ac_temp_factor

ac_temp_factor=-1*(temp==-40)+1*(temp==125)  (set separately in the corners form)

However, I get an error at the start of the simulation:

----
Error found by spectre during circuit read-in.
    ERROR (SFE-874): "input.scs" 10: Cannot run the simulation because syntax error `Unexpected quoted string ""testLib:calcVal_TEST:ac". Expected close parenthesis' was encountered at line 10, column 28. Correct the syntax error and rerun the simulation.
    ERROR (SFE-683): "input.scs" 10: Badly formed parameters statement.

----

If I replace ac_temp_factor with constant, calcVal("bw3db_ac" "testLib:calcVal_TEST:ac" ?getFirstSweepPoint t)+1.0, the sim runs OK, but if I use the variable ac_temp_factor I get this error.

input.scs:

----

// Point Netlist Generated on: Mar  1 18:17:08 2023
// Generated for: spectre
// Design Netlist Generated on: Mar  1 17:45:47 2023
// Design library name: testLib
// Design cell name: calcVal_TEST
// Design view name: schematic
simulator lang=spectre
global 0
parameters ac_temp_factor=-1*(temp==-40)+1*(temp==125) \
    fsin=calcVal("bw3db_ac" "testLib:calcVal_TEST:ac" ?getFirstSweepPoint \
    t)+ac_temp_factor

include "netlist"
simulatorOptions options psfversion="1.4.0" reltol=1e-3 vabstol=1e-6 \
    iabstol=1e-12 temp=-40 tnom=25 scalem=1.0 scale=1.0 gmin=1e-12 \
    rforce=1 maxnotes=5 maxwarns=5 digits=5 cols=80 pivrel=1e-3 \
    sensfile="../psf/sens.output" dochecklimit=no checklimitdest=psf
tran tran stop=1u write="spectre.ic" writefinal="spectre.fc" \
    annotate=status maxiters=5
finalTimeOP info what=oppoint where=rawfile
modelParameter info what=models where=rawfile
element info what=inst where=rawfile
outputParameter info what=output where=rawfile
designParamVals info what=parameters where=rawfile
primitives info what=primitives where=rawfile
subckts info what=subckts where=rawfile
saveOptions options save=allpub

---

File netlist:

simulator lang=spectre

// Library name: evros_wl_tpc_sim
// Cell name: calcVal_TEST
// View name: schematic
R0 (IN OUT) resistor r=1e3
C0 (OUT 0) capacitor c=1e-9
V0 (IN 0) vsource dc=0 mag=1 type=sine ampl=1 freq=fsin

-----

  • Cancel
  • ShawnLogan
    ShawnLogan over 2 years ago

    Dear msharma,

    msharma said:

    ac_temp_factor=-1*(temp==-40)+1*(temp==125)  (set separately in the corners form)

    However, I get an error at the start of the simulation:

    Please allow me to make an alternate suggestion which I think will avoid the issue. In lieu of defining ac_temp_factor in your corners setup,  include it as a design variable with a conditional expression. Then in your corners setup it will be setup automatically and in your calcVal expression, you may use the variable directly.

    So, in your design variable, it is defined as something like the following where mytemp is your design variable for the simulation temperature:

    ac_temp_factor = case(VAR("my temp")( -40 -1)(125 1))

    Other conditional syntax are shown at URL:

    https://support.cadence.com/apex/ArticleAttachmentPortal?id=a1O3w00000AE15CEAT&pageName=ArticleContent

    Shawn

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • msharma
    msharma over 2 years ago in reply to ShawnLogan

    Dear Shawn,

    Thanks for suggestion. I will try this and let everyone know.

    Do you know if we can also compare strings in such conditional statements? I could not make that work.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 2 years ago in reply to ShawnLogan

    You can't do 1*(temp==-40) safely, because the calcVal() needs to be interpreted in SKILL (since the simulator doesn't understand it), and in SKILL temp==-40 does not return a number but a boolean. It might work (I haven't tested it) using:

    -1*if(temp==40 1 0)+1*if(temp==125 1 0)

    To answer your question you typed as I was writing this, you should be able to have string targets in a SKILL case statement - i.e. using Shawn's example:

    ac_temp_factor = case(VAR("myVar")("abc" -1)("def" 1))

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • msharma
    msharma over 2 years ago in reply to Andrew Beckett

    OK thanks for addressing the original and subsequent question, Andrew.

    I will try these.

    • 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