from migen.actorlib.structuring import Pipeline, Converter
bitrates = {
- "sata_gen3" : 6.0,
- "sata_gen2" : 3.0,
- "sata_gen1" : 1.5,
+ "sata_gen3": 6.0,
+ "sata_gen2": 3.0,
+ "sata_gen1": 1.5,
}
frequencies = {
- "sata_gen3" : 150.0,
- "sata_gen2" : 75.0,
- "sata_gen1" : 37.5,
+ "sata_gen3": 150.0,
+ "sata_gen2": 75.0,
+ "sata_gen1": 37.5,
}
# PHY / Link Layers
primitives = {
- "ALIGN" : 0x7B4A4ABC,
- "CONT" : 0X9999AA7C,
- "SYNC" : 0xB5B5957C,
- "R_RDY" : 0x4A4A957C,
- "R_OK" : 0x3535B57C,
- "R_ERR" : 0x5656B57C,
- "R_IP" : 0X5555B57C,
- "X_RDY" : 0x5757B57C,
- "CONT" : 0x9999AA7C,
- "WTRM" : 0x5858B57C,
- "SOF" : 0x3737B57C,
- "EOF" : 0xD5D5B57C,
- "HOLD" : 0xD5D5AA7C,
- "HOLDA" : 0X9595AA7C
+ "ALIGN": 0x7B4A4ABC,
+ "CONT": 0X9999AA7C,
+ "SYNC": 0xB5B5957C,
+ "R_RDY": 0x4A4A957C,
+ "R_OK": 0x3535B57C,
+ "R_ERR": 0x5656B57C,
+ "R_IP": 0X5555B57C,
+ "X_RDY": 0x5757B57C,
+ "CONT": 0x9999AA7C,
+ "WTRM": 0x5858B57C,
+ "SOF": 0x3737B57C,
+ "EOF": 0xD5D5B57C,
+ "HOLD": 0xD5D5AA7C,
+ "HOLDA": 0X9595AA7C
}
# Command Layer
regs = {
- "WRITE_DMA_EXT" : 0x35,
- "READ_DMA_EXT" : 0x25,
- "IDENTIFY_DEVICE" : 0xEC
+ "WRITE_DMA_EXT": 0x35,
+ "READ_DMA_EXT": 0x25,
+ "IDENTIFY_DEVICE": 0xEC
}
reg_d2h_status = {
- "bsy" : 7,
- "drdy" : 6,
- "df" : 5,
- "se" : 5,
- "dwe" : 4,
- "drq" : 3,
- "ae" : 2,
- "sns" : 1,
- "cc" : 0,
- "err" : 0
+ "bsy": 7,
+ "drdy": 6,
+ "df": 5,
+ "se": 5,
+ "dwe": 4,
+ "drq": 3,
+ "ae": 2,
+ "sns": 1,
+ "cc": 0,
+ "err": 0
}
for name, endpoint in endpoints.items():
if not self.names or name in self.names:
if isinstance(endpoint, Sink):
- sinks.update({name : endpoint})
+ sinks.update({name: endpoint})
elif isinstance(endpoint, Source):
- sources.update({name : endpoint})
+ sources.update({name: endpoint})
# add buffer on sinks
for name, sink in sinks.items():
conditions = {}
conditions["now"] = {}
conditions["id_cmd"] = {
- "sata_command_tx_sink_stb" : 1,
- "sata_command_tx_sink_payload_identify" : 1,
+ "sata_command_tx_sink_stb": 1,
+ "sata_command_tx_sink_payload_identify": 1,
}
conditions["id_resp"] = {
- "source_source_payload_data" : primitives["X_RDY"],
+ "source_source_payload_data": primitives["X_RDY"],
}
conditions["wr_cmd"] = {
- "sata_command_tx_sink_stb" : 1,
- "sata_command_tx_sink_payload_write" : 1,
+ "sata_command_tx_sink_stb": 1,
+ "sata_command_tx_sink_payload_write": 1,
}
conditions["wr_resp"] = {
- "sata_command_rx_source_stb" : 1,
- "sata_command_rx_source_payload_write" : 1,
+ "sata_command_rx_source_stb": 1,
+ "sata_command_rx_source_payload_write": 1,
}
conditions["rd_cmd"] = {
- "sata_command_tx_sink_stb" : 1,
- "sata_command_tx_sink_payload_read" : 1,
+ "sata_command_tx_sink_stb": 1,
+ "sata_command_tx_sink_payload_read": 1,
}
conditions["rd_resp"] = {
- "sata_command_rx_source_stb" : 1,
- "sata_command_rx_source_payload_read" : 1,
+ "sata_command_rx_source_stb": 1,
+ "sata_command_rx_source_payload_read": 1,
}
la.configure_term(port=0, cond=conditions[trig])
# Config at startup
div_config = {
- "sata_gen1" : 4,
- "sata_gen2" : 2,
- "sata_gen3" : 1
+ "sata_gen1": 4,
+ "sata_gen2": 2,
+ "sata_gen3": 1
}
rxout_div = div_config[revision]
txout_div = div_config[revision]
cdr_config = {
- "sata_gen1" : 0x0380008BFF40100008,
- "sata_gen2" : 0x0388008BFF40200008,
- "sata_gen3" : 0X0380008BFF10200010
+ "sata_gen1": 0x0380008BFF40100008,
+ "sata_gen2": 0x0388008BFF40200008,
+ "sata_gen3": 0X0380008BFF10200010
}
rxcdr_cfg = cdr_config[revision]