diff --git a/gen_input/templates/interp/CORENAME.cpp.gtl b/gen_input/templates/interp/CORENAME.cpp.gtl index 65d3b5b..f2b86ae 100644 --- a/gen_input/templates/interp/CORENAME.cpp.gtl +++ b/gen_input/templates/interp/CORENAME.cpp.gtl @@ -64,7 +64,9 @@ public: using addr_t = typename super::addr_t; using reg_t = typename traits::reg_t; using mem_type_e = typename traits::mem_type_e; - + + const bool has_compressed = traits::MISA_VAL & 0b100; + vm_impl(); vm_impl(ARCH &core, unsigned core_id = 0, unsigned cluster_id = 0); @@ -210,6 +212,7 @@ private: <%instr.behavior.eachLine{%>${it} <%}%>} catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, ${idx}); // trap check if(*trap_state!=0){ @@ -324,6 +327,7 @@ typename vm_base::virt_addr_t vm_impl::execute_inst(finish_cond_e co if (is_jump_to_self_enabled(cond) && (insn == 0x0000006f || (insn&0xffff)==0xa001)) throw simulation_stopped(0); // 'J 0' or 'C.J 0' auto f = decode_inst(insn); + auto old_pc = pc.val; pc = (this->*f)(pc, insn); } } diff --git a/incl/iss/arch/riscv_hart_m_p.h b/incl/iss/arch/riscv_hart_m_p.h index 87066f3..9d93bd2 100644 --- a/incl/iss/arch/riscv_hart_m_p.h +++ b/incl/iss/arch/riscv_hart_m_p.h @@ -920,7 +920,16 @@ template uint64_t riscv_hart_m_p::enter_trap(uint64_t flag if (trap_id == 0) { // exception // store ret addr in xepc register csr[mepc] = static_cast(addr) & get_pc_mask(); // store actual address instruction of exception - csr[mtval] = cause==2?((instr & 0x3)==3?instr:instr&0xffff):fault_data; + switch(cause){ + case 0: + csr[mtval] = instr; + break; + case 2: + csr[mtval] = (instr & 0x3)==3?instr:instr&0xffff; + break; + default: + csr[mtval] = fault_data; + } fault_data = 0; } else { csr[mepc] = this->reg.NEXT_PC & get_pc_mask(); // store next address if interrupt diff --git a/src/vm/interp/vm_tgc_c.cpp b/src/vm/interp/vm_tgc_c.cpp index 01985ba..f2686de 100644 --- a/src/vm/interp/vm_tgc_c.cpp +++ b/src/vm/interp/vm_tgc_c.cpp @@ -64,7 +64,9 @@ public: using addr_t = typename super::addr_t; using reg_t = typename traits::reg_t; using mem_type_e = typename traits::mem_type_e; - + + const bool has_compressed = traits::MISA_VAL & 0b100; + vm_impl(); vm_impl(ARCH &core, unsigned core_id = 0, unsigned cluster_id = 0); @@ -385,6 +387,7 @@ private: if(rd != 0) *(X+rd) = (int32_t)imm; } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 0); // trap check if(*trap_state!=0){ @@ -425,6 +428,7 @@ private: if(rd != 0) *(X+rd) = *PC + (int32_t)imm; } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 1); // trap check if(*trap_state!=0){ @@ -468,6 +472,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 2); // trap check if(*trap_state!=0){ @@ -513,6 +518,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 3); // trap check if(*trap_state!=0){ @@ -554,6 +560,7 @@ private: if(*(X+rs1) == *(X+rs2)) pc_assign(*NEXT_PC) = *PC + (int16_t)sext<13>(imm); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 4); // trap check if(*trap_state!=0){ @@ -595,6 +602,7 @@ private: if(*(X+rs1) != *(X+rs2)) pc_assign(*NEXT_PC) = *PC + (int16_t)sext<13>(imm); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 5); // trap check if(*trap_state!=0){ @@ -636,6 +644,7 @@ private: if((int32_t)*(X+rs1) < (int32_t)*(X+rs2)) pc_assign(*NEXT_PC) = *PC + (int16_t)sext<13>(imm); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 6); // trap check if(*trap_state!=0){ @@ -677,6 +686,7 @@ private: if((int32_t)*(X+rs1) >= (int32_t)*(X+rs2)) pc_assign(*NEXT_PC) = *PC + (int16_t)sext<13>(imm); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 7); // trap check if(*trap_state!=0){ @@ -718,6 +728,7 @@ private: if(*(X+rs1) < *(X+rs2)) pc_assign(*NEXT_PC) = *PC + (int16_t)sext<13>(imm); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 8); // trap check if(*trap_state!=0){ @@ -759,6 +770,7 @@ private: if(*(X+rs1) >= *(X+rs2)) pc_assign(*NEXT_PC) = *PC + (int16_t)sext<13>(imm); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 9); // trap check if(*trap_state!=0){ @@ -803,6 +815,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 10); // trap check if(*trap_state!=0){ @@ -848,6 +861,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 11); // trap check if(*trap_state!=0){ @@ -893,6 +907,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 12); // trap check if(*trap_state!=0){ @@ -937,6 +952,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 13); // trap check if(*trap_state!=0){ @@ -982,6 +998,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 14); // trap check if(*trap_state!=0){ @@ -1023,6 +1040,7 @@ private: writeSpace1(traits::MEM, *(X+rs1) + (int16_t)sext<12>(imm), (int8_t)*(X+rs2)); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 15); // trap check if(*trap_state!=0){ @@ -1067,6 +1085,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 16); // trap check if(*trap_state!=0){ @@ -1111,6 +1130,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 17); // trap check if(*trap_state!=0){ @@ -1152,6 +1172,7 @@ private: if(rd != 0) *(X+rd) = *(X+rs1) + (int16_t)sext<12>(imm); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 18); // trap check if(*trap_state!=0){ @@ -1193,6 +1214,7 @@ private: if(rd != 0) *(X+rd) = (int32_t)*(X+rs1) < (int16_t)sext<12>(imm)? 1 : 0; } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 19); // trap check if(*trap_state!=0){ @@ -1234,6 +1256,7 @@ private: if(rd != 0) *(X+rd) = (*(X+rs1) < (uint32_t)((int16_t)sext<12>(imm)))? 1 : 0; } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 20); // trap check if(*trap_state!=0){ @@ -1275,6 +1298,7 @@ private: if(rd != 0) *(X+rd) = *(X+rs1) ^ (int16_t)sext<12>(imm); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 21); // trap check if(*trap_state!=0){ @@ -1316,6 +1340,7 @@ private: if(rd != 0) *(X+rd) = *(X+rs1) | (int16_t)sext<12>(imm); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 22); // trap check if(*trap_state!=0){ @@ -1357,6 +1382,7 @@ private: if(rd != 0) *(X+rd) = *(X+rs1) & (int16_t)sext<12>(imm); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 23); // trap check if(*trap_state!=0){ @@ -1403,6 +1429,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 24); // trap check if(*trap_state!=0){ @@ -1449,6 +1476,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 25); // trap check if(*trap_state!=0){ @@ -1495,6 +1523,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 26); // trap check if(*trap_state!=0){ @@ -1536,6 +1565,7 @@ private: if(rd != 0) *(X+rd) = *(X+rs1) + *(X+rs2); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 27); // trap check if(*trap_state!=0){ @@ -1577,6 +1607,7 @@ private: if(rd != 0) *(X+rd) = *(X+rs1) - *(X+rs2); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 28); // trap check if(*trap_state!=0){ @@ -1618,6 +1649,7 @@ private: if(rd != 0) *(X+rd) = *(X+rs1) << (*(X+rs2) & (traits::XLEN - 1)); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 29); // trap check if(*trap_state!=0){ @@ -1659,6 +1691,7 @@ private: if(rd != 0) *(X+rd) = (int32_t)*(X+rs1) < (int32_t)*(X+rs2)? 1 : 0; } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 30); // trap check if(*trap_state!=0){ @@ -1700,6 +1733,7 @@ private: if(rd != 0) *(X+rd) = (uint32_t)*(X+rs1) < (uint32_t)*(X+rs2)? 1 : 0; } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 31); // trap check if(*trap_state!=0){ @@ -1741,6 +1775,7 @@ private: if(rd != 0) *(X+rd) = *(X+rs1) ^ *(X+rs2); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 32); // trap check if(*trap_state!=0){ @@ -1782,6 +1817,7 @@ private: if(rd != 0) *(X+rd) = *(X+rs1) >> (*(X+rs2) & (traits::XLEN - 1)); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 33); // trap check if(*trap_state!=0){ @@ -1823,6 +1859,7 @@ private: if(rd != 0) *(X+rd) = (int32_t)*(X+rs1) >> (*(X+rs2) & (traits::XLEN - 1)); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 34); // trap check if(*trap_state!=0){ @@ -1864,6 +1901,7 @@ private: if(rd != 0) *(X+rd) = *(X+rs1) | *(X+rs2); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 35); // trap check if(*trap_state!=0){ @@ -1905,6 +1943,7 @@ private: if(rd != 0) *(X+rd) = *(X+rs1) & *(X+rs2); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 36); // trap check if(*trap_state!=0){ @@ -1947,6 +1986,7 @@ private: writeSpace1(traits::FENCE, traits::fence, pred << 4 | succ); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 37); // trap check if(*trap_state!=0){ @@ -1981,6 +2021,7 @@ private: raise(0, 11); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 38); // trap check if(*trap_state!=0){ @@ -2015,6 +2056,7 @@ private: raise(0, 3); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 39); // trap check if(*trap_state!=0){ @@ -2049,6 +2091,7 @@ private: leave(0); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 40); // trap check if(*trap_state!=0){ @@ -2083,6 +2126,7 @@ private: leave(1); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 41); // trap check if(*trap_state!=0){ @@ -2117,6 +2161,7 @@ private: leave(3); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 42); // trap check if(*trap_state!=0){ @@ -2151,6 +2196,7 @@ private: wait(1); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 43); // trap check if(*trap_state!=0){ @@ -2202,6 +2248,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 44); // trap check if(*trap_state!=0){ @@ -2248,6 +2295,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 45); // trap check if(*trap_state!=0){ @@ -2294,6 +2342,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 46); // trap check if(*trap_state!=0){ @@ -2339,6 +2388,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 47); // trap check if(*trap_state!=0){ @@ -2384,6 +2434,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 48); // trap check if(*trap_state!=0){ @@ -2429,6 +2480,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 49); // trap check if(*trap_state!=0){ @@ -2475,6 +2527,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 50); // trap check if(*trap_state!=0){ @@ -2521,6 +2574,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 51); // trap check if(*trap_state!=0){ @@ -2567,6 +2621,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 52); // trap check if(*trap_state!=0){ @@ -2613,6 +2668,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 53); // trap check if(*trap_state!=0){ @@ -2663,6 +2719,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 54); // trap check if(*trap_state!=0){ @@ -2709,6 +2766,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 55); // trap check if(*trap_state!=0){ @@ -2759,6 +2817,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 56); // trap check if(*trap_state!=0){ @@ -2805,6 +2864,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 57); // trap check if(*trap_state!=0){ @@ -2846,6 +2906,7 @@ private: else raise(0, 2); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 58); // trap check if(*trap_state!=0){ @@ -2890,6 +2951,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 59); // trap check if(*trap_state!=0){ @@ -2934,6 +2996,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 60); // trap check if(*trap_state!=0){ @@ -2974,6 +3037,7 @@ private: *(X+rs1) = *(X+rs1) + (int8_t)sext<6>(imm); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 61); // trap check if(*trap_state!=0){ @@ -3010,6 +3074,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 62); // trap check if(*trap_state!=0){ @@ -3052,6 +3117,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 63); // trap check if(*trap_state!=0){ @@ -3094,6 +3160,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 64); // trap check if(*trap_state!=0){ @@ -3137,6 +3204,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 65); // trap check if(*trap_state!=0){ @@ -3177,6 +3245,7 @@ private: else raise(0, 2); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 66); // trap check if(*trap_state!=0){ @@ -3212,6 +3281,7 @@ private: raise(0, 2); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 67); // trap check if(*trap_state!=0){ @@ -3255,6 +3325,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 68); // trap check if(*trap_state!=0){ @@ -3302,6 +3373,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 69); // trap check if(*trap_state!=0){ @@ -3345,6 +3417,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 70); // trap check if(*trap_state!=0){ @@ -3388,6 +3461,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 71); // trap check if(*trap_state!=0){ @@ -3431,6 +3505,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 72); // trap check if(*trap_state!=0){ @@ -3474,6 +3549,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 73); // trap check if(*trap_state!=0){ @@ -3517,6 +3593,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 74); // trap check if(*trap_state!=0){ @@ -3555,6 +3632,7 @@ private: pc_assign(*NEXT_PC) = *PC + (int16_t)sext<12>(imm); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 75); // trap check if(*trap_state!=0){ @@ -3595,6 +3673,7 @@ private: if(*(X+(rs1 + 8)) == 0) pc_assign(*NEXT_PC) = *PC + (int16_t)sext<9>(imm); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 76); // trap check if(*trap_state!=0){ @@ -3635,6 +3714,7 @@ private: if(*(X+(rs1 + 8)) != 0) pc_assign(*NEXT_PC) = *PC + (int16_t)sext<9>(imm); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 77); // trap check if(*trap_state!=0){ @@ -3675,6 +3755,7 @@ private: if(nzuimm) *(X+rs1) = *(X+rs1) << nzuimm; } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 78); // trap check if(*trap_state!=0){ @@ -3719,6 +3800,7 @@ private: else raise(0, 2); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 79); // trap check if(*trap_state!=0){ @@ -3759,6 +3841,7 @@ private: if(rd != 0) *(X+rd) = *(X+rs2); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 80); // trap check if(*trap_state!=0){ @@ -3799,6 +3882,7 @@ private: else raise(0, 2); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 81); // trap check if(*trap_state!=0){ @@ -3833,6 +3917,7 @@ private: raise(0, 2); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 82); // trap check if(*trap_state!=0){ @@ -3873,6 +3958,7 @@ private: if(rd != 0) *(X+rd) = *(X+rd) + *(X+rs2); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 83); // trap check if(*trap_state!=0){ @@ -3916,6 +4002,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 84); // trap check if(*trap_state!=0){ @@ -3950,6 +4037,7 @@ private: raise(0, 3); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 85); // trap check if(*trap_state!=0){ @@ -3993,6 +4081,7 @@ private: } } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 86); // trap check if(*trap_state!=0){ @@ -4027,6 +4116,7 @@ private: raise(0, 2); } catch(...){} // post execution stuff + if(!has_compressed && (*NEXT_PC&0x3)!=0) raise(0, 0); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 87); // trap check if(*trap_state!=0){ @@ -4141,6 +4231,7 @@ typename vm_base::virt_addr_t vm_impl::execute_inst(finish_cond_e co if (is_jump_to_self_enabled(cond) && (insn == 0x0000006f || (insn&0xffff)==0xa001)) throw simulation_stopped(0); // 'J 0' or 'C.J 0' auto f = decode_inst(insn); + auto old_pc = pc.val; pc = (this->*f)(pc, insn); } }