Add data structure for DP instructions w/ S

This commit is contained in:
Themis Demetriades 2024-05-31 17:30:19 +01:00
parent 34eee8599e
commit d6148f6d34
3 changed files with 77 additions and 24 deletions

7
src/a64instruction_DP.h Normal file
View File

@ -0,0 +1,7 @@
// 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;

View File

@ -1,50 +1,38 @@
#include <stdbool.h>
#include "a64instruction_global.h"
#include "a64instruction_DP.h"
// Denotes the type of data processing operation
typedef enum {
a64inst_arithm,
a64inst_wideMov
a64inst_DPI_ARITHM,
a64inst_DPI_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_MOVN = 0,
a64inst_UNDEFINED = 1,
a64inst_MOVZ = 2,
a64inst_MOVK = 3
} a64inst_wideMovOp;
// Holds data specific to arithmetic data processing instructions
// Holds data specific to arithmetic immediate 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
// Holds data specific to wide move immediate data processing instructions
typedef struct {
int x; //TEMPORARY FOR COMPILATION!
uint8_t shiftScalar;
uint16_t immediate;
} a64inst_DPImmediate_WideMovData;
// Holds data for immediate data processing instructions
typedef struct {
a64inst_DPIOpType DPIOpType;
a64inst_regType regType;
a64inst_DPIOpType DPIOpType;
union {
a64inst_arithmOp arithmOp;
a64inst_wideMovOp movOp;

View File

@ -0,0 +1,58 @@
#include <stdbool.h>
#include "a64instruction_global.h"
#include "a64instruction_DP.h"
// Denotes the type of data processing operation
typedef enum {
a64inst_DPR_ARITHMLOGIC,
a64inst_DPR_MULTIPLY
} a64inst_DPROpType;
// Denotes the logical operations supported by the architecture
typedef enum {
a64inst_AND = 0,
a64inst_OR = 1,
a64inst_XOR = 2,
a64inst_AND_FLAGGED = 3
} a64inst_logicOp;
// Denotes the different kinds of shifts supported by the architecture
typedef enum {
a64inst_LSL = 0,
a64inst_LSR = 1,
a64inst_ASR = 2,
a64inst_ROR = 3
} a64inst_ShiftType;
// Holds data specific to arithmetic/logic register data processing instructions
typedef struct {
enum {
a64inst_DPR_ARITHM = 0,
a64inst_DPR_LOGIC = 1
} type;
a64inst_ShiftType shiftType;
bool negShiftedSrc2; // Guaranteed to be 0 for arithmetic instructions
} a64inst_DPRegister_ArithmLogicData;
// Holds data specific to multiply register data processing instructions
typedef struct {
bool negProd;
a64inst_regSpecifier summand;
} a64inst_DPRegister_MultiplyData;
// Holds data for register data processing instructions
typedef struct {
a64inst_regType regType;
a64inst_DPROpType DPROpType;
union {
a64inst_logicOp logicOp;
a64inst_arithmOp arithmOp;
} processOpId;
a64inst_regSpecifier src2;
union {
a64inst_DPRegister_ArithmLogicData arithmLogicData;
a64inst_DPRegister_MultiplyData multiplydata;
} processOpData;
a64inst_regSpecifier src1;
a64inst_regSpecifier dest;
} a64inst_DPRegisterData;