about summary refs log tree commit diff stats
path: root/test/arch/mep/asm/test_major_opcode_10.py
blob: e10992c8ccec9d29edcb857af9fb6b890e19b21c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Toshiba MeP-c4 - Major Opcode #10 unit tests
# Guillaume Valadon <guillaume@valadon.net>

from ut_helpers_asm import check_instruction


class TestMajor10(object):

    def test_BEQZ(self):
        """Test the BEQZ instruction"""

        # Top instructions
        check_instruction("BEQZ $11, 0xFFFFFF8C", "ab8c")
        check_instruction("BEQZ $4, 0x6", "a406")
        check_instruction("BEQZ $TP, 0x4", "ad04")
        check_instruction("BEQZ $11, 0x4", "ab04")
        check_instruction("BEQZ $12, 0xA", "ac0a")

        # Randomly chosen instructions
        check_instruction("BEQZ $0, 0x42", "a042")
        check_instruction("BEQZ $10, 0x6", "aa06")
        check_instruction("BEQZ $0, 0x8", "a008")
        check_instruction("BEQZ $12, 0x4", "ac04")
        check_instruction("BEQZ $1, 0x70", "a170")

    def test_BNEZ(self):
        """Test the BNEZ instruction"""

        # Top instructions
        check_instruction("BNEZ $7, 0x46", "a747")
        check_instruction("BNEZ $0, 0x40", "a041")
        check_instruction("BNEZ $9, 0x1C", "a91d")
        check_instruction("BNEZ $0, 0xFFFFFFF6", "a0f7")
        check_instruction("BNEZ $4, 0xA", "a40b")

        # Randomly chosen instructions
        check_instruction("BNEZ $7, 0xE", "a70f")
        check_instruction("BNEZ $11, 0xE", "ab0f")
        check_instruction("BNEZ $10, 0x28", "aa29")
        check_instruction("BNEZ $9, 0xFFFFFFAE", "a9af")
        check_instruction("BNEZ $9, 0xE", "a90f")