summaryrefslogtreecommitdiff
path: root/hdl/core/opcodes.py
blob: 09c5d2ce634c0b6eb88ee94936b14cabdfb6dce9 (plain)
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
42
43
44
45
46
47
48
49
50
51
52
from ctypes.wintypes import INT
from enum import unique, Enum
from http.client import MULTI_STATUS


@unique
class OpCodes(Enum):

    # R-type
    NOP    = 0x00
    ADD    = 0x01
    SUB    = 0x02
    XOR    = 0x03
    OR     = 0x04
    AND    = 0x05
    LSL    = 0x06
    LSR    = 0x07
    ASR    = 0x08
    MUL    = 0x09
    MULU   = 0x0A
    DIV    = 0x0B     # not implemented yet
    DIVU   = 0x0C     # not implemented yet

    # I-type
    ADDI   = 0x40
    SUBI   = 0x41
    XORI   = 0x42
    ORI    = 0x43
    ANDI   = 0x44
    LSLI   = 0x45
    LSRI   = 0x46
    ASRI   = 0x47
    MULI   = 0x48
    MULUI  = 0x49
    DIVI   = 0x4A     # not implemented yet
    DIVUI  = 0x4B     # not implemented yet

    # J-type
    JMP    = 0x80
    JMPI   = 0x81

    # C-type (control), 2 MSB -> System mode only
    CALL   = 0xA0
    RET    = 0xA1
    SCALL  = 0xA2

    # ------------------ System mode only ------------------
    INT    = 0xC0
    IRET   = 0xC1
    INVP   = 0xC2