Add instruction type classification to decode, w/ T
This commit is contained in:
parent
c07cbd12c9
commit
497cd7ce3b
19
src/decode.c
19
src/decode.c
@ -21,4 +21,23 @@ a64inst_instruction *decode(word wrd) {
|
||||
fprintf(stderr, "Ran out of memory while attempting to decode an instruction!\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
word DPImmFlag = getBits(wrd, DATA_PROCESSING_DPIMM_LSB, DATA_PROCESSING_DPIMM_MSB);
|
||||
if (wrd == HALT_WORD) {
|
||||
inst->type = a64inst_Halt;
|
||||
|
||||
} else if (DPImmFlag == 0) {
|
||||
inst->type = a64inst_DPImmediate;
|
||||
|
||||
}else if (DPImmFlag == 1) {
|
||||
inst->type = a64inst_Branch;
|
||||
|
||||
} else if (getBits(wrd, DATA_PROCESSING_DPReg_LSB, DATA_PROCESSING_DPReg_MSB) == 1) {
|
||||
inst->type = a64inst_DPRegister;
|
||||
|
||||
} else {
|
||||
// Load and Store, or unknown
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -2,5 +2,12 @@
|
||||
#include "a64instruction.h"
|
||||
|
||||
#define BYTE_BITS 8
|
||||
#define HALT_WORD 0x8a000000
|
||||
|
||||
#define DATA_PROCESSING_DPIMM_LSB 26
|
||||
#define DATA_PROCESSING_DPIMM_MSB 29
|
||||
|
||||
#define DATA_PROCESSING_DPReg_LSB 25
|
||||
#define DATA_PROCESSING_DPReg_MSB 26
|
||||
|
||||
a64inst_instruction *decode(word w);
|
||||
Loading…
Reference in New Issue
Block a user