• 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. VAR() returns a waveform instead of a number, after simulation...

Stats

  • Locked Locked
  • Replies 8
  • Subscribers 142
  • Views 16790
  • 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

VAR() returns a waveform instead of a number, after simulation finished in ADEXL

fatcat1206
fatcat1206 over 9 years ago

Hi All

I am developing some code to process the simulation data.

Where I want to use VAR() as one of the arguments (selExpr ) for the function. Please find the procedure below.

procedure(SIScalcWaveCase(selExpr listOfClauseList)
prog(
(
)     ;local variable

    foreach(clauseList listOfClauseList
        when(selExpr == car(clauseList)
            return(eval(cadr(clauseList)))    
        );when
    );foreach
);prog
);proc

I expect VAR() returns a number, thus I assume selExpr would be "float" type.

But somehow it returns a waveform.

Below is the expression I made for selecting the waveform due to the value of "ctrl" in the ADEXL.

SIScalcWaveCase(VAR("ctrl") list('(0 VT("/s<0>")) '(1 VT("/s<1>")) '(2 VT("/s<2>")) '(3 VT("/s<3>"))))

where "ctrl" is a variable, whose value is swept from 0 to 3, and s<3:0> are the nets saved in the schematic.

I set breaking point in the procedure.

I notice the procedure has been called twice during the simulation in ADEXL (only 1 run)

In the first time, the VAR() indeed passes a number, and on the second time it passes a waveform.

Thus in the end, there is nothing in the results tab in ADEXL.

I run the same thing inside ADE L, and the procedure works properly there.

From my point of view, inside ADE XL, the second triggering for the procedure causes the problem.

So, I'd like to ask, why the procedure has been called twice inside ADE XL; and how to retrieve the value from VAR() properly under this condition.

Best Regards

Yi

  • Cancel
Parents
  • fatcat1206
    fatcat1206 over 9 years ago

    Hi All


    Before getting the answer, I adjust the code to adapt the situation where VAR() may return a waveform or even waveform family.

    I have changed the definition for the arguments, by using @rest, arbitrary number of arguments can be defined.

    The purpose for this is that:

    if an argument is also a waveform family, it needs to be expanded together with the return value of VAR().

    So it must be mentioned in the argument list of "famMap()".

    I achieve this by using @rest and "apply('famMap argList)", see the piece of code in red.

    procedure(SIScalcWaveCase(selExpr @rest args)
    let(
    (
        selValue    
        listOfClausList
        returnValue
    )     ;local variable


        if(evenp(length(args)) then
            for(Index 0 length(args)/2-1
                listOfClausList = cons(list(nth(Index*2 args) nth(Index*2+1 args)) listOfClausList)
            );for
            cond(
                (!drIsWaveform(selExpr) && !famIsFamily(selExpr)
                    foreach(clausList listOfClausList        
                        when(selExpr == car(clausList)
                            returnValue = cadr(clausList)    
                        );when
                    );foreach  
                returnValue              
                );not waveform and family
                (drIsWaveform(selExpr)
                    selValue = drGetElem(drGetWaveformYVec(selExpr) 0)
                    foreach(clausList listOfClausList        
                        when(selValue == car(clausList)                    
                            returnValue = cadr(clausList)                          
                        );when
                    );foreach
                returnValue                        
                );is a waveform
                (famIsFamily(selExpr)
                    apply('famMap append(list("SIScalcWaveCase" selExpr) args))  ;the argument would also be expend if it's family waveform
                );
                (t
                    error("SIScalcWaveCase - can't handle %L" selExpr)
                );error
            );cond
        else
            error("Not even number of arguments for the clause pair")
        );if
    );let
    );proc

    Below is the expression used in the ADEXL.

    SIScalcWaveCase(VAR("ctrl") 0 VT("1s<0>") 1 VT("/s<1>") 2 VT("1s<2>") 3 VT("/s<3>"))

    Best Regards

    Yi

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • fatcat1206
    fatcat1206 over 9 years ago

    Hi All


    Before getting the answer, I adjust the code to adapt the situation where VAR() may return a waveform or even waveform family.

    I have changed the definition for the arguments, by using @rest, arbitrary number of arguments can be defined.

    The purpose for this is that:

    if an argument is also a waveform family, it needs to be expanded together with the return value of VAR().

    So it must be mentioned in the argument list of "famMap()".

    I achieve this by using @rest and "apply('famMap argList)", see the piece of code in red.

    procedure(SIScalcWaveCase(selExpr @rest args)
    let(
    (
        selValue    
        listOfClausList
        returnValue
    )     ;local variable


        if(evenp(length(args)) then
            for(Index 0 length(args)/2-1
                listOfClausList = cons(list(nth(Index*2 args) nth(Index*2+1 args)) listOfClausList)
            );for
            cond(
                (!drIsWaveform(selExpr) && !famIsFamily(selExpr)
                    foreach(clausList listOfClausList        
                        when(selExpr == car(clausList)
                            returnValue = cadr(clausList)    
                        );when
                    );foreach  
                returnValue              
                );not waveform and family
                (drIsWaveform(selExpr)
                    selValue = drGetElem(drGetWaveformYVec(selExpr) 0)
                    foreach(clausList listOfClausList        
                        when(selValue == car(clausList)                    
                            returnValue = cadr(clausList)                          
                        );when
                    );foreach
                returnValue                        
                );is a waveform
                (famIsFamily(selExpr)
                    apply('famMap append(list("SIScalcWaveCase" selExpr) args))  ;the argument would also be expend if it's family waveform
                );
                (t
                    error("SIScalcWaveCase - can't handle %L" selExpr)
                );error
            );cond
        else
            error("Not even number of arguments for the clause pair")
        );if
    );let
    );proc

    Below is the expression used in the ADEXL.

    SIScalcWaveCase(VAR("ctrl") 0 VT("1s<0>") 1 VT("/s<1>") 2 VT("1s<2>") 3 VT("/s<3>"))

    Best Regards

    Yi

    • 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