2015-01-16 15:01:06 -05:00
|
|
|
import sys
|
|
|
|
from config import *
|
|
|
|
from tools import *
|
|
|
|
from bist import *
|
2015-02-18 10:53:02 -05:00
|
|
|
from litescope.host.driver.la import LiteScopeLADriver
|
2015-01-16 15:01:06 -05:00
|
|
|
|
2015-01-22 19:34:59 -05:00
|
|
|
la = LiteScopeLADriver(wb.regs, "la")
|
2015-01-16 17:52:41 -05:00
|
|
|
identify = LiteSATABISTIdentifyDriver(wb.regs, "sata_bist")
|
|
|
|
generator = LiteSATABISTGeneratorDriver(wb.regs, "sata_bist")
|
|
|
|
checker = LiteSATABISTCheckerDriver(wb.regs, "sata_bist")
|
2015-01-16 15:01:06 -05:00
|
|
|
wb.open()
|
|
|
|
regs = wb.regs
|
|
|
|
###
|
|
|
|
|
2015-01-23 06:36:45 -05:00
|
|
|
trig = "now"
|
2015-01-16 15:01:06 -05:00
|
|
|
if len(sys.argv) < 2:
|
2015-01-23 06:36:45 -05:00
|
|
|
print("No trigger condition, triggering immediately!")
|
|
|
|
else:
|
|
|
|
trig = sys.argv[1]
|
2015-01-16 15:01:06 -05:00
|
|
|
|
|
|
|
conditions = {}
|
2015-01-23 06:36:45 -05:00
|
|
|
conditions["now"] = {}
|
|
|
|
conditions["id_cmd"] = {
|
|
|
|
"sata_command_tx_sink_stb" : 1,
|
|
|
|
"sata_command_tx_sink_payload_identify" : 1,
|
|
|
|
}
|
|
|
|
conditions["id_resp"] = {
|
|
|
|
"source_source_payload_data" : primitives["X_RDY"],
|
|
|
|
}
|
2015-01-16 15:01:06 -05:00
|
|
|
conditions["wr_cmd"] = {
|
2015-01-21 17:11:38 -05:00
|
|
|
"sata_command_tx_sink_stb" : 1,
|
|
|
|
"sata_command_tx_sink_payload_write" : 1,
|
2015-01-16 15:01:06 -05:00
|
|
|
}
|
2015-01-23 06:36:45 -05:00
|
|
|
conditions["wr_resp"] = {
|
2015-01-21 17:11:38 -05:00
|
|
|
"sata_command_rx_source_stb" : 1,
|
|
|
|
"sata_command_rx_source_payload_write" : 1,
|
2015-01-16 15:01:06 -05:00
|
|
|
}
|
|
|
|
conditions["rd_cmd"] = {
|
2015-01-21 17:11:38 -05:00
|
|
|
"sata_command_tx_sink_stb" : 1,
|
|
|
|
"sata_command_tx_sink_payload_read" : 1,
|
2015-01-16 15:01:06 -05:00
|
|
|
}
|
2015-01-23 06:36:45 -05:00
|
|
|
conditions["rd_resp"] = {
|
2015-01-21 17:11:38 -05:00
|
|
|
"sata_command_rx_source_stb" : 1,
|
|
|
|
"sata_command_rx_source_payload_read" : 1,
|
2015-01-16 15:01:06 -05:00
|
|
|
}
|
|
|
|
|
2015-01-25 10:21:56 -05:00
|
|
|
la.configure_term(port=0, cond=conditions[trig])
|
|
|
|
la.configure_sum("term")
|
2015-01-16 15:01:06 -05:00
|
|
|
|
2015-01-25 10:21:56 -05:00
|
|
|
# Run Logic Analyzer
|
|
|
|
la.run(offset=64, length=1024)
|
2015-01-16 15:01:06 -05:00
|
|
|
|
2015-01-23 06:36:45 -05:00
|
|
|
#identify.run(blocking=False)
|
|
|
|
generator.run(0, 2, 1, 0, blocking=False)
|
|
|
|
#checker.run(0, 2, 1, 0, blocking=False)
|
2015-01-16 15:01:06 -05:00
|
|
|
|
2015-01-25 10:21:56 -05:00
|
|
|
while not la.done():
|
|
|
|
pass
|
|
|
|
|
|
|
|
la.upload()
|
|
|
|
la.save("dump.vcd")
|
2015-01-16 15:01:06 -05:00
|
|
|
###
|
|
|
|
wb.close()
|
|
|
|
|
2015-01-21 17:11:38 -05:00
|
|
|
f = open("dump_link.txt", "w")
|
2015-01-22 19:34:59 -05:00
|
|
|
data = link_trace(la,
|
2015-01-21 17:11:38 -05:00
|
|
|
tx_data_name="sink_sink_payload_data",
|
|
|
|
rx_data_name="source_source_payload_data"
|
2015-01-16 15:01:06 -05:00
|
|
|
)
|
2015-01-21 17:11:38 -05:00
|
|
|
f.write(data)
|
|
|
|
f.close()
|