def memassign(self, ea, sz, val):
self.mem.memassign(ea, sz, val)
+ def prep_namespace(self):
+ si = yield self.decoder.SI
+ self.namespace.SI = SelectableInt(si, bits=16)
+
def call(self, name):
function, read_regs, uninit_regs, write_regs = self.instrs[name]
input_names = create_args(read_regs | uninit_regs)
inputs = []
for name in input_names:
regnum = yield getattr(self.decoder, name)
- print(regnum)
+ print('reading reg %d' % regnum)
inputs.append(self.gpr(regnum))
print(inputs)
results = function(self, *inputs)
print(results)
+ output_names = create_args(write_regs)
+ for name, output in zip(output_names, results):
+ regnum = yield getattr(self.decoder, name)
+ print('writing reg %d' % regnum)
+ self.gpr[regnum] = output
def inject():
initial_regs[3] = 0x1234
initial_regs[2] = 0x4321
with Program(lst) as program:
- self.run_test_program(program, initial_regs)
+ sim = self.run_test_program(program, initial_regs)
+ self.assertEqual(sim.gpr(1), SelectableInt(0x5555, 64))
def run_test_program(self, prog, initial_regs):
simulator = self.run_tst(prog, initial_regs)
print(simulator.gpr)
+ return simulator
if __name__ == "__main__":
unittest.main()