• 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. How to allow hand-made waveform plot into Viva from Assembler...

Stats

  • Locked Locked
  • Replies 9
  • Subscribers 144
  • Views 4690
  • 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

How to allow hand-made waveform plot into Viva from Assembler?

dontpanic
dontpanic 11 months ago

Hi! I've made some 1-point waveform "markers" that I want to overlay in my plots to aid visualization (with the added advantage, w.r.t. normal Viva markers, that they update location automatically upon refreshing simulation data).

For example, the plot below shows an spectrum along with two of these markers, which I create with the function "singlePointWave", and the Assembler output definitions also as shown below.

The problem is: as currently created and defined, Assembler is unable to plot these elements. I can send their expressions to the calculator and plotting works from there, BUT ONLY after first enabling the "Allow Any Units" in the target Viva subwindow.

Thus, I suspect Assembler is failing to plot my markers because they "lack" other information like axes units and so on. How could I add whatever is missing, so that these markers can plot automatically from Assembler?

Thanks in advance for any help!

Jorge.

P.S. I also don't know why, but nothing works without those "ymax()" in the output definitions--I suspect they are somehow converting the arguments to the right data type expected by singlePointWave(). Ideas how to fix that are also welcome! ^^

procedure( singlePointWave(xVal yVal)
    let( (xVect yVect wave)
        xVect = drCreateVec('double list(xVal));
        yVect = drCreateVec('double list(yVal));
        wave = drCreateWaveform(xVect yVect);
    );
);

  • Cancel
  • henker
    henker 10 months ago

    The wave x and y units need to be the same as in the plot to be drawn together.
    If known, just set them before returning the wave, e.g.:
    putpropq(drGetWaveformXVec(wave) <xunits> units)
    putpropq(drGetWaveformYVec(wave) <yunits> units)

    or pass the units as parameter, to allow some flexibility,
    or have the original wave as input to the procedure and extract the units from there.

    There are also two solutions, abSetXUnits and abSetUnits, where you might have a look.

    Regards,

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • dontpanic
    dontpanic 10 months ago in reply to henker

    Hi henker! Thanks so much for your reply. I modified my function to add units, but unfortunately plotting from Assembler results still doesn't work (doesn't do anything, no errors in CIW whatsoever). It does plot fine when evaluated in the calculator or in the CIW. Any ideas on what could be missing?

    Thanks and regards,

    Jorge.

    procedure( singlePointWave(xVal yVal @optional (xUnits "") (yUnits ""))
        let( (xVect yVect wave)

            xVect = drCreateVec('double list(xVal));
            yVect = drCreateVec('double list(yVal));
            wave = drCreateWaveform(xVect yVect);

            ; Apply units if specified
            if(strcmp(xUnits, "")!=0 then
                (putpropq (drGetWaveformXVec wave) xUnits units);
            )
            if(strcmp(yUnits, "")!=0 then
                (putpropq (drGetWaveformYVec wave) yUnits units);
            )

            ; Returned output
            wave
        );
    );

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • dontpanic
    dontpanic 10 months ago in reply to dontpanic

    P.S. how can I embed code in a forum post so that it looks neat e.g. as in the example below (taken from here)?

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett 10 months ago in reply to dontpanic

    Jorge,

    The issue is not the units (although those could be added) but more that the code needs to be able to handle waveform and family data. Even if you run a single simulation, when you plot the waveform the ymax() type expressions will be a waveform or family across all the simulations run (it might just be against a single design point). Something like this should work:

    procedure( singlePointWave(xVal yVal)
        cond(
            (numberp(xVal)
                let( (xVect yVect wave)
                    ;printf("xVal: %L yVal: %L\n" xVal yVal)
                    xVect = drCreateVec('double list(xVal));
                    yVect = drCreateVec('double list(yVal));
                    wave = drCreateWaveform(xVect yVect);
                )
            )
            (drIsWaveform(xVal)
                let((xVect x_yVect y_yVect xType len family thisXVal thisYVal)
                    xVect=drGetWaveformXVec(xVal)
                    xType=drGetWaveformXType(xVal)
                    x_yVect=drGetWaveformYVec(xVal)
                    y_yVect=drGetWaveformYVec(yVal)
                    len=drVectorLength(xVect)
                    family=famCreateFamily(xVect->name||"sweep" xType)
                    for(i 0 len-1
                        thisXVal=drGetElem(x_yVect i)
                        thisYVal=drGetElem(y_yVect i)
                        famAddValue(family thisXVal singlePointWave(thisXVal thisYVal))
                    )
                    family
                )
            )
            (famIsFamily(xVal)
                famMap('singlePointWave xVal yVal)
            )
            (t
                error("singlePointWave: can't handle %L\n" xVal)
            )
        )
    );
    
    

    As for the formatting, I often use an HTML formatter that I have at my end, but in the simple case like above, all I do is put the code in a text file (forum.txt), open that in a web browser, and then copy and paste into the forum (I am on a Mac, but I think this behaves the same on Windows). It doesn't get the colouring that I do with my HTML formatter, but avoids me needing it to copy the code to my central web server which has the formatter.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • dontpanic
    dontpanic 10 months ago in reply to Andrew Beckett

    Thanks so much for your reply, Andrew. As much as I have tried, I'm unable to get it to work :\

    I tried using the code you provided to build a marker at the maximum value of a sine wave in a tran simulation (see snapshot below of the actual output definitions), and no matter what I try, Assembler/Viva refuse to plot it (both "marker_xval" and "marker_yval evaluate properly, and I get the wave icon for the "marker" output; no messages appear in the CIW). Any ideas of what I can be missing?

    Thanks and regards,

    Jorge.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett 10 months ago in reply to dontpanic

    Jorge,

    The issue is that your xval and yval expressions have different dimensions (at least when plotted). Given a single waveform result, both:

    ymax(vIN)
    cross(vIN marker_yval 1 "either" nil nil nil)

    will each produce a single number. If vIN is now a family of waveforms, then each would produce a waveform of the single values for each point. You however had a ymax() around the cross, so in the second case, this would return the maximum of all the single values and so the marker_xval would be a number, and marker_yval would be a waveform - causing it to break. It doesn't error normally, because ymax(3.4) produces 3.4 too. So the solution is to omit the ymax() around the cross.

    Or you could use xmax(vIN) instead of the cross - xmax gives the x-value where the y is maximum.

    I tested this, and it's all working fine for me with either of the two marker_xval expressions I suggest above.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • dontpanic
    dontpanic 9 months ago in reply to Andrew Beckett

    Thanks again for the reply, Andrew. For some reason this is not working on my side. If I don't use the ymax() function before passing the arguments to singlePointWave(), even this minimalistic definition of the "marker" output fails:

    singlePointWave(xmax(VT("/vIN")) ymax(VT("/vIN")))

    ...Assembler is unable to plot the marker, and I get the following error in the CIW:

    *Error* ("ilGetString" 0 t nil ("*Error* ilGetString: arg must be symbol or string" 1e-11))

    ERROR (ADE-1057): Could not evaluate expression
    Name:'marker'
    Expression:'singlePointWave(xmax(VT("/vIN")) ymax(VT("/vIN")))'
    because of the following error(s)
    ("ilGetString" 0 t nil ("*Error* ilGetString: arg must be symbol or string" 1e-11))
    Ensure that the definition of the expression is correct.

    ...any ideas of what could be happening?

    (BTW, sorry that I don't post snapshots, but since a couple days I'm unable to paste or insert images in my posts--I get an orange popup with the message "An error occurred. Please try again or contact your administrator" on the top right corner of my browser)

    KR, Jorge.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • dontpanic
    dontpanic 9 months ago in reply to dontpanic

    Wait, after further experimentation I think I've bumped into the real culprit: the behavior I see on my side seems to be dependent on the way I'm defining and using some global variables in my Maestro view: upon removing/changing those definitions, things seem to work as expected; I'll do a bit more debugging and let you know what I find!

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • dontpanic
    dontpanic 9 months ago in reply to dontpanic

    Indeed, the problem seems to be that the "last-defined" global variable somehow percolates all the way up to the results, and messes with the way things are being interpreted during the outputs evaluation and/or the wave creation.

    In the picture in the link below two cases are compared:

    • When my last defined global variable is "VDD" with numeric value "1.0", all works fine, the marker plots from Assembler, as shown in the upper snaphots.
    • If, however, my last defined global variable is an expression "timestamp" with value "getCurrentTime()", then only the waveform plots from Assembler, as shown in the bottom snapshot, and I get the following error in the CIW for the marker:

    *Error* ("ilGetString" 0 t nil ("*Error* ilGetString: arg must be symbol or string" 2.527395863957799e-10))

    ERROR (ADE-1057): Could not evaluate expression
    Name:'marker'
    Expression:'singlePointWave(xmax(vIN) ymax(vIN))'
    because of the following error(s)
    ("ilGetString" 0 t nil ("*Error* ilGetString: arg must be symbol or string" 2.527395863957799e-10))
    Ensure that the definition of the expression is correct.

    (TBH, I had already noticed in the past that VIVA "automatically" associates the last global variable defined with the waveforms it plots, and even changes the displayed wave names to add that variable and its value when reloading simulation results with CTRL+R).

    Do you think there's a way to get around this behavior, and modify singlePointWave() and/or the output definition expressions to allow automatic plotting irrespective of the variables definitions?

    Thanks and regards,

    Jorge.

    P.S. Please note that the "single-point wave" marker example I used in this post was a "toy" example I created to understand and solve these wave creation and plotting issues. In reality, my final goal is to develop a Skill function that can automatically create a plottable waveform from x and y data vectors passed as e.g. lists. I believe that the function singlePointWave() is already quite close to achieving this, and probably just needs the above details to be figured out?

    • 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