2 Commits

Author SHA1 Message Date
c8679fca85 remove MSVC warning 2021-10-10 19:56:33 +02:00
f0ada1ba8c add MSVC 16 compatibility 2021-10-10 19:06:41 +02:00
16 changed files with 135 additions and 323 deletions

View File

@ -48,16 +48,24 @@ if(WITH_LLVM)
endif()
# Define the library
add_library(${PROJECT_NAME} SHARED ${LIB_SOURCES})
add_library(${PROJECT_NAME} ${LIB_SOURCES})
# list code gen dependencies
if(TARGET ${CORE_NAME}_cpp)
add_dependencies(${PROJECT_NAME} ${CORE_NAME}_cpp)
endif()
target_compile_options(${PROJECT_NAME} PRIVATE -Wno-shift-count-overflow)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
target_compile_options(${PROJECT_NAME} PRIVATE -Wno-shift-count-overflow)
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
target_compile_options(${PROJECT_NAME} PRIVATE /wd4293)
endif()
target_include_directories(${PROJECT_NAME} PUBLIC incl)
target_link_libraries(${PROJECT_NAME} PUBLIC softfloat scc-util jsoncpp)
target_link_libraries(${PROJECT_NAME} PUBLIC -Wl,--whole-archive dbt-core -Wl,--no-whole-archive)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
target_link_libraries(${PROJECT_NAME} PUBLIC -Wl,--whole-archive dbt-core -Wl,--no-whole-archive)
else()
target_link_libraries(${PROJECT_NAME} PUBLIC dbt-core)
endif()
if(TARGET CONAN_PKG::elfio)
target_link_libraries(${PROJECT_NAME} PUBLIC CONAN_PKG::elfio)
elseif(TARGET elfio::elfio)
@ -98,16 +106,15 @@ if(WITH_LLVM)
target_link_libraries(${PROJECT_NAME} PUBLIC ${llvm_libs})
endif()
# Links the target exe against the libraries
target_link_libraries(${PROJECT_NAME} dbt-rise-tgc)
#target_link_libraries(${PROJECT_NAME} jsoncpp)
target_link_libraries(${PROJECT_NAME} PUBLIC dbt-rise-tgc)
if(TARGET Boost::program_options)
target_link_libraries(${PROJECT_NAME} Boost::program_options Boost::thread)
target_link_libraries(${PROJECT_NAME} PUBLIC Boost::program_options Boost::thread)
else()
target_link_libraries(${PROJECT_NAME} ${BOOST_program_options_LIBRARY} ${BOOST_thread_LIBRARY})
target_link_libraries(${PROJECT_NAME} PUBLIC ${BOOST_program_options_LIBRARY} ${BOOST_thread_LIBRARY})
endif()
target_link_libraries(${PROJECT_NAME} ${CMAKE_DL_LIBS})
target_link_libraries(${PROJECT_NAME} PUBLIC ${CMAKE_DL_LIBS})
if (Tcmalloc_FOUND)
target_link_libraries(${PROJECT_NAME} ${Tcmalloc_LIBRARIES})
target_link_libraries(${PROJECT_NAME} PUBLIC ${Tcmalloc_LIBRARIES})
endif(Tcmalloc_FOUND)
install(TARGETS tgc-sim

View File

@ -1,16 +0,0 @@
import "CoreDSL-Instruction-Set-Description/RV32I.core_desc"
import "CoreDSL-Instruction-Set-Description/RVM.core_desc"
import "CoreDSL-Instruction-Set-Description/RVC.core_desc"
Core TGC_B provides RV32I {
architectural_state {
unsigned XLEN=32;
unsigned PCLEN=32;
// definitions for the architecture wrapper
// XL ZYXWVUTSRQPONMLKJIHGFEDCBA
unsigned MISA_VAL = 0b01000000000000000000000100000000;
unsigned PGSIZE = 0x1000; //1 << 12;
unsigned PGMASK = 0xfff; //PGSIZE-1
}
}

View File

@ -1,15 +0,0 @@
import "CoreDSL-Instruction-Set-Description/RV32I.core_desc"
import "CoreDSL-Instruction-Set-Description/RVM.core_desc"
import "CoreDSL-Instruction-Set-Description/RVC.core_desc"
Core TGC_C provides RV32I, RV32M, RV32IC {
architectural_state {
unsigned XLEN=32;
unsigned PCLEN=32;
// definitions for the architecture wrapper
// XL ZYXWVUTSRQPONMLKJIHGFEDCBA
unsigned MISA_VAL = 0b01000000000000000001000100000100;
unsigned PGSIZE = 0x1000; //1 << 12;
unsigned PGMASK = 0xfff; //PGSIZE-1
}
}

View File

@ -1,13 +0,0 @@
import "CoreDSL-Instruction-Set-Description/RV32I.core_desc"
import "CoreDSL-Instruction-Set-Description/RVM.core_desc"
import "CoreDSL-Instruction-Set-Description/RVC.core_desc"
Core TGC_D provides RV32I, RV32M, RV32IC {
architectural_state {
unsigned XLEN=32;
unsigned PCLEN=32;
// definitions for the architecture wrapper
// XL ZYXWVUTSRQPONMLKJIHGFEDCBA
unsigned MISA_VAL = 0b01000000000000000001000100000100;
}
}

View File

@ -1,73 +0,0 @@
import "CoreDSL-Instruction-Set-Description/RISCVBase.core_desc"
import "CoreDSL-Instruction-Set-Description/RV32I.core_desc"
import "CoreDSL-Instruction-Set-Description/RVM.core_desc"
import "CoreDSL-Instruction-Set-Description/RVC.core_desc"
InstructionSet X_RB_MAC extends RISCVBase {
architectural_state {
register unsigned<64> ACC;
}
instructions {
RESET_ACC { // v-- funct7 v-- funct3
encoding: 7'd0 :: 10'b0 :: 3'd0 :: 5'b0 :: 7'b0001011;
behavior: ACC = 0;
}
GET_ACC_LO {
encoding: 7'd1 :: 10'b0 :: 3'd0 :: rd[4:0] :: 7'b0001011;
behavior: if (rd != 0) X[rd] = ACC[31:0];
}
GET_ACC_HI {
encoding: 7'd2 :: 10'b0 :: 3'd0 :: rd[4:0] :: 7'b0001011;
behavior: if (rd != 0) X[rd] = ACC[63:32];
}
MACU_32 {
encoding: 7'd0 :: rs2[4:0] :: rs1[4:0] :: 3'd1 :: 5'b0 :: 7'b0001011;
behavior: {
unsigned<64> mul = X[rs1] * X[rs2];
unsigned<33> add = mul[31:0] + ACC[31:0];
ACC = add[31:0];
}
}
MACS_32 {
encoding: 7'd1 :: rs2[4:0] :: rs1[4:0] :: 3'd1 :: 5'b0 :: 7'b0001011;
behavior: {
signed<64> mul = ((signed) X[rs1]) * ((signed) X[rs2]);
signed<33> add = ((signed) mul[31:0]) + ((signed) ACC[31:0]);
ACC = add[31:0]; // bit range always yields unsigned type
}
}
MACU_64 {
encoding: 7'd0 :: rs2[4:0] :: rs1[4:0] :: 3'd2 :: 5'b0 :: 7'b0001011;
behavior: {
unsigned<64> mul = X[rs1] * X[rs2];
unsigned<65> add = mul + ACC;
ACC = add[63:0];
}
}
MACS_64 {
encoding: 7'd1 :: rs2[4:0] :: rs1[4:0] :: 3'd2 :: 5'b0 :: 7'b0001011;
behavior: {
signed<64> mul = ((signed) X[rs1]) * ((signed) X[rs2]);
signed<65> add = mul + ((signed) ACC);
ACC = add[63:0];
}
}
}
}
Core TGC_D_XRB_MAC provides RV32I, RV32M, RV32IC, X_RB_MAC {
architectural_state {
unsigned XLEN=32;
unsigned PCLEN=32;
// definitions for the architecture wrapper
// XL ZYXWVUTSRQPONMLKJIHGFEDCBA
unsigned MISA_VAL = 0b01000000000000000001000100000100;
}
}

37
gen_input/TGFS.core_desc Normal file
View File

@ -0,0 +1,37 @@
import "CoreDSL-Instruction-Set-Description/RV32I.core_desc"
import "CoreDSL-Instruction-Set-Description/RVM.core_desc"
import "CoreDSL-Instruction-Set-Description/RVC.core_desc"
Core TGC_B provides RV32I {
architectural_state {
unsigned XLEN=32;
unsigned PCLEN=32;
// definitions for the architecture wrapper
// XL ZYXWVUTSRQPONMLKJIHGFEDCBA
unsigned MISA_VAL = 0b01000000000000000000000100000000;
unsigned PGSIZE = 0x1000; //1 << 12;
unsigned PGMASK = 0xfff; //PGSIZE-1
}
}
Core TGC_C provides RV32I, RV32M, RV32IC {
architectural_state {
unsigned XLEN=32;
unsigned PCLEN=32;
// definitions for the architecture wrapper
// XL ZYXWVUTSRQPONMLKJIHGFEDCBA
unsigned MISA_VAL = 0b01000000000000000001000100000100;
unsigned PGSIZE = 0x1000; //1 << 12;
unsigned PGMASK = 0xfff; //PGSIZE-1
}
}
Core TGC_D provides RV32I, RV32M, RV32IC {
architectural_state {
unsigned XLEN=32;
unsigned PCLEN=32;
// definitions for the architecture wrapper
// XL ZYXWVUTSRQPONMLKJIHGFEDCBA
unsigned MISA_VAL = 0b01000000000000000001000100000100;
}
}

View File

@ -64,9 +64,7 @@ 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);
@ -212,7 +210,6 @@ 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){
@ -327,7 +324,6 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::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);
}
}

View File

@ -362,8 +362,8 @@ riscv_hart_m_p<BASE>::riscv_hart_m_p()
csr_rd_cb[mie] = &this_class::read_ie;
csr_wr_cb[mie] = &this_class::write_ie;
csr_rd_cb[mhartid] = &this_class::read_hartid;
// csr_rd_cb[mcounteren] = &this_class::read_null;
// csr_wr_cb[mcounteren] = &this_class::write_null;
csr_rd_cb[mcounteren] = &this_class::read_null;
csr_wr_cb[mcounteren] = &this_class::write_null;
csr_wr_cb[misa] = &this_class::write_null;
csr_wr_cb[mvendorid] = &this_class::write_null;
csr_wr_cb[marchid] = &this_class::write_null;
@ -397,7 +397,7 @@ template <typename BASE> std::pair<uint64_t, bool> riscv_hart_m_p<BASE>::load_fi
traits<BASE>::MEM, pseg->get_physical_address(),
fsize, reinterpret_cast<const uint8_t *const>(seg_data));
if (res != iss::Ok)
LOG(ERROR) << "problem writing " << fsize << "bytes to 0x" << std::hex
LOG(ERR) << "problem writing " << fsize << "bytes to 0x" << std::hex
<< pseg->get_physical_address();
}
}
@ -920,16 +920,7 @@ template <typename BASE> uint64_t riscv_hart_m_p<BASE>::enter_trap(uint64_t flag
if (trap_id == 0) { // exception
// store ret addr in xepc register
csr[mepc] = static_cast<reg_t>(addr) & get_pc_mask(); // store actual address instruction of exception
switch(cause){
case 0:
csr[mtval] = instr;
break;
case 2:
csr[mtval] = (instr & 0x3)==3?instr:instr&0xffff;
break;
default:
csr[mtval] = fault_data;
}
csr[mtval] = cause==2?((instr & 0x3)==3?instr:instr&0xffff):fault_data;
fault_data = 0;
} else {
csr[mepc] = this->reg.NEXT_PC & get_pc_mask(); // store next address if interrupt
@ -957,7 +948,11 @@ template <typename BASE> uint64_t riscv_hart_m_p<BASE>::enter_trap(uint64_t flag
this->reg.PRIV = PRIV_M;
this->reg.trap_state = 0;
std::array<char, 32> buffer;
#if defined(_MSC_VER)
sprintf(buffer.data(), "0x%016llx", addr);
#else
sprintf(buffer.data(), "0x%016lx", addr);
#endif
if((flags&0xffffffff) != 0xffffffff)
CLOG(INFO, disass) << (trap_id ? "Interrupt" : "Trap") << " with cause '"
<< (trap_id ? irq_str[cause] : trap_str[cause]) << "' (" << cause << ")"

View File

@ -145,7 +145,7 @@ public:
mstatus_t mstatus;
static const reg_t mstatus_reset_val = 0x1800;
static const reg_t mstatus_reset_val = 0;
void write_mstatus(T val, unsigned priv_lvl) {
auto mask = get_mask(priv_lvl);
@ -398,7 +398,7 @@ private:
iss::status read_ip(unsigned addr, reg_t &val);
iss::status write_ip(unsigned addr, reg_t val);
iss::status read_hartid(unsigned addr, reg_t &val);
iss::status write_epc(unsigned addr, reg_t val);
iss::status write_mepc(unsigned addr, reg_t val);
iss::status read_satp(unsigned addr, reg_t &val);
iss::status write_satp(unsigned addr, reg_t val);
iss::status read_fcsr(unsigned addr, reg_t &val);
@ -954,8 +954,8 @@ template <typename BASE> iss::status riscv_hart_msu_vp<BASE>::write_ip(unsigned
return iss::Ok;
}
template <typename BASE> iss::status riscv_hart_msu_vp<BASE>::write_epc(unsigned addr, reg_t val) {
csr[addr] = val & get_pc_mask();
template <typename BASE> iss::status riscv_hart_m_p<BASE>::write_epc(unsigned addr, reg_t val) {
csr[addr] = val & get_pc_mask();
return iss::Ok;
}

View File

@ -146,7 +146,7 @@ public:
mstatus_t mstatus;
static const reg_t mstatus_reset_val = 0x1800; // MPP set to 1
static const reg_t mstatus_reset_val = 0;
void write_mstatus(T val, unsigned priv_lvl) {
auto mask = get_mask(priv_lvl);
@ -543,27 +543,25 @@ template <typename BASE, features_e FEAT> bool riscv_hart_mu_p<BASE, FEAT>::pmp_
constexpr auto PMP_NA4 =0x2U;
constexpr auto PMP_NAPOT =0x3U;
reg_t base = 0;
auto any_active = false;
for (size_t i = 0; i < 16; i++) {
reg_t tor = csr[pmpaddr0+i] << PMP_SHIFT;
uint8_t cfg = csr[pmpcfg0+(i/4)]>>(i%4);
if (cfg & PMP_A) {
any_active=true;
auto pmp_a = (cfg & PMP_A) >> 3;
auto is_tor = pmp_a == PMP_TOR;
auto is_na4 = pmp_a == PMP_NA4;
bool is_tor = pmp_a == PMP_TOR;
bool is_na4 = pmp_a == PMP_NA4;
reg_t mask = (csr[pmpaddr0+i] << 1) | (!is_na4);
mask = ~(mask & ~(mask + 1)) << PMP_SHIFT;
// Check each 4-byte sector of the access
auto any_match = false;
auto all_match = true;
bool any_match = false;
bool all_match = true;
for (reg_t offset = 0; offset < len; offset += 1 << PMP_SHIFT) {
reg_t cur_addr = addr + offset;
auto napot_match = ((cur_addr ^ tor) & mask) == 0;
auto tor_match = base <= cur_addr && cur_addr < tor;
auto match = is_tor ? tor_match : napot_match;
bool napot_match = ((cur_addr ^ tor) & mask) == 0;
bool tor_match = base <= cur_addr && cur_addr < tor;
bool match = is_tor ? tor_match : napot_match;
any_match |= match;
all_match &= match;
}
@ -579,7 +577,7 @@ template <typename BASE, features_e FEAT> bool riscv_hart_mu_p<BASE, FEAT>::pmp_
}
base = tor;
}
return !any_active || this->reg.PRIV == PRIV_M;
return this->reg.PRIV == PRIV_M;
}
@ -928,6 +926,8 @@ template <typename BASE, features_e FEAT> iss::status riscv_hart_mu_p<BASE, FEAT
template <typename BASE, features_e FEAT> iss::status riscv_hart_mu_p<BASE, FEAT>::write_ie(unsigned addr, reg_t val) {
auto mask = get_irq_wrmask((addr >> 8) & 0x3);
if(this->reg.PRIV==0)
mask&= ~(0xff<<4); // STIE and UTIE are read only in user and supervisor mode
csr[mie] = (csr[mie] & ~mask) | (val & mask);
check_interrupt();
return iss::Ok;
@ -1256,33 +1256,27 @@ template <typename BASE, features_e FEAT> uint64_t riscv_hart_mu_p<BASE, FEAT>::
template <typename BASE, features_e FEAT> uint64_t riscv_hart_mu_p<BASE, FEAT>::leave_trap(uint64_t flags) {
auto cur_priv = this->reg.PRIV;
auto inst_priv = (flags & 0x3)? 3:0;
if(inst_priv>cur_priv){
auto trap_val = 0x80ULL << 24 | (2 << 16); // illegal instruction
this->reg.trap_state = trap_val;
this->reg.NEXT_PC = std::numeric_limits<uint32_t>::max();
} else {
auto status = state.mstatus;
// pop the relevant lower-privilege interrupt enable and privilege mode stack
// clear respective yIE
switch (inst_priv) {
case PRIV_M:
this->reg.PRIV = state.mstatus.MPP;
state.mstatus.MPP = 0; // clear mpp to U mode
state.mstatus.MIE = state.mstatus.MPIE;
state.mstatus.MPIE = 1;
break;
case PRIV_U:
this->reg.PRIV = 0;
state.mstatus.UIE = state.mstatus.UPIE;
state.mstatus.UPIE = 1;
break;
}
// sets the pc to the value stored in the x epc register.
this->reg.NEXT_PC = csr[uepc | inst_priv << 8];
CLOG(INFO, disass) << "Executing xRET , changing privilege level from " << lvl[cur_priv] << " to "
<< lvl[this->reg.PRIV];
check_interrupt();
auto status = state.mstatus;
// pop the relevant lower-privilege interrupt enable and privilege mode stack
// clear respective yIE
switch (inst_priv) {
case PRIV_M:
this->reg.PRIV = state.mstatus.MPP;
state.mstatus.MPP = 0; // clear mpp to U mode
state.mstatus.MIE = state.mstatus.MPIE;
state.mstatus.MPIE = 1;
break;
case PRIV_U:
this->reg.PRIV = 0;
state.mstatus.UIE = state.mstatus.UPIE;
state.mstatus.UPIE = 1;
break;
}
// sets the pc to the value stored in the x epc register.
this->reg.NEXT_PC = csr[uepc | inst_priv << 8];
CLOG(INFO, disass) << "Executing xRET , changing privilege level from " << lvl[cur_priv] << " to "
<< lvl[this->reg.PRIV];
check_interrupt();
return this->reg.NEXT_PC;
}

View File

@ -49,7 +49,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/*----------------------------------------------------------------------------
*----------------------------------------------------------------------------*/
#ifdef __GNUC__
#define SOFTFLOAT_BUILTIN_CLZ 1
#define SOFTFLOAT_INTRINSIC_INT128 1
#endif
#include "opts-GCC.h"

View File

@ -49,11 +49,6 @@ using tgc_b_plat_type = iss::arch::riscv_hart_m_p<iss::arch::tgc_b>;
#include "iss/arch/tgc_d.h"
using tgc_d_plat_type = iss::arch::riscv_hart_mu_p<iss::arch::tgc_d, (iss::arch::features_e)(iss::arch::FEAT_PMP | iss::arch::FEAT_CLIC | iss::arch::FEAT_EXT_N)>;
#endif
#ifdef CORE_TGC_D_XRB_MAC
#include "iss/arch/riscv_hart_mu_p.h"
#include "iss/arch/tgc_d_xrb_mac.h"
using tgc_d_xrb_mac_plat_type = iss::arch::riscv_hart_mu_p<iss::arch::tgc_d_xrb_mac, (iss::arch::features_e)(iss::arch::FEAT_PMP | iss::arch::FEAT_CLIC | iss::arch::FEAT_EXT_N)>;
#endif
#ifdef WITH_LLVM
#include <iss/llvm/jit_helper.h>
#endif
@ -143,15 +138,9 @@ int main(int argc, char *argv[]) {
std::tie(cpu, vm) =
iss::create_cpu<tgc_d_plat_type>(clim["backend"].as<std::string>(), clim["gdb-port"].as<unsigned>());
} else
#endif
#ifdef CORE_TGC_D_XRB_MAC
if (isa_opt == "tgc_d_xrb_mac") {
std::tie(cpu, vm) =
iss::create_cpu<tgc_d_xrb_mac_plat_type>(clim["backend"].as<std::string>(), clim["gdb-port"].as<unsigned>());
} else
#endif
{
LOG(ERROR) << "Illegal argument value for '--isa': " << clim["isa"].as<std::string>() << std::endl;
LOG(ERR) << "Illegal argument value for '--isa': " << clim["isa"].as<std::string>() << std::endl;
return 127;
}
if (clim.count("plugin")) {
@ -172,7 +161,7 @@ int main(int argc, char *argv[]) {
vm->register_plugin(*ce_plugin);
plugin_list.push_back(ce_plugin);
} else {
LOG(ERROR) << "Unknown plugin name: " << plugin_name << ", valid names are 'ce', 'ic'" << std::endl;
LOG(ERR) << "Unknown plugin name: " << plugin_name << ", valid names are 'ce', 'ic'" << std::endl;
return 127;
}
}
@ -207,7 +196,7 @@ int main(int argc, char *argv[]) {
auto cycles = clim["instructions"].as<uint64_t>();
res = vm->start(cycles, dump);
} catch (std::exception &e) {
LOG(ERROR) << "Unhandled Exception reached the top of main: " << e.what() << ", application will now exit"
LOG(ERR) << "Unhandled Exception reached the top of main: " << e.what() << ", application will now exit"
<< std::endl;
res = 2;
}

View File

@ -47,10 +47,10 @@ iss::plugin::cycle_estimate::cycle_estimate(std::string config_file_name)
try {
is >> root;
} catch (Json::RuntimeError &e) {
LOG(ERROR) << "Could not parse input file " << config_file_name << ", reason: " << e.what();
LOG(ERR) << "Could not parse input file " << config_file_name << ", reason: " << e.what();
}
} else {
LOG(ERROR) << "Could not open input file " << config_file_name;
LOG(ERR) << "Could not open input file " << config_file_name;
}
}
}
@ -77,7 +77,7 @@ bool iss::plugin::cycle_estimate::registration(const char* const version, vm_if&
}
}
} else {
LOG(ERROR)<<"plugin cycle_estimate: could not find an entry for "<<core_name<<" in JSON file"<<std::endl;
LOG(ERR)<<"plugin cycle_estimate: could not find an entry for "<<core_name<<" in JSON file"<<std::endl;
}
return true;
@ -87,6 +87,8 @@ void iss::plugin::cycle_estimate::callback(instr_info_t instr_info, exec_info co
assert(arch_instr && "No instrumentation interface available but callback executed");
auto entry = delays[instr_info.instr_id];
bool taken = (arch_instr->get_next_pc()-arch_instr->get_pc()) != (entry.size/8);
uint32_t delay = taken ? entry.taken : entry.not_taken;
if(delay>1) arch_instr->set_curr_instr_cycles(delay);
if (taken && entry.taken > 1)
arch_instr->set_curr_instr_cycles(entry.taken);
else if (entry.not_taken > 1)
arch_instr->set_curr_instr_cycles(entry.not_taken);
}

View File

@ -46,10 +46,10 @@ iss::plugin::instruction_count::instruction_count(std::string config_file_name)
try {
is >> root;
} catch (Json::RuntimeError &e) {
LOG(ERROR) << "Could not parse input file " << config_file_name << ", reason: " << e.what();
LOG(ERR) << "Could not parse input file " << config_file_name << ", reason: " << e.what();
}
} else {
LOG(ERROR) << "Could not open input file " << config_file_name;
LOG(ERR) << "Could not open input file " << config_file_name;
}
}
}
@ -85,7 +85,7 @@ bool iss::plugin::instruction_count::registration(const char* const version, vm_
}
rep_counts.resize(delays.size());
} else {
LOG(ERROR)<<"plugin instruction_count: could not find an entry for "<<core_name<<" in JSON file"<<std::endl;
LOG(ERR)<<"plugin instruction_count: could not find an entry for "<<core_name<<" in JSON file"<<std::endl;
}
return true;
}

View File

@ -30,6 +30,13 @@
*
*******************************************************************************/
// clang-format off
#include "iss/debugger/gdb_session.h"
#include "iss/debugger/encoderdecoder.h"
#include "iss/debugger/server.h"
#include "iss/debugger/target_adapter_if.h"
#include "iss/iss.h"
#include "iss/vm_types.h"
#include "sysc/core_complex.h"
#ifdef CORE_TGC_B
#include "iss/arch/riscv_hart_m_p.h"
@ -44,21 +51,11 @@ using tgc_c_plat_type = iss::arch::riscv_hart_m_p<iss::arch::tgc_c>;
#include "iss/arch/tgc_d.h"
using tgc_d_plat_type = iss::arch::riscv_hart_mu_p<iss::arch::tgc_d, iss::arch::FEAT_PMP>;
#endif
#ifdef CORE_TGC_D_XRB_MAC
#include "iss/arch/riscv_hart_mu_p.h"
#include "iss/arch/tgc_d_xrb_mac.h"
using tgc_d_xrb_mac_plat_type = iss::arch::riscv_hart_mu_p<iss::arch::tgc_d_xrb_mac, iss::arch::FEAT_PMP>;
#endif
#include "iss/debugger/encoderdecoder.h"
#include "iss/debugger/gdb_session.h"
#include "iss/debugger/server.h"
#include "iss/debugger/target_adapter_if.h"
#include "iss/iss.h"
#include "iss/vm_types.h"
#include "scc/report.h"
#include <iostream>
#include <sstream>
#include <array>
// clang-format on
#define STR(X) #X
#define CREATE_CORE(CN) \
@ -77,6 +74,12 @@ using namespace scv_tr;
#define GET_PROP_VALUE(P) P.getValue()
#endif
#ifdef _MSC_VER
// not #if defined(_WIN32) || defined(_WIN64) because we have strncasecmp in mingw
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#endif
namespace sysc {
namespace tgfs {
using namespace std;
@ -290,12 +293,9 @@ public:
#endif
#ifdef CORE_TGC_D
CREATE_CORE(tgc_d)
#endif
#ifdef CORE_TGC_D_XRB_MACD
CREATE_CORE(tgc_d_xrb_mac)
#endif
{
LOG(ERROR) << "Illegal argument value for core type: " << type << std::endl;
LOG(ERR) << "Illegal argument value for core type: " << type << std::endl;
}
auto *srv = debugger::server<debugger::gdb_session>::get();
if (srv) tgt_adapter = srv->get_target();

View File

@ -30,23 +30,21 @@
*
*******************************************************************************/
#include "../fp_functions.h"
#include <iss/arch/tgc_c.h>
#include <iss/arch/riscv_hart_m_p.h>
// clang-format off
#include <iss/debugger/gdb_session.h>
#include <iss/debugger/server.h>
#include <iss/iss.h>
#include <iss/arch/tgc_c.h>
#include <iss/arch/riscv_hart_m_p.h>
#include <iss/interp/vm_base.h>
#include "../fp_functions.h"
#include <util/logging.h>
#include <sstream>
#ifndef FMT_HEADER_ONLY
#define FMT_HEADER_ONLY
#endif
#include <fmt/format.h>
#include <array>
#include <iss/debugger/riscv_target_adapter.h>
// clang-format on
namespace iss {
namespace interp {
@ -64,9 +62,7 @@ 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);
@ -387,7 +383,6 @@ 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){
@ -428,7 +423,6 @@ 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){
@ -472,7 +466,6 @@ 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){
@ -518,7 +511,6 @@ 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){
@ -560,7 +552,6 @@ 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){
@ -602,7 +593,6 @@ 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){
@ -644,7 +634,6 @@ 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){
@ -686,7 +675,6 @@ 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){
@ -728,7 +716,6 @@ 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){
@ -770,7 +757,6 @@ 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){
@ -815,7 +801,6 @@ 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){
@ -861,7 +846,6 @@ 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){
@ -907,7 +891,6 @@ 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){
@ -952,7 +935,6 @@ 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){
@ -998,7 +980,6 @@ 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){
@ -1040,7 +1021,6 @@ 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){
@ -1085,7 +1065,6 @@ 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){
@ -1130,7 +1109,6 @@ 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){
@ -1172,7 +1150,6 @@ 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){
@ -1214,7 +1191,6 @@ 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){
@ -1256,7 +1232,6 @@ 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){
@ -1298,7 +1273,6 @@ 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){
@ -1340,7 +1314,6 @@ 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){
@ -1382,7 +1355,6 @@ 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){
@ -1429,7 +1401,6 @@ 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){
@ -1476,7 +1447,6 @@ 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){
@ -1523,7 +1493,6 @@ 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){
@ -1565,7 +1534,6 @@ 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){
@ -1607,7 +1575,6 @@ 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){
@ -1649,7 +1616,6 @@ 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){
@ -1691,7 +1657,6 @@ 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){
@ -1733,7 +1698,6 @@ 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){
@ -1775,7 +1739,6 @@ 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){
@ -1817,7 +1780,6 @@ 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){
@ -1859,7 +1821,6 @@ 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){
@ -1901,7 +1862,6 @@ 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){
@ -1943,7 +1903,6 @@ 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){
@ -1986,7 +1945,6 @@ 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){
@ -2021,7 +1979,6 @@ 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){
@ -2056,7 +2013,6 @@ 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){
@ -2091,7 +2047,6 @@ 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){
@ -2126,7 +2081,6 @@ 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){
@ -2161,7 +2115,6 @@ 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){
@ -2196,7 +2149,6 @@ 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){
@ -2248,7 +2200,6 @@ 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){
@ -2295,7 +2246,6 @@ 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){
@ -2342,7 +2292,6 @@ 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){
@ -2388,7 +2337,6 @@ 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){
@ -2434,7 +2382,6 @@ 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){
@ -2480,7 +2427,6 @@ 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){
@ -2527,7 +2473,6 @@ 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){
@ -2574,7 +2519,6 @@ 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){
@ -2621,7 +2565,6 @@ 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){
@ -2668,7 +2611,6 @@ 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){
@ -2719,7 +2661,6 @@ 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){
@ -2766,7 +2707,6 @@ 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){
@ -2817,7 +2757,6 @@ 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){
@ -2864,7 +2803,6 @@ 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){
@ -2906,7 +2844,6 @@ 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){
@ -2951,7 +2888,6 @@ 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){
@ -2996,7 +2932,6 @@ 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){
@ -3037,7 +2972,6 @@ 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){
@ -3074,7 +3008,6 @@ 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){
@ -3117,7 +3050,6 @@ 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){
@ -3160,7 +3092,6 @@ 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){
@ -3204,7 +3135,6 @@ 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){
@ -3245,7 +3175,6 @@ 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){
@ -3281,7 +3210,6 @@ 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){
@ -3325,7 +3253,6 @@ 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){
@ -3373,7 +3300,6 @@ 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){
@ -3417,7 +3343,6 @@ 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){
@ -3461,7 +3386,6 @@ 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){
@ -3505,7 +3429,6 @@ 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){
@ -3549,7 +3472,6 @@ 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){
@ -3593,7 +3515,6 @@ 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){
@ -3632,7 +3553,6 @@ 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){
@ -3673,7 +3593,6 @@ 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){
@ -3714,7 +3633,6 @@ 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){
@ -3755,7 +3673,6 @@ 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){
@ -3800,7 +3717,6 @@ 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){
@ -3841,7 +3757,6 @@ 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){
@ -3882,7 +3797,6 @@ 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){
@ -3917,7 +3831,6 @@ 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){
@ -3958,7 +3871,6 @@ 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){
@ -4002,7 +3914,6 @@ 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){
@ -4037,7 +3948,6 @@ 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){
@ -4081,7 +3991,6 @@ 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){
@ -4116,7 +4025,6 @@ 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){
@ -4228,10 +4136,9 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
this->do_sync(POST_SYNC, std::numeric_limits<unsigned>::max());
pc.val = super::core.enter_trap(std::numeric_limits<uint64_t>::max(), pc.val, 0);
} else {
if (is_jump_to_self_enabled(cond) &&
(insn == 0x0000006f || (insn&0xffff)==0xa001)) throw simulation_stopped(0); // 'J 0' or 'C.J 0'
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);
}
}