Add data types for internal instructions w/ S

This commit is contained in:
Themis Demetriades 2024-05-30 14:43:07 +01:00
parent 41ca0b3ffa
commit e2e97bbff9
3 changed files with 82 additions and 0 deletions

21
src/a64instruction.h Normal file
View File

@ -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;

View File

@ -0,0 +1,57 @@
#include <stdbool.h>
#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;

View File

@ -0,0 +1,4 @@
#include <stdint.h>
// Specifies the register being referred to
typedef uint8_t a64inst_regSpecifier;