• 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. case Statement in range type spec

Stats

  • Replies 2
  • Subscribers 131
  • Views 641
  • Members are here 0

case Statement in range type spec

Kevin T Buck
Kevin T Buck 1 month ago

I'm trying to create a case statement for an output specification in maestro. An example of the first few outputs is the following:

"range (case(VAR(""ical_sel"") (""0"" 0.02) (t 0))) (case(VAR(""ical_sel"") (""0"" 0.03) (t 0.001)))"

"range (case(VAR(""ical_sel"") (""1"" 0.02) (t 0))) (case(VAR(""ical_sel"") (""1"" 0.03) (t 0.001)))"

"range (case(VAR(""ical_sel"") (""2"" 0.02) (t 0))) (case(VAR(""ical_sel"") (""2"" 0.03) (t 0.001)))"

"range (case(VAR(""ical_sel"") (""3"" 0.02) (t 0))) (case(VAR(""ical_sel"") (""3"" 0.03) (t 0.001)))"

I've tried using with and without quotes for the variable type and also tried using ical_sel directly without wrapping it in the VAR operator (two sets of double quotes are shown in the text file output, in the maestro view there is only one double quote).

The ical_sel variable in the design variable list looks like this: {From/To}Linear:0:1:3{From/To}.

This is an ams simulation, I've used this type of expression in the past using spectre without any problem and from the documentation and testing in the CIW it seems like the case statement should work as expected but the output is always evaluated with the (t 0) or (t 0.001) case.

Tool version is IC23.1-64b.ISR16.19.

  • Cancel
  • Sign in to reply
  • Andrew Beckett
    Andrew Beckett 1 month ago

    I'm not sure where these strings are being created. I entered a similar range specification on an output and used the case function. I then exported to CSV (that was my guess as to where this "range" syntax was coming from):

    range (case(round(VAR("ical_sel")) (2 1.9) (t 0.0))) (case(round(VAR("ical_sel")) (2 2.1) (t 0.001))),

    I don't need any escaped quotation marks, and because the VAR() function is returning a number (a float) I converted it to an integer to do the comparison in the case branches. You should not really use case with the target values being floating point as small rounding errors could lead to a non-match. So in this case it worked fine (note, I set the limits a little different to suit my testcase; in my example I just had a voltage source with a voltage of ical_sel and only the point with ical_sel=2 passed.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Kevin T Buck
    Kevin T Buck 1 month ago in reply to Andrew Beckett

    Thanks for the reply. I did copy/paste from an exported csv (my corporate security policy prevents uploading screenshots to Cadence, I should probably ask them to white list this site). The second set of quotes popped up because I was trying to see if the tool was interpreting the design variable input as a string and causing the case evaluation to fail (so inside of the case statement it said VAR("ical_sel") == "0" ...). My initial statement looked exactly like yours without the round() function wrapping the variable. I was attempting to use case because I saw the following article:

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

    In any case I was able to make this work using an if statement rather than a case statement. The syntax I used in the working solution was:

    range (if((VAR("ical_sel") == 0) 0.02 0) if((VAR("ical_sel") == 0) 0.03 0.001))

    Thanks again.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • 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.

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

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