summaryrefslogtreecommitdiff
path: root/cocotb_try/cic3_pdm.v
diff options
context:
space:
mode:
authorJon Nordby <jononor@gmail.com>2025-04-27 16:13:33 +0200
committerJon Nordby <jononor@gmail.com>2025-05-02 21:00:12 +0200
commit70818e9a7f83531270382900c54033f27e08c5f4 (patch)
treecb1070d0687af4d91b4d2b1b2207c1f3b719aef7 /cocotb_try/cic3_pdm.v
parentcb019a43f55e08aa4c12573270a32213c823e1cb (diff)
cocotb: Test and fix 1khz sine
Diffstat (limited to 'cocotb_try/cic3_pdm.v')
-rw-r--r--cocotb_try/cic3_pdm.v5
1 files changed, 3 insertions, 2 deletions
diff --git a/cocotb_try/cic3_pdm.v b/cocotb_try/cic3_pdm.v
index 1c8ba25..e350fda 100644
--- a/cocotb_try/cic3_pdm.v
+++ b/cocotb_try/cic3_pdm.v
@@ -7,10 +7,11 @@ module cic3_pdm (
input wire pdm_in, // 1-bit PDM data input
output wire signed [15:0] pcm_out, // Decimated PCM output
output wire pcm_valid, // High when pcm_out is valid
- output reg pdm_out
+ output reg pdm_out
);
parameter DECIMATION = 64; // Decimation factor
+ parameter OUTPUT_SHIFT = 8; // Can tune this
// Internal registers
reg signed [31:0] integrator_0 = 0;
@@ -60,7 +61,7 @@ module cic3_pdm (
// Bit-shift down to get 16-bit output (tune shift based on DECIMATION and stage count)
pdm_out <= pdm_in;
- pcm_out_r <= comb_2[31:16];
+ pcm_out_r <= comb_2[OUTPUT_SHIFT + 15 : OUTPUT_SHIFT];
pcm_valid_r <= 1;
end
end