From f7c9f47c3fdf05072b06d3a907270a51971f736f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A0rius=20Mont=C3=B3n?= Date: Tue, 16 Nov 2021 10:25:47 +0100 Subject: [PATCH] changed pointer by reference --- inc/A_extension.h | 2 +- inc/BASE_ISA.h | 2 +- inc/C_extension.h | 2 +- inc/M_extension.h | 2 +- src/A_extension.cpp | 6 +++--- src/BASE_ISA.cpp | 6 +++--- src/C_extension.cpp | 6 +++--- src/M_extension.cpp | 6 +++--- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/inc/A_extension.h b/inc/A_extension.h index 59267de..95fa517 100644 --- a/inc/A_extension.h +++ b/inc/A_extension.h @@ -89,7 +89,7 @@ public: bool Exec_A_AMOMINU() const; bool Exec_A_AMOMAXU() const; - bool process_instruction(Instruction *inst); + bool process_instruction(Instruction &inst); void TLB_reserve(std::uint32_t address); bool TLB_reserved(std::uint32_t address); diff --git a/inc/BASE_ISA.h b/inc/BASE_ISA.h index cb2a63d..8356030 100644 --- a/inc/BASE_ISA.h +++ b/inc/BASE_ISA.h @@ -336,7 +336,7 @@ public: * @param inst instruction to execute * @return true if PC is affected by instruction */ - bool process_instruction(Instruction *inst, bool *breakpoint = nullptr); + bool process_instruction(Instruction &inst, bool *breakpoint = nullptr); /** * @brief Decodes opcode of instruction diff --git a/inc/C_extension.h b/inc/C_extension.h index a16be81..6db5429 100644 --- a/inc/C_extension.h +++ b/inc/C_extension.h @@ -405,7 +405,7 @@ public: bool Exec_C_JAL(int m_rd); bool Exec_C_EBREAK(); - bool process_instruction(Instruction *inst, bool *breakpoint = nullptr); + bool process_instruction(Instruction &inst, bool *breakpoint = nullptr); }; #endif diff --git a/inc/M_extension.h b/inc/M_extension.h index 2f24e67..5aa66ba 100644 --- a/inc/M_extension.h +++ b/inc/M_extension.h @@ -69,7 +69,7 @@ public: bool Exec_M_REM() const; bool Exec_M_REMU() const; - bool process_instruction(Instruction *inst); + bool process_instruction(Instruction &inst); private: diff --git a/src/A_extension.cpp b/src/A_extension.cpp index 37ff3b4..a813659 100644 --- a/src/A_extension.cpp +++ b/src/A_extension.cpp @@ -385,10 +385,10 @@ bool A_extension::TLB_reserved(std::uint32_t address) { } } -bool A_extension::process_instruction(Instruction *inst) { +bool A_extension::process_instruction(Instruction &inst) { bool PC_not_affected = true; - setInstr(inst->getInstr()); + setInstr(inst.getInstr()); switch (decode()) { case OP_A_LR: @@ -426,7 +426,7 @@ bool A_extension::process_instruction(Instruction *inst) { break; [[unlikely]] default: std::cout << "A instruction not implemented yet" << std::endl; - inst->dump(); + inst.dump(); NOP(); break; } diff --git a/src/BASE_ISA.cpp b/src/BASE_ISA.cpp index c8ebdaa..c6aa9c2 100644 --- a/src/BASE_ISA.cpp +++ b/src/BASE_ISA.cpp @@ -1172,11 +1172,11 @@ bool BASE_ISA::Exec_SFENCE() const { return true; } -bool BASE_ISA::process_instruction(Instruction *inst, bool *breakpoint) { +bool BASE_ISA::process_instruction(Instruction &inst, bool *breakpoint) { bool PC_not_affected = true; *breakpoint = false; - setInstr(inst->getInstr()); + setInstr(inst.getInstr()); switch (decode()) { case OP_LUI: @@ -1344,7 +1344,7 @@ bool BASE_ISA::process_instruction(Instruction *inst, bool *breakpoint) { break; [[unlikely]] default: std::cout << "Wrong instruction" << "\n"; - inst->dump(); + inst.dump(); NOP(); //sc_stop(); break; diff --git a/src/C_extension.cpp b/src/C_extension.cpp index d9a2e1f..902ef1a 100644 --- a/src/C_extension.cpp +++ b/src/C_extension.cpp @@ -680,12 +680,12 @@ bool C_extension::Exec_C_EBREAK() { return true; } -bool C_extension::process_instruction(Instruction *inst, bool *breakpoint) { +bool C_extension::process_instruction(Instruction &inst, bool *breakpoint) { bool PC_not_affected = true; *breakpoint = false; - setInstr(inst->getInstr()); + setInstr(inst.getInstr()); switch (decode()) { case OP_C_ADDI4SPN: @@ -773,7 +773,7 @@ bool C_extension::process_instruction(Instruction *inst, bool *breakpoint) { break; [[unlikely]] default: std::cout << "C instruction not implemented yet" << "\n"; - inst->dump(); + inst.dump(); NOP(); break; } diff --git a/src/M_extension.cpp b/src/M_extension.cpp index 0c9251e..76e4fd7 100644 --- a/src/M_extension.cpp +++ b/src/M_extension.cpp @@ -245,10 +245,10 @@ bool M_extension::Exec_M_REMU() const { return true; } -bool M_extension::process_instruction(Instruction *inst) { +bool M_extension::process_instruction(Instruction &inst) { bool PC_not_affected = true; - setInstr(inst->getInstr()); + setInstr(inst.getInstr()); switch (decode()) { case OP_M_MUL: @@ -277,7 +277,7 @@ bool M_extension::process_instruction(Instruction *inst) { break; [[unlikely]] default: std::cout << "M instruction not implemented yet" << "\n"; - inst->dump(); + inst.dump(); //NOP(inst); sc_core::sc_stop(); break;