From d3363c3430029eba44464469176b3b27bb12089a Mon Sep 17 00:00:00 2001 From: Pavel Pisa Date: Mon, 4 Feb 2019 19:05:40 +0100 Subject: 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 --- qtmips_machine/instruction.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'qtmips_machine/instruction.cpp') 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; } -- cgit v1.2.3