|
@@ -1,7 +1,8 @@
|
|
|
import curses
|
|
import curses
|
|
|
import math
|
|
import math
|
|
|
from quartus_tcl import INSYS_SPI_ERROR, INSYS_MEM_ERROR, QuartusTCL, QUATUS_TCL_TIMEOUT
|
|
from quartus_tcl import INSYS_SPI_ERROR, INSYS_MEM_ERROR, QuartusTCL, QUATUS_TCL_TIMEOUT
|
|
|
-from . import oisc8asm
|
|
|
|
|
|
|
+import oisc8asm
|
|
|
|
|
+
|
|
|
|
|
|
|
|
def render_list(w, items, offset=3):
|
|
def render_list(w, items, offset=3):
|
|
|
selected = 0
|
|
selected = 0
|
|
@@ -266,7 +267,7 @@ def memedit_window(w, q, hw, dev, mem):
|
|
|
del moded[selected]
|
|
del moded[selected]
|
|
|
elif key == ord('s'):
|
|
elif key == ord('s'):
|
|
|
for i, val in moded.items():
|
|
for i, val in moded.items():
|
|
|
- data[i] = val
|
|
|
|
|
|
|
+ data[i] = str(val)
|
|
|
content = ''.join(list(reversed(data)))
|
|
content = ''.join(list(reversed(data)))
|
|
|
q.write_content_to_memory(mem_index, 0, depth, content)
|
|
q.write_content_to_memory(mem_index, 0, depth, content)
|
|
|
elif key in {curses.KEY_ENTER, ord('\n')}:
|
|
elif key in {curses.KEY_ENTER, ord('\n')}:
|
|
@@ -306,14 +307,18 @@ def memedit_window(w, q, hw, dev, mem):
|
|
|
|
|
|
|
|
def oisc_comments(probe, value):
|
|
def oisc_comments(probe, value):
|
|
|
try:
|
|
try:
|
|
|
- data = int(value[0], 16)
|
|
|
|
|
|
|
+ hexdata = value[0]
|
|
|
|
|
+ if len(hexdata) % 2 == 1:
|
|
|
|
|
+ hexdata = "0" + hexdata
|
|
|
|
|
+ data = bytes.fromhex(hexdata)
|
|
|
except ValueError:
|
|
except ValueError:
|
|
|
return None
|
|
return None
|
|
|
except IndexError:
|
|
except IndexError:
|
|
|
return None
|
|
return None
|
|
|
|
|
|
|
|
if probe == "INST":
|
|
if probe == "INST":
|
|
|
- val = oisc8asm.asmc.decompile([data]).split('\n')[0]
|
|
|
|
|
|
|
+ val = oisc8asm.asmc.decompile(data).split('\n')[0]
|
|
|
|
|
+ val = ' '.join(list(filter(None, val.split(' ')))[1:3])
|
|
|
return val
|
|
return val
|
|
|
return None
|
|
return None
|
|
|
|
|
|
|
@@ -466,6 +471,7 @@ def main(w):
|
|
|
reprint_header(w, q, hw, dev)
|
|
reprint_header(w, q, hw, dev)
|
|
|
w.addstr(3, 2, "Checking device in-system sources and probes..")
|
|
w.addstr(3, 2, "Checking device in-system sources and probes..")
|
|
|
w.refresh()
|
|
w.refresh()
|
|
|
|
|
+ cont_flag = False
|
|
|
try:
|
|
try:
|
|
|
spis = q.get_insystem_source_probe_instance_info(dev, hw)
|
|
spis = q.get_insystem_source_probe_instance_info(dev, hw)
|
|
|
w.addstr(3, 2, f"Found {len(spis)} source/probe instances..")
|
|
w.addstr(3, 2, f"Found {len(spis)} source/probe instances..")
|
|
@@ -473,9 +479,16 @@ def main(w):
|
|
|
except INSYS_SPI_ERROR as e:
|
|
except INSYS_SPI_ERROR as e:
|
|
|
w.addstr(3, 2, "ERROR: ", curses.color_pair(4) | curses.A_BOLD)
|
|
w.addstr(3, 2, "ERROR: ", curses.color_pair(4) | curses.A_BOLD)
|
|
|
w.addstr(e.message, curses.color_pair(4))
|
|
w.addstr(e.message, curses.color_pair(4))
|
|
|
|
|
+ cont_flag = True
|
|
|
spis = []
|
|
spis = []
|
|
|
w.refresh()
|
|
w.refresh()
|
|
|
w.addstr(4, 2, "Checking device in-system memory..")
|
|
w.addstr(4, 2, "Checking device in-system memory..")
|
|
|
|
|
+ # Attemt to close previous connections
|
|
|
|
|
+ try:
|
|
|
|
|
+ q.end_memory_edit()
|
|
|
|
|
+ except INSYS_MEM_ERROR:
|
|
|
|
|
+ pass
|
|
|
|
|
+
|
|
|
try:
|
|
try:
|
|
|
mems = q.get_editable_mem_instances(dev, hw)
|
|
mems = q.get_editable_mem_instances(dev, hw)
|
|
|
w.addstr(4, 2, f"Found {len(mems)} memory instances..")
|
|
w.addstr(4, 2, f"Found {len(mems)} memory instances..")
|
|
@@ -483,6 +496,7 @@ def main(w):
|
|
|
except INSYS_MEM_ERROR as e:
|
|
except INSYS_MEM_ERROR as e:
|
|
|
w.addstr(4, 2, "ERROR: ", curses.color_pair(4) | curses.A_BOLD)
|
|
w.addstr(4, 2, "ERROR: ", curses.color_pair(4) | curses.A_BOLD)
|
|
|
w.addstr(e.message, curses.color_pair(4))
|
|
w.addstr(e.message, curses.color_pair(4))
|
|
|
|
|
+ cont_flag = True
|
|
|
mems = []
|
|
mems = []
|
|
|
w.refresh()
|
|
w.refresh()
|
|
|
try:
|
|
try:
|
|
@@ -492,10 +506,13 @@ def main(w):
|
|
|
except INSYS_SPI_ERROR as e:
|
|
except INSYS_SPI_ERROR as e:
|
|
|
w.addstr(5, 2, "ERROR: ", curses.color_pair(4) | curses.A_BOLD)
|
|
w.addstr(5, 2, "ERROR: ", curses.color_pair(4) | curses.A_BOLD)
|
|
|
w.addstr("Transaction setup failed: " + e.message, curses.color_pair(4))
|
|
w.addstr("Transaction setup failed: " + e.message, curses.color_pair(4))
|
|
|
|
|
+ cont_flag = True
|
|
|
pren = False
|
|
pren = False
|
|
|
w.refresh()
|
|
w.refresh()
|
|
|
- w.addstr(6, 4, "Press any key to start..", curses.color_pair(1))
|
|
|
|
|
- w.getch()
|
|
|
|
|
|
|
+ if cont_flag:
|
|
|
|
|
+ w.addstr(6, 4, "Press any key to start..", curses.color_pair(1))
|
|
|
|
|
+ w.refresh()
|
|
|
|
|
+ w.getch()
|
|
|
debugging_window(w, q, hw, dev, spis, mems, pren)
|
|
debugging_window(w, q, hw, dev, spis, mems, pren)
|
|
|
try:
|
|
try:
|
|
|
if pren:
|
|
if pren:
|