• 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. Mixed-Signal Design
  3. Modulo operation in a decimal-to-binary converter

Stats

  • Locked Locked
  • Replies 2
  • Subscribers 64
  • Views 20566
  • 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

Modulo operation in a decimal-to-binary converter

mixic
mixic over 8 years ago

I'd like to create a simulation device which converts an integer that is passed through as a parameter "_N" into a 8-bit bus. The plan is to use a vdc battery, and bit 0 is fairly simple (pPar("_N")%2).

For bit 1 I tried ((pPar("_N")-(pPar("_N")%2))%2), but it caused a fatal error  

Unexpected character `%' in netlist.

Unexpected integer "2". Expected close parenthesis

By changing the formula to (pPar("_N")-(pPar("_N")%2)), the simulation turned out OK. 

So why is the second modulo operation not accepted?

Thanks in advance!

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 8 years ago

    Percent (%) is not a valid AEL (Analog Expression Language) nor spectre operator (see the AEL documentation and "spectre -h expressions").

    Instead, I'd suggest you use pPar("_N")&1 or if you want to detect a different bit something like use (pPar("_N")&4)>>2 (this will detect nnnn1nn).

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • mixic
    mixic over 8 years ago
    Thanks Andrew. I just found fmod() would do the job for me.
    • 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