Commit 17678e2c authored by alan's avatar alan
Browse files

fixed for syscall memory

parent 1a7cfc6a
......@@ -88,6 +88,9 @@ def run_cpu(imem, dmem, symbols, debug, max_t, stats_map, statistics):
print(f"{t:20d}:", display(pc_val, instr))
continue
if pc_val in symbols:
print(f"-------------- <<< {symbols[pc_val]} >>> --------------")
if debug != 0:
print(f"{t:20d}:", display(pc_val, instr))
......@@ -270,7 +273,7 @@ def run_cpu(imem, dmem, symbols, debug, max_t, stats_map, statistics):
if mem_em == 1 and mem_wr == 1 and 'tohost' in symbols:
if (word_size == 4 and result == symbols['tohost']+4) or (word_size == 8 and result == symbols['tohost']):
if (word_size == 4 and as_twos_comp(result) == symbols['tohost']+4) or (word_size == 8 and as_twos_comp(result) == symbols['tohost']):
# syscall detected, tohost is a 64 bit reg, so wait for addr of second word on 32 bit
val = dmem.mem[symbols['tohost']]
......@@ -279,6 +282,10 @@ def run_cpu(imem, dmem, symbols, debug, max_t, stats_map, statistics):
print (f"SYSCALL: exit ({val>>1})")
print("--------------------Final register values-----------------------")
my_reg.display()
from pprint import pprint
if statistics:
pprint(stats_map)
sys.exit(val>>1)
if val & 0b0 == 0b0:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment