• 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. How to combine two plots y1=f(v1) & y2=f(v2)

Stats

  • Locked Locked
  • Replies 11
  • Subscribers 125
  • Views 7831
  • 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 combine two plots y1=f(v1) & y2=f(v2)

SUEE
SUEE over 13 years ago

Hi all,

In ADE plot using AWD, how to combine two plots y1=f(V1) & y2=f(V2)

For y1=f(V1(t)), I could plot V1 along the x-axis and y1 along the y-axis

Similarly for y2=f(V2(t)), I could plot y2 (on the y-axis) versus V2 (along the x-axis)

Because V1(t) is not equal to V2(t) so that I can not plot both y1 & y2 respect to either V1 or V2.

However, I do need to overlap the y1=f(V1) and y2=f(V2) on the same plot.

What can I do?

 

Thank you very much !!

  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 13 years ago

    It's still not entirely clear what you want, because you can plot both of these on the same graph. I'm assuming you want to scale the x-values so that the axes match?

    If so, you could do something like this:

    v1=v("sig1" ?result 'tran ?resultsDir "run5ms.raw")
    v2=v("sig2" ?result 'tran ?resultsDir "run5.raw")
    scaledX=xval(v1)*1000
    v1scaled=abChangeXAxis(v1 scaledX)
    plot(v1scaled v2)

    This is using this code:

    /* abChangeXAxis.il
    
    Author     A.D.Beckett
    Group      Custom IC (UK), Cadence Design Systems Ltd.
    Language   SKILL
    Date       May 25, 1999 
    Modified   May 21, 2002 
    By         A.D.Beckett
    
    Function to change the X Axis of a waveform to the corresponding
    Y values of the second variable.
    
    Also function to transpose the X and Y axes of a waveform.
    
    Now handles families, and can be registered as a special function.
    Just call:
    
    abRegChangeXAxis()
    
    to add to the calculator.
    
    ***************************************************
    
    SCCS Info: @(#) abChangeXAxis.il 11/27/08.09:59:36 1.3
    
    */
    
    /*******************************************************************
    *                                                                  *
    *                    (abChangeXAxis yVar xVar)                     *
    *                                                                  *
    * Return a new waveform object with the x axis set to the y values *
    *                     of the second argument.                      *
    *                                                                  *
    *******************************************************************/
    
    (procedure (abChangeXAxis yVar xVar)
      (let (newWave)
        (cond
          ;------------------------------------------------------------------
          ; Handle normal waveform
          ;------------------------------------------------------------------
          ((drIsWaveform yVar)
           (setq newWave (drCreateEmptyWaveform))
           (drPutWaveformXVec newWave (drGetWaveformYVec xVar))
           (if (eq (drGetWaveformXVec yVar) (drGetWaveformXVec xVar))
             ;---------------------------------------------------------------
             ; if the x axes are the same for both, it's simple
             ;---------------------------------------------------------------
             (drPutWaveformYVec newWave (drGetWaveformYVec yVar))
             ;---------------------------------------------------------------
             ; otherwise need to use value() to interpolate
             ;---------------------------------------------------------------
             (let (xVec yVec len)
               (setq xVec (drGetWaveformXVec xVar))
               (setq len (drVectorLength xVec))
               (setq yVec (drCreateVec (drGetWaveformYType yVar) len))
               (for ind 0 (sub1 len)
                    (drAddElem yVec (value yVar (drGetElem xVec ind)))
                    )
               (drPutWaveformYVec newWave yVec)
               )
             )
           newWave
           )
          ;------------------------------------------------------------------
          ; Handle family
          ;------------------------------------------------------------------
          ((famIsFamily yVar)
           (famMap 'abChangeXAxis yVar xVar)
           ) ; is family
          (t
            (error "abChangeXAxis - can't handle %L\n" yVar)
            )
          ) ; cond
        ) ; let
      ) ; defun
    
    /**********************************************************************
    *                                                                     *
    *                         (abRegChangeXAxis)                          *
    *                                                                     *
    * Registers abChangeXAxis as a new special function in the calculator *
    *                                                                     *
    **********************************************************************/
    
    (procedure (abRegChangeXAxis)
      (calRegisterSpecialFunction
        (list "abChangeXAxis" 'abChangeXAxisCB)
        )
      t
      )
    
    /***************************************************************************
    *                                                                          *
    *                            (abChangeXAxisCB)                             *
    *                                                                          *
    * Callback function for the special function - which builds the expression *
    *                                                                          *
    ***************************************************************************/
    
    (procedure (abChangeXAxisCB)
      (calSpecialFunctionInput 'abChangeXAxis '(STACK))
      )
    
    /***************************************************************
    *                                                              *
    *                     (abTransposeXY var)                      *
    *                                                              *
    *             Swap the X and Y axes of a variable              *
    *                                                              *
    ***************************************************************/
    
    (procedure (abTransposeXY var)
      (let (newWave)
           (setq newWave (drCreateEmptyWaveform))
           (drPutWaveformXVec newWave (drGetWaveformYVec var))
           (drPutWaveformYVec newWave (drGetWaveformXVec var))
           newWave
           )
      )
    

     

    IC61X has a function (ocnYvsY) for doing this kind of plot directly.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett over 13 years ago

    It's still not entirely clear what you want, because you can plot both of these on the same graph. I'm assuming you want to scale the x-values so that the axes match?

    If so, you could do something like this:

    v1=v("sig1" ?result 'tran ?resultsDir "run5ms.raw")
    v2=v("sig2" ?result 'tran ?resultsDir "run5.raw")
    scaledX=xval(v1)*1000
    v1scaled=abChangeXAxis(v1 scaledX)
    plot(v1scaled v2)

    This is using this code:

    /* abChangeXAxis.il
    
    Author     A.D.Beckett
    Group      Custom IC (UK), Cadence Design Systems Ltd.
    Language   SKILL
    Date       May 25, 1999 
    Modified   May 21, 2002 
    By         A.D.Beckett
    
    Function to change the X Axis of a waveform to the corresponding
    Y values of the second variable.
    
    Also function to transpose the X and Y axes of a waveform.
    
    Now handles families, and can be registered as a special function.
    Just call:
    
    abRegChangeXAxis()
    
    to add to the calculator.
    
    ***************************************************
    
    SCCS Info: @(#) abChangeXAxis.il 11/27/08.09:59:36 1.3
    
    */
    
    /*******************************************************************
    *                                                                  *
    *                    (abChangeXAxis yVar xVar)                     *
    *                                                                  *
    * Return a new waveform object with the x axis set to the y values *
    *                     of the second argument.                      *
    *                                                                  *
    *******************************************************************/
    
    (procedure (abChangeXAxis yVar xVar)
      (let (newWave)
        (cond
          ;------------------------------------------------------------------
          ; Handle normal waveform
          ;------------------------------------------------------------------
          ((drIsWaveform yVar)
           (setq newWave (drCreateEmptyWaveform))
           (drPutWaveformXVec newWave (drGetWaveformYVec xVar))
           (if (eq (drGetWaveformXVec yVar) (drGetWaveformXVec xVar))
             ;---------------------------------------------------------------
             ; if the x axes are the same for both, it's simple
             ;---------------------------------------------------------------
             (drPutWaveformYVec newWave (drGetWaveformYVec yVar))
             ;---------------------------------------------------------------
             ; otherwise need to use value() to interpolate
             ;---------------------------------------------------------------
             (let (xVec yVec len)
               (setq xVec (drGetWaveformXVec xVar))
               (setq len (drVectorLength xVec))
               (setq yVec (drCreateVec (drGetWaveformYType yVar) len))
               (for ind 0 (sub1 len)
                    (drAddElem yVec (value yVar (drGetElem xVec ind)))
                    )
               (drPutWaveformYVec newWave yVec)
               )
             )
           newWave
           )
          ;------------------------------------------------------------------
          ; Handle family
          ;------------------------------------------------------------------
          ((famIsFamily yVar)
           (famMap 'abChangeXAxis yVar xVar)
           ) ; is family
          (t
            (error "abChangeXAxis - can't handle %L\n" yVar)
            )
          ) ; cond
        ) ; let
      ) ; defun
    
    /**********************************************************************
    *                                                                     *
    *                         (abRegChangeXAxis)                          *
    *                                                                     *
    * Registers abChangeXAxis as a new special function in the calculator *
    *                                                                     *
    **********************************************************************/
    
    (procedure (abRegChangeXAxis)
      (calRegisterSpecialFunction
        (list "abChangeXAxis" 'abChangeXAxisCB)
        )
      t
      )
    
    /***************************************************************************
    *                                                                          *
    *                            (abChangeXAxisCB)                             *
    *                                                                          *
    * Callback function for the special function - which builds the expression *
    *                                                                          *
    ***************************************************************************/
    
    (procedure (abChangeXAxisCB)
      (calSpecialFunctionInput 'abChangeXAxis '(STACK))
      )
    
    /***************************************************************
    *                                                              *
    *                     (abTransposeXY var)                      *
    *                                                              *
    *             Swap the X and Y axes of a variable              *
    *                                                              *
    ***************************************************************/
    
    (procedure (abTransposeXY var)
      (let (newWave)
           (setq newWave (drCreateEmptyWaveform))
           (drPutWaveformXVec newWave (drGetWaveformYVec var))
           (drPutWaveformYVec newWave (drGetWaveformXVec var))
           newWave
           )
      )
    

     

    IC61X has a function (ocnYvsY) for doing this kind of plot directly.

    Regards,

    Andrew.

    • 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