• 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. can I have a if statement for the config

Stats

  • Locked Locked
  • Replies 3
  • Subscribers 125
  • Views 1639
  • 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

can I have a if statement for the config

Mooh
Mooh 6 months ago

As shown in the picture, I have a global variable config, and I want to use this variable in an if statement to set another variable's value. The logic is as follows:
if((VAR("CONFIG/XX_TB/XXOhm") == "schematic_35Ohms_lumped_bw") (then = 35) (else= if((VAR("CONFIG/XX_TB/XXOhm") == "schematic_17Ohms_lumped_bw") (then = 17) (else= 25))))

This works fine when I run it in the calculator, but it doesn't seem to work during the simulation.

  • Cancel
  • Frank Wiedmann
    Frank Wiedmann 6 months ago

    How about using a Parametric Set instead (see https://support.cadence.com/apex/techpubDocViewerPage?path=assembler/assemblerIC23.1/asmDesignVars.html#pgfId-1035202 and https://support.cadence.com/apex/ArticleAttachmentPortal?id=a1Od0000000v6rtEAA)? 

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett 6 months ago

    The issue is that the syntax is wrong. VAR() with a config sweep has been supported since IC6.1.8 ISR26 (6.1.8.500.26) but your if() has incorrect syntax. The "then=" and "else=" parts are incorrect. The if function returns a value from the then and else branches, so you'd want:

    if(VAR("CONFIG/XX_TB/XXOhm") == "schematic_35Ohms_lumped_bw" then 35 else if(VAR("CONFIG/XX_TB/XXOhm") == "schematic_17Ohms_lumped_bw" then 17 else 25))

    alternatively you could use a case() function which might be easier to maintain than nested if() calls:

    case(VAR("CONFIG/XX_TB/XXOhm") ("schematic_35Ohms_lumped_bw" 35) ("schematic_17Ohms_lumped_bw" 17) (t 25))

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett 6 months ago in reply to Andrew Beckett

    Apologies - I was having difficulty replying - please see my previous edited response above which shows how you should correctly format the if statement - your syntax was incorrect.

    • 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