soc/interconnect: rename stream_packet to packet & cleanup (with retro-compat)
This commit is contained in:
parent
59bf04d965
commit
427d7af767
|
@ -1,6 +1,11 @@
|
||||||
import sys
|
import sys
|
||||||
from litex.tools.litex_client import RemoteClient
|
|
||||||
|
# retro-compat 2019-09-30
|
||||||
|
from litex.soc.interconnect import packet
|
||||||
|
sys.modules["litex.soc.interconnect.stream_packet"] = packet
|
||||||
|
|
||||||
# retro-compat 2019-09-29
|
# retro-compat 2019-09-29
|
||||||
from litex.soc.integration import export
|
from litex.soc.integration import export
|
||||||
sys.modules["litex.soc.integration.cpu_interface"] = export
|
sys.modules["litex.soc.integration.cpu_interface"] = export
|
||||||
|
|
||||||
|
from litex.tools.litex_client import RemoteClient
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# This file is Copyright (c) 2015-2018 Florent Kermarrec <florent@enjoy-digital.fr>
|
# This file is Copyright (c) 2015-2019 Florent Kermarrec <florent@enjoy-digital.fr>
|
||||||
# License: BSD
|
# License: BSD
|
||||||
|
|
||||||
from migen import *
|
from migen import *
|
||||||
|
@ -10,31 +10,31 @@ from litex.gen import *
|
||||||
|
|
||||||
from litex.soc.interconnect import stream
|
from litex.soc.interconnect import stream
|
||||||
|
|
||||||
# TODO: clean up code below
|
# Status -------------------------------------------------------------------------------------------
|
||||||
# XXX
|
|
||||||
|
|
||||||
class Status(Module):
|
class Status(Module):
|
||||||
def __init__(self, endpoint):
|
def __init__(self, endpoint):
|
||||||
self.first = first = Signal(reset=1)
|
self.first = Signal(reset=1)
|
||||||
self.last = last = Signal()
|
self.last = Signal()
|
||||||
self.ongoing = Signal()
|
self.ongoing = Signal()
|
||||||
|
|
||||||
ongoing = Signal()
|
ongoing = Signal()
|
||||||
self.comb += \
|
self.comb += \
|
||||||
If(endpoint.valid,
|
If(endpoint.valid,
|
||||||
last.eq(endpoint.last & endpoint.ready)
|
self.last.eq(endpoint.last & endpoint.ready)
|
||||||
)
|
)
|
||||||
self.sync += ongoing.eq((endpoint.valid | ongoing) & ~last)
|
self.sync += ongoing.eq((endpoint.valid | ongoing) & ~self.last)
|
||||||
self.comb += self.ongoing.eq((endpoint.valid | ongoing) & ~last)
|
self.comb += self.ongoing.eq((endpoint.valid | ongoing) & ~self.last)
|
||||||
|
|
||||||
self.sync += [
|
self.sync += [
|
||||||
If(last,
|
If(self.last,
|
||||||
first.eq(1)
|
self.first.eq(1)
|
||||||
).Elif(endpoint.valid & endpoint.ready,
|
).Elif(endpoint.valid & endpoint.ready,
|
||||||
first.eq(0)
|
self.first.eq(0)
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Arbiter ------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
class Arbiter(Module):
|
class Arbiter(Module):
|
||||||
def __init__(self, masters, slave):
|
def __init__(self, masters, slave):
|
||||||
|
@ -54,6 +54,7 @@ class Arbiter(Module):
|
||||||
cases[i] = [master.connect(slave)]
|
cases[i] = [master.connect(slave)]
|
||||||
self.comb += Case(self.grant, cases)
|
self.comb += Case(self.grant, cases)
|
||||||
|
|
||||||
|
# Dispatcher ---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
class Dispatcher(Module):
|
class Dispatcher(Module):
|
||||||
def __init__(self, master, slaves, one_hot=False):
|
def __init__(self, master, slaves, one_hot=False):
|
||||||
|
@ -95,6 +96,7 @@ class Dispatcher(Module):
|
||||||
cases["default"] = [master.ready.eq(1)]
|
cases["default"] = [master.ready.eq(1)]
|
||||||
self.comb += Case(sel, cases)
|
self.comb += Case(sel, cases)
|
||||||
|
|
||||||
|
# Header -------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
class HeaderField:
|
class HeaderField:
|
||||||
def __init__(self, byte, offset, width):
|
def __init__(self, byte, offset, width):
|
||||||
|
@ -149,6 +151,7 @@ class Header:
|
||||||
r.append(field.eq(signal[start:end]))
|
r.append(field.eq(signal[start:end]))
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
# Packetizer ---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
class Packetizer(Module):
|
class Packetizer(Module):
|
||||||
def __init__(self, sink_description, source_description, header):
|
def __init__(self, sink_description, source_description, header):
|
||||||
|
@ -196,7 +199,7 @@ class Packetizer(Module):
|
||||||
if header_words == 1:
|
if header_words == 1:
|
||||||
idle_next_state = "COPY"
|
idle_next_state = "COPY"
|
||||||
else:
|
else:
|
||||||
idle_next_state = "SEND_HEADER"
|
idle_next_state = "SEND-HEADER"
|
||||||
|
|
||||||
fsm.act("IDLE",
|
fsm.act("IDLE",
|
||||||
sink.ready.eq(1),
|
sink.ready.eq(1),
|
||||||
|
@ -213,7 +216,7 @@ class Packetizer(Module):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
if header_words != 1:
|
if header_words != 1:
|
||||||
fsm.act("SEND_HEADER",
|
fsm.act("SEND-HEADER",
|
||||||
source.valid.eq(1),
|
source.valid.eq(1),
|
||||||
source.last.eq(0),
|
source.last.eq(0),
|
||||||
source.data.eq(header_reg[dw:2*dw]),
|
source.data.eq(header_reg[dw:2*dw]),
|
||||||
|
@ -239,6 +242,7 @@ class Packetizer(Module):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Depacketizer -------------------------------------------------------------------------------------
|
||||||
|
|
||||||
class Depacketizer(Module):
|
class Depacketizer(Module):
|
||||||
def __init__(self, sink_description, source_description, header):
|
def __init__(self, sink_description, source_description, header):
|
||||||
|
@ -323,5 +327,3 @@ class Depacketizer(Module):
|
||||||
NextState("IDLE")
|
NextState("IDLE")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
# XXX
|
|
Loading…
Reference in New Issue