forked from M-Labs/artiq
fir: size hint for pre-adder
This commit is contained in:
parent
f310274e39
commit
cfb66117af
|
@ -83,7 +83,10 @@ class FIR(Module):
|
||||||
else:
|
else:
|
||||||
self.comb += o0.eq(o + m)
|
self.comb += o0.eq(o + m)
|
||||||
assert js[0] - delay >= 0
|
assert js[0] - delay >= 0
|
||||||
self.sync += m.eq(c*reduce(add, [x[j - delay] for j in js]))
|
xs = [x[j - delay] for j in js]
|
||||||
|
s = Signal((bits_for(len(xs)) - 1 + len(xs[0]), True))
|
||||||
|
self.comb += s.eq(sum(xs))
|
||||||
|
self.sync += m.eq(c*s)
|
||||||
# symmetric rounding
|
# symmetric rounding
|
||||||
if shift:
|
if shift:
|
||||||
self.comb += o.eq((1 << shift - 1) - 1)
|
self.comb += o.eq((1 << shift - 1) - 1)
|
||||||
|
@ -136,7 +139,10 @@ class ParallelFIR(Module):
|
||||||
else:
|
else:
|
||||||
self.comb += o0.eq(o + m)
|
self.comb += o0.eq(o + m)
|
||||||
assert js[0] - delay >= 0
|
assert js[0] - delay >= 0
|
||||||
self.sync += m.eq(c*reduce(add, [x[j - delay] for j in js]))
|
xs = [x[j - delay] for j in js]
|
||||||
|
s = Signal((bits_for(len(xs)) - 1 + len(xs[0]), True))
|
||||||
|
self.comb += s.eq(sum(xs))
|
||||||
|
self.sync += m.eq(c*s)
|
||||||
# symmetric rounding
|
# symmetric rounding
|
||||||
if shift:
|
if shift:
|
||||||
self.comb += o.eq((1 << shift - 1) - 1)
|
self.comb += o.eq((1 << shift - 1) - 1)
|
||||||
|
|
Loading…
Reference in New Issue