• 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. VerilogA $abstime limitation to 2pi

Stats

  • Locked Locked
  • Replies 6
  • Subscribers 125
  • Views 10111
  • 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

VerilogA $abstime limitation to 2pi

Ajmal Hussian
Ajmal Hussian over 3 years ago

Hi,

I am developing a VeriolA module from which I want to get continuous angle in radian.

I am using the following code to get the angle

angle_in_rad = (current_velocity*$abstime + phi);

But I am facing a problem while limiting the value of abstime to 2pi.

Is it possible to limit $abstime to 2Pi? like the idt_mod operation.

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

    Create an analog function fmod like this (similar to the C function, but not part of the Verilog-A language):

    analog function real fmod;
        input num,den;
        real num,den;
        fmod=num-floor(num/den)*den;
    endfunction 
    
    analog begin
      angle_in_rad = fmod((current_velocity*$abstime + phi),`M_TWO_PI);
      $strobe(angle_in_rad);
    end
    

    That will do what you want, I think. I'm not sure it's the $abstime you want to limit to 2 pi, but the angle_in_rad (I assume)?

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Ajmal Hussian
    Ajmal Hussian over 3 years ago in reply to Andrew Beckett

    Thanks Andrew,

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Ajmal Hussian
    Ajmal Hussian over 3 years ago in reply to Andrew Beckett

    Thanks 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