2015-01-16 15:01:06 -05:00
|
|
|
import sys
|
|
|
|
from config import *
|
|
|
|
from tools import *
|
|
|
|
from bist import *
|
|
|
|
from miscope.host.drivers import MiLaDriver
|
|
|
|
|
|
|
|
mila = MiLaDriver(wb.regs, "mila")
|
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
|
|
|
|
###
|
|
|
|
|
|
|
|
if len(sys.argv) < 2:
|
|
|
|
print("Need trigger condition!")
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
conditions = {}
|
|
|
|
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
|
|
|
}
|
|
|
|
conditions["wr_dma_activate"] = {
|
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
|
|
|
}
|
|
|
|
conditions["rd_data"] = {
|
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-16 16:49:34 -05:00
|
|
|
conditions["id_cmd"] = {
|
2015-01-21 17:11:38 -05:00
|
|
|
"sata_command_tx_sink_stb" : 1,
|
|
|
|
"sata_command_tx_sink_payload_identify" : 1,
|
2015-01-16 16:49:34 -05:00
|
|
|
}
|
|
|
|
conditions["id_pio_setup"] = {
|
2015-01-21 17:11:38 -05:00
|
|
|
"source_source_payload_data" : primitives["X_RDY"],
|
2015-01-16 16:49:34 -05:00
|
|
|
}
|
2015-01-16 15:01:06 -05:00
|
|
|
|
|
|
|
mila.prog_term(port=0, cond=conditions[sys.argv[1]])
|
|
|
|
mila.prog_sum("term")
|
|
|
|
|
|
|
|
# Trigger / wait / receive
|
|
|
|
mila.trigger(offset=512, length=2000)
|
|
|
|
|
2015-01-21 17:11:38 -05:00
|
|
|
#identify.run()
|
2015-01-21 19:33:02 -05:00
|
|
|
generator.run(0, 2, 1, 0)
|
|
|
|
#checker.run(0, 2, 1, 0)
|
2015-01-16 15:01:06 -05:00
|
|
|
mila.wait_done()
|
|
|
|
|
|
|
|
mila.read()
|
|
|
|
mila.export("dump.vcd")
|
|
|
|
###
|
|
|
|
wb.close()
|
|
|
|
|
2015-01-21 17:11:38 -05:00
|
|
|
f = open("dump_link.txt", "w")
|
|
|
|
data = link_trace(mila,
|
|
|
|
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()
|