Commit b0ec8f67 authored by Christina Yu's avatar Christina Yu
Browse files

lab7 update

parent 4636517f
......@@ -92,7 +92,7 @@ for t in itertools.count():
###################################################################################
# decode
if instr.name in ["CSRRS", "CSRRW", "CSRRSI"]:
if instr.name in ["CSRRS", "CSRRW", "CSRRSI", "CSRRW1"]:
print(f"{t:20d}:", display())
PC.clock(pc_val + 4)
continue
......@@ -186,16 +186,26 @@ for t in itertools.count():
print(f"{t:20d}:", display())
###################################################################################
RF.display()
if instr.name == 'ecall':
if RF.read(10) == 1:
print(f"ECALL({RF.read(10)}): {RF.read(11)}\n")
status = "TEST PASS" if RF.read(10) == 0 else "TEST FAIL"
print(status)
if status == "TEST FAIL":
exit(1)
if status == "TEST PASS":
exit(0)
print(status)
if RF.read(17) == 0x5d:
status = "TEST PASS" if RF.read(10) == 0 else "TEST FAIL"
print(status)
RF.display()
if status == "TEST FAIL":
exit(1)
if status == "TEST PASS":
exit(0)
elif (RF.read(10) == 0) or (RF.read(10) == 10):
strr = f"ECALL({RF.read(10)}): "
if RF.read(10) == 10:
......@@ -211,6 +221,12 @@ for t in itertools.count():
# print("STOP -- PC is large! Is something wrong?")
# break
if imem[PC.out()] == 0:
status = "TEST PASS" if RF.read(10) == 0 else "TEST FAIL"
if status == "TEST FAIL":
exit(1)
if status == "TEST PASS":
exit(0)
print(status)
#print("Done -- end of program.")
print("------------------------------< Final reg values >------------------------------")
RF.display()
......
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