From cb63c65d7f2792b09fb52cb42f10fd22245aff6b Mon Sep 17 00:00:00 2001 From: mariusmonton Date: Mon, 18 Jan 2021 09:14:54 +0100 Subject: [PATCH] Implemented C_EBREAK instruction --- inc/C_extension.h | 1 + src/BASE_ISA.cpp | 2 +- src/C_extension.cpp | 19 ++++++++++++++++++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/inc/C_extension.h b/inc/C_extension.h index 8d8dd28..12f123f 100644 --- a/inc/C_extension.h +++ b/inc/C_extension.h @@ -415,6 +415,7 @@ public: bool Exec_C_LW(); bool Exec_C_SW(); bool Exec_C_JAL(int m_rd); + bool Exec_C_EBREAK(); bool process_instruction(Instruction *inst); }; diff --git a/src/BASE_ISA.cpp b/src/BASE_ISA.cpp index 7d41128..67ca4cc 100644 --- a/src/BASE_ISA.cpp +++ b/src/BASE_ISA.cpp @@ -933,7 +933,7 @@ bool BASE_ISA::Exec_EBREAK() { perf->dump(); RaiseException(EXCEPTION_CAUSE_BREAKPOINT, m_instr); - + NOP(); return true; } diff --git a/src/C_extension.cpp b/src/C_extension.cpp index 5b942c4..2df5b30 100644 --- a/src/C_extension.cpp +++ b/src/C_extension.cpp @@ -138,11 +138,11 @@ op_C_Codes C_extension::decode() const { break; [[unlikely]] default: + return OP_C_ERROR; break; } - return OP_C_ERROR; } @@ -663,6 +663,20 @@ bool C_extension::Exec_C_JAL(int m_rd) { return true; } +bool C_extension::Exec_C_EBREAK() { + + log->SC_log(Log::INFO) << "C.EBREAK" << "\n"; + std::cout << "\n" << "C.EBRAK Instruction called, dumping information" + << "\n"; + regs->dump(); + std::cout << "Simulation time " << sc_core::sc_time_stamp() << "\n"; + perf->dump(); + + RaiseException(EXCEPTION_CAUSE_BREAKPOINT, m_instr); + NOP(); + return true; +} + bool C_extension::process_instruction(Instruction *inst) { bool PC_not_affected = true; @@ -747,6 +761,9 @@ bool C_extension::process_instruction(Instruction *inst) { case OP_C_AND: Exec_C_AND(); break; + case OP_C_EBREAK: + Exec_C_EBREAK(); + break; [[unlikely]] default: std::cout << "C instruction not implemented yet" << "\n"; inst->dump();