Exemplo n.º 1
0
        public void Execute_NegativeImmediate()
        {
            reg[1] = 0x00000003;
            target = new AddiInstruction(2, 1, 0xFFFF);

            target.Execute(ref pc, mem, reg);

            Assert.AreEqual(0x00000002, reg[2]);
            Assert.AreEqual(0x00000004, pc);
        }
Exemplo n.º 2
0
        public void Execute_Overflow()
        {
            reg[1] = 0xFFFFFFFF;
            target = new AddiInstruction(1, 1, 0x0001);

            target.Execute(ref pc, mem, reg);

            Assert.AreEqual(0x00000000, reg[1]);
            Assert.AreEqual(0x00000004, pc);
        }
Exemplo n.º 3
0
        public void Execute_AddPositiveNumbers()
        {
            reg[1] = 0x00000002;
            target = new AddiInstruction(1, 1, 0x0001);

            target.Execute(ref pc, mem, reg);

            Assert.AreEqual(0x00000003, reg[1]);
            Assert.AreEqual(0x00000004, pc);
        }
Exemplo n.º 4
0
        public void ToString_Formatted()
        {
            target = new AddiInstruction(1, 2, 0xFFFF);

            Assert.AreEqual("ADDI $at, $v0, 0xFFFF", target.ToString());
        }