core/multiplexer: fix count signal width (when max<2)

This commit is contained in:
Florent Kermarrec 2018-08-16 15:32:29 +02:00
parent ad8438f5d3
commit a215ac7d8b
1 changed files with 2 additions and 2 deletions

View File

@ -125,7 +125,7 @@ class tXXDController(Module):
# # #
if txxd is not None:
count = Signal(max=txxd + 1)
count = Signal(max=max(txxd, 2))
self.sync += \
If(valid,
count.eq(txxd - 1),
@ -149,7 +149,7 @@ class tFAWController(Module):
# # #
if tfaw is not None:
count = Signal(max=tfaw)
count = Signal(max=max(tfaw, 2))
window = Signal(tfaw)
self.sync += window.eq(Cat(valid, window))
self.comb += count.eq(reduce(add, [window[i] for i in range(tfaw)]))