mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
flow/actor/PipelinedActor: clean up
This commit is contained in:
parent
6aa1e0c199
commit
c2d6f14087
1 changed files with 11 additions and 9 deletions
|
@ -90,15 +90,17 @@ class PipelinedActor(BinaryActor):
|
||||||
BinaryActor.__init__(self, latency)
|
BinaryActor.__init__(self, latency)
|
||||||
|
|
||||||
def build_binary_control(self, stb_i, ack_o, stb_o, ack_i, latency):
|
def build_binary_control(self, stb_i, ack_o, stb_o, ack_i, latency):
|
||||||
valid = Signal(latency)
|
busy = 0
|
||||||
if latency > 1:
|
valid = stb_i
|
||||||
self.sync += If(self.pipe_ce, valid.eq(Cat(stb_i, valid[:latency-1])))
|
for i in range(latency):
|
||||||
else:
|
valid_n = Signal()
|
||||||
self.sync += If(self.pipe_ce, valid.eq(stb_i))
|
self.sync += If(self.pipe_ce, valid_n.eq(valid))
|
||||||
last_valid = valid[latency-1]
|
valid = valid_n
|
||||||
|
busy = busy | valid
|
||||||
|
|
||||||
self.comb += [
|
self.comb += [
|
||||||
self.pipe_ce.eq(ack_i | ~last_valid),
|
self.pipe_ce.eq(ack_i | ~valid),
|
||||||
ack_o.eq(self.pipe_ce),
|
ack_o.eq(self.pipe_ce),
|
||||||
stb_o.eq(last_valid),
|
stb_o.eq(valid),
|
||||||
self.busy.eq(optree("|", [valid[i] for i in range(latency)]))
|
self.busy.eq(busy)
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in a new issue