• 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 SKILL
  3. Force increment step in parameter

Stats

  • Locked Locked
  • Replies 6
  • Subscribers 143
  • Views 15405
  • 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

Force increment step in parameter

Dimitris Kar
Dimitris Kar over 11 years ago

Hi,

 

I am trying to force the minimum increment in parameters that user defines.

 I managed to implement the min max to force the limits of my parameter (i.e. if 3<=x<=10, I write x=max(x 3)   x=min(x 10))

 I can not find the correct expresion on setting the acceptable step i.e. if the grid is 0.1, then values of x.xxx are not accepted.

 

An suggestions will be warmly welcomed!

 

Many thanks!

 

BR,

  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 11 years ago

    I'm guessing that the libId and cellId are for a different cell, which is why you're doing it this way rather than using get(cdfgData param2)? 

    I did realise that actually it's bad practice for me to have suggested using get() for this. The right way is cdfFindParamByName(cdfgData get_string(param1))->value . A bit longer, but this will still work if your CDF parameter name happens to be one of a number of "reserved" slots on the CDF object (e.g. a parameter called "id", amongst others).

    Similarly, your dep variable could be found:

    dep=cdfFindParamByName(cdfGetBaseCellCDF(ddGetObj(libID cellID)) get_string(param2))->value

    rather than looping over all of them yourself.

    Now onto the case(). Two problems - one is that the target values in a case statement have to be literal values, not expressions. In other words, it will not evaluate the target values and so it will in fact be trying to check if the value is either the symbol min, or the list (max dep lower). Which it won't be, which is why it doesn't work. 

    Instead, you could use cond:

    value=cond(
      (dep==min(max(dep lower)) ... value1)
      (dep==min(max(dep yy.yyy)) ... value2)
      (...)
    )

    cond is like a nested if-then-elseif-elseif-else type structure.

    Note however that you should be rather cautious about using == type checks on floating point numbers if there is any chance that the floating point number might suffer from rounding errors. There are a number of solutions and posts on this before, but floating point numbers in SKILL (and C, and Java, and Python and Perl and Tcl for that matter) are represented with IEEE floating point representation, which can suffer from rounding errors even with a 52 bit mantissa (in the same way that 1/3 can't be represented exactly in decimal, 1/10 can't be represented exactly in binary). So it's generally dangerous to do equality checks on floating point numbers - instead one usually does things like abs(value1-value2)<smallNumber to check if value1 and value2 are effectively equal.

    So your condition may want to change a bit.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett over 11 years ago

    I'm guessing that the libId and cellId are for a different cell, which is why you're doing it this way rather than using get(cdfgData param2)? 

    I did realise that actually it's bad practice for me to have suggested using get() for this. The right way is cdfFindParamByName(cdfgData get_string(param1))->value . A bit longer, but this will still work if your CDF parameter name happens to be one of a number of "reserved" slots on the CDF object (e.g. a parameter called "id", amongst others).

    Similarly, your dep variable could be found:

    dep=cdfFindParamByName(cdfGetBaseCellCDF(ddGetObj(libID cellID)) get_string(param2))->value

    rather than looping over all of them yourself.

    Now onto the case(). Two problems - one is that the target values in a case statement have to be literal values, not expressions. In other words, it will not evaluate the target values and so it will in fact be trying to check if the value is either the symbol min, or the list (max dep lower). Which it won't be, which is why it doesn't work. 

    Instead, you could use cond:

    value=cond(
      (dep==min(max(dep lower)) ... value1)
      (dep==min(max(dep yy.yyy)) ... value2)
      (...)
    )

    cond is like a nested if-then-elseif-elseif-else type structure.

    Note however that you should be rather cautious about using == type checks on floating point numbers if there is any chance that the floating point number might suffer from rounding errors. There are a number of solutions and posts on this before, but floating point numbers in SKILL (and C, and Java, and Python and Perl and Tcl for that matter) are represented with IEEE floating point representation, which can suffer from rounding errors even with a 52 bit mantissa (in the same way that 1/3 can't be represented exactly in decimal, 1/10 can't be represented exactly in binary). So it's generally dangerous to do equality checks on floating point numbers - instead one usually does things like abs(value1-value2)<smallNumber to check if value1 and value2 are effectively equal.

    So your condition may want to change a bit.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

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