Created
February 15, 2026 13:48
-
-
Save LIMPIX31/f33475238d7f2d6c99d6e65b6e1d761f to your computer and use it in GitHub Desktop.
PI Filter for DPLL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module pi_filter # | |
| ( parameter DW = 10 | |
| , parameter KP = 4 | |
| , parameter KI = 6 | |
| ) | |
| ( input logic clk | |
| , input logic rst | |
| , input logic i_valid | |
| , output logic o_valid | |
| , input logic signed [DW-1:0] i | |
| , output logic signed [DW-1:0] o | |
| ); | |
| logic signed [DW-1:0] acc; | |
| always_ff @(posedge clk) begin | |
| if (rst) begin | |
| acc <= 0; | |
| o <= 0; | |
| end else if (i_valid) begin | |
| acc <= acc + i; | |
| o <= (acc >>> KI) + (i >>> KP); | |
| end | |
| end | |
| always_ff @(posedge clk) begin | |
| o_valid <= i_valid; | |
| end | |
| endmodule |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment