update LiteScope
[litex.git] / test / test_la.py
1 import sys
2 from config import *
3 from tools import *
4 from bist import *
5 from litescope.host.driver import LiteScopeLADriver
6
7 la = LiteScopeLADriver(wb.regs, "la")
8 identify = LiteSATABISTIdentifyDriver(wb.regs, "sata_bist")
9 generator = LiteSATABISTGeneratorDriver(wb.regs, "sata_bist")
10 checker = LiteSATABISTCheckerDriver(wb.regs, "sata_bist")
11 wb.open()
12 regs = wb.regs
13 ###
14
15 trig = "now"
16 if len(sys.argv) < 2:
17 print("No trigger condition, triggering immediately!")
18 else:
19 trig = sys.argv[1]
20
21 conditions = {}
22 conditions["now"] = {}
23 conditions["id_cmd"] = {
24 "sata_command_tx_sink_stb" : 1,
25 "sata_command_tx_sink_payload_identify" : 1,
26 }
27 conditions["id_resp"] = {
28 "source_source_payload_data" : primitives["X_RDY"],
29 }
30 conditions["wr_cmd"] = {
31 "sata_command_tx_sink_stb" : 1,
32 "sata_command_tx_sink_payload_write" : 1,
33 }
34 conditions["wr_resp"] = {
35 "sata_command_rx_source_stb" : 1,
36 "sata_command_rx_source_payload_write" : 1,
37 }
38 conditions["rd_cmd"] = {
39 "sata_command_tx_sink_stb" : 1,
40 "sata_command_tx_sink_payload_read" : 1,
41 }
42 conditions["rd_resp"] = {
43 "sata_command_rx_source_stb" : 1,
44 "sata_command_rx_source_payload_read" : 1,
45 }
46
47 la.configure_term(port=0, cond=conditions[trig])
48 la.configure_sum("term")
49
50 # Run Logic Analyzer
51 la.run(offset=64, length=1024)
52
53 #identify.run(blocking=False)
54 generator.run(0, 2, 1, 0, blocking=False)
55 #checker.run(0, 2, 1, 0, blocking=False)
56
57 while not la.done():
58 pass
59
60 la.upload()
61 la.save("dump.vcd")
62 ###
63 wb.close()
64
65 f = open("dump_link.txt", "w")
66 data = link_trace(la,
67 tx_data_name="sink_sink_payload_data",
68 rx_data_name="source_source_payload_data"
69 )
70 f.write(data)
71 f.close()