public void DecExecLS_Imm_Load_Success() { //Test 2 LOAD : e51b3008 ldr r3, [fp, #-8] uint u = 0xe51b3008; int r = Convert.ToInt32(~u); r = ~r; Memory regs = new Memory(regsize), RAM = new Memory(12); regs.WriteWord(Reg.R11, 8); RAM.WriteWord(0, 23); LoadStore inst = new LoadStore(r, ref regs, ref RAM); inst.Decode(); inst.Execute(); Assert.IsTrue(regs.ReadWord(Reg.R3) == 23); Assert.IsTrue(inst.ToString() == "ldr r3, [fp, #-8]"); }
public void DecExecLS_RegImm_Store_Load_Success() { //Test 2 LOAD : e79290c4 ldr r9, [r2, r4, asr #1] uint u = 0xe79290c4; int r = Convert.ToInt32(~u); r = ~r; Memory regs = new Memory(regsize), RAM = new Memory(12); regs.WriteWord(Reg.R2, 4); regs.WriteWord(Reg.R4, 8); //8 RAM.WriteWord(8, 23); LoadStore inst = new LoadStore(r, ref regs, ref RAM); inst.Decode(); inst.Execute(); Assert.IsTrue(regs.ReadWord(Reg.R9) == 23); Assert.IsTrue(inst.ToString() == "ldr r9, [r2, r4, asr #1]"); }
public void DecExecLS_RegImm_Store_Success() { // STORE : e78210c4 str r1, [r2, r4, asr #1] uint u = 0xe78210c4; int r = Convert.ToInt32(~u); r = ~r; Memory regs = new Memory(regsize), RAM = new Memory(12); regs.WriteWord(Reg.R2, 4); regs.WriteWord(Reg.R4, 8); //8 regs.WriteWord(Reg.R1, 23); LoadStore inst = new LoadStore(r, ref regs, ref RAM); inst.Decode(); inst.Execute(); Assert.IsTrue(RAM.ReadWord(8) == 23); Assert.IsTrue(inst.ToString() == "str r1, [r2, r4, asr #1]"); }