• 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. Easy way to convert a String to a Float?

Stats

  • Locked Locked
  • Replies 8
  • Subscribers 144
  • Views 20256
  • 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

Easy way to convert a String to a Float?

Patrick1982
Patrick1982 over 14 years ago

Hi Everyone,

Firstly, I am using the Cadence Pcell Layout enviroment to create/modify Pcells. So in other words I am using the pcell menu within the layout window, I am not generating the pcell using skill.  I am trying to use an already supported device and I am trying to inherit certain parameters.  However, the parameters can only be inherited as a "string".  And in order to use this parameter else where within the pcell (i.e. stretch or repitition) it needs to be a "float". 

 So is there an easy way to convert a string to a float within cadence?

 Thanks very much,

Patrick

  • Cancel
  • skillUser
    skillUser over 14 years ago

    Hi Patrick,

    one of the easiest ways to do this is to use the function cdfParseFloatString() which takes a numeric string and outputs a floating point number.

    Best regards,

    Lawrence.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Patrick1982
    Patrick1982 over 14 years ago

    Excellent, that works perfect for what I need. Thanks very much Lawrence. 

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • stuso
    stuso over 14 years ago

    Hi guys,

    I was about to ask a similar question relating to an earlier post i had made which was:

    1) How to determine which type a variable is?

    2) How to convert variable types (which i have an idea of now with the parse example from Lawrence)

    Specifically my issue is that i have assigned the w&l of a transistor to variables X & Y but when i do X*Y it does not work, i assume its the format of the w&l initially OR that in assigning them to new variable names i have not specified a variable type therefore string is assumed. As if you type: 500n*2u directly into the CIW it returns a result OK.

    Thanks

    Stu

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 14 years ago

    Stu,

    The type() function will tell you the type of a variable (actually, to be precise, it tells you the type of the data pointed to by the variable, as variables do not have a type).

    To produce strings, the best way is to use something like:

    sprintf(nil "%g" X*Y)

    For example. What you have to set the parameters of a transistor to depends on things like the type of the parameter in the CDF and/or the type of the pcell parameter (I'm not quite sure exactly what you're trying to do) - it all depends on how it has been defined.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • stuso
    stuso over 14 years ago

    Hi Andrew,

    i am trying to estimate area of layout from schematic, so for example i have assigned gate length to a variable:

    cv=geGetWindowCellView(hiGetCurrentWindow())

    foreach(sd_instance cv~>instances

    if(sd_instance~>cellName     == "nmos_myPDK"           

    then

    sd_length         = sd_instance~>l

     

    so basically i have assigned gate length to "sd_length". I just did as you suggested:

    type(sd_length)

    string

    so i guess if i convert string to flonum (or some such number) then i can begin to multiple width x length x fingers...etc.

     

    Thanks

    Stu

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Patrick1982
    Patrick1982 over 14 years ago

     Hi Lawrence and Andrew,

    I've got another question for you guys.  Similar to my original question, I have a string "3u" but I want to convert it to a float, is there a way for me to just ignore the "u" in the string?

    Thanks very much,

    Patrick

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 14 years ago
    Patrick,

    You could use atof() for this.

    Regards,

    Andrew
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • archive
    archive over 14 years ago

     Hi Stu,

    Not directly related to your question, but to what you want to do.

    In the "Virtuoso Preview Fundamentals Reference" documentation "installdir/doc/prfref/prfref.pdf" (in IC 5.1.41 installation tree) there is a skill procedure example that estimate the layout area from schematic. Procedure name is "areaEstSchematic" (p638) may it help you.

    Regards,

    Seb

     

     

     

    • 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