Compare commits

..

2 Commits

5 changed files with 2380 additions and 2338 deletions

View File

@ -15,59 +15,51 @@ RV32I:
- JAL: - JAL:
encoding: 0b00000000000000000000000001101111 encoding: 0b00000000000000000000000001101111
mask: 0b00000000000000000000000001111111 mask: 0b00000000000000000000000001111111
attributes: [[name:no_cont]]
size: 32 size: 32
branch: true branch: true
delay: 1 delay: 1
- JALR: - JALR:
encoding: 0b00000000000000000000000001100111 encoding: 0b00000000000000000000000001100111
mask: 0b00000000000000000111000001111111 mask: 0b00000000000000000111000001111111
attributes: [[name:no_cont]]
size: 32 size: 32
branch: true branch: true
delay: 1 delay: 1
- BEQ: - BEQ:
encoding: 0b00000000000000000000000001100011 encoding: 0b00000000000000000000000001100011
mask: 0b00000000000000000111000001111111 mask: 0b00000000000000000111000001111111
attributes: [[name:no_cont], [name:cond]]
size: 32 size: 32
branch: true branch: true
delay: [1,1] delay: 1
- BNE: - BNE:
encoding: 0b00000000000000000001000001100011 encoding: 0b00000000000000000001000001100011
mask: 0b00000000000000000111000001111111 mask: 0b00000000000000000111000001111111
attributes: [[name:no_cont], [name:cond]]
size: 32 size: 32
branch: true branch: true
delay: [1,1] delay: 1
- BLT: - BLT:
encoding: 0b00000000000000000100000001100011 encoding: 0b00000000000000000100000001100011
mask: 0b00000000000000000111000001111111 mask: 0b00000000000000000111000001111111
attributes: [[name:no_cont], [name:cond]]
size: 32 size: 32
branch: true branch: true
delay: [1,1] delay: 1
- BGE: - BGE:
encoding: 0b00000000000000000101000001100011 encoding: 0b00000000000000000101000001100011
mask: 0b00000000000000000111000001111111 mask: 0b00000000000000000111000001111111
attributes: [[name:no_cont], [name:cond]]
size: 32 size: 32
branch: true branch: true
delay: [1,1] delay: 1
- BLTU: - BLTU:
encoding: 0b00000000000000000110000001100011 encoding: 0b00000000000000000110000001100011
mask: 0b00000000000000000111000001111111 mask: 0b00000000000000000111000001111111
attributes: [[name:no_cont], [name:cond]]
size: 32 size: 32
branch: true branch: true
delay: [1,1] delay: 1
- BGEU: - BGEU:
encoding: 0b00000000000000000111000001100011 encoding: 0b00000000000000000111000001100011
mask: 0b00000000000000000111000001111111 mask: 0b00000000000000000111000001111111
attributes: [[name:no_cont], [name:cond]]
size: 32 size: 32
branch: true branch: true
delay: [1,1] delay: 1
- LB: - LB:
encoding: 0b00000000000000000000000000000011 encoding: 0b00000000000000000000000000000011
mask: 0b00000000000000000111000001111111 mask: 0b00000000000000000111000001111111
@ -239,14 +231,12 @@ RV32I:
- ECALL: - ECALL:
encoding: 0b00000000000000000000000001110011 encoding: 0b00000000000000000000000001110011
mask: 0b11111111111111111111111111111111 mask: 0b11111111111111111111111111111111
attributes: [[name:no_cont]]
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- EBREAK: - EBREAK:
encoding: 0b00000000000100000000000001110011 encoding: 0b00000000000100000000000001110011
mask: 0b11111111111111111111111111111111 mask: 0b11111111111111111111111111111111
attributes: [[name:no_cont]]
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
@ -391,7 +381,6 @@ RV32IC:
- CJAL: - CJAL:
encoding: 0b0010000000000001 encoding: 0b0010000000000001
mask: 0b1110000000000011 mask: 0b1110000000000011
attributes: [[name:no_cont]]
size: 16 size: 16
branch: true branch: true
delay: 1 delay: 1
@ -458,24 +447,21 @@ RV32IC:
- CJ: - CJ:
encoding: 0b1010000000000001 encoding: 0b1010000000000001
mask: 0b1110000000000011 mask: 0b1110000000000011
attributes: [[name:no_cont]]
size: 16 size: 16
branch: true branch: true
delay: 1 delay: 1
- CBEQZ: - CBEQZ:
encoding: 0b1100000000000001 encoding: 0b1100000000000001
mask: 0b1110000000000011 mask: 0b1110000000000011
attributes: [[name:no_cont], [name:cond]]
size: 16 size: 16
branch: true branch: true
delay: [1,1] delay: 1
- CBNEZ: - CBNEZ:
encoding: 0b1110000000000001 encoding: 0b1110000000000001
mask: 0b1110000000000011 mask: 0b1110000000000011
attributes: [[name:no_cont], [name:cond]]
size: 16 size: 16
branch: true branch: true
delay: [1,1] delay: 1
- CSLLI: - CSLLI:
encoding: 0b0000000000000010 encoding: 0b0000000000000010
mask: 0b1111000000000011 mask: 0b1111000000000011
@ -497,7 +483,6 @@ RV32IC:
- CJR: - CJR:
encoding: 0b1000000000000010 encoding: 0b1000000000000010
mask: 0b1111000001111111 mask: 0b1111000001111111
attributes: [[name:no_cont]]
size: 16 size: 16
branch: true branch: true
delay: 1 delay: 1
@ -510,14 +495,12 @@ RV32IC:
- CJALR: - CJALR:
encoding: 0b1001000000000010 encoding: 0b1001000000000010
mask: 0b1111000001111111 mask: 0b1111000001111111
attributes: [[name:no_cont]]
size: 16 size: 16
branch: true branch: true
delay: 1 delay: 1
- CEBREAK: - CEBREAK:
encoding: 0b1001000000000010 encoding: 0b1001000000000010
mask: 0b1111111111111111 mask: 0b1111111111111111
attributes: [[name:no_cont]]
size: 16 size: 16
branch: false branch: false
delay: 1 delay: 1
@ -530,7 +513,6 @@ RV32IC:
- DII: - DII:
encoding: 0b0000000000000000 encoding: 0b0000000000000000
mask: 0b1111111111111111 mask: 0b1111111111111111
attributes: [[name:no_cont]]
size: 16 size: 16
branch: false branch: false
delay: 1 delay: 1

View File

@ -43,6 +43,7 @@ def nativeTypeSize(int size){
#include <sstream> #include <sstream>
#include <boost/coroutine2/all.hpp> #include <boost/coroutine2/all.hpp>
#include <functional> #include <functional>
#include <exception>
#ifndef FMT_HEADER_ONLY #ifndef FMT_HEADER_ONLY
#define FMT_HEADER_ONLY #define FMT_HEADER_ONLY
@ -59,6 +60,10 @@ using namespace iss::arch;
using namespace iss::debugger; using namespace iss::debugger;
using namespace std::placeholders; using namespace std::placeholders;
struct memory_access_exception : public std::exception{
memory_access_exception(){}
};
template <typename ARCH> class vm_impl : public iss::interp::vm_base<ARCH> { template <typename ARCH> class vm_impl : public iss::interp::vm_base<ARCH> {
public: public:
using traits = arch::traits<ARCH>; using traits = arch::traits<ARCH>;
@ -91,30 +96,9 @@ protected:
inline const char *name(size_t index){return index<traits::reg_aliases.size()?traits::reg_aliases[index]:"illegal";} inline const char *name(size_t index){return index<traits::reg_aliases.size()?traits::reg_aliases[index]:"illegal";}
typename arch::traits<ARCH>::opcode_e decode_inst_id(code_word_t instr);
virt_addr_t execute_inst(finish_cond_e cond, virt_addr_t start, uint64_t icount_limit) override; virt_addr_t execute_inst(finish_cond_e cond, virt_addr_t start, uint64_t icount_limit) override;
// some compile time constants // some compile time constants
// enum { MASK16 = 0b1111110001100011, MASK32 = 0b11111111111100000111000001111111 };
enum { MASK16 = 0b1111111111111111, MASK32 = 0b11111111111100000111000001111111 };
enum { EXTR_MASK16 = MASK16 >> 2, EXTR_MASK32 = MASK32 >> 2 };
enum {
LUT_SIZE = 1 << util::bit_count(static_cast<uint32_t>(EXTR_MASK32)),
LUT_SIZE_C = 1 << util::bit_count(static_cast<uint32_t>(EXTR_MASK16))
};
std::array<compile_func, LUT_SIZE> lut;
std::array<compile_func, LUT_SIZE_C> lut_00, lut_01, lut_10;
std::array<compile_func, LUT_SIZE> lut_11;
struct instruction_pattern {
uint32_t value;
uint32_t mask;
typename arch::traits<ARCH>::opcode_e id;
};
std::array<std::vector<instruction_pattern>, 4> qlut;
inline void raise(uint16_t trap_id, uint16_t cause){ inline void raise(uint16_t trap_id, uint16_t cause){
auto trap_val = 0x80ULL << 24 | (cause << 16) | trap_id; auto trap_val = 0x80ULL << 24 | (cause << 16) | trap_id;
@ -314,6 +298,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
// pre execution stuff // pre execution stuff
this->core.reg.last_branch = 0; this->core.reg.last_branch = 0;
if(this->sync_exec && PRE_SYNC) this->do_sync(PRE_SYNC, static_cast<unsigned>(inst_id)); if(this->sync_exec && PRE_SYNC) this->do_sync(PRE_SYNC, static_cast<unsigned>(inst_id));
try{
switch(inst_id){<%instructions.eachWithIndex{instr, idx -> %> switch(inst_id){<%instructions.eachWithIndex{instr, idx -> %>
case arch::traits<ARCH>::opcode_e::${instr.name}: { case arch::traits<ARCH>::opcode_e::${instr.name}: {
<%instr.fields.eachLine{%>${it} <%instr.fields.eachLine{%>${it}
@ -329,13 +314,14 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
*NEXT_PC = *PC + ${instr.length/8}; *NEXT_PC = *PC + ${instr.length/8};
// execute instruction<%instr.behavior.eachLine{%> // execute instruction<%instr.behavior.eachLine{%>
${it}<%}%> ${it}<%}%>
TRAP_${instr.name}:break; break;
}// @suppress("No break at end of case")<%}%> }// @suppress("No break at end of case")<%}%>
default: { default: {
*NEXT_PC = *PC + ((instr & 3) == 3 ? 4 : 2); *NEXT_PC = *PC + ((instr & 3) == 3 ? 4 : 2);
raise(0, 2); raise(0, 2);
} }
} }
}catch(memory_access_exception& e){}
// post execution stuff // post execution stuff
process_spawn_blocks(); process_spawn_blocks();
if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, static_cast<unsigned>(inst_id)); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, static_cast<unsigned>(inst_id));

View File

@ -167,8 +167,9 @@ private:
auto cur_pc_val = tu.constant(pc.val, traits::reg_bit_widths[traits::PC]); auto cur_pc_val = tu.constant(pc.val, traits::reg_bit_widths[traits::PC]);
pc=pc+ ${instr.length/8}; pc=pc+ ${instr.length/8};
gen_set_pc(tu, pc, traits::NEXT_PC); gen_set_pc(tu, pc, traits::NEXT_PC);
tu.open_scope();<%instr.behavior.eachLine{%> tu.open_scope();
${it}<%}%> <%instr.behavior.eachLine{%>${it}
<%}%>
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,${idx}); vm_base<ARCH>::gen_sync(tu, POST_SYNC,${idx});
gen_trap_check(tu); gen_trap_check(tu);

View File

@ -39,6 +39,7 @@
#include <sstream> #include <sstream>
#include <boost/coroutine2/all.hpp> #include <boost/coroutine2/all.hpp>
#include <functional> #include <functional>
#include <exception>
#ifndef FMT_HEADER_ONLY #ifndef FMT_HEADER_ONLY
#define FMT_HEADER_ONLY #define FMT_HEADER_ONLY
@ -55,6 +56,10 @@ using namespace iss::arch;
using namespace iss::debugger; using namespace iss::debugger;
using namespace std::placeholders; using namespace std::placeholders;
struct memory_access_exception : public std::exception{
memory_access_exception(){}
};
template <typename ARCH> class vm_impl : public iss::interp::vm_base<ARCH> { template <typename ARCH> class vm_impl : public iss::interp::vm_base<ARCH> {
public: public:
using traits = arch::traits<ARCH>; using traits = arch::traits<ARCH>;
@ -87,30 +92,9 @@ protected:
inline const char *name(size_t index){return index<traits::reg_aliases.size()?traits::reg_aliases[index]:"illegal";} inline const char *name(size_t index){return index<traits::reg_aliases.size()?traits::reg_aliases[index]:"illegal";}
typename arch::traits<ARCH>::opcode_e decode_inst_id(code_word_t instr);
virt_addr_t execute_inst(finish_cond_e cond, virt_addr_t start, uint64_t icount_limit) override; virt_addr_t execute_inst(finish_cond_e cond, virt_addr_t start, uint64_t icount_limit) override;
// some compile time constants // some compile time constants
// enum { MASK16 = 0b1111110001100011, MASK32 = 0b11111111111100000111000001111111 };
enum { MASK16 = 0b1111111111111111, MASK32 = 0b11111111111100000111000001111111 };
enum { EXTR_MASK16 = MASK16 >> 2, EXTR_MASK32 = MASK32 >> 2 };
enum {
LUT_SIZE = 1 << util::bit_count(static_cast<uint32_t>(EXTR_MASK32)),
LUT_SIZE_C = 1 << util::bit_count(static_cast<uint32_t>(EXTR_MASK16))
};
std::array<compile_func, LUT_SIZE> lut;
std::array<compile_func, LUT_SIZE_C> lut_00, lut_01, lut_10;
std::array<compile_func, LUT_SIZE> lut_11;
struct instruction_pattern {
uint32_t value;
uint32_t mask;
typename arch::traits<ARCH>::opcode_e id;
};
std::array<std::vector<instruction_pattern>, 4> qlut;
inline void raise(uint16_t trap_id, uint16_t cause){ inline void raise(uint16_t trap_id, uint16_t cause){
auto trap_val = 0x80ULL << 24 | (cause << 16) | trap_id; auto trap_val = 0x80ULL << 24 | (cause << 16) | trap_id;
@ -394,6 +378,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
// pre execution stuff // pre execution stuff
this->core.reg.last_branch = 0; this->core.reg.last_branch = 0;
if(this->sync_exec && PRE_SYNC) this->do_sync(PRE_SYNC, static_cast<unsigned>(inst_id)); if(this->sync_exec && PRE_SYNC) this->do_sync(PRE_SYNC, static_cast<unsigned>(inst_id));
try{
switch(inst_id){ switch(inst_id){
case arch::traits<ARCH>::opcode_e::LUI: { case arch::traits<ARCH>::opcode_e::LUI: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -419,7 +404,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_LUI:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::AUIPC: { case arch::traits<ARCH>::opcode_e::AUIPC: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -445,7 +430,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_AUIPC:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::JAL: { case arch::traits<ARCH>::opcode_e::JAL: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -478,7 +463,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_JAL:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::JALR: { case arch::traits<ARCH>::opcode_e::JALR: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -513,7 +498,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_JALR:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::BEQ: { case arch::traits<ARCH>::opcode_e::BEQ: {
uint16_t imm = ((bit_sub<7,1>(instr) << 11) | (bit_sub<8,4>(instr) << 1) | (bit_sub<25,6>(instr) << 5) | (bit_sub<31,1>(instr) << 12)); uint16_t imm = ((bit_sub<7,1>(instr) << 11) | (bit_sub<8,4>(instr) << 1) | (bit_sub<25,6>(instr) << 5) | (bit_sub<31,1>(instr) << 12));
@ -546,7 +531,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_BEQ:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::BNE: { case arch::traits<ARCH>::opcode_e::BNE: {
uint16_t imm = ((bit_sub<7,1>(instr) << 11) | (bit_sub<8,4>(instr) << 1) | (bit_sub<25,6>(instr) << 5) | (bit_sub<31,1>(instr) << 12)); uint16_t imm = ((bit_sub<7,1>(instr) << 11) | (bit_sub<8,4>(instr) << 1) | (bit_sub<25,6>(instr) << 5) | (bit_sub<31,1>(instr) << 12));
@ -579,7 +564,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_BNE:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::BLT: { case arch::traits<ARCH>::opcode_e::BLT: {
uint16_t imm = ((bit_sub<7,1>(instr) << 11) | (bit_sub<8,4>(instr) << 1) | (bit_sub<25,6>(instr) << 5) | (bit_sub<31,1>(instr) << 12)); uint16_t imm = ((bit_sub<7,1>(instr) << 11) | (bit_sub<8,4>(instr) << 1) | (bit_sub<25,6>(instr) << 5) | (bit_sub<31,1>(instr) << 12));
@ -612,7 +597,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_BLT:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::BGE: { case arch::traits<ARCH>::opcode_e::BGE: {
uint16_t imm = ((bit_sub<7,1>(instr) << 11) | (bit_sub<8,4>(instr) << 1) | (bit_sub<25,6>(instr) << 5) | (bit_sub<31,1>(instr) << 12)); uint16_t imm = ((bit_sub<7,1>(instr) << 11) | (bit_sub<8,4>(instr) << 1) | (bit_sub<25,6>(instr) << 5) | (bit_sub<31,1>(instr) << 12));
@ -645,7 +630,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_BGE:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::BLTU: { case arch::traits<ARCH>::opcode_e::BLTU: {
uint16_t imm = ((bit_sub<7,1>(instr) << 11) | (bit_sub<8,4>(instr) << 1) | (bit_sub<25,6>(instr) << 5) | (bit_sub<31,1>(instr) << 12)); uint16_t imm = ((bit_sub<7,1>(instr) << 11) | (bit_sub<8,4>(instr) << 1) | (bit_sub<25,6>(instr) << 5) | (bit_sub<31,1>(instr) << 12));
@ -678,7 +663,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_BLTU:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::BGEU: { case arch::traits<ARCH>::opcode_e::BGEU: {
uint16_t imm = ((bit_sub<7,1>(instr) << 11) | (bit_sub<8,4>(instr) << 1) | (bit_sub<25,6>(instr) << 5) | (bit_sub<31,1>(instr) << 12)); uint16_t imm = ((bit_sub<7,1>(instr) << 11) | (bit_sub<8,4>(instr) << 1) | (bit_sub<25,6>(instr) << 5) | (bit_sub<31,1>(instr) << 12));
@ -711,7 +696,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_BGEU:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::LB: { case arch::traits<ARCH>::opcode_e::LB: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -735,14 +720,14 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
else { else {
uint32_t load_address = (uint32_t)(*(X+rs1) + (int16_t)sext<12>(imm)); uint32_t load_address = (uint32_t)(*(X+rs1) + (int16_t)sext<12>(imm));
int8_t read_res = super::template read_mem<int8_t>(traits::MEM, load_address); int8_t read_res = super::template read_mem<int8_t>(traits::MEM, load_address);
if(this->core.reg.trap_state>=0x80000000UL) goto TRAP_LB; if(this->core.reg.trap_state>=0x80000000UL) throw memory_access_exception();
int8_t res = (int8_t)read_res; int8_t res = (int8_t)read_res;
if(rd != 0) { if(rd != 0) {
*(X+rd) = (uint32_t)res; *(X+rd) = (uint32_t)res;
} }
} }
} }
TRAP_LB:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::LH: { case arch::traits<ARCH>::opcode_e::LH: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -766,14 +751,14 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
else { else {
uint32_t load_address = (uint32_t)(*(X+rs1) + (int16_t)sext<12>(imm)); uint32_t load_address = (uint32_t)(*(X+rs1) + (int16_t)sext<12>(imm));
int16_t read_res = super::template read_mem<int16_t>(traits::MEM, load_address); int16_t read_res = super::template read_mem<int16_t>(traits::MEM, load_address);
if(this->core.reg.trap_state>=0x80000000UL) goto TRAP_LH; if(this->core.reg.trap_state>=0x80000000UL) throw memory_access_exception();
int16_t res = (int16_t)read_res; int16_t res = (int16_t)read_res;
if(rd != 0) { if(rd != 0) {
*(X+rd) = (uint32_t)res; *(X+rd) = (uint32_t)res;
} }
} }
} }
TRAP_LH:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::LW: { case arch::traits<ARCH>::opcode_e::LW: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -797,14 +782,14 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
else { else {
uint32_t load_address = (uint32_t)(*(X+rs1) + (int16_t)sext<12>(imm)); uint32_t load_address = (uint32_t)(*(X+rs1) + (int16_t)sext<12>(imm));
int32_t read_res = super::template read_mem<int32_t>(traits::MEM, load_address); int32_t read_res = super::template read_mem<int32_t>(traits::MEM, load_address);
if(this->core.reg.trap_state>=0x80000000UL) goto TRAP_LW; if(this->core.reg.trap_state>=0x80000000UL) throw memory_access_exception();
int32_t res = (int32_t)read_res; int32_t res = (int32_t)read_res;
if(rd != 0) { if(rd != 0) {
*(X+rd) = (uint32_t)res; *(X+rd) = (uint32_t)res;
} }
} }
} }
TRAP_LW:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::LBU: { case arch::traits<ARCH>::opcode_e::LBU: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -828,14 +813,14 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
else { else {
uint32_t load_address = (uint32_t)(*(X+rs1) + (int16_t)sext<12>(imm)); uint32_t load_address = (uint32_t)(*(X+rs1) + (int16_t)sext<12>(imm));
uint8_t read_res = super::template read_mem<uint8_t>(traits::MEM, load_address); uint8_t read_res = super::template read_mem<uint8_t>(traits::MEM, load_address);
if(this->core.reg.trap_state>=0x80000000UL) goto TRAP_LBU; if(this->core.reg.trap_state>=0x80000000UL) throw memory_access_exception();
uint8_t res = read_res; uint8_t res = read_res;
if(rd != 0) { if(rd != 0) {
*(X+rd) = (uint32_t)res; *(X+rd) = (uint32_t)res;
} }
} }
} }
TRAP_LBU:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::LHU: { case arch::traits<ARCH>::opcode_e::LHU: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -859,14 +844,14 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
else { else {
uint32_t load_address = (uint32_t)(*(X+rs1) + (int16_t)sext<12>(imm)); uint32_t load_address = (uint32_t)(*(X+rs1) + (int16_t)sext<12>(imm));
uint16_t read_res = super::template read_mem<uint16_t>(traits::MEM, load_address); uint16_t read_res = super::template read_mem<uint16_t>(traits::MEM, load_address);
if(this->core.reg.trap_state>=0x80000000UL) goto TRAP_LHU; if(this->core.reg.trap_state>=0x80000000UL) throw memory_access_exception();
uint16_t res = read_res; uint16_t res = read_res;
if(rd != 0) { if(rd != 0) {
*(X+rd) = (uint32_t)res; *(X+rd) = (uint32_t)res;
} }
} }
} }
TRAP_LHU:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::SB: { case arch::traits<ARCH>::opcode_e::SB: {
uint16_t imm = ((bit_sub<7,5>(instr)) | (bit_sub<25,7>(instr) << 5)); uint16_t imm = ((bit_sub<7,5>(instr)) | (bit_sub<25,7>(instr) << 5));
@ -890,10 +875,10 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
else { else {
uint32_t store_address = (uint32_t)(*(X+rs1) + (int16_t)sext<12>(imm)); uint32_t store_address = (uint32_t)(*(X+rs1) + (int16_t)sext<12>(imm));
super::template write_mem<uint8_t>(traits::MEM, store_address, (uint8_t)*(X+rs2)); super::template write_mem<uint8_t>(traits::MEM, store_address, (uint8_t)*(X+rs2));
if(this->core.reg.trap_state>=0x80000000UL) goto TRAP_SB; if(this->core.reg.trap_state>=0x80000000UL) throw memory_access_exception();
} }
} }
TRAP_SB:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::SH: { case arch::traits<ARCH>::opcode_e::SH: {
uint16_t imm = ((bit_sub<7,5>(instr)) | (bit_sub<25,7>(instr) << 5)); uint16_t imm = ((bit_sub<7,5>(instr)) | (bit_sub<25,7>(instr) << 5));
@ -917,10 +902,10 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
else { else {
uint32_t store_address = (uint32_t)(*(X+rs1) + (int16_t)sext<12>(imm)); uint32_t store_address = (uint32_t)(*(X+rs1) + (int16_t)sext<12>(imm));
super::template write_mem<uint16_t>(traits::MEM, store_address, (uint16_t)*(X+rs2)); super::template write_mem<uint16_t>(traits::MEM, store_address, (uint16_t)*(X+rs2));
if(this->core.reg.trap_state>=0x80000000UL) goto TRAP_SH; if(this->core.reg.trap_state>=0x80000000UL) throw memory_access_exception();
} }
} }
TRAP_SH:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::SW: { case arch::traits<ARCH>::opcode_e::SW: {
uint16_t imm = ((bit_sub<7,5>(instr)) | (bit_sub<25,7>(instr) << 5)); uint16_t imm = ((bit_sub<7,5>(instr)) | (bit_sub<25,7>(instr) << 5));
@ -944,10 +929,10 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
else { else {
uint32_t store_address = (uint32_t)(*(X+rs1) + (int16_t)sext<12>(imm)); uint32_t store_address = (uint32_t)(*(X+rs1) + (int16_t)sext<12>(imm));
super::template write_mem<uint32_t>(traits::MEM, store_address, (uint32_t)*(X+rs2)); super::template write_mem<uint32_t>(traits::MEM, store_address, (uint32_t)*(X+rs2));
if(this->core.reg.trap_state>=0x80000000UL) goto TRAP_SW; if(this->core.reg.trap_state>=0x80000000UL) throw memory_access_exception();
} }
} }
TRAP_SW:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::ADDI: { case arch::traits<ARCH>::opcode_e::ADDI: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -974,7 +959,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_ADDI:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::SLTI: { case arch::traits<ARCH>::opcode_e::SLTI: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -1001,7 +986,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_SLTI:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::SLTIU: { case arch::traits<ARCH>::opcode_e::SLTIU: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -1028,7 +1013,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_SLTIU:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::XORI: { case arch::traits<ARCH>::opcode_e::XORI: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -1055,7 +1040,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_XORI:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::ORI: { case arch::traits<ARCH>::opcode_e::ORI: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -1082,7 +1067,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_ORI:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::ANDI: { case arch::traits<ARCH>::opcode_e::ANDI: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -1109,7 +1094,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_ANDI:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::SLLI: { case arch::traits<ARCH>::opcode_e::SLLI: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -1136,7 +1121,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_SLLI:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::SRLI: { case arch::traits<ARCH>::opcode_e::SRLI: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -1163,7 +1148,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_SRLI:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::SRAI: { case arch::traits<ARCH>::opcode_e::SRAI: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -1190,7 +1175,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_SRAI:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::ADD: { case arch::traits<ARCH>::opcode_e::ADD: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -1217,7 +1202,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_ADD:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::SUB: { case arch::traits<ARCH>::opcode_e::SUB: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -1244,7 +1229,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_SUB:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::SLL: { case arch::traits<ARCH>::opcode_e::SLL: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -1271,7 +1256,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_SLL:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::SLT: { case arch::traits<ARCH>::opcode_e::SLT: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -1298,7 +1283,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_SLT:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::SLTU: { case arch::traits<ARCH>::opcode_e::SLTU: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -1325,7 +1310,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_SLTU:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::XOR: { case arch::traits<ARCH>::opcode_e::XOR: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -1352,7 +1337,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_XOR:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::SRL: { case arch::traits<ARCH>::opcode_e::SRL: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -1379,7 +1364,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_SRL:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::SRA: { case arch::traits<ARCH>::opcode_e::SRA: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -1406,7 +1391,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_SRA:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::OR: { case arch::traits<ARCH>::opcode_e::OR: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -1433,7 +1418,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_OR:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::AND: { case arch::traits<ARCH>::opcode_e::AND: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -1460,7 +1445,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_AND:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::FENCE: { case arch::traits<ARCH>::opcode_e::FENCE: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -1480,9 +1465,9 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
// execute instruction // execute instruction
{ {
super::template write_mem<uint32_t>(traits::FENCE, traits::fence, (uint8_t)pred << 4 | succ); super::template write_mem<uint32_t>(traits::FENCE, traits::fence, (uint8_t)pred << 4 | succ);
if(this->core.reg.trap_state>=0x80000000UL) goto TRAP_FENCE; if(this->core.reg.trap_state>=0x80000000UL) throw memory_access_exception();
} }
TRAP_FENCE:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::ECALL: { case arch::traits<ARCH>::opcode_e::ECALL: {
if(this->disass_enabled){ if(this->disass_enabled){
@ -1495,7 +1480,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
{ {
raise(0, 11); raise(0, 11);
} }
TRAP_ECALL:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::EBREAK: { case arch::traits<ARCH>::opcode_e::EBREAK: {
if(this->disass_enabled){ if(this->disass_enabled){
@ -1508,7 +1493,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
{ {
raise(0, 3); raise(0, 3);
} }
TRAP_EBREAK:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::MRET: { case arch::traits<ARCH>::opcode_e::MRET: {
if(this->disass_enabled){ if(this->disass_enabled){
@ -1521,7 +1506,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
{ {
leave(3); leave(3);
} }
TRAP_MRET:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::WFI: { case arch::traits<ARCH>::opcode_e::WFI: {
if(this->disass_enabled){ if(this->disass_enabled){
@ -1534,7 +1519,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
{ {
wait(1); wait(1);
} }
TRAP_WFI:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::CSRRW: { case arch::traits<ARCH>::opcode_e::CSRRW: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -1559,19 +1544,19 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
uint32_t xrs1 = *(X+rs1); uint32_t xrs1 = *(X+rs1);
if(rd != 0) { if(rd != 0) {
uint32_t read_res = super::template read_mem<uint32_t>(traits::CSR, csr); uint32_t read_res = super::template read_mem<uint32_t>(traits::CSR, csr);
if(this->core.reg.trap_state>=0x80000000UL) goto TRAP_CSRRW; if(this->core.reg.trap_state>=0x80000000UL) throw memory_access_exception();
uint32_t xrd = read_res; uint32_t xrd = read_res;
super::template write_mem<uint32_t>(traits::CSR, csr, xrs1); super::template write_mem<uint32_t>(traits::CSR, csr, xrs1);
if(this->core.reg.trap_state>=0x80000000UL) goto TRAP_CSRRW; if(this->core.reg.trap_state>=0x80000000UL) throw memory_access_exception();
*(X+rd) = xrd; *(X+rd) = xrd;
} }
else { else {
super::template write_mem<uint32_t>(traits::CSR, csr, xrs1); super::template write_mem<uint32_t>(traits::CSR, csr, xrs1);
if(this->core.reg.trap_state>=0x80000000UL) goto TRAP_CSRRW; if(this->core.reg.trap_state>=0x80000000UL) throw memory_access_exception();
} }
} }
} }
TRAP_CSRRW:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::CSRRS: { case arch::traits<ARCH>::opcode_e::CSRRS: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -1594,19 +1579,19 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
else { else {
uint32_t read_res = super::template read_mem<uint32_t>(traits::CSR, csr); uint32_t read_res = super::template read_mem<uint32_t>(traits::CSR, csr);
if(this->core.reg.trap_state>=0x80000000UL) goto TRAP_CSRRS; if(this->core.reg.trap_state>=0x80000000UL) throw memory_access_exception();
uint32_t xrd = read_res; uint32_t xrd = read_res;
uint32_t xrs1 = *(X+rs1); uint32_t xrs1 = *(X+rs1);
if(rs1 != 0) { if(rs1 != 0) {
super::template write_mem<uint32_t>(traits::CSR, csr, xrd | xrs1); super::template write_mem<uint32_t>(traits::CSR, csr, xrd | xrs1);
if(this->core.reg.trap_state>=0x80000000UL) goto TRAP_CSRRS; if(this->core.reg.trap_state>=0x80000000UL) throw memory_access_exception();
} }
if(rd != 0) { if(rd != 0) {
*(X+rd) = xrd; *(X+rd) = xrd;
} }
} }
} }
TRAP_CSRRS:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::CSRRC: { case arch::traits<ARCH>::opcode_e::CSRRC: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -1629,19 +1614,19 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
else { else {
uint32_t read_res = super::template read_mem<uint32_t>(traits::CSR, csr); uint32_t read_res = super::template read_mem<uint32_t>(traits::CSR, csr);
if(this->core.reg.trap_state>=0x80000000UL) goto TRAP_CSRRC; if(this->core.reg.trap_state>=0x80000000UL) throw memory_access_exception();
uint32_t xrd = read_res; uint32_t xrd = read_res;
uint32_t xrs1 = *(X+rs1); uint32_t xrs1 = *(X+rs1);
if(rs1 != 0) { if(rs1 != 0) {
super::template write_mem<uint32_t>(traits::CSR, csr, xrd & ~ xrs1); super::template write_mem<uint32_t>(traits::CSR, csr, xrd & ~ xrs1);
if(this->core.reg.trap_state>=0x80000000UL) goto TRAP_CSRRC; if(this->core.reg.trap_state>=0x80000000UL) throw memory_access_exception();
} }
if(rd != 0) { if(rd != 0) {
*(X+rd) = xrd; *(X+rd) = xrd;
} }
} }
} }
TRAP_CSRRC:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::CSRRWI: { case arch::traits<ARCH>::opcode_e::CSRRWI: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -1664,16 +1649,16 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
else { else {
uint32_t read_res = super::template read_mem<uint32_t>(traits::CSR, csr); uint32_t read_res = super::template read_mem<uint32_t>(traits::CSR, csr);
if(this->core.reg.trap_state>=0x80000000UL) goto TRAP_CSRRWI; if(this->core.reg.trap_state>=0x80000000UL) throw memory_access_exception();
uint32_t xrd = read_res; uint32_t xrd = read_res;
super::template write_mem<uint32_t>(traits::CSR, csr, (uint32_t)zimm); super::template write_mem<uint32_t>(traits::CSR, csr, (uint32_t)zimm);
if(this->core.reg.trap_state>=0x80000000UL) goto TRAP_CSRRWI; if(this->core.reg.trap_state>=0x80000000UL) throw memory_access_exception();
if(rd != 0) { if(rd != 0) {
*(X+rd) = xrd; *(X+rd) = xrd;
} }
} }
} }
TRAP_CSRRWI:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::CSRRSI: { case arch::traits<ARCH>::opcode_e::CSRRSI: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -1696,18 +1681,18 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
else { else {
uint32_t read_res = super::template read_mem<uint32_t>(traits::CSR, csr); uint32_t read_res = super::template read_mem<uint32_t>(traits::CSR, csr);
if(this->core.reg.trap_state>=0x80000000UL) goto TRAP_CSRRSI; if(this->core.reg.trap_state>=0x80000000UL) throw memory_access_exception();
uint32_t xrd = read_res; uint32_t xrd = read_res;
if(zimm != 0) { if(zimm != 0) {
super::template write_mem<uint32_t>(traits::CSR, csr, xrd | (uint32_t)zimm); super::template write_mem<uint32_t>(traits::CSR, csr, xrd | (uint32_t)zimm);
if(this->core.reg.trap_state>=0x80000000UL) goto TRAP_CSRRSI; if(this->core.reg.trap_state>=0x80000000UL) throw memory_access_exception();
} }
if(rd != 0) { if(rd != 0) {
*(X+rd) = xrd; *(X+rd) = xrd;
} }
} }
} }
TRAP_CSRRSI:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::CSRRCI: { case arch::traits<ARCH>::opcode_e::CSRRCI: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -1730,18 +1715,18 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
else { else {
uint32_t read_res = super::template read_mem<uint32_t>(traits::CSR, csr); uint32_t read_res = super::template read_mem<uint32_t>(traits::CSR, csr);
if(this->core.reg.trap_state>=0x80000000UL) goto TRAP_CSRRCI; if(this->core.reg.trap_state>=0x80000000UL) throw memory_access_exception();
uint32_t xrd = read_res; uint32_t xrd = read_res;
if(zimm != 0) { if(zimm != 0) {
super::template write_mem<uint32_t>(traits::CSR, csr, xrd & ~ ((uint32_t)zimm)); super::template write_mem<uint32_t>(traits::CSR, csr, xrd & ~ ((uint32_t)zimm));
if(this->core.reg.trap_state>=0x80000000UL) goto TRAP_CSRRCI; if(this->core.reg.trap_state>=0x80000000UL) throw memory_access_exception();
} }
if(rd != 0) { if(rd != 0) {
*(X+rd) = xrd; *(X+rd) = xrd;
} }
} }
} }
TRAP_CSRRCI:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::FENCE_I: { case arch::traits<ARCH>::opcode_e::FENCE_I: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -1759,9 +1744,9 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
// execute instruction // execute instruction
{ {
super::template write_mem<uint32_t>(traits::FENCE, traits::fencei, imm); super::template write_mem<uint32_t>(traits::FENCE, traits::fencei, imm);
if(this->core.reg.trap_state>=0x80000000UL) goto TRAP_FENCE_I; if(this->core.reg.trap_state>=0x80000000UL) throw memory_access_exception();
} }
TRAP_FENCE_I:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::MUL: { case arch::traits<ARCH>::opcode_e::MUL: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -1789,7 +1774,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_MUL:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::MULH: { case arch::traits<ARCH>::opcode_e::MULH: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -1817,7 +1802,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_MULH:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::MULHSU: { case arch::traits<ARCH>::opcode_e::MULHSU: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -1845,7 +1830,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_MULHSU:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::MULHU: { case arch::traits<ARCH>::opcode_e::MULHU: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -1873,7 +1858,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_MULHU:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::DIV: { case arch::traits<ARCH>::opcode_e::DIV: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -1913,7 +1898,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_DIV:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::DIVU: { case arch::traits<ARCH>::opcode_e::DIVU: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -1947,7 +1932,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_DIVU:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::REM: { case arch::traits<ARCH>::opcode_e::REM: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -1989,7 +1974,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_REM:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::REMU: { case arch::traits<ARCH>::opcode_e::REMU: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -2023,7 +2008,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_REMU:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::CADDI4SPN: { case arch::traits<ARCH>::opcode_e::CADDI4SPN: {
uint8_t rd = ((bit_sub<2,3>(instr))); uint8_t rd = ((bit_sub<2,3>(instr)));
@ -2047,7 +2032,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
raise(0, 2); raise(0, 2);
} }
} }
TRAP_CADDI4SPN:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::CLW: { case arch::traits<ARCH>::opcode_e::CLW: {
uint8_t rd = ((bit_sub<2,3>(instr))); uint8_t rd = ((bit_sub<2,3>(instr)));
@ -2067,10 +2052,10 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
{ {
uint32_t offs = (uint32_t)(*(X+rs1 + 8) + uimm); uint32_t offs = (uint32_t)(*(X+rs1 + 8) + uimm);
int32_t read_res = super::template read_mem<int32_t>(traits::MEM, offs); int32_t read_res = super::template read_mem<int32_t>(traits::MEM, offs);
if(this->core.reg.trap_state>=0x80000000UL) goto TRAP_CLW; if(this->core.reg.trap_state>=0x80000000UL) throw memory_access_exception();
*(X+rd + 8) = (uint32_t)(int32_t)read_res; *(X+rd + 8) = (uint32_t)(int32_t)read_res;
} }
TRAP_CLW:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::CSW: { case arch::traits<ARCH>::opcode_e::CSW: {
uint8_t rs2 = ((bit_sub<2,3>(instr))); uint8_t rs2 = ((bit_sub<2,3>(instr)));
@ -2090,9 +2075,9 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
{ {
uint32_t offs = (uint32_t)(*(X+rs1 + 8) + uimm); uint32_t offs = (uint32_t)(*(X+rs1 + 8) + uimm);
super::template write_mem<uint32_t>(traits::MEM, offs, (uint32_t)*(X+rs2 + 8)); super::template write_mem<uint32_t>(traits::MEM, offs, (uint32_t)*(X+rs2 + 8));
if(this->core.reg.trap_state>=0x80000000UL) goto TRAP_CSW; if(this->core.reg.trap_state>=0x80000000UL) throw memory_access_exception();
} }
TRAP_CSW:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::CADDI: { case arch::traits<ARCH>::opcode_e::CADDI: {
uint8_t imm = ((bit_sub<2,5>(instr)) | (bit_sub<12,1>(instr) << 5)); uint8_t imm = ((bit_sub<2,5>(instr)) | (bit_sub<12,1>(instr) << 5));
@ -2118,7 +2103,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_CADDI:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::CNOP: { case arch::traits<ARCH>::opcode_e::CNOP: {
uint8_t nzimm = ((bit_sub<2,5>(instr)) | (bit_sub<12,1>(instr) << 5)); uint8_t nzimm = ((bit_sub<2,5>(instr)) | (bit_sub<12,1>(instr) << 5));
@ -2131,7 +2116,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
// execute instruction // execute instruction
{ {
} }
TRAP_CNOP:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::CJAL: { case arch::traits<ARCH>::opcode_e::CJAL: {
uint16_t imm = ((bit_sub<2,1>(instr) << 5) | (bit_sub<3,3>(instr) << 1) | (bit_sub<6,1>(instr) << 7) | (bit_sub<7,1>(instr) << 6) | (bit_sub<8,1>(instr) << 10) | (bit_sub<9,2>(instr) << 8) | (bit_sub<11,1>(instr) << 4) | (bit_sub<12,1>(instr) << 11)); uint16_t imm = ((bit_sub<2,1>(instr) << 5) | (bit_sub<3,3>(instr) << 1) | (bit_sub<6,1>(instr) << 7) | (bit_sub<7,1>(instr) << 6) | (bit_sub<8,1>(instr) << 10) | (bit_sub<9,2>(instr) << 8) | (bit_sub<11,1>(instr) << 4) | (bit_sub<12,1>(instr) << 11));
@ -2151,7 +2136,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
*NEXT_PC = (uint32_t)(*PC + (int16_t)sext<12>(imm)); *NEXT_PC = (uint32_t)(*PC + (int16_t)sext<12>(imm));
this->core.reg.last_branch = 1; this->core.reg.last_branch = 1;
} }
TRAP_CJAL:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::CLI: { case arch::traits<ARCH>::opcode_e::CLI: {
uint8_t imm = ((bit_sub<2,5>(instr)) | (bit_sub<12,1>(instr) << 5)); uint8_t imm = ((bit_sub<2,5>(instr)) | (bit_sub<12,1>(instr) << 5));
@ -2177,7 +2162,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_CLI:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::CLUI: { case arch::traits<ARCH>::opcode_e::CLUI: {
uint32_t imm = ((bit_sub<2,5>(instr) << 12) | (bit_sub<12,1>(instr) << 17)); uint32_t imm = ((bit_sub<2,5>(instr) << 12) | (bit_sub<12,1>(instr) << 17));
@ -2201,7 +2186,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
*(X+rd) = (uint32_t)((int32_t)sext<18>(imm)); *(X+rd) = (uint32_t)((int32_t)sext<18>(imm));
} }
} }
TRAP_CLUI:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::CADDI16SP: { case arch::traits<ARCH>::opcode_e::CADDI16SP: {
uint16_t nzimm = ((bit_sub<2,1>(instr) << 5) | (bit_sub<3,2>(instr) << 7) | (bit_sub<5,1>(instr) << 6) | (bit_sub<6,1>(instr) << 4) | (bit_sub<12,1>(instr) << 9)); uint16_t nzimm = ((bit_sub<2,1>(instr) << 5) | (bit_sub<3,2>(instr) << 7) | (bit_sub<5,1>(instr) << 6) | (bit_sub<6,1>(instr) << 4) | (bit_sub<12,1>(instr) << 9));
@ -2224,7 +2209,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
raise(0, 2); raise(0, 2);
} }
} }
TRAP_CADDI16SP:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::__reserved_clui: { case arch::traits<ARCH>::opcode_e::__reserved_clui: {
uint8_t rd = ((bit_sub<7,5>(instr))); uint8_t rd = ((bit_sub<7,5>(instr)));
@ -2238,7 +2223,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
{ {
raise(0, 2); raise(0, 2);
} }
TRAP___reserved_clui:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::CSRLI: { case arch::traits<ARCH>::opcode_e::CSRLI: {
uint8_t shamt = ((bit_sub<2,5>(instr))); uint8_t shamt = ((bit_sub<2,5>(instr)));
@ -2257,7 +2242,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
{ {
*(X+rs1 + 8) = *(X+rs1 + 8) >> shamt; *(X+rs1 + 8) = *(X+rs1 + 8) >> shamt;
} }
TRAP_CSRLI:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::CSRAI: { case arch::traits<ARCH>::opcode_e::CSRAI: {
uint8_t shamt = ((bit_sub<2,5>(instr))); uint8_t shamt = ((bit_sub<2,5>(instr)));
@ -2283,7 +2268,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_CSRAI:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::CANDI: { case arch::traits<ARCH>::opcode_e::CANDI: {
uint8_t imm = ((bit_sub<2,5>(instr)) | (bit_sub<12,1>(instr) << 5)); uint8_t imm = ((bit_sub<2,5>(instr)) | (bit_sub<12,1>(instr) << 5));
@ -2302,7 +2287,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
{ {
*(X+rs1 + 8) = (uint32_t)(*(X+rs1 + 8) & (int8_t)sext<6>(imm)); *(X+rs1 + 8) = (uint32_t)(*(X+rs1 + 8) & (int8_t)sext<6>(imm));
} }
TRAP_CANDI:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::CSUB: { case arch::traits<ARCH>::opcode_e::CSUB: {
uint8_t rs2 = ((bit_sub<2,3>(instr))); uint8_t rs2 = ((bit_sub<2,3>(instr)));
@ -2321,7 +2306,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
{ {
*(X+rd + 8) = (uint32_t)(*(X+rd + 8) - *(X+rs2 + 8)); *(X+rd + 8) = (uint32_t)(*(X+rd + 8) - *(X+rs2 + 8));
} }
TRAP_CSUB:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::CXOR: { case arch::traits<ARCH>::opcode_e::CXOR: {
uint8_t rs2 = ((bit_sub<2,3>(instr))); uint8_t rs2 = ((bit_sub<2,3>(instr)));
@ -2340,7 +2325,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
{ {
*(X+rd + 8) = *(X+rd + 8) ^ *(X+rs2 + 8); *(X+rd + 8) = *(X+rd + 8) ^ *(X+rs2 + 8);
} }
TRAP_CXOR:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::COR: { case arch::traits<ARCH>::opcode_e::COR: {
uint8_t rs2 = ((bit_sub<2,3>(instr))); uint8_t rs2 = ((bit_sub<2,3>(instr)));
@ -2359,7 +2344,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
{ {
*(X+rd + 8) = *(X+rd + 8) | *(X+rs2 + 8); *(X+rd + 8) = *(X+rd + 8) | *(X+rs2 + 8);
} }
TRAP_COR:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::CAND: { case arch::traits<ARCH>::opcode_e::CAND: {
uint8_t rs2 = ((bit_sub<2,3>(instr))); uint8_t rs2 = ((bit_sub<2,3>(instr)));
@ -2378,7 +2363,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
{ {
*(X+rd + 8) = *(X+rd + 8) & *(X+rs2 + 8); *(X+rd + 8) = *(X+rd + 8) & *(X+rs2 + 8);
} }
TRAP_CAND:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::CJ: { case arch::traits<ARCH>::opcode_e::CJ: {
uint16_t imm = ((bit_sub<2,1>(instr) << 5) | (bit_sub<3,3>(instr) << 1) | (bit_sub<6,1>(instr) << 7) | (bit_sub<7,1>(instr) << 6) | (bit_sub<8,1>(instr) << 10) | (bit_sub<9,2>(instr) << 8) | (bit_sub<11,1>(instr) << 4) | (bit_sub<12,1>(instr) << 11)); uint16_t imm = ((bit_sub<2,1>(instr) << 5) | (bit_sub<3,3>(instr) << 1) | (bit_sub<6,1>(instr) << 7) | (bit_sub<7,1>(instr) << 6) | (bit_sub<8,1>(instr) << 10) | (bit_sub<9,2>(instr) << 8) | (bit_sub<11,1>(instr) << 4) | (bit_sub<12,1>(instr) << 11));
@ -2396,7 +2381,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
*NEXT_PC = (uint32_t)(*PC + (int16_t)sext<12>(imm)); *NEXT_PC = (uint32_t)(*PC + (int16_t)sext<12>(imm));
this->core.reg.last_branch = 1; this->core.reg.last_branch = 1;
} }
TRAP_CJ:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::CBEQZ: { case arch::traits<ARCH>::opcode_e::CBEQZ: {
uint16_t imm = ((bit_sub<2,1>(instr) << 5) | (bit_sub<3,2>(instr) << 1) | (bit_sub<5,2>(instr) << 6) | (bit_sub<10,2>(instr) << 3) | (bit_sub<12,1>(instr) << 8)); uint16_t imm = ((bit_sub<2,1>(instr) << 5) | (bit_sub<3,2>(instr) << 1) | (bit_sub<5,2>(instr) << 6) | (bit_sub<10,2>(instr) << 3) | (bit_sub<12,1>(instr) << 8));
@ -2418,7 +2403,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
this->core.reg.last_branch = 1; this->core.reg.last_branch = 1;
} }
} }
TRAP_CBEQZ:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::CBNEZ: { case arch::traits<ARCH>::opcode_e::CBNEZ: {
uint16_t imm = ((bit_sub<2,1>(instr) << 5) | (bit_sub<3,2>(instr) << 1) | (bit_sub<5,2>(instr) << 6) | (bit_sub<10,2>(instr) << 3) | (bit_sub<12,1>(instr) << 8)); uint16_t imm = ((bit_sub<2,1>(instr) << 5) | (bit_sub<3,2>(instr) << 1) | (bit_sub<5,2>(instr) << 6) | (bit_sub<10,2>(instr) << 3) | (bit_sub<12,1>(instr) << 8));
@ -2440,7 +2425,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
this->core.reg.last_branch = 1; this->core.reg.last_branch = 1;
} }
} }
TRAP_CBNEZ:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::CSLLI: { case arch::traits<ARCH>::opcode_e::CSLLI: {
uint8_t nzuimm = ((bit_sub<2,5>(instr))); uint8_t nzuimm = ((bit_sub<2,5>(instr)));
@ -2466,7 +2451,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_CSLLI:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::CLWSP: { case arch::traits<ARCH>::opcode_e::CLWSP: {
uint8_t uimm = ((bit_sub<2,2>(instr) << 6) | (bit_sub<4,3>(instr) << 2) | (bit_sub<12,1>(instr) << 5)); uint8_t uimm = ((bit_sub<2,2>(instr) << 6) | (bit_sub<4,3>(instr) << 2) | (bit_sub<12,1>(instr) << 5));
@ -2489,11 +2474,11 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
else { else {
uint32_t offs = (uint32_t)(*(X+2) + uimm); uint32_t offs = (uint32_t)(*(X+2) + uimm);
int32_t read_res = super::template read_mem<int32_t>(traits::MEM, offs); int32_t read_res = super::template read_mem<int32_t>(traits::MEM, offs);
if(this->core.reg.trap_state>=0x80000000UL) goto TRAP_CLWSP; if(this->core.reg.trap_state>=0x80000000UL) throw memory_access_exception();
*(X+rd) = (uint32_t)(int32_t)read_res; *(X+rd) = (uint32_t)(int32_t)read_res;
} }
} }
TRAP_CLWSP:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::CMV: { case arch::traits<ARCH>::opcode_e::CMV: {
uint8_t rs2 = ((bit_sub<2,5>(instr))); uint8_t rs2 = ((bit_sub<2,5>(instr)));
@ -2519,7 +2504,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_CMV:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::CJR: { case arch::traits<ARCH>::opcode_e::CJR: {
uint8_t rs1 = ((bit_sub<7,5>(instr))); uint8_t rs1 = ((bit_sub<7,5>(instr)));
@ -2543,7 +2528,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
raise(0, 2); raise(0, 2);
} }
} }
TRAP_CJR:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::__reserved_cmv: { case arch::traits<ARCH>::opcode_e::__reserved_cmv: {
if(this->disass_enabled){ if(this->disass_enabled){
@ -2556,7 +2541,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
{ {
raise(0, 2); raise(0, 2);
} }
TRAP___reserved_cmv:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::CADD: { case arch::traits<ARCH>::opcode_e::CADD: {
uint8_t rs2 = ((bit_sub<2,5>(instr))); uint8_t rs2 = ((bit_sub<2,5>(instr)));
@ -2582,7 +2567,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} }
} }
} }
TRAP_CADD:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::CJALR: { case arch::traits<ARCH>::opcode_e::CJALR: {
uint8_t rs1 = ((bit_sub<7,5>(instr))); uint8_t rs1 = ((bit_sub<7,5>(instr)));
@ -2608,7 +2593,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
this->core.reg.last_branch = 1; this->core.reg.last_branch = 1;
} }
} }
TRAP_CJALR:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::CEBREAK: { case arch::traits<ARCH>::opcode_e::CEBREAK: {
if(this->disass_enabled){ if(this->disass_enabled){
@ -2621,7 +2606,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
{ {
raise(0, 3); raise(0, 3);
} }
TRAP_CEBREAK:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::CSWSP: { case arch::traits<ARCH>::opcode_e::CSWSP: {
uint8_t rs2 = ((bit_sub<2,5>(instr))); uint8_t rs2 = ((bit_sub<2,5>(instr)));
@ -2644,10 +2629,10 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
else { else {
uint32_t offs = (uint32_t)(*(X+2) + uimm); uint32_t offs = (uint32_t)(*(X+2) + uimm);
super::template write_mem<uint32_t>(traits::MEM, offs, (uint32_t)*(X+rs2)); super::template write_mem<uint32_t>(traits::MEM, offs, (uint32_t)*(X+rs2));
if(this->core.reg.trap_state>=0x80000000UL) goto TRAP_CSWSP; if(this->core.reg.trap_state>=0x80000000UL) throw memory_access_exception();
} }
} }
TRAP_CSWSP:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
case arch::traits<ARCH>::opcode_e::DII: { case arch::traits<ARCH>::opcode_e::DII: {
if(this->disass_enabled){ if(this->disass_enabled){
@ -2660,13 +2645,14 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
{ {
raise(0, 2); raise(0, 2);
} }
TRAP_DII:break; break;
}// @suppress("No break at end of case") }// @suppress("No break at end of case")
default: { default: {
*NEXT_PC = *PC + ((instr & 3) == 3 ? 4 : 2); *NEXT_PC = *PC + ((instr & 3) == 3 ? 4 : 2);
raise(0, 2); raise(0, 2);
} }
} }
}catch(memory_access_exception& e){}
// post execution stuff // post execution stuff
process_spawn_blocks(); process_spawn_blocks();
if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, static_cast<unsigned>(inst_id)); if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, static_cast<unsigned>(inst_id));

View File

@ -353,6 +353,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,0); vm_base<ARCH>::gen_sync(tu, POST_SYNC,0);
gen_trap_check(tu); gen_trap_check(tu);
@ -385,6 +386,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,1); vm_base<ARCH>::gen_sync(tu, POST_SYNC,1);
gen_trap_check(tu); gen_trap_check(tu);
@ -424,6 +426,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(BRANCH); auto returnValue = std::make_tuple(BRANCH);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,2); vm_base<ARCH>::gen_sync(tu, POST_SYNC,2);
gen_trap_check(tu); gen_trap_check(tu);
@ -465,6 +468,7 @@ private:
tu.close_scope(); tu.close_scope();
} }
auto returnValue = std::make_tuple(BRANCH); auto returnValue = std::make_tuple(BRANCH);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,3); vm_base<ARCH>::gen_sync(tu, POST_SYNC,3);
gen_trap_check(tu); gen_trap_check(tu);
@ -504,6 +508,7 @@ private:
tu.close_scope(); tu.close_scope();
} }
auto returnValue = std::make_tuple(BRANCH); auto returnValue = std::make_tuple(BRANCH);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,4); vm_base<ARCH>::gen_sync(tu, POST_SYNC,4);
gen_trap_check(tu); gen_trap_check(tu);
@ -543,6 +548,7 @@ private:
tu.close_scope(); tu.close_scope();
} }
auto returnValue = std::make_tuple(BRANCH); auto returnValue = std::make_tuple(BRANCH);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,5); vm_base<ARCH>::gen_sync(tu, POST_SYNC,5);
gen_trap_check(tu); gen_trap_check(tu);
@ -582,6 +588,7 @@ private:
tu.close_scope(); tu.close_scope();
} }
auto returnValue = std::make_tuple(BRANCH); auto returnValue = std::make_tuple(BRANCH);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,6); vm_base<ARCH>::gen_sync(tu, POST_SYNC,6);
gen_trap_check(tu); gen_trap_check(tu);
@ -621,6 +628,7 @@ private:
tu.close_scope(); tu.close_scope();
} }
auto returnValue = std::make_tuple(BRANCH); auto returnValue = std::make_tuple(BRANCH);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,7); vm_base<ARCH>::gen_sync(tu, POST_SYNC,7);
gen_trap_check(tu); gen_trap_check(tu);
@ -660,6 +668,7 @@ private:
tu.close_scope(); tu.close_scope();
} }
auto returnValue = std::make_tuple(BRANCH); auto returnValue = std::make_tuple(BRANCH);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,8); vm_base<ARCH>::gen_sync(tu, POST_SYNC,8);
gen_trap_check(tu); gen_trap_check(tu);
@ -699,6 +708,7 @@ private:
tu.close_scope(); tu.close_scope();
} }
auto returnValue = std::make_tuple(BRANCH); auto returnValue = std::make_tuple(BRANCH);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,9); vm_base<ARCH>::gen_sync(tu, POST_SYNC,9);
gen_trap_check(tu); gen_trap_check(tu);
@ -734,6 +744,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,10); vm_base<ARCH>::gen_sync(tu, POST_SYNC,10);
gen_trap_check(tu); gen_trap_check(tu);
@ -769,6 +780,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,11); vm_base<ARCH>::gen_sync(tu, POST_SYNC,11);
gen_trap_check(tu); gen_trap_check(tu);
@ -804,6 +816,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,12); vm_base<ARCH>::gen_sync(tu, POST_SYNC,12);
gen_trap_check(tu); gen_trap_check(tu);
@ -839,6 +852,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,13); vm_base<ARCH>::gen_sync(tu, POST_SYNC,13);
gen_trap_check(tu); gen_trap_check(tu);
@ -874,6 +888,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,14); vm_base<ARCH>::gen_sync(tu, POST_SYNC,14);
gen_trap_check(tu); gen_trap_check(tu);
@ -906,6 +921,7 @@ private:
tu.write_mem(traits::MEM, store_address, tu.ext(tu.load(rs2+ traits::X0, 0),8,true)); tu.write_mem(traits::MEM, store_address, tu.ext(tu.load(rs2+ traits::X0, 0),8,true));
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,15); vm_base<ARCH>::gen_sync(tu, POST_SYNC,15);
gen_trap_check(tu); gen_trap_check(tu);
@ -938,6 +954,7 @@ private:
tu.write_mem(traits::MEM, store_address, tu.ext(tu.load(rs2+ traits::X0, 0),16,true)); tu.write_mem(traits::MEM, store_address, tu.ext(tu.load(rs2+ traits::X0, 0),16,true));
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,16); vm_base<ARCH>::gen_sync(tu, POST_SYNC,16);
gen_trap_check(tu); gen_trap_check(tu);
@ -970,6 +987,7 @@ private:
tu.write_mem(traits::MEM, store_address, tu.ext(tu.load(rs2+ traits::X0, 0),32,true)); tu.write_mem(traits::MEM, store_address, tu.ext(tu.load(rs2+ traits::X0, 0),32,true));
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,17); vm_base<ARCH>::gen_sync(tu, POST_SYNC,17);
gen_trap_check(tu); gen_trap_check(tu);
@ -1003,6 +1021,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,18); vm_base<ARCH>::gen_sync(tu, POST_SYNC,18);
gen_trap_check(tu); gen_trap_check(tu);
@ -1036,6 +1055,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,19); vm_base<ARCH>::gen_sync(tu, POST_SYNC,19);
gen_trap_check(tu); gen_trap_check(tu);
@ -1069,6 +1089,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,20); vm_base<ARCH>::gen_sync(tu, POST_SYNC,20);
gen_trap_check(tu); gen_trap_check(tu);
@ -1102,6 +1123,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,21); vm_base<ARCH>::gen_sync(tu, POST_SYNC,21);
gen_trap_check(tu); gen_trap_check(tu);
@ -1135,6 +1157,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,22); vm_base<ARCH>::gen_sync(tu, POST_SYNC,22);
gen_trap_check(tu); gen_trap_check(tu);
@ -1168,6 +1191,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,23); vm_base<ARCH>::gen_sync(tu, POST_SYNC,23);
gen_trap_check(tu); gen_trap_check(tu);
@ -1201,6 +1225,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,24); vm_base<ARCH>::gen_sync(tu, POST_SYNC,24);
gen_trap_check(tu); gen_trap_check(tu);
@ -1234,6 +1259,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,25); vm_base<ARCH>::gen_sync(tu, POST_SYNC,25);
gen_trap_check(tu); gen_trap_check(tu);
@ -1267,6 +1293,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,26); vm_base<ARCH>::gen_sync(tu, POST_SYNC,26);
gen_trap_check(tu); gen_trap_check(tu);
@ -1300,6 +1327,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,27); vm_base<ARCH>::gen_sync(tu, POST_SYNC,27);
gen_trap_check(tu); gen_trap_check(tu);
@ -1333,6 +1361,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,28); vm_base<ARCH>::gen_sync(tu, POST_SYNC,28);
gen_trap_check(tu); gen_trap_check(tu);
@ -1366,6 +1395,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,29); vm_base<ARCH>::gen_sync(tu, POST_SYNC,29);
gen_trap_check(tu); gen_trap_check(tu);
@ -1399,6 +1429,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,30); vm_base<ARCH>::gen_sync(tu, POST_SYNC,30);
gen_trap_check(tu); gen_trap_check(tu);
@ -1432,6 +1463,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,31); vm_base<ARCH>::gen_sync(tu, POST_SYNC,31);
gen_trap_check(tu); gen_trap_check(tu);
@ -1465,6 +1497,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,32); vm_base<ARCH>::gen_sync(tu, POST_SYNC,32);
gen_trap_check(tu); gen_trap_check(tu);
@ -1498,6 +1531,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,33); vm_base<ARCH>::gen_sync(tu, POST_SYNC,33);
gen_trap_check(tu); gen_trap_check(tu);
@ -1531,6 +1565,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,34); vm_base<ARCH>::gen_sync(tu, POST_SYNC,34);
gen_trap_check(tu); gen_trap_check(tu);
@ -1564,6 +1599,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,35); vm_base<ARCH>::gen_sync(tu, POST_SYNC,35);
gen_trap_check(tu); gen_trap_check(tu);
@ -1597,6 +1633,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,36); vm_base<ARCH>::gen_sync(tu, POST_SYNC,36);
gen_trap_check(tu); gen_trap_check(tu);
@ -1625,6 +1662,7 @@ private:
tu.open_scope(); tu.open_scope();
tu.write_mem(traits::FENCE, static_cast<uint32_t>(traits:: fence), tu.constant((uint8_t)pred<< 4|succ,8)); tu.write_mem(traits::FENCE, static_cast<uint32_t>(traits:: fence), tu.constant((uint8_t)pred<< 4|succ,8));
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,37); vm_base<ARCH>::gen_sync(tu, POST_SYNC,37);
gen_trap_check(tu); gen_trap_check(tu);
@ -1645,6 +1683,7 @@ private:
tu.open_scope(); tu.open_scope();
this->gen_raise_trap(tu, 0, 11); this->gen_raise_trap(tu, 0, 11);
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,38); vm_base<ARCH>::gen_sync(tu, POST_SYNC,38);
gen_trap_check(tu); gen_trap_check(tu);
@ -1665,6 +1704,7 @@ private:
tu.open_scope(); tu.open_scope();
this->gen_raise_trap(tu, 0, 3); this->gen_raise_trap(tu, 0, 3);
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,39); vm_base<ARCH>::gen_sync(tu, POST_SYNC,39);
gen_trap_check(tu); gen_trap_check(tu);
@ -1685,6 +1725,7 @@ private:
tu.open_scope(); tu.open_scope();
this->gen_leave_trap(tu, 3); this->gen_leave_trap(tu, 3);
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,40); vm_base<ARCH>::gen_sync(tu, POST_SYNC,40);
gen_trap_check(tu); gen_trap_check(tu);
@ -1705,6 +1746,7 @@ private:
tu.open_scope(); tu.open_scope();
this->gen_wait(tu, 1); this->gen_wait(tu, 1);
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,41); vm_base<ARCH>::gen_sync(tu, POST_SYNC,41);
gen_trap_check(tu); gen_trap_check(tu);
@ -1743,6 +1785,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,42); vm_base<ARCH>::gen_sync(tu, POST_SYNC,42);
gen_trap_check(tu); gen_trap_check(tu);
@ -1781,6 +1824,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,43); vm_base<ARCH>::gen_sync(tu, POST_SYNC,43);
gen_trap_check(tu); gen_trap_check(tu);
@ -1819,6 +1863,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,44); vm_base<ARCH>::gen_sync(tu, POST_SYNC,44);
gen_trap_check(tu); gen_trap_check(tu);
@ -1854,6 +1899,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,45); vm_base<ARCH>::gen_sync(tu, POST_SYNC,45);
gen_trap_check(tu); gen_trap_check(tu);
@ -1891,6 +1937,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,46); vm_base<ARCH>::gen_sync(tu, POST_SYNC,46);
gen_trap_check(tu); gen_trap_check(tu);
@ -1928,6 +1975,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,47); vm_base<ARCH>::gen_sync(tu, POST_SYNC,47);
gen_trap_check(tu); gen_trap_check(tu);
@ -1954,6 +2002,7 @@ private:
tu.open_scope(); tu.open_scope();
tu.write_mem(traits::FENCE, static_cast<uint32_t>(traits:: fencei), tu.constant(imm,16)); tu.write_mem(traits::FENCE, static_cast<uint32_t>(traits:: fencei), tu.constant(imm,16));
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,48); vm_base<ARCH>::gen_sync(tu, POST_SYNC,48);
gen_trap_check(tu); gen_trap_check(tu);
@ -1988,6 +2037,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,49); vm_base<ARCH>::gen_sync(tu, POST_SYNC,49);
gen_trap_check(tu); gen_trap_check(tu);
@ -2022,6 +2072,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,50); vm_base<ARCH>::gen_sync(tu, POST_SYNC,50);
gen_trap_check(tu); gen_trap_check(tu);
@ -2056,6 +2107,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,51); vm_base<ARCH>::gen_sync(tu, POST_SYNC,51);
gen_trap_check(tu); gen_trap_check(tu);
@ -2090,6 +2142,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,52); vm_base<ARCH>::gen_sync(tu, POST_SYNC,52);
gen_trap_check(tu); gen_trap_check(tu);
@ -2133,6 +2186,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,53); vm_base<ARCH>::gen_sync(tu, POST_SYNC,53);
gen_trap_check(tu); gen_trap_check(tu);
@ -2172,6 +2226,7 @@ private:
tu.close_scope(); tu.close_scope();
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,54); vm_base<ARCH>::gen_sync(tu, POST_SYNC,54);
gen_trap_check(tu); gen_trap_check(tu);
@ -2218,6 +2273,7 @@ private:
tu.close_scope(); tu.close_scope();
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,55); vm_base<ARCH>::gen_sync(tu, POST_SYNC,55);
gen_trap_check(tu); gen_trap_check(tu);
@ -2257,6 +2313,7 @@ private:
tu.close_scope(); tu.close_scope();
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,56); vm_base<ARCH>::gen_sync(tu, POST_SYNC,56);
gen_trap_check(tu); gen_trap_check(tu);
@ -2287,6 +2344,7 @@ private:
this->gen_raise_trap(tu, 0, 2); this->gen_raise_trap(tu, 0, 2);
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,57); vm_base<ARCH>::gen_sync(tu, POST_SYNC,57);
gen_trap_check(tu); gen_trap_check(tu);
@ -2314,6 +2372,7 @@ private:
auto offs = tu.assignment(tu.ext((tu.add(tu.load(rs1+ 8+ traits::X0, 0),tu.constant(uimm,8))),32,true),32); auto offs = tu.assignment(tu.ext((tu.add(tu.load(rs1+ 8+ traits::X0, 0),tu.constant(uimm,8))),32,true),32);
tu.store(rd+ 8 + traits::X0,tu.ext(tu.ext(tu.read_mem(traits::MEM, offs, 32),32,false),32,true)); tu.store(rd+ 8 + traits::X0,tu.ext(tu.ext(tu.read_mem(traits::MEM, offs, 32),32,false),32,true));
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,58); vm_base<ARCH>::gen_sync(tu, POST_SYNC,58);
gen_trap_check(tu); gen_trap_check(tu);
@ -2341,6 +2400,7 @@ private:
auto offs = tu.assignment(tu.ext((tu.add(tu.load(rs1+ 8+ traits::X0, 0),tu.constant(uimm,8))),32,true),32); auto offs = tu.assignment(tu.ext((tu.add(tu.load(rs1+ 8+ traits::X0, 0),tu.constant(uimm,8))),32,true),32);
tu.write_mem(traits::MEM, offs, tu.ext(tu.load(rs2+ 8+ traits::X0, 0),32,true)); tu.write_mem(traits::MEM, offs, tu.ext(tu.load(rs2+ 8+ traits::X0, 0),32,true));
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,59); vm_base<ARCH>::gen_sync(tu, POST_SYNC,59);
gen_trap_check(tu); gen_trap_check(tu);
@ -2373,6 +2433,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,60); vm_base<ARCH>::gen_sync(tu, POST_SYNC,60);
gen_trap_check(tu); gen_trap_check(tu);
@ -2393,6 +2454,7 @@ private:
gen_set_pc(tu, pc, traits::NEXT_PC); gen_set_pc(tu, pc, traits::NEXT_PC);
tu.open_scope(); tu.open_scope();
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,61); vm_base<ARCH>::gen_sync(tu, POST_SYNC,61);
gen_trap_check(tu); gen_trap_check(tu);
@ -2420,6 +2482,7 @@ private:
tu.store(traits::NEXT_PC, PC_val_v); tu.store(traits::NEXT_PC, PC_val_v);
tu.store(traits::LAST_BRANCH, tu.constant(2U, 2)); tu.store(traits::LAST_BRANCH, tu.constant(2U, 2));
auto returnValue = std::make_tuple(BRANCH); auto returnValue = std::make_tuple(BRANCH);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,62); vm_base<ARCH>::gen_sync(tu, POST_SYNC,62);
gen_trap_check(tu); gen_trap_check(tu);
@ -2452,6 +2515,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,63); vm_base<ARCH>::gen_sync(tu, POST_SYNC,63);
gen_trap_check(tu); gen_trap_check(tu);
@ -2482,6 +2546,7 @@ private:
tu.store(rd + traits::X0,tu.constant((uint32_t)((int32_t)sext<18>(imm)),32)); tu.store(rd + traits::X0,tu.constant((uint32_t)((int32_t)sext<18>(imm)),32));
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,64); vm_base<ARCH>::gen_sync(tu, POST_SYNC,64);
gen_trap_check(tu); gen_trap_check(tu);
@ -2511,6 +2576,7 @@ private:
this->gen_raise_trap(tu, 0, 2); this->gen_raise_trap(tu, 0, 2);
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,65); vm_base<ARCH>::gen_sync(tu, POST_SYNC,65);
gen_trap_check(tu); gen_trap_check(tu);
@ -2532,6 +2598,7 @@ private:
tu.open_scope(); tu.open_scope();
this->gen_raise_trap(tu, 0, 2); this->gen_raise_trap(tu, 0, 2);
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,66); vm_base<ARCH>::gen_sync(tu, POST_SYNC,66);
gen_trap_check(tu); gen_trap_check(tu);
@ -2557,6 +2624,7 @@ private:
tu.open_scope(); tu.open_scope();
tu.store(rs1+ 8 + traits::X0,tu.lshr(tu.load(rs1+ 8+ traits::X0, 0),tu.constant(shamt,8))); tu.store(rs1+ 8 + traits::X0,tu.lshr(tu.load(rs1+ 8+ traits::X0, 0),tu.constant(shamt,8)));
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,67); vm_base<ARCH>::gen_sync(tu, POST_SYNC,67);
gen_trap_check(tu); gen_trap_check(tu);
@ -2587,6 +2655,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,68); vm_base<ARCH>::gen_sync(tu, POST_SYNC,68);
gen_trap_check(tu); gen_trap_check(tu);
@ -2612,6 +2681,7 @@ private:
tu.open_scope(); tu.open_scope();
tu.store(rs1+ 8 + traits::X0,tu.ext((tu.bitwise_and(tu.load(rs1+ 8+ traits::X0, 0),tu.constant((int8_t)sext<6>(imm),8))),32,true)); tu.store(rs1+ 8 + traits::X0,tu.ext((tu.bitwise_and(tu.load(rs1+ 8+ traits::X0, 0),tu.constant((int8_t)sext<6>(imm),8))),32,true));
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,69); vm_base<ARCH>::gen_sync(tu, POST_SYNC,69);
gen_trap_check(tu); gen_trap_check(tu);
@ -2637,6 +2707,7 @@ private:
tu.open_scope(); tu.open_scope();
tu.store(rd+ 8 + traits::X0,tu.ext((tu.sub(tu.load(rd+ 8+ traits::X0, 0),tu.load(rs2+ 8+ traits::X0, 0))),32,true)); tu.store(rd+ 8 + traits::X0,tu.ext((tu.sub(tu.load(rd+ 8+ traits::X0, 0),tu.load(rs2+ 8+ traits::X0, 0))),32,true));
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,70); vm_base<ARCH>::gen_sync(tu, POST_SYNC,70);
gen_trap_check(tu); gen_trap_check(tu);
@ -2662,6 +2733,7 @@ private:
tu.open_scope(); tu.open_scope();
tu.store(rd+ 8 + traits::X0,tu.bitwise_xor(tu.load(rd+ 8+ traits::X0, 0),tu.load(rs2+ 8+ traits::X0, 0))); tu.store(rd+ 8 + traits::X0,tu.bitwise_xor(tu.load(rd+ 8+ traits::X0, 0),tu.load(rs2+ 8+ traits::X0, 0)));
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,71); vm_base<ARCH>::gen_sync(tu, POST_SYNC,71);
gen_trap_check(tu); gen_trap_check(tu);
@ -2687,6 +2759,7 @@ private:
tu.open_scope(); tu.open_scope();
tu.store(rd+ 8 + traits::X0,tu.bitwise_or(tu.load(rd+ 8+ traits::X0, 0),tu.load(rs2+ 8+ traits::X0, 0))); tu.store(rd+ 8 + traits::X0,tu.bitwise_or(tu.load(rd+ 8+ traits::X0, 0),tu.load(rs2+ 8+ traits::X0, 0)));
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,72); vm_base<ARCH>::gen_sync(tu, POST_SYNC,72);
gen_trap_check(tu); gen_trap_check(tu);
@ -2712,6 +2785,7 @@ private:
tu.open_scope(); tu.open_scope();
tu.store(rd+ 8 + traits::X0,tu.bitwise_and(tu.load(rd+ 8+ traits::X0, 0),tu.load(rs2+ 8+ traits::X0, 0))); tu.store(rd+ 8 + traits::X0,tu.bitwise_and(tu.load(rd+ 8+ traits::X0, 0),tu.load(rs2+ 8+ traits::X0, 0)));
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,73); vm_base<ARCH>::gen_sync(tu, POST_SYNC,73);
gen_trap_check(tu); gen_trap_check(tu);
@ -2738,6 +2812,7 @@ private:
tu.store(traits::NEXT_PC, PC_val_v); tu.store(traits::NEXT_PC, PC_val_v);
tu.store(traits::LAST_BRANCH, tu.constant(2U, 2)); tu.store(traits::LAST_BRANCH, tu.constant(2U, 2));
auto returnValue = std::make_tuple(BRANCH); auto returnValue = std::make_tuple(BRANCH);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,74); vm_base<ARCH>::gen_sync(tu, POST_SYNC,74);
gen_trap_check(tu); gen_trap_check(tu);
@ -2767,6 +2842,7 @@ private:
tu.store(traits::LAST_BRANCH, tu.constant(2U, 2)); tu.store(traits::LAST_BRANCH, tu.constant(2U, 2));
tu.close_scope(); tu.close_scope();
auto returnValue = std::make_tuple(BRANCH); auto returnValue = std::make_tuple(BRANCH);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,75); vm_base<ARCH>::gen_sync(tu, POST_SYNC,75);
gen_trap_check(tu); gen_trap_check(tu);
@ -2796,6 +2872,7 @@ private:
tu.store(traits::LAST_BRANCH, tu.constant(2U, 2)); tu.store(traits::LAST_BRANCH, tu.constant(2U, 2));
tu.close_scope(); tu.close_scope();
auto returnValue = std::make_tuple(BRANCH); auto returnValue = std::make_tuple(BRANCH);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,76); vm_base<ARCH>::gen_sync(tu, POST_SYNC,76);
gen_trap_check(tu); gen_trap_check(tu);
@ -2828,6 +2905,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,77); vm_base<ARCH>::gen_sync(tu, POST_SYNC,77);
gen_trap_check(tu); gen_trap_check(tu);
@ -2859,6 +2937,7 @@ private:
tu.store(rd + traits::X0,tu.ext(tu.ext(tu.read_mem(traits::MEM, offs, 32),32,false),32,true)); tu.store(rd + traits::X0,tu.ext(tu.ext(tu.read_mem(traits::MEM, offs, 32),32,false),32,true));
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,78); vm_base<ARCH>::gen_sync(tu, POST_SYNC,78);
gen_trap_check(tu); gen_trap_check(tu);
@ -2891,6 +2970,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,79); vm_base<ARCH>::gen_sync(tu, POST_SYNC,79);
gen_trap_check(tu); gen_trap_check(tu);
@ -2922,6 +3002,7 @@ private:
this->gen_raise_trap(tu, 0, 2); this->gen_raise_trap(tu, 0, 2);
} }
auto returnValue = std::make_tuple(BRANCH); auto returnValue = std::make_tuple(BRANCH);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,80); vm_base<ARCH>::gen_sync(tu, POST_SYNC,80);
gen_trap_check(tu); gen_trap_check(tu);
@ -2942,6 +3023,7 @@ private:
tu.open_scope(); tu.open_scope();
this->gen_raise_trap(tu, 0, 2); this->gen_raise_trap(tu, 0, 2);
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,81); vm_base<ARCH>::gen_sync(tu, POST_SYNC,81);
gen_trap_check(tu); gen_trap_check(tu);
@ -2974,6 +3056,7 @@ private:
} }
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,82); vm_base<ARCH>::gen_sync(tu, POST_SYNC,82);
gen_trap_check(tu); gen_trap_check(tu);
@ -3007,6 +3090,7 @@ private:
tu.store(traits::LAST_BRANCH, tu.constant(2U, 2)); tu.store(traits::LAST_BRANCH, tu.constant(2U, 2));
} }
auto returnValue = std::make_tuple(BRANCH); auto returnValue = std::make_tuple(BRANCH);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,83); vm_base<ARCH>::gen_sync(tu, POST_SYNC,83);
gen_trap_check(tu); gen_trap_check(tu);
@ -3027,6 +3111,7 @@ private:
tu.open_scope(); tu.open_scope();
this->gen_raise_trap(tu, 0, 3); this->gen_raise_trap(tu, 0, 3);
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,84); vm_base<ARCH>::gen_sync(tu, POST_SYNC,84);
gen_trap_check(tu); gen_trap_check(tu);
@ -3058,6 +3143,7 @@ private:
tu.write_mem(traits::MEM, offs, tu.ext(tu.load(rs2+ traits::X0, 0),32,true)); tu.write_mem(traits::MEM, offs, tu.ext(tu.load(rs2+ traits::X0, 0),32,true));
} }
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,85); vm_base<ARCH>::gen_sync(tu, POST_SYNC,85);
gen_trap_check(tu); gen_trap_check(tu);
@ -3078,6 +3164,7 @@ private:
tu.open_scope(); tu.open_scope();
this->gen_raise_trap(tu, 0, 2); this->gen_raise_trap(tu, 0, 2);
auto returnValue = std::make_tuple(CONT); auto returnValue = std::make_tuple(CONT);
tu.close_scope(); tu.close_scope();
vm_base<ARCH>::gen_sync(tu, POST_SYNC,86); vm_base<ARCH>::gen_sync(tu, POST_SYNC,86);
gen_trap_check(tu); gen_trap_check(tu);