• 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. function for thermometric code from digital bus

Stats

  • Locked Locked
  • Replies 7
  • Subscribers 126
  • Views 3262
  • 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

function for thermometric code from digital bus

NewScreenName
NewScreenName 9 months ago

Hi all,


I have found this code to convert a bus into its decimal representation, which is quite useful: RE: Convert Digital Bus to an Integer value - Calculator Viva 
However it misses the option to take the bus as a thermometric code, Andrew Beckett  if you had the bandwidth, would it be possible to update the script accordingly?

What could also be useful would be (with lower priority than the previous thermometric feature) to have a function which re-converts this digital decimal output into an analog voltage (maybe with a scaling factor). This would allow some useful data processing (e.g. and ADC input voltage minus its digital output code).

In case you had the bandwidth to update it it would be greatly appreciated.

BR

  • Cancel
Parents
  • henker
    henker 8 months ago

    You can easily convert a number to the nearest thermo value, with e.g.
    floor(log( <number> )/log(2))+1

    This just looks at the highest bit and would thus also work for one-hot encoding. Other encodings of the bus value, e.g. gray code, could be handled similarly.
    If you, however, want error handling, e.g. doing some majority decision, or just check if all bits of the thermo sequence are set with e.g. !(<number> & (<number> + 1)), it will get a bit more complicated. But for this the question is not specific enough.


    For the second, to convert a digital waveform to an analog, you can use the Measurements > Digital To Analog in the ViVA menu, the corresponding skill function is awvDigital2Analog.

    Regards,

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • NewScreenName
    NewScreenName 8 months ago in reply to henker

    Thank you!

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett 8 months ago in reply to NewScreenName

    By the way, I didn't see the original post (there's a bug in the forums at the moment where some notifications are not being sent), but I think it's not trivial to adapt the code you reference to handle thermometer encoded data (particularly with the points that henker makes about error handling).

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • henker
    henker 8 months ago in reply to Andrew Beckett


    It might be an option to apply a separate bus conversion module e.g. in veriloga, which takes a thermo-coded bus as input and outputs the value as binary-coded bus. This can than be displayed with the existing functionality.
    There is an example for the opposite conversion on edaboard (look for verilog-a-model-for-binary-to-thermometer-decoder, the external link is classified as spam), which might be a good starting point.

    Regards,

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • henker
    henker 8 months ago in reply to Andrew Beckett


    It might be an option to apply a separate bus conversion module e.g. in veriloga, which takes a thermo-coded bus as input and outputs the value as binary-coded bus. This can than be displayed with the existing functionality.
    There is an example for the opposite conversion on edaboard (look for verilog-a-model-for-binary-to-thermometer-decoder, the external link is classified as spam), which might be a good starting point.

    Regards,

    • 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