2015-05-01 14:27:31 -04:00
|
|
|
from litescope.software.dump import *
|
2014-12-20 10:06:02 -05:00
|
|
|
|
|
|
|
primitives = {
|
2015-04-13 09:25:40 -04:00
|
|
|
"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
|
2014-12-20 10:06:02 -05:00
|
|
|
}
|
|
|
|
|
2015-04-13 09:12:39 -04:00
|
|
|
|
2014-12-20 10:06:02 -05:00
|
|
|
def decode_primitive(dword):
|
2015-04-13 08:55:26 -04:00
|
|
|
for k, v in primitives.items():
|
|
|
|
if dword == v:
|
|
|
|
return k
|
|
|
|
return ""
|
2014-12-20 10:06:02 -05:00
|
|
|
|
2015-04-13 09:12:39 -04:00
|
|
|
|
2015-01-20 11:14:01 -05:00
|
|
|
def link_trace(mila, tx_data_name, rx_data_name):
|
2015-04-13 08:55:26 -04:00
|
|
|
r = ""
|
|
|
|
dump = Dump()
|
|
|
|
dump.add_from_layout(mila.layout, mila.dat)
|
2014-12-20 10:06:02 -05:00
|
|
|
|
2015-04-13 08:55:26 -04:00
|
|
|
for var in dump.vars:
|
|
|
|
if var.name == tx_data_name:
|
|
|
|
tx_data = var.values
|
|
|
|
if var.name == rx_data_name:
|
|
|
|
rx_data = var.values
|
2014-12-20 10:06:02 -05:00
|
|
|
|
2015-04-13 08:55:26 -04:00
|
|
|
for i in range(len(tx_data)):
|
2015-04-13 09:44:04 -04:00
|
|
|
tx = "{:08x} ".format(tx_data[i])
|
2015-04-13 08:55:26 -04:00
|
|
|
tx += decode_primitive(tx_data[i])
|
|
|
|
tx += " "*(16-len(tx))
|
2014-12-20 10:06:02 -05:00
|
|
|
|
2015-04-13 09:44:04 -04:00
|
|
|
rx = "{:08x} ".format(rx_data[i])
|
2015-04-13 08:55:26 -04:00
|
|
|
rx += decode_primitive(rx_data[i])
|
|
|
|
rx += " "*(16-len(rx))
|
2014-12-20 10:06:02 -05:00
|
|
|
|
2015-04-13 08:55:26 -04:00
|
|
|
r += tx + rx + "\n"
|
2015-01-20 11:14:01 -05:00
|
|
|
|
2015-04-13 08:55:26 -04:00
|
|
|
return r
|