changed pointer by reference

This commit is contained in:
Màrius Montón 2021-11-16 10:25:47 +01:00
parent 5caf1b77c8
commit f7c9f47c3f
8 changed files with 16 additions and 16 deletions

View File

@ -89,7 +89,7 @@ public:
bool Exec_A_AMOMINU() const; bool Exec_A_AMOMINU() const;
bool Exec_A_AMOMAXU() const; bool Exec_A_AMOMAXU() const;
bool process_instruction(Instruction *inst); bool process_instruction(Instruction &inst);
void TLB_reserve(std::uint32_t address); void TLB_reserve(std::uint32_t address);
bool TLB_reserved(std::uint32_t address); bool TLB_reserved(std::uint32_t address);

View File

@ -336,7 +336,7 @@ public:
* @param inst instruction to execute * @param inst instruction to execute
* @return true if PC is affected by instruction * @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 * @brief Decodes opcode of instruction

View File

@ -405,7 +405,7 @@ public:
bool Exec_C_JAL(int m_rd); bool Exec_C_JAL(int m_rd);
bool Exec_C_EBREAK(); bool Exec_C_EBREAK();
bool process_instruction(Instruction *inst, bool *breakpoint = nullptr); bool process_instruction(Instruction &inst, bool *breakpoint = nullptr);
}; };
#endif #endif

View File

@ -69,7 +69,7 @@ public:
bool Exec_M_REM() const; bool Exec_M_REM() const;
bool Exec_M_REMU() const; bool Exec_M_REMU() const;
bool process_instruction(Instruction *inst); bool process_instruction(Instruction &inst);
private: private:

View File

@ -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; bool PC_not_affected = true;
setInstr(inst->getInstr()); setInstr(inst.getInstr());
switch (decode()) { switch (decode()) {
case OP_A_LR: case OP_A_LR:
@ -426,7 +426,7 @@ bool A_extension::process_instruction(Instruction *inst) {
break; break;
[[unlikely]] default: [[unlikely]] default:
std::cout << "A instruction not implemented yet" << std::endl; std::cout << "A instruction not implemented yet" << std::endl;
inst->dump(); inst.dump();
NOP(); NOP();
break; break;
} }

View File

@ -1172,11 +1172,11 @@ bool BASE_ISA::Exec_SFENCE() const {
return true; 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; bool PC_not_affected = true;
*breakpoint = false; *breakpoint = false;
setInstr(inst->getInstr()); setInstr(inst.getInstr());
switch (decode()) { switch (decode()) {
case OP_LUI: case OP_LUI:
@ -1344,7 +1344,7 @@ bool BASE_ISA::process_instruction(Instruction *inst, bool *breakpoint) {
break; break;
[[unlikely]] default: [[unlikely]] default:
std::cout << "Wrong instruction" << "\n"; std::cout << "Wrong instruction" << "\n";
inst->dump(); inst.dump();
NOP(); NOP();
//sc_stop(); //sc_stop();
break; break;

View File

@ -680,12 +680,12 @@ bool C_extension::Exec_C_EBREAK() {
return true; 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; bool PC_not_affected = true;
*breakpoint = false; *breakpoint = false;
setInstr(inst->getInstr()); setInstr(inst.getInstr());
switch (decode()) { switch (decode()) {
case OP_C_ADDI4SPN: case OP_C_ADDI4SPN:
@ -773,7 +773,7 @@ bool C_extension::process_instruction(Instruction *inst, bool *breakpoint) {
break; break;
[[unlikely]] default: [[unlikely]] default:
std::cout << "C instruction not implemented yet" << "\n"; std::cout << "C instruction not implemented yet" << "\n";
inst->dump(); inst.dump();
NOP(); NOP();
break; break;
} }

View File

@ -245,10 +245,10 @@ bool M_extension::Exec_M_REMU() const {
return true; return true;
} }
bool M_extension::process_instruction(Instruction *inst) { bool M_extension::process_instruction(Instruction &inst) {
bool PC_not_affected = true; bool PC_not_affected = true;
setInstr(inst->getInstr()); setInstr(inst.getInstr());
switch (decode()) { switch (decode()) {
case OP_M_MUL: case OP_M_MUL:
@ -277,7 +277,7 @@ bool M_extension::process_instruction(Instruction *inst) {
break; break;
[[unlikely]] default: [[unlikely]] default:
std::cout << "M instruction not implemented yet" << "\n"; std::cout << "M instruction not implemented yet" << "\n";
inst->dump(); inst.dump();
//NOP(inst); //NOP(inst);
sc_core::sc_stop(); sc_core::sc_stop();
break; break;