1
0
Fork 0

pipeline GW: clean up variable naming

This commit is contained in:
morgan 2024-09-10 16:43:54 +08:00
parent d81c770e54
commit b2ce43155e
1 changed files with 28 additions and 28 deletions

View File

@ -52,11 +52,11 @@ class Code_Source(Module):
class Code_Inserter(Module):
def __init__(self, layout, insert_infront=True, counts=4):
self.sink = sink = stream.Endpoint(layout)
self.source = source = stream.Endpoint(layout)
self.sink = stream.Endpoint(layout)
self.source = stream.Endpoint(layout)
self.data = Signal.like(sink.data)
self.k = Signal.like(sink.k)
self.data = Signal.like(self.sink.data)
self.k = Signal.like(self.sink.k)
# # #
assert counts > 0
@ -77,61 +77,61 @@ class Code_Inserter(Module):
if insert_infront:
fsm.act("IDLE",
sink.ack.eq(1),
self.sink.ack.eq(1),
clr_cnt.eq(1),
If(sink.stb,
sink.ack.eq(0),
If(self.sink.stb,
self.sink.ack.eq(0),
NextState("INSERT"),
)
)
fsm.act("INSERT",
sink.ack.eq(0),
source.stb.eq(1),
source.data.eq(self.data),
source.k.eq(self.k),
self.sink.ack.eq(0),
self.source.stb.eq(1),
self.source.data.eq(self.data),
self.source.k.eq(self.k),
If(cnt == counts - 1,
If(source.ack, NextState("COPY"))
If(self.source.ack, NextState("COPY"))
).Else(
inc_cnt.eq(source.ack)
inc_cnt.eq(self.source.ack)
)
)
fsm.act("COPY",
sink.connect(source),
If(sink.stb & sink.eop & source.ack,
self.sink.connect(self.source),
If(self.sink.stb & self.sink.eop & self.source.ack,
NextState("IDLE"),
)
)
else:
fsm.act("IDLE",
sink.ack.eq(1),
self.sink.ack.eq(1),
clr_cnt.eq(1),
If(sink.stb,
sink.ack.eq(0),
If(self.sink.stb,
self.sink.ack.eq(0),
NextState("COPY"),
)
)
fsm.act("COPY",
sink.connect(source),
source.eop.eq(0),
If(sink.stb & sink.eop & source.ack,
self.sink.connect(self.source),
self.source.eop.eq(0),
If(self.sink.stb & self.sink.eop & self.source.ack,
NextState("INSERT"),
)
)
fsm.act("INSERT",
sink.ack.eq(0),
source.stb.eq(1),
source.data.eq(self.data),
source.k.eq(self.k),
self.sink.ack.eq(0),
self.source.stb.eq(1),
self.source.data.eq(self.data),
self.source.k.eq(self.k),
If(cnt == counts - 1,
source.eop.eq(1),
If(source.ack, NextState("IDLE"))
self.source.eop.eq(1),
If(self.source.ack, NextState("IDLE"))
).Else(
inc_cnt.eq(source.ack)
inc_cnt.eq(self.source.ack)
),
)