common: move tXXDController to common

This commit is contained in:
John Sully 2018-10-10 17:27:58 +02:00
parent fef4701a45
commit bce411ec95
2 changed files with 24 additions and 24 deletions

View File

@ -167,3 +167,27 @@ def cmd_request_rw_layout(a, ba):
("is_read", 1),
("is_write", 1)
]
class tXXDController(Module):
def __init__(self, txxd):
self.valid = valid = Signal()
self.ready = ready = Signal(reset=1)
ready.attr.add("no_retiming")
# # #
if txxd is not None:
count = Signal(max=max(txxd, 2))
self.sync += \
If(valid,
count.eq(txxd-1),
If((txxd - 1) == 0,
ready.eq(1)
).Else(
ready.eq(0)
)
).Elif(~ready,
count.eq(count - 1),
If(count == 1, ready.eq(1))
)

View File

@ -133,30 +133,6 @@ class _Steerer(Module):
]
class tXXDController(Module):
def __init__(self, txxd):
self.valid = valid = Signal()
self.ready = ready = Signal(reset=1)
ready.attr.add("no_retiming")
# # #
if txxd is not None:
count = Signal(max=max(txxd, 2))
self.sync += \
If(valid,
count.eq(txxd-1),
If((txxd - 1) == 0,
ready.eq(1)
).Else(
ready.eq(0)
)
).Elif(~ready,
count.eq(count - 1),
If(count == 1, ready.eq(1))
)
class tFAWController(Module):
def __init__(self, tfaw):
self.valid = valid = Signal()