core/multiplexer: synchronize ready on tXXDController and tFAWcontroller to improve timings
This commit is contained in:
parent
147466beec
commit
c1b1b07b3c
|
@ -1,5 +1,5 @@
|
||||||
from functools import reduce
|
from functools import reduce
|
||||||
from operator import or_, and_
|
from operator import add, or_, and_
|
||||||
|
|
||||||
from migen import *
|
from migen import *
|
||||||
from migen.genlib.roundrobin import *
|
from migen.genlib.roundrobin import *
|
||||||
|
@ -118,38 +118,49 @@ class _Steerer(Module):
|
||||||
|
|
||||||
class tXXDController(Module):
|
class tXXDController(Module):
|
||||||
def __init__(self, txxd):
|
def __init__(self, txxd):
|
||||||
self.valid = Signal()
|
self.valid = valid = Signal()
|
||||||
self.ready = Signal(reset=1)
|
self.ready = ready = Signal(reset=1)
|
||||||
|
ready.attr.add("no_retiming")
|
||||||
|
|
||||||
# # #
|
# # #
|
||||||
|
|
||||||
if txxd is not None:
|
if txxd is not None:
|
||||||
count = Signal(max=txxd+1)
|
count = Signal(max=txxd + 1)
|
||||||
self.sync += \
|
self.sync += \
|
||||||
If(self.valid,
|
If(valid,
|
||||||
count.eq(txxd-1)
|
count.eq(txxd - 1),
|
||||||
).Elif(~self.ready,
|
If((txxd - 1) == 0,
|
||||||
count.eq(count-1)
|
ready.eq(1)
|
||||||
|
).Else(
|
||||||
|
ready.eq(0)
|
||||||
|
)
|
||||||
|
).Elif(~ready,
|
||||||
|
count.eq(count - 1),
|
||||||
|
If(count == 1, ready.eq(1))
|
||||||
)
|
)
|
||||||
self.comb += self.ready.eq(count == 0)
|
|
||||||
|
|
||||||
|
|
||||||
class tFAWController(Module):
|
class tFAWController(Module):
|
||||||
def __init__(self, tfaw):
|
def __init__(self, tfaw):
|
||||||
self.valid = Signal()
|
self.valid = valid = Signal()
|
||||||
self.ready = Signal(reset=1)
|
self.ready = ready = Signal(reset=1)
|
||||||
|
ready.attr.add("no_retiming")
|
||||||
|
|
||||||
# # #
|
# # #
|
||||||
|
|
||||||
if tfaw is not None:
|
if tfaw is not None:
|
||||||
count = Signal(max=tfaw)
|
count = Signal(max=tfaw)
|
||||||
window = Signal(tfaw)
|
window = Signal(tfaw)
|
||||||
self.sync += window.eq(Cat(self.valid, window))
|
self.sync += window.eq(Cat(valid, window))
|
||||||
for i in range(tfaw):
|
self.comb += reduce(add, [window[i] for i in range(tfaw)])
|
||||||
next_count = Signal(max=tfaw)
|
self.sync += \
|
||||||
self.comb += next_count.eq(count + window[i])
|
If(count < 4,
|
||||||
count = next_count
|
If(count == 3,
|
||||||
self.comb += If(count >= 4, self.ready.eq(0))
|
ready.eq(~valid)
|
||||||
|
).Else(
|
||||||
|
ready.eq(1)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class Multiplexer(Module, AutoCSR):
|
class Multiplexer(Module, AutoCSR):
|
||||||
|
|
Loading…
Reference in New Issue