diff options
author | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-02-04 19:05:40 +0100 |
---|---|---|
committer | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-02-04 19:05:40 +0100 |
commit | d3363c3430029eba44464469176b3b27bb12089a (patch) | |
tree | 9987ae6daae04cb6f5a3a74bc2d04ea5b5a3887e /qtmips_machine/instruction.cpp | |
parent | a107902ca07e69413437fd2e66495a91b4b6fb18 (diff) | |
download | qtmips-d3363c3430029eba44464469176b3b27bb12089a.tar.gz qtmips-d3363c3430029eba44464469176b3b27bb12089a.tar.bz2 qtmips-d3363c3430029eba44464469176b3b27bb12089a.zip |
Remove almost all direct access to opcode and function from the core.
Remaining are MOVZ and MOVN in the execution phase
and all branch and jump operations in handle_pc().
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Diffstat (limited to 'qtmips_machine/instruction.cpp')
-rw-r--r-- | qtmips_machine/instruction.cpp | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/qtmips_machine/instruction.cpp b/qtmips_machine/instruction.cpp index 4c91d6f..c11e621 100644 --- a/qtmips_machine/instruction.cpp +++ b/qtmips_machine/instruction.cpp @@ -176,7 +176,7 @@ struct AluInstructionMap { unsigned int flags; }; -#define AIM_UNKNOWN {"UNKNOWN"} +#define AIM_UNKNOWN {"UNKNOWN", IMF_NONE} // This table is indexed by funct static const struct AluInstructionMap alu_instruction_map[] = { {"SLL", FLAGS_ALU_T_R_STD}, @@ -187,8 +187,8 @@ static const struct AluInstructionMap alu_instruction_map[] = { AIM_UNKNOWN, {"SRLV", FLAGS_ALU_T_R_STD}, {"SRAV", FLAGS_ALU_T_R_STD}, - {"JR", FLAGS_ALU_T_R_S}, - {"JALR", FLAGS_ALU_T_R_SD}, + {"JR", IMF_SUPPORTED | IMF_BJR_REQ_RS}, + {"JALR", IMF_SUPPORTED | IMF_REGD | IMF_REGWRITE | IMF_BJR_REQ_RS | IMF_PC8_TO_RT}, {"MOVZ", FLAGS_ALU_T_R_STD}, {"MOVN", FLAGS_ALU_T_R_STD}, AIM_UNKNOWN, @@ -321,7 +321,7 @@ enum AluOp Instruction::alu_op() const { if (opcode() >= (sizeof(instruction_map) / sizeof(struct InstructionMap))) return ALU_OP_UNKNOWN; const struct InstructionMap &im = instruction_map[opcode()]; - return im.alu; + return opcode() == 0? (enum AluOp)funct(): im.alu; } enum AccessControl Instruction::mem_ctl() const { if (opcode() >= (sizeof(instruction_map) / sizeof(struct InstructionMap))) @@ -330,13 +330,6 @@ enum AccessControl Instruction::mem_ctl() const { return im.mem_ctl; } -bool Instruction::is_store() const { - if (opcode() >= (sizeof(instruction_map) / sizeof(struct InstructionMap))) - return false; - const struct InstructionMap &im = instruction_map[opcode()]; - return im.flags & IMF_MEM_STORE; -} - bool Instruction::is_break() const { return opcode() == 0 && funct() == ALU_OP_BREAK; } |