• 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. ADE Assembler: variable values with leading zeros interpreted...

Stats

  • Locked Locked
  • Replies 6
  • Subscribers 125
  • Views 12347
  • 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

ADE Assembler: variable values with leading zeros interpreted as octal in ICADVM20.1

dontpanic
dontpanic over 4 years ago

Hi! We recently switched to ICADVM20.1 and started to get weird results in many old testbenches. After a close lookup, it turns out that all the variables with values starting with zero ("0") are being interpreted as octal!

We have lots of testbenches where we use leading zeros as indentation in values to improve clarity, e.g (note leading zeros in front of 503 and 61):

As changing all these existing maestro views would mean a colossal work, we look for a workaround. Will this behavior be corrected in the future (or maybe has been already corrected?)?

Thanks in advance for any help!

KR, Jorge.

  • Cancel
  • ShawnLogan
    ShawnLogan over 4 years ago

    Dear dontpanic,

    dontpanic said:
    We recently switched to ICADVM20.1 and started to get weird results in many old testbenches. After a close lookup, it turns out that all the variables with values starting with zero ("0") are being interpreted as octal!

    Yes. It appears this is a known issue as detailed in the On-line support article:

    Virtuoso Known Problems and Solutions
    Product Version ICADVM20.1, March 2021

    at URL:

    support.cadence.com/.../techpubDocViewerPage

    which includes the following:

    Problem: Entering leading zeroes in numeric fields results in octal interpretation

    Description: If a number is immediately preceded by a zero, SKILL interprets this as an octal number.

    Solution: Use the Backspace key to delete the zero before you type a new number.

    I don't think the suggested "Solution"  is to your liking though! I am not privy to any potential date for correcting the behavior nor a release in which the known issue will be corrected - sorry!

    Shawn

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

    The manual that Shawn mentions isn't strictly speaking related to this issue - it's a general point that numeric fields on forms in Virtuoso will interpret integers as SKILL does, where leading zeros indicate octal. This is not new, and there's nothing that's going to be fixed. In this case, we're talking about global variables in ADE, and the field for these isn't a numeric field, so that manual isn't really relevant here (even though the symptoms are similar).

    The problem in this case is that global variables in ADE Explorer/Assembler (and indeed ADE XL) are first evaluated in SKILL to allow complex functions to be used, before passing to the simulator anything else. There have been some changes to this flow recently to try to preserve parameters within such expressions so that they can be swept within an analysis in Spectre, but it's not that change that causes this problem. I checked, and expressions with numbers starting with 0 in global variables have always been treated as octal since IC617 was first released with Assembler (that's when Assembler was first released). I suspect it goes back even further with ADE XL (I did not check that). So this is not new, and I am surprised that you have existing test benches that weren't broken before (maybe they were run in ADE L before? ADE L didn't evaluate any design variables in SKILL and passed the expressions through to the simulator, so that could well be a difference).

    I haven't spotted any reports of this being an issue with anybody else (and I can understand why it's a pain), but I can't see any plan to alter this behaviour (it would be quite hard). Potentially I can imagine some SKILL code to fix these automatically would be possible...

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Frank Wiedmann
    Frank Wiedmann over 4 years ago in reply to Andrew Beckett

    I remember a similar issue where the ternary operator worked in ADE L, but did not work in ADE XL, Explorer or Assembler. This was fixed eventually, see support.cadence.com/.../ArticleAttachmentPortal

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • dontpanic
    dontpanic over 4 years ago

    Thank you all for your replies. Interesting situation to say the least! (I wonder about the origins of the idea of using "0" as a prefix for octal--never heard of that before in my entire career!)

    I guess we'll have to explore the solution of automatically updating it via skill, but that will be a problem for "future Jorge". For the time being I guess we'll have to update manually on a per-case basis...

    Cheers,

    Jorge.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 4 years ago in reply to dontpanic

    Hi Jorge,

    The C language also treats literal integers which start with a 0 as octal, so it's not unique to SKILL. Of course, most designers would not necessarily expect this - in the same way that designers get confused by the fact that 1/2 in expressions is 0!

    I wrote some code that I think will do the job of the cleanup. Caveat emptor, since I've really not done a huge amount of testing - you might want to try using abCleanOctalLikeNumbersInVars() on an open session or two before trying abRegOctalLikeNumbers() to do it automatically when a maestro view is opened (if you really want that). Hopefully I got the regular expression right!

    Regards,

    Andrew

    /* abCleanOctalLikeNumbers.il
    
    Author     A.D.Beckett
    Group      Custom IC (UK), Cadence Design Systems Ltd.
    Language   SKILL
    Date       Apr 01, 2021 
    Modified   
    By         
    
    Provide functions to clean up numbers that will be interpreted
    in SKILL as octal, even though that wasn't what the designer intended
    
    abCleanOctalLikeNumbersInVars([session]
        cleans up all design and global variables in the given (or current)
        ADE XL/Explorer/Assembler session
    
    abRegCleanOctalLikeNumbers()
        registers a trigger to do the cleanup whenever a maestro or adexl
        view is opened. Use once you're happy it works properly (I
        have only done limited testing)
    
    ***************************************************
    
    SCCS Info: @(#) abCleanOctalLikeNumbers.il 04/02/21.10:25:24 1.2
    
    */
    
    /************************************************************************
    *                                                                       *
    *                  abCleanOctalLikeNumbers(expression)                  *
    *                                                                       *
    * Take a string expression, and replace any number that starts with a 0 *
    * so that it doesn't start with a number any more. This avoids numbers  *
    *              starting with 0 as being treated as octal.               *
    *                                                                       *
    ************************************************************************/
    
    procedure(abCleanOctalLikeNumbers(expression)
        ;--------------------------------------------------------------------
        ; pattern looks for a non-word non-dot character, followed by one 
        ; or more zeros, followed by one or more digits
        ;--------------------------------------------------------------------
        let(((pat pcreCompile("(^|[^\\w.])0+(\\d+)")))
            if(stringp(expression) && pcreExecute(pat expression) then
                pcreReplace(pat expression "\\1\\2" 0)
            else
                expression
            )
        )
    )
    
    /***********************************************************************
    *                                                                      *
    *                abCleanOctalLikeNumbersForHandle(sdb)                 *
    *                                                                      *
    *   Passed either a handle for the whole view (for global variables)   *
    * or for a test (for design variables) and iterates over all variables *
    *        and tries cleaning them up to avoid octal-like values         *
    *                                                                      *
    ***********************************************************************/
    
    procedure(abCleanOctalLikeNumbersForHandle(sdb)
        let((var curValue newValue)
            foreach(varName cadr(axlGetVars(sdb))
                var=axlGetVar(sdb varName)
                curValue=axlGetVarValue(var)
                newValue=abCleanOctalLikeNumbers(curValue)
                unless(newValue==curValue
                    printf("Changing Expression %s to %s\n" curValue newValue)
                    axlPutVar(sdb varName newValue)
                )
            )
            t
        )
    )
    
    /***************************************************************
    *                                                              *
    *           abCleanOctalLikeNumbersInVars([session])           *
    *                                                              *
    *     Fixes all the octal-like numbers in a given session      *
    *                 (defaults to current window)                 *
    *                                                              *
    ***************************************************************/
    
    procedure(abCleanOctalLikeNumbersInVars(
            @optional (session axlGetWindowSession()))
        let((sdb test)
            sdb=axlGetMainSetupDB(session)
            abCleanOctalLikeNumbersForHandle(sdb)
            foreach(testName cadr(axlGetTests(sdb))
                test=axlGetTest(sdb testName)
                abCleanOctalLikeNumbersForHandle(test)
            )
            t
        )
    )
    
    /***************************************************************
    *                                                              *
    *           abRegCleanOctalLikeNumbersInit(session)            *
    *                                                              *
    *   Registers a trigger to do the cleanup once the UI is up    *
    *                                                              *
    ***************************************************************/
    
    procedure(abRegCleanOctalLikeNumbersInit(session)
        axlSessionConnect(session "postInstall" 'abCleanOctalLikeNumbersInVars)
    )
    
    /***************************************************************
    *                                                              *
    *                 abRegCleanOctalLikeNumbers()                 *
    *                                                              *
    *   Registers the postInstall trigger at startup of the view   *
    *                                                              *
    ***************************************************************/
    
    procedure(abRegCleanOctalLikeNumbers()
        axlSessionRegisterCreationCallback('abRegCleanOctalLikeNumbersInit)
    )
    
    /***************************************************************
    *                                                              *
    *                abTestCleanOctalLikeNumbers()                 *
    *                                                              *
    *            Test code to check for a few examples             *
    *                                                              *
    ***************************************************************/
    
    procedure(abTestCleanOctalLikeNumbers()
        assert(abCleanOctalLikeNumbers("0123")=="123")
        assert(abCleanOctalLikeNumbers("(0562+0*012)/073^02")=="(562+0*12)/73^2")
        assert(abCleanOctalLikeNumbers("TRIM_024_VAL+014")=="TRIM_024_VAL+14")
        assert(abCleanOctalLikeNumbers("0.0033")=="0.0033")
        assert(abCleanOctalLikeNumbers("if( 012==12 0515 0632 )")==
            "if( 12==12 515 632 )")
        t
    )
    

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

    Hi Jorge,

    I updated the code I posted yesterday - so don't use the code in any email notification from yesterday; use the latest code in the thread above (I replaced it in the post with version 1.2 to avoid having two versions in the thread). I suddenly realised (in the middle of the night, as you do) that it would rather unhelpfully "clean" floating point numbers that had zeros (e.g. "0.0012" would have become "0.12", which is clearly wrong). Hopefully there aren't other issues (other than I know it will still remove leading zeros in numbers inside double quotes within the expression - I decided that was fairly unlikely to happen and probably not worth the complexity of trying to deal with).

    Andrew

    • 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