forked from M-Labs/artiq
1
0
Fork 0

fir: different adder layout

This commit is contained in:
Robert Jördens 2016-12-14 00:01:45 +01:00
parent 61abd994e9
commit 93076b8efa
1 changed files with 5 additions and 4 deletions

View File

@ -102,18 +102,19 @@ class ParallelFIR(Module):
for j in range(p):
# Make products
o = []
o = Signal((width + shift, True))
for i, c in enumerate(coefficients):
# simplify for halfband and symmetric filters
if c == 0 or c in coefficients[i + 1:]:
continue
m = Signal((width + shift, True))
m = Signal.like(o)
self.sync += m.eq(c*reduce(add, [
xj for xj, cj in zip(x[-1 - j::-1], coefficients) if cj == c
]))
o.append(m)
o0, o = o, Signal.like(o)
self.comb += o.eq(o0 + m)
# Make sum
self.sync += self.o[j].eq(reduce(add, o) >> shift)
self.sync += self.o[j].eq(o >> shift)
def halfgen4_cascade(rate, width, order=None):