• 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 16787
  • 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
  • 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
  • Andrew Beckett
    Andrew Beckett over 9 years ago

    Generally speaking you should always give all the arguments to famMap. There's no need to use the @rest approach - using the formal arguments from your original procedure, you'd just do:

    famMap('SIScalcWaveCase selExpr listOfClauseList)

    So no need for the apply() approach. That's unnecessarily complicated. You'll see in most of my other calculator functions (spread all over the universe) that I don't do that.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • fatcat1206
    fatcat1206 over 9 years ago
    Hi Andrew

    What I want to achieve is kind of "case" function for dealing with the waveforms:
    Base on the variable value, the corresponding waveform would be sent to the output.

    It's part of my flow, where I want to make flexible output expression to verified the circuit.

    So in this case, the number of clauses for the "case" is undefined. Which means, I do not know all the arguments in advance.

    I have tried the exactly same thing as you mentioned:
    famMap('SIScalcWaveCase selExpr listOfClauseList)

    The bug I notice is that, if the waveform is an element of the "listofClauseList", then it would not been expanded, when passing by the "famMap()".
    As a results, not a single waveform, but a waveform family has been used.

    Finally, I find the method to use "apply" functions, then I can put the arbitrary number of waveforms as the direct argument in the "famMap" function. Most important is that I do not need to mention them separately.

    I hope I have explain the situation clear.

    Best Regards

    Yi
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 9 years ago

    Hi Yi,

    You're quite right. I misinterpreted your original intention and didn't spot the change in how you were calling the function in your revised version.

    Obviously famMap can't really be expected to identify waveform objects in some arbitrary location within a list structure, so what you're doing is reasonable (I have a similar example as the case where I'm using apply).

    Note you don't need to do the append that you're doing in your code. You should be able to just do:

    apply('famMap 'SIScalcWaveCase selExpr args)

    The way that apply works is that you can supply a number of positional arguments and then the last argument is a list of the remaining arguments.

    Regards,

    Andrew.

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

    Hi Andrew


    Thank you for the feedback.

    I have tried your suggestion about the "apply" function, it works, and makes the code looks simpler :)

    I cross check the manual "SKILL Language Reference", what you have mentioned is not written down there, that's a pity.

    According to the document, I assume the "apply" only accept two arguments.

    But it's good that I can have some deeper understanding about the API from you :)

    After these discussion between you and me, the main question of this post is still not answered:

    Why the spacial function has been called twice during the simulation of ADEXL.

    And VAR() returns different value on each time (1st time: number; 2nd time: waveform)

    Best Regards

    Yi

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

    Hi Yi,

    You must be looking at an old version of the documentation, because even in IC616 it shows that it takes 2 or more arguments. I know in older versions it certainly used to only say it was the function name and a list of arguments (although in reality it allowed the form I showed you).

    I'm not going to be able to investigate the double-evaluation problem as I'm on vacation for the next couple of days and will be spending my time on non-work related things. I suggest you contact customer support so that the team can look at this (that is, after all, what we're here for). Folks other than me can then investigate...

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • fatcat1206
    fatcat1206 over 9 years ago
    Hi Andrew

    Thank you for the quick reply.
    You are right, the document I am looking at is not up to date.
    I will update it.

    I will contact the custom support, and wish you a nice holiday.

    Best Regards

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

    Hi All

    I did some further checks for different situations.

    It seems that the ADEXL "wrap" the signals inside the design and variables in different ways.

    This can be checked, if you open the results browser. You would have different options when you click "Select Sweep Data" icon, under "variable" and "tran" folder (assume a transient simulation is done.)

    Due to this, if only the variable  is swept in ADEXL, wrong results would be output.

    In the previous test, I sweep both the variable and corner, it's a lucky shoot that wrong passing value of the variable same to be the same as the wanted one.

    The solutions is not difficult, just like using the VAR() in the functions defined by calculator.

    DO NOT put the VAR() as the first argument, put a actual waveform there.

    Then the famMap() function can unwrap the waveform family properly, and you would always has a number as the return value of VAR()

    Best Regards

    Yi

    • 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