class SATACommandTX(Module):
def __init__(self, transport):
- self.sink = sink = Sink(command_tx_layout(32))
+ self.sink = sink = Sink(command_tx_description(32))
self.from_rx = Sink(from_rx)
###
class SATACommandRX(Module):
def __init__(self, transport):
- self.source = source = Source(command_tx_layout(32))
+ self.source = source = Source(command_tx_description(32))
self.to_tx = Source(from_rx)
###
return k
return ""
-def phy_layout(dw):
+def phy_description(dw):
layout = [
("data", dw),
("charisk", dw//8),
]
return EndpointDescription(layout, packetized=False)
-def link_layout(dw):
+def link_description(dw):
layout = [
("d", dw),
("error", 1)
"type": FISField(0, 0, 8)
}
-def transport_tx_layout(dw):
+def transport_tx_description(dw):
layout = [
("type", 8),
("pm_port", 4),
]
return EndpointDescription(layout, packetized=True)
-def transport_rx_layout(dw):
+def transport_rx_description(dw):
layout = [
("type", 8),
("pm_port", 4),
"IDENTIFY_DEVICE_DMA" : 0xEE
}
-def command_tx_layout(dw):
+def command_tx_description(dw):
layout = [
("write", 1),
("read", 1),
]
return EndpointDescription(layout, packetized=True)
-def command_rx_layout(dw):
+def command_rx_description(dw):
layout = [
("write", 1),
("read", 1),
class SATALinkTX(Module):
def __init__(self, phy):
- self.sink = Sink(link_layout(32))
+ self.sink = Sink(link_description(32))
self.from_rx = Sink(from_rx)
###
self.submodules += fsm
# insert CRC
- crc = SATACRCInserter(link_layout(32))
+ crc = SATACRCInserter(link_description(32))
self.submodules += crc
# scramble
- scrambler = SATAScrambler(link_layout(32))
+ scrambler = SATAScrambler(link_description(32))
self.submodules += scrambler
# connect CRC / scrambler
# inserter CONT and scrambled data between
# CONT and next primitive
- cont = SATACONTInserter(phy_layout(32))
+ cont = SATACONTInserter(phy_description(32))
self.submodules += cont
# datas / primitives mux
class SATALinkRX(Module):
def __init__(self, phy):
- self.source = Source(link_layout(32))
+ self.source = Source(link_description(32))
self.to_tx = Source(from_rx)
###
self.submodules += fsm
# CONT remover
- cont = SATACONTRemover(phy_layout(32))
+ cont = SATACONTRemover(phy_description(32))
self.submodules += cont
self.comb += Record.connect(phy.source, cont.sink)
)
# descrambler
- scrambler = SATAScrambler(link_layout(32))
+ scrambler = SATAScrambler(link_description(32))
self.submodules += scrambler
# check CRC
- crc = SATACRCChecker(link_layout(32))
+ crc = SATACRCChecker(link_description(32))
self.submodules += crc
sop = Signal()
)
# small fifo to manage HOLD
- self.submodules.fifo = SyncFIFO(link_layout(32), 32)
+ self.submodules.fifo = SyncFIFO(link_description(32), 32)
# graph
self.sync += \
from lib.sata.link.scrambler import Scrambler
class SATACONTInserter(Module):
- def __init__(self, layout):
- self.sink = sink = Sink(layout)
- self.source = source = Source(layout)
+ def __init__(self, description):
+ self.sink = sink = Sink(description)
+ self.source = source = Source(description)
###
]
class SATACONTRemover(Module):
- def __init__(self, layout):
- self.sink = sink = Sink(layout)
- self.source = source = Source(layout)
+ def __init__(self, description):
+ self.sink = sink = Sink(description)
+ self.source = source = Source(description)
###
]
class SATACRCInserter(CRCInserter):
- def __init__(self, layout):
- CRCInserter.__init__(self, SATACRC, layout)
+ def __init__(self, description):
+ CRCInserter.__init__(self, SATACRC, description)
class SATACRCChecker(CRCChecker):
- def __init__(self, layout):
- CRCChecker.__init__(self, SATACRC, layout)
\ No newline at end of file
+ def __init__(self, description):
+ CRCChecker.__init__(self, SATACRC, description)
\ No newline at end of file
@DecorateModule(InsertReset)
class SATAScrambler(Module):
- def __init__(self, layout):
- self.sink = sink = Sink(layout)
- self.source = source = Source(layout)
+ def __init__(self, description):
+ self.sink = sink = Sink(description)
+ self.source = source = Source(description)
###
class PHYSource(Module):
def __init__(self):
- self.source = Source(phy_layout(32))
+ self.source = Source(phy_description(32))
###
self.dword = PHYDword()
class PHYSink(Module):
def __init__(self):
- self.sink = Sink(phy_layout(32))
+ self.sink = Sink(phy_description(32))
###
self.dword = PHYDword()
return (packet[field.dword] >> field.offset) & (2**field.width-1)
class FIS:
- def __init__(self, packet, layout):
+ def __init__(self, packet, description):
self.packet = packet
- self.layout = layout
+ self.description = description
self.decode()
def decode(self):
- for k, v in self.layout.items():
+ for k, v in self.description.items():
setattr(self, k, get_field_data(v, self.packet))
def encode(self):
- for k, v in self.layout.items():
+ for k, v in self.description.items():
self.packet[v.dword] |= (getattr(self, k) << v.offset)
def __repr__(self):
r = "--------\n"
- for k in sorted(self.layout.keys()):
+ for k in sorted(self.description.keys()):
r += k + " : 0x%x" %getattr(self,k) + "\n"
return r
class LinkStreamer(Module):
def __init__(self):
- self.source = Source(link_layout(32))
+ self.source = Source(link_description(32))
###
self.packets = []
self.packet = LinkTXPacket()
class LinkLogger(Module):
def __init__(self):
- self.sink = Sink(link_layout(32))
+ self.sink = Sink(link_description(32))
###
self.packet = LinkRXPacket()
self.submodules.link = SATALink(self.bfm.phy)
self.submodules.streamer = LinkStreamer()
- streamer_ack_randomizer = AckRandomizer(link_layout(32), level=50)
+ streamer_ack_randomizer = AckRandomizer(link_description(32), level=50)
self.submodules += streamer_ack_randomizer
self.submodules.logger = LinkLogger()
- logger_ack_randomizer = AckRandomizer(link_layout(32), level=50)
+ logger_ack_randomizer = AckRandomizer(link_description(32), level=50)
self.submodules += logger_ack_randomizer
self.comb += [
Record.connect(self.streamer.source, streamer_ack_randomizer.sink),
from lib.sata.common import *
-def _encode_cmd(obj, layout, signal):
+def _encode_cmd(obj, description, signal):
r = []
- for k, v in sorted(layout.items()):
+ for k, v in sorted(description.items()):
start = v.dword*32 + v.offset
end = start + v.width
if "_lsb" in k:
class SATATransportTX(Module):
def __init__(self, link):
- self.sink = sink = Sink(transport_tx_layout(32))
+ self.sink = sink = Sink(transport_tx_description(32))
###
cnt.eq(cnt+1)
)
-def _decode_cmd(signal, layout, obj):
+def _decode_cmd(signal, description, obj):
r = []
- for k, v in sorted(layout.items()):
+ for k, v in sorted(description.items()):
start = v.dword*32+v.offset
end = start+v.width
if "_lsb" in k:
class SATATransportRX(Module):
def __init__(self, link):
- self.source = source = Source(transport_rx_layout(32))
+ self.source = source = Source(transport_rx_description(32))
###