diff --git a/src/a64instruction.h b/src/a64instruction.h new file mode 100644 index 0000000..aaab669 --- /dev/null +++ b/src/a64instruction.h @@ -0,0 +1,21 @@ +#include "a64instruction_DPImmediate.h" + +// Define the types of instructions in subset of the AArch64 Instruction Set implemented. +// Each type is defined by the format of the instruction's operand(s). +typedef enum { + a64inst_DPImmediate, + a64inst_DPRegister, + a64inst_SingleTransfer, + a64inst_LoadLiteral, + a64inst_Branch, + a64inst_Halt +} a64inst_type; + + +// Structure the holds the type and operand data of an instruction +typedef struct { + a64inst_type type; + union { + a64inst_DPImmediateData DPImmediateData; + } data; +} a64inst_instruction; diff --git a/src/a64instruction_DPImmediate.h b/src/a64instruction_DPImmediate.h new file mode 100644 index 0000000..b504772 --- /dev/null +++ b/src/a64instruction_DPImmediate.h @@ -0,0 +1,57 @@ +#include +#include "a64instruction_global.h" + +// Denotes the type of data processing operation +typedef enum { + a64inst_arithm, + a64inst_wideMov +} a64inst_DPIOpType; + +// Denotes the type of register being referred to +typedef enum { + a64inst_W = 0, + a64inst_R = 1 +} a64inst_regType; + +// Denotes the type of arithmetic operations supported by the architecture +typedef enum { + a64inst_add = 0, + a64inst_adds = 1, + a64inst_sub = 2, + a64inst_subs = 3 +} a64inst_arithmOp; + +// Denotes the type of wide move operations supported by the architecture +typedef enum { + a64inst_movn = 0, + a64inst_undefined = 1, + a64inst_movz = 2, + a64inst_movk = 3 +} a64inst_wideMovOp; + +// Holds data specific to arithmetic data processing instructions +typedef struct { + bool shiftImmediate; + uint16_t immediate; + a64inst_regSpecifier src; +} a64inst_DPImmediate_ArithmData; + +// Holds data specific to wide move data processing instructions +typedef struct { + int x; //TEMPORARY FOR COMPILATION! +} a64inst_DPImmediate_WideMovData; + +// Holds data for immediate data processing instructions +typedef struct { + a64inst_DPIOpType DPIOpType; + a64inst_regType regType; + union { + a64inst_arithmOp arithmOp; + a64inst_wideMovOp movOp; + } processOpId; + union { + a64inst_DPImmediate_ArithmData arithmData; + a64inst_DPImmediate_WideMovData wideMovData; + } processOpData; + a64inst_regSpecifier dest; +} a64inst_DPImmediateData; diff --git a/src/a64instruction_global.h b/src/a64instruction_global.h new file mode 100644 index 0000000..421a838 --- /dev/null +++ b/src/a64instruction_global.h @@ -0,0 +1,4 @@ +#include + +// Specifies the register being referred to +typedef uint8_t a64inst_regSpecifier;