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