added likely, unlikely attributes to switch case, could boost perfomance
This commit is contained in:
parent
9feda996e6
commit
5b91897244
|
@ -44,7 +44,7 @@ op_A_Codes A_extension::decode() {
|
||||||
case A_AMOMAXU:
|
case A_AMOMAXU:
|
||||||
return OP_A_AMOMAXU;
|
return OP_A_AMOMAXU;
|
||||||
break;
|
break;
|
||||||
default:
|
[[unlikely]] default:
|
||||||
return OP_A_ERROR;
|
return OP_A_ERROR;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -405,7 +405,7 @@ bool A_extension::process_instruction(Instruction &inst) {
|
||||||
case OP_A_AMOMAXU:
|
case OP_A_AMOMAXU:
|
||||||
Exec_A_AMOMAXU();
|
Exec_A_AMOMAXU();
|
||||||
break;
|
break;
|
||||||
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();
|
||||||
|
|
|
@ -1316,7 +1316,7 @@ bool BASE_ISA::process_instruction(Instruction &inst) {
|
||||||
case OP_SFENCE:
|
case OP_SFENCE:
|
||||||
Exec_SFENCE();
|
Exec_SFENCE();
|
||||||
break;
|
break;
|
||||||
default:
|
[[unlikely]] default:
|
||||||
std::cout << "Wrong instruction" << std::endl;
|
std::cout << "Wrong instruction" << std::endl;
|
||||||
inst.dump();
|
inst.dump();
|
||||||
NOP();
|
NOP();
|
||||||
|
|
|
@ -37,7 +37,7 @@ void BusCtrl::b_transport(tlm::tlm_generic_payload &trans,
|
||||||
case TRACE_MEMORY_ADDRESS / 4:
|
case TRACE_MEMORY_ADDRESS / 4:
|
||||||
trace_socket->b_transport(trans, delay);
|
trace_socket->b_transport(trans, delay);
|
||||||
break;
|
break;
|
||||||
default:
|
[[likely]] default:
|
||||||
memory_socket->b_transport(trans, delay);
|
memory_socket->b_transport(trans, delay);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,7 +162,7 @@ void CPU::CPU_thread(void) {
|
||||||
|
|
||||||
/* check what type of instruction is and execute it */
|
/* check what type of instruction is and execute it */
|
||||||
switch (inst->check_extension()) {
|
switch (inst->check_extension()) {
|
||||||
case BASE_EXTENSION:
|
[[likely]] case BASE_EXTENSION:
|
||||||
PC_not_affected = exec->process_instruction(*inst);
|
PC_not_affected = exec->process_instruction(*inst);
|
||||||
incPCby2 = false;
|
incPCby2 = false;
|
||||||
break;
|
break;
|
||||||
|
@ -178,7 +178,7 @@ void CPU::CPU_thread(void) {
|
||||||
PC_not_affected = a_inst->process_instruction(*inst);
|
PC_not_affected = a_inst->process_instruction(*inst);
|
||||||
incPCby2 = false;
|
incPCby2 = false;
|
||||||
break;
|
break;
|
||||||
default:
|
[[unlikely]] default:
|
||||||
std::cout << "Extension not implemented yet" << std::endl;
|
std::cout << "Extension not implemented yet" << std::endl;
|
||||||
inst->dump();
|
inst->dump();
|
||||||
exec->NOP();
|
exec->NOP();
|
||||||
|
@ -193,7 +193,7 @@ void CPU::CPU_thread(void) {
|
||||||
/* Process IRQ (if any) */
|
/* Process IRQ (if any) */
|
||||||
cpu_process_IRQ();
|
cpu_process_IRQ();
|
||||||
|
|
||||||
/* Fixed instruction time to 10 ns (i.e. 100 MHz)*/
|
/* Fixed instruction time to 10 ns (i.e. 100 MHz) */
|
||||||
//#define USE_QK
|
//#define USE_QK
|
||||||
#ifdef USE_QK
|
#ifdef USE_QK
|
||||||
// Model time used for additional processing
|
// Model time used for additional processing
|
||||||
|
|
|
@ -33,7 +33,7 @@ op_C_Codes C_extension::decode() {
|
||||||
case C_FSW:
|
case C_FSW:
|
||||||
return OP_C_FSW;
|
return OP_C_FSW;
|
||||||
break;
|
break;
|
||||||
default:
|
[[unlikely]] default:
|
||||||
return OP_C_ERROR;
|
return OP_C_ERROR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ op_C_Codes C_extension::decode() {
|
||||||
case C_BNEZ:
|
case C_BNEZ:
|
||||||
return OP_C_BNEZ;
|
return OP_C_BNEZ;
|
||||||
break;
|
break;
|
||||||
default:
|
[[unlikely]] default:
|
||||||
return OP_C_ERROR;
|
return OP_C_ERROR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -131,13 +131,13 @@ op_C_Codes C_extension::decode() {
|
||||||
return OP_C_SWSP;
|
return OP_C_SWSP;
|
||||||
break;
|
break;
|
||||||
case C_FWWSP:
|
case C_FWWSP:
|
||||||
default:
|
[[unlikely]] default:
|
||||||
return OP_C_ERROR;
|
return OP_C_ERROR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
[[unlikely]] default:
|
||||||
return OP_C_ERROR;
|
return OP_C_ERROR;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -745,7 +745,7 @@ bool C_extension::process_instruction(Instruction &inst) {
|
||||||
case OP_C_AND:
|
case OP_C_AND:
|
||||||
Exec_C_AND();
|
Exec_C_AND();
|
||||||
break;
|
break;
|
||||||
default:
|
[[unlikely]] default:
|
||||||
std::cout << "C instruction not implemented yet" << std::endl;
|
std::cout << "C instruction not implemented yet" << std::endl;
|
||||||
inst.dump();
|
inst.dump();
|
||||||
NOP();
|
NOP();
|
||||||
|
|
|
@ -35,7 +35,7 @@ op_M_Codes M_extension::decode() {
|
||||||
case M_REMU:
|
case M_REMU:
|
||||||
return OP_M_REMU;
|
return OP_M_REMU;
|
||||||
break;
|
break;
|
||||||
default:
|
[[unlikely]] default:
|
||||||
return OP_M_ERROR;
|
return OP_M_ERROR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -275,7 +275,7 @@ bool M_extension::process_instruction(Instruction &inst) {
|
||||||
case OP_M_REMU:
|
case OP_M_REMU:
|
||||||
Exec_M_REMU();
|
Exec_M_REMU();
|
||||||
break;
|
break;
|
||||||
default:
|
[[unlikely]] default:
|
||||||
std::cout << "M instruction not implemented yet" << std::endl;
|
std::cout << "M instruction not implemented yet" << std::endl;
|
||||||
inst.dump();
|
inst.dump();
|
||||||
//NOP(inst);
|
//NOP(inst);
|
||||||
|
|
Loading…
Reference in New Issue