• 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. Convert Digital Bus to an Integer value - Calculator Vi...

Stats

  • Locked Locked
  • Replies 10
  • Subscribers 125
  • Views 19480
  • 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

Convert Digital Bus to an Integer value - Calculator Viva

FAwqati
FAwqati over 7 years ago

I would like to check the integer output of a decoder matches the integer value i set using the busset instance that drives the decoder.

ive tried using awvDigital2Analog() and numConv() but just cant get it to work.

Is there a function to convert the bus vector to a string or simply an easy way to achieve the above ?

Thanks 

Faisal

  • Cancel
Parents
  • FAwqati
    FAwqati over 7 years ago

    FYI,  i failed to get either of the suggestions in the following solution to work:

    How to get the decimal value of a digital bus at a given time point

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Dimitra Papazoglou
    Dimitra Papazoglou over 7 years ago in reply to FAwqati

    Hi Faisal,

     Can you give more details of what went wrong trying the above solution? I just tried using expr numConv(value(VT("a<0:3>") 400n ) "dec" t) and it works fine for me. 

    How your expression looks like and what kind of error you get if any? If it's an eval error you can probably do RMB->Job Log to get more details.

    Regards,

    Dimitra

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • FAwqati
    FAwqati over 7 years ago in reply to Dimitra Papazoglou

    Hi Dimitra,

    i modified your expression to the following = numConv(value(VT("/vin<0:3>") 0) "dec" t)

    i get the following output in CIW =

    expression evaluation failed: val is not legal.
    expression evaluation failed: numConv(value(VT("/vin<0:3>") 0) "dec" t)
    ("Exception" 1 t nil ("*Error* Exception: SKILL ERROR" nil))

    FYI, 

    the value() returns correctly but the numConv does NOT.

    also im using the 617 with latest hotfixes

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Dimitra Papazoglou
    Dimitra Papazoglou over 7 years ago in reply to FAwqati

    Hi Faisal,

     What value(VT("/vin<0:3>") 0) returns?

    Regards,

    Dimitra

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • FAwqati
    FAwqati over 7 years ago in reply to Dimitra Papazoglou

    Hi Dimitra,

    it returns a list of analog values for each bit

    vin<0> 0

    vin<1> 1.2

    etc ..

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

    Faisal,

    That's because your bus is an analog bus. If I convert it to digital, it works for me:

    numConv(value(awvCreateBus("opBus" list(awvAnalog2Digital(leafValue(VT("/op<5:0>") "bit" "/op<5>") nil nil 0.6 nil "centre") awvAnalog2Digital(leafValue(VT("/op<5:0>") "bit" "/op<4>") nil nil 0.6 nil "centre") awvAnalog2Digital(leafValue(VT("/op<5:0>") "bit" "/op<3>") nil nil 0.6 nil "centre") awvAnalog2Digital(leafValue(VT("/op<5:0>") "bit" "/op<2>") nil nil 0.6 nil "centre") awvAnalog2Digital(leafValue(VT("/op<5:0>") "bit" "/op<1>") nil nil 0.6 nil "centre") awvAnalog2Digital(leafValue(VT("/op<5:0>") "bit" "/op<0>") nil nil 0.6 nil "centre") ) "Binary") 0) "dec" t)

    The expression is a bit like War and Peace because it needs to take the analog bus, pull out the individual member (using leafValue) for each bit, and then use awvAnalog2Digital to convert it into a digital bus. I then find the value of this at time 0, and then use numConv to convert to decimal. For me I used bussetp and set the bus to 23 and the above expression also gives me 23.

    I didn't write the above expression by hand. I plotted VT("/op<5:0>") and then selected the 6 member bits in the graph, and did Measurements->Analog to Digital, set my threshold, made sure the bits are in the right order, and said I wanted to make a bus. Then having done that, I selected the digital bus and sent it to the calculator and used value and numConv on the result.

    Regards,

    Andrew.

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

    Good morning Andrew,

    thanks for the thorough feedback.as always much appreciated.

    we encounter this scenario often, and i think we would really benefit from this being a custom calculator defined function.

    Any chance you have some bandwidth to help me with this ?

    Cheers,

    Faisal

    Ps.

    value(analog2Digital(VT("/vin<8:0>") "center" ?vCenter (VAR("vdd12") / 2)) 0)  "dec" t) 0) 

    returns the correct binary list. If there was a way to convert this list into a string, couldnt we pass the string to numConv() ?

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

    Hi Faisal,

    I'll try to find some time to do this. The value function you show above seems to give a waveform with the x-axis being the bit, so it's not quite what you want. Anyway, I'll think about it - hopefully I'll have a bit of time in the next week or so.

    Andrew. 

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

    Hi Faisal,

    I had a few minutes on a plane yesterday (I know how to have fun!), so I threw this together. It needs the code from this post too (I made life easier for myself by reusing some of that code).

    To use it, use the "fx" button in the calculator function panel and navigate to the file - it will add the calculator UI too which works just like analog2Digital. See the comments at the top for an example usage.

    /* abA2DBus.il
    
    Author     A.D.Beckett
    Group      Custom IC (UK), Cadence Design Systems Ltd.
    Language   SKILL
    Date       Jun 20, 2018 
    Modified   May 13, 2023 
    By         A.D.Beckett
    
    Function to convert an analog bus to a digital bus. For example:
    
    numConv(value(abA2DBus(VT("/op<5:0>")  "center" ?vCenter 0.6) 0 ) "dec" t)
    
    Outputs the decimal value of the bus at time 0.
    
    Can be installed in the calculator using the fx button in the function
    panel, or the + button in the expresson builder
    
    ***************************************************
    
    SCCS Info: @(#) abA2DBus.il 05/13/23.15:29:40 1.2
    
    */
    
    /*********************************************************************
    *                                                                    *
    * abA2DBus(analogBus thresholdType [?radix radix] [?vCenter vCenter] *
    *              [?vHigh vHigh] [?vLow  vlow] [?timeX 1])              *
    *                                                                    *
    *  Function similar to analog2Digital except will work on an analog  *
    *                   bus and return a digital bus.                    *
    *                                                                    *
    *********************************************************************/
    
    procedure(abA2DBus(analogBus @key (radix "Hex") @rest args)
        awvCreateBus(
            "Bus"
            apply('analog2Digital
                abUnwrapFamily(analogBus)~>wave
                args
            )
            radix
        )
    )
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;; GUI builder information ;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ocnmRegGUIBuilder(
      '(nil
        function abA2DBus
        name abA2DBus
        description "Returns the digital form of an analog bus waveform"
        category ("Custom Functions")
        analysis (nil
                  general  (nil
                       format ("abA2DBus(%s %s)" signal thresholdType)
                       signals (nil
                                signal (nil
                                        prompt "Waveform"
                                        tooltip "Input waveform"
                                        )
                       )
                       params (nil
                               radix (nil
                                         prompt "Radix"
                                         tooltip "The radix of the bus"
                                         default "Hex"
                                         required t
                                         keyed t
                                         guiRowHint 1
                                         type ("Hex" "Octal" "Binary" "Ascii" "Signed Decimal" "Unsigned Decimal")
                                         )
                               thresholdType (nil
                                         prompt "Logic Threshold"
                                         tooltip "Logic Threshold."
                                         required t
                                         default "hilo"
                                         type (("hilo" (" \"hilo\" ?radix %s ?vHigh %s ?vLow %s ?timeX %s" radix vHigh vLow timeX)) 
                                             ("center" (" \"center\" ?radix %s ?vCenter %s" radix vCenter)))
                                         guiRowHint 2
                                         guiEnableHint ((vHigh "hilo") (vLow "hilo") (timeX "hilo") (vCenter "center"))
                                         )
                              vHigh (nil
                                         prompt "Voltage High/Low"
                                         tooltip "Any value higher than this is high state."
                                         default nil
                                         guiRowHint 3
                                         required nil
                                         keyed t
                                         type float)
                               vLow (nil
                                         prompt ""
                                         tooltip "Any value lower than this is low state."
                                         default nil
                                         guiRowHint 3
                                         required nil
                                         keyed t
                                         type float)
                               vCenter (nil
                                         prompt "Center Voltage"
                                         tooltip "Any value higher than this value is high state, and lower than this is low state."
                                         default nil
                                         guiRowHint 4
                                         required nil
                                         keyed t
                                         type float)
                               timeX (nil
                                         prompt "Time to X"
                                         tooltip "The minimum duration of analog signal between vHigh and vLow. It is used to determine logic X."
                                         default 1
                                         required nil
                                         keyed t
                                         guiRowHint 5
                                         type float)
                       )
                       inputrange t
                       )
        )
        outputs (result)
       )
    )
    

    Regards,

    Andrew.

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

    Hi Faisal,

    I had a few minutes on a plane yesterday (I know how to have fun!), so I threw this together. It needs the code from this post too (I made life easier for myself by reusing some of that code).

    To use it, use the "fx" button in the calculator function panel and navigate to the file - it will add the calculator UI too which works just like analog2Digital. See the comments at the top for an example usage.

    /* abA2DBus.il
    
    Author     A.D.Beckett
    Group      Custom IC (UK), Cadence Design Systems Ltd.
    Language   SKILL
    Date       Jun 20, 2018 
    Modified   May 13, 2023 
    By         A.D.Beckett
    
    Function to convert an analog bus to a digital bus. For example:
    
    numConv(value(abA2DBus(VT("/op<5:0>")  "center" ?vCenter 0.6) 0 ) "dec" t)
    
    Outputs the decimal value of the bus at time 0.
    
    Can be installed in the calculator using the fx button in the function
    panel, or the + button in the expresson builder
    
    ***************************************************
    
    SCCS Info: @(#) abA2DBus.il 05/13/23.15:29:40 1.2
    
    */
    
    /*********************************************************************
    *                                                                    *
    * abA2DBus(analogBus thresholdType [?radix radix] [?vCenter vCenter] *
    *              [?vHigh vHigh] [?vLow  vlow] [?timeX 1])              *
    *                                                                    *
    *  Function similar to analog2Digital except will work on an analog  *
    *                   bus and return a digital bus.                    *
    *                                                                    *
    *********************************************************************/
    
    procedure(abA2DBus(analogBus @key (radix "Hex") @rest args)
        awvCreateBus(
            "Bus"
            apply('analog2Digital
                abUnwrapFamily(analogBus)~>wave
                args
            )
            radix
        )
    )
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;; GUI builder information ;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ocnmRegGUIBuilder(
      '(nil
        function abA2DBus
        name abA2DBus
        description "Returns the digital form of an analog bus waveform"
        category ("Custom Functions")
        analysis (nil
                  general  (nil
                       format ("abA2DBus(%s %s)" signal thresholdType)
                       signals (nil
                                signal (nil
                                        prompt "Waveform"
                                        tooltip "Input waveform"
                                        )
                       )
                       params (nil
                               radix (nil
                                         prompt "Radix"
                                         tooltip "The radix of the bus"
                                         default "Hex"
                                         required t
                                         keyed t
                                         guiRowHint 1
                                         type ("Hex" "Octal" "Binary" "Ascii" "Signed Decimal" "Unsigned Decimal")
                                         )
                               thresholdType (nil
                                         prompt "Logic Threshold"
                                         tooltip "Logic Threshold."
                                         required t
                                         default "hilo"
                                         type (("hilo" (" \"hilo\" ?radix %s ?vHigh %s ?vLow %s ?timeX %s" radix vHigh vLow timeX)) 
                                             ("center" (" \"center\" ?radix %s ?vCenter %s" radix vCenter)))
                                         guiRowHint 2
                                         guiEnableHint ((vHigh "hilo") (vLow "hilo") (timeX "hilo") (vCenter "center"))
                                         )
                              vHigh (nil
                                         prompt "Voltage High/Low"
                                         tooltip "Any value higher than this is high state."
                                         default nil
                                         guiRowHint 3
                                         required nil
                                         keyed t
                                         type float)
                               vLow (nil
                                         prompt ""
                                         tooltip "Any value lower than this is low state."
                                         default nil
                                         guiRowHint 3
                                         required nil
                                         keyed t
                                         type float)
                               vCenter (nil
                                         prompt "Center Voltage"
                                         tooltip "Any value higher than this value is high state, and lower than this is low state."
                                         default nil
                                         guiRowHint 4
                                         required nil
                                         keyed t
                                         type float)
                               timeX (nil
                                         prompt "Time to X"
                                         tooltip "The minimum duration of analog signal between vHigh and vLow. It is used to determine logic X."
                                         default 1
                                         required nil
                                         keyed t
                                         guiRowHint 5
                                         type float)
                       )
                       inputrange t
                       )
        )
        outputs (result)
       )
    )
    

    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