Ejemplo n.º 1
0
    def test_blti(self):
        """Test BLTI jit"""

        # Instructions that will be jitted
        instructions = "MOV R0, 1\n"
        instructions += "BLTI R0, 0x2, 0x6\n"
        instructions += "MOV R0, 0\n"
        instructions += "MOV R1, 1"

        # Jit
        jitter = jit_instructions(instructions)

        # Check expected results
        assert (jitter.cpu.R0 == 1)
        assert (jitter.cpu.R1 == 1)
Ejemplo n.º 2
0
    def test_blti(self):
        """Test BLTI jit"""

        # Instructions that will be jitted
        instructions = "MOV R0, 1\n"
        instructions += "BLTI R0, 0x2, 0x6\n"
        instructions += "MOV R0, 0\n"
        instructions += "MOV R1, 1"

        # Jit
        jitter = jit_instructions(instructions)

        # Check expected results
        assert(jitter.cpu.R0 == 1)
        assert(jitter.cpu.R1 == 1)
Ejemplo n.º 3
0
    def test_erepeat_3(self):
        """Test EREPEAT jit"""

        # Instructions that will be jitted
        instructions = "EREPEAT 0x8\n"
        instructions += "ADD R1, 1\n"
        instructions += "ADD R2, 1\n"
        instructions += "BEQI R1, 0x6, 0x6\n"  # <- RPE
        instructions += "ADD R3, 1"

        # Jit
        jitter = jit_instructions(instructions)

        # Check expected results
        assert (jitter.cpu.R1 == 6)
        assert (jitter.cpu.R2 == 6)
        assert (jitter.cpu.R3 == 5)
Ejemplo n.º 4
0
    def test_erepeat_3(self):
        """Test EREPEAT jit"""

        # Instructions that will be jitted
        instructions = "EREPEAT 0x8\n"
        instructions += "ADD R1, 1\n"
        instructions += "ADD R2, 1\n"
        instructions += "BEQI R1, 0x6, 0x6\n"  # <- RPE
        instructions += "ADD R3, 1"

        # Jit
        jitter = jit_instructions(instructions)

        # Check expected results
        assert(jitter.cpu.R1 == 6)
        assert(jitter.cpu.R2 == 6)
        assert(jitter.cpu.R3 == 5)
Ejemplo n.º 5
0
    def test_repeat(self):
        """Test REPEAT jit"""

        # Instructions that will be jitted
        instructions = "MOV R0, 8\n"
        instructions += "REPEAT R0, 0x6\n"
        instructions += "ADD R1, 1\n"
        instructions += "ADD R2, 1\n"  # <-RPE
        instructions += "ADD R3, 1"

        # Jit
        jitter = jit_instructions(instructions)

        # Check expected results
        assert (jitter.cpu.R0 == 8)
        assert (jitter.cpu.R1 == 8)
        assert (jitter.cpu.R2 == 8)
        assert (jitter.cpu.R3 == 8)
Ejemplo n.º 6
0
    def test_repeat(self):
        """Test REPEAT jit"""

        # Instructions that will be jitted
        instructions = "MOV R0, 8\n"
        instructions += "REPEAT R0, 0x6\n"
        instructions += "ADD R1, 1\n"
        instructions += "ADD R2, 1\n"  # <-RPE
        instructions += "ADD R3, 1"

        # Jit
        jitter = jit_instructions(instructions)

        # Check expected results
        assert(jitter.cpu.R0 == 8)
        assert(jitter.cpu.R1 == 8)
        assert(jitter.cpu.R2 == 8)
        assert(jitter.cpu.R3 == 8)