gateware: CIC defaults to the minimum resampling factor

This commit is contained in:
mndza 2026-06-03 10:12:36 +02:00
parent 74d0437e6b
commit e32695e24f
No known key found for this signature in database
GPG key ID: D6902E72B4601DD8
2 changed files with 4 additions and 1 deletions

Binary file not shown.

View file

@ -240,6 +240,7 @@ class ProgrammableShift(wiring.Component):
# Implement the map itself (should it be done outside?)
max_shift = max(self.shift_map.values())
min_shift = min(self.shift_map.values())
value_scaled = [ Signal(signed(self.width_in + max_shift)) for _ in range(self.num_channels) ]
scaled_valid = Signal()
@ -255,7 +256,9 @@ class ProgrammableShift(wiring.Component):
for k, v in self.shift_map.items():
with m.Case(k):
m.d.sync += value_scaled[c].eq(self.input.payload[c] << (max_shift - v))
with m.Default():
m.d.sync += value_scaled[c].eq(self.input.payload[c] << (max_shift - min_shift))
with m.If(~self.output.valid | self.output.ready):
m.d.comb += scaled_ready.eq(1)
m.d.sync += self.output.valid.eq(scaled_valid)