addr = self.regfile.read_reg(addr_reg)
imm_ok = yield pdecode2.e.imm_data.ok
+ r2_ok = yield pdecode2.e.read_reg2.ok
if imm_ok:
imm = yield pdecode2.e.imm_data.data
addr += imm
+ elif r2_ok:
+ r2_sel = yield pdecode2.e.read_reg2.data
+ addr += self.regfile.read_reg(r2_sel)
if internal_op == InternalOp.OP_STORE.value:
val_reg = yield pdecode2.e.read_reg3.data
val = self.regfile.read_reg(val_reg)
2: 0x5678,
3: 0x1234})
+ def test_ldst_extended(self):
+ lst = ["addi 1, 0, 0x1234",
+ "addi 2, 0, 0x5678",
+ "addi 4, 0, 0x40",
+ "stw 1, 0x40(2)",
+ "lwzx 3, 4, 2"]
+ gen = InstrList(lst)
+
+ simulator = InternalOpSimulator()
+
+ self.run_tst(gen, simulator)
+ simulator.regfile.assert_gprs(
+ {1: 0x1234,
+ 2: 0x5678,
+ 3: 0x1234})
if __name__ == "__main__":
unittest.main()