yield pc_i.eq(pc)
yield issuer.pc_i.ok.eq(1)
+ print ("instructions", instructions)
+
index = sim.pc.CIA.value//4
while index < len(instructions):
ins, code = instructions[index]
suite = unittest.TestSuite()
# suite.addTest(TestRunner(HelloTestCases.test_data))
# suite.addTest(TestRunner(DivTestCase.test_data))
- suite.addTest(TestRunner(AttnTestCase.test_data))
+ #suite.addTest(TestRunner(AttnTestCase.test_data))
suite.addTest(TestRunner(GeneralTestCases.test_data))
- suite.addTest(TestRunner(LDSTTestCase().test_data))
- suite.addTest(TestRunner(CRTestCase().test_data))
+ #suite.addTest(TestRunner(LDSTTestCase().test_data))
+ #suite.addTest(TestRunner(CRTestCase().test_data))
# suite.addTest(TestRunner(ShiftRotTestCase.test_data))
# suite.addTest(TestRunner(LogicalTestCase.test_data))
# suite.addTest(TestRunner(ALUTestCase.test_data))
import struct
import os
import sys
+from io import BytesIO
+
filedir = os.path.dirname(os.path.realpath(__file__))
memmap = os.path.join(filedir, "memmap")
self.endian_fmt = "elf64-little"
self.obj_fmt = "-le"
- if isinstance(instructions, str): # filename
+ if isinstance(instructions, bytes): # actual bytes
+ self.binfile = BytesIO(instructions)
+ self.binfile.name = "assembly"
+ self.assembly = '' # noo disassemble number fiiive
+ elif isinstance(instructions, str): # filename
# read instructions into a BytesIO to avoid "too many open files"
with open(instructions, "rb") as f:
b = f.read()
- self.binfile = BytesIO(b, 'rb')
+ self.binfile = BytesIO(b)
self.assembly = '' # noo disassemble number fiiive
print("program", self.binfile)
else:
def test_nop(self):
lst = ["addi 1, 0, 0x1004",
- "nop",
+ "ori 0,0,0", # "preferred" form of nop
"addi 3, 0, 0x15eb",
]
initial_regs = [0] * 32
with Program(lst, bigendian) as program:
self.run_tst_program(program, [1, 3])
+ @unittest.skip("disable")
+ def test_zero_illegal(self):
+ lst = bytes([0x10,0x00,0x20,0x39,
+ 0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0 ])
+ disassembly = ["addi 9, 0, 0x10",
+ "nop", # not quite
+ "nop"] # not quite
+ initial_regs = [0] * 32
+ with Program(lst, bigendian) as program:
+ program.assembly = '\n'.join(disassembly) + '\n' # XXX HACK!
+ self.run_tst_program(program, [1, 3])
+
def test_loop(self):
"""in godbolt.org:
register unsigned long i asm ("r12");