packet: Switch to LiteX/Module.
This commit is contained in:
parent
8a3534f84f
commit
f3d08e589b
|
@ -9,13 +9,15 @@
|
||||||
from math import log2
|
from math import log2
|
||||||
|
|
||||||
from migen import *
|
from migen import *
|
||||||
|
|
||||||
from litex.gen import *
|
from litex.gen import *
|
||||||
|
|
||||||
from litex.soc.interconnect.packet import Header, HeaderField
|
from litex.soc.interconnect.packet import Header, HeaderField
|
||||||
from litex.soc.interconnect import stream
|
from litex.soc.interconnect import stream
|
||||||
|
|
||||||
# Packetizer ---------------------------------------------------------------------------------------
|
# Packetizer ---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
class Packetizer(Module):
|
class Packetizer(LiteXModule):
|
||||||
def __init__(self, sink_description, source_description, header):
|
def __init__(self, sink_description, source_description, header):
|
||||||
self.sink = sink = stream.Endpoint(sink_description)
|
self.sink = sink = stream.Endpoint(sink_description)
|
||||||
self.source = source = stream.Endpoint(source_description)
|
self.source = source = stream.Endpoint(source_description)
|
||||||
|
@ -48,7 +50,7 @@ class Packetizer(Module):
|
||||||
source_last_s = Signal()
|
source_last_s = Signal()
|
||||||
|
|
||||||
# FSM.
|
# FSM.
|
||||||
self.submodules.fsm = fsm = FSM(reset_state="IDLE")
|
self.fsm = fsm = FSM(reset_state="IDLE")
|
||||||
fsm_from_idle = Signal()
|
fsm_from_idle = Signal()
|
||||||
fsm.act("IDLE",
|
fsm.act("IDLE",
|
||||||
sink.ready.eq(1),
|
sink.ready.eq(1),
|
||||||
|
@ -148,7 +150,7 @@ class Packetizer(Module):
|
||||||
|
|
||||||
# FSM used to conveniently assign combinational and synchronous
|
# FSM used to conveniently assign combinational and synchronous
|
||||||
# signals in the same context.
|
# signals in the same context.
|
||||||
self.submodules.last_be_fsm = last_be_fsm = FSM(reset_state="DEFAULT")
|
self.last_be_fsm = last_be_fsm = FSM(reset_state="DEFAULT")
|
||||||
|
|
||||||
# Whether the main FSM is in one of the DATA-COPY states. This is
|
# Whether the main FSM is in one of the DATA-COPY states. This is
|
||||||
# important as we overwrite sink.ready below and need to have
|
# important as we overwrite sink.ready below and need to have
|
||||||
|
@ -211,7 +213,7 @@ class Packetizer(Module):
|
||||||
|
|
||||||
# Depacketizer -------------------------------------------------------------------------------------
|
# Depacketizer -------------------------------------------------------------------------------------
|
||||||
|
|
||||||
class Depacketizer(Module):
|
class Depacketizer(LiteXModule):
|
||||||
def __init__(self, sink_description, source_description, header):
|
def __init__(self, sink_description, source_description, header):
|
||||||
self.sink = sink = stream.Endpoint(sink_description)
|
self.sink = sink = stream.Endpoint(sink_description)
|
||||||
self.source = source = stream.Endpoint(source_description)
|
self.source = source = stream.Endpoint(source_description)
|
||||||
|
@ -249,7 +251,7 @@ class Depacketizer(Module):
|
||||||
source_last_s = Signal()
|
source_last_s = Signal()
|
||||||
|
|
||||||
# FSM.
|
# FSM.
|
||||||
self.submodules.fsm = fsm = FSM(reset_state="IDLE")
|
self.fsm = fsm = FSM(reset_state="IDLE")
|
||||||
fsm_from_idle = Signal()
|
fsm_from_idle = Signal()
|
||||||
fsm.act("IDLE",
|
fsm.act("IDLE",
|
||||||
sink.ready.eq(1),
|
sink.ready.eq(1),
|
||||||
|
@ -346,7 +348,7 @@ class Depacketizer(Module):
|
||||||
|
|
||||||
# FSM used to conveniently assign combinational and synchronous
|
# FSM used to conveniently assign combinational and synchronous
|
||||||
# signals in the same context.
|
# signals in the same context.
|
||||||
self.submodules.last_be_fsm = last_be_fsm = FSM(reset_state="DEFAULT")
|
self.last_be_fsm = last_be_fsm = FSM(reset_state="DEFAULT")
|
||||||
|
|
||||||
# Whether the main FSM is / was in one of the DATA-COPY states. This
|
# Whether the main FSM is / was in one of the DATA-COPY states. This
|
||||||
# is important as we must handle a special case when last is
|
# is important as we must handle a special case when last is
|
||||||
|
|
Loading…
Reference in New Issue