• 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. Moving average offset in verilogA

Stats

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

Moving average offset in verilogA

jorgevdelacruzN
jorgevdelacruzN over 4 years ago

Hi,

I'm using the "11277434" solution to implement a moving average function on verilogA but the problem is that I'm always getting a different offset on the simulations. Is there any way to cancel this offset? I saw that in the new version of the function for the viva calculator this problem, with the offset, was solved. Unfortunately, I can't migrate the skill code into verilogA. Do you have any suggestions to avoid the offset issue in the verilogA code?

verilogA Code:

parameter    real    gain=1.0;
parameter    real    time_window= 1u from (0:inf);

real x, k1;

analog begin

    @(initial_step) k1 = gain/time_window;

    x    =    k1*(V(in)- absdelay(V(in),time_window));
    V(out) <+  idt(x,0.0);
end
endmodule

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 4 years ago

    The article Moving Average Function in OCEAN/calculator went through quite a bit of refinement to improve it with respect to getting the DC level correct (took a few attempts for me to get it right). I've never had the opportunity to try to do the same with the Verilog-A (it's quite hard because it uses a piecewise strategy of combining the results together in the calculator function to ensure that the startup behaviour doesn't break anything).

    Unfortunately it's unlikely I'd have time to revisit the moving average Verilog-A to see if this can be addressed soon (the Verilog-A article was written by another colleague many years ago). This is one of those things you just need to sit in a quiet room and think carefully about - quiet rooms are in short supply at the moment!

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • slim15
    slim15 over 3 years ago

    I found the verilogA and also encountered the offset issue. In my application I was able to work around it by first determining the initial offset at time=0 and used it to calculate the integral

    parameter    real    gain=1.0;
    parameter    real    time_window= 1u from (0:inf);

    real x, k1;

    real y0;

    analog begin

        @(initial_step) begin

          k1 = gain/time_window;

         y0 = V(in);

        end

        x    =    k1*(V(in)- absdelay(V(in),time_window));
        V(out) <+  y0 + idt(x,0.0);
    end
    endmodule

    • 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