From 543d0c1a5fcc68b6c7778cd86e544d6d1261d6d6 Mon Sep 17 00:00:00 2001 From: jjsuperpower Date: Thu, 13 Oct 2022 21:04:09 -0500 Subject: started op codes file --- hdl/core/opcodes.py | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 hdl/core/opcodes.py (limited to 'hdl/core') diff --git a/hdl/core/opcodes.py b/hdl/core/opcodes.py new file mode 100644 index 0000000..09c5d2c --- /dev/null +++ b/hdl/core/opcodes.py @@ -0,0 +1,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 + + -- cgit v1.2.3