Skip to content

Fix CIC interpolator and add model/tests#1

Merged
catkira merged 4 commits into
masterfrom
feature/fix-cic-interpolator-ports
Feb 23, 2026
Merged

Fix CIC interpolator and add model/tests#1
catkira merged 4 commits into
masterfrom
feature/fix-cic-interpolator-ports

Conversation

@stschake

@stschake stschake commented Feb 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Fix cic_i.sv port/parameter mismatches with comb and integrator modules (named parameters/ports, uniform ACC_DW width, proper sign-extension and truncation)
  • Add CIC interpolator Python model (model/cic_i_model.py)
  • Add cocotb test (tests/test_cic_i.py) parameterized over R, N, M, and data width
  • Add standalone spectral analysis script (tests/spectral_analysis_cic_i.py) that visualizes image suppression vs CIC order (N=1..5) for a 5 kHz sine interpolated from 20 kHz to 80 kHz (R=4)
  • Pin cocotb<2 in requirements.txt to fix CI (test code uses cocotb 1.x APIs)

Test plan

  • CI passes (pytest tests/test_cic_d.py — 88 tests, 3 min)
  • Run pytest tests/test_cic_i.py to verify RTL matches Python model across parameter combinations
  • Run python tests/spectral_analysis_cic_i.py to verify spectral plots show increasing image suppression with higher N

🤖 Generated with Claude Code

The comb and integrator instantiations used positional parameters and
wrong port names that don't match their module definitions. Use named
parameters/ports and a uniform ACC_DW width for all internal stages.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@stschake stschake requested a review from catkira February 23, 2026 16:46
@catkira catkira added the bug Something isn't working label Feb 23, 2026
@catkira catkira self-assigned this Feb 23, 2026
catkira and others added 2 commits February 23, 2026 20:45
Add cic_i_model.py that models the RTL cic_i.sv behavior:
- Comb stages all fire simultaneously on in_dv (matching RTL wiring)
- Integrator accumulators use modular arithmetic (ACC_DW-bit wrapping)
- Output truncation matches RTL bit-select: int_out[ACC_DW-1 -: OUT_DW]

Add test_cic_i.py with parametrized cocotb tests covering:
- r ∈ {4, 10}, m ∈ {3, 6}, g ∈ {1, 2}, dw ∈ {8, 16} (16 combinations)

Minor: remove trailing semicolon in cic_d_model.py.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Standalone script that feeds a 5 kHz sine (20 kHz sample rate) through
the CIC interpolator model with R=4, plotting input and output spectra
for N=1..5 to visualize image suppression vs CIC order.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@catkira catkira changed the title Fix cic_i.sv port/parameter mismatches Fix CIC interpolator and add model/tests Feb 23, 2026
The test code uses cocotb 1.x APIs (cocotb.fork, Task.kill). Pin
cocotb<2 in requirements.txt so CI installs a compatible version.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@catkira catkira force-pushed the feature/fix-cic-interpolator-ports branch from 874d79f to 2f805c9 Compare February 23, 2026 21:06
@catkira catkira merged commit fc36526 into master Feb 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants