Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
a13689b
fixes C++20 compatibility of SystemC wrapper
eyck Jul 20, 2025
0ce8463
removes shallow checkout for dbt-rise-core as refed commit cannot be …
EAlexJ Jul 23, 2025
cd79f8c
removes unused definitions
eyck Jul 23, 2025
462257c
refactors arch state representation of generated cores
eyck Jul 23, 2025
cc21074
fixes copy-paste error
eyck Jul 23, 2025
b52822c
corrects commit tag of dbt-rise-core to allow building
EAlexJ Jul 23, 2025
59323c9
adds msu privilege wrapper if ISA string contains 'gc'
eyck Jul 23, 2025
56aa5b9
remove left-over directories and fixes C++ Std level
eyck Jul 23, 2025
40030b9
fixes page-based access of memory_with_htif
eyck Jul 23, 2025
e8b7b63
correcst typo
EAlexJ Jul 23, 2025
9421422
corrects Usage for elfio test
EAlexJ Jul 24, 2025
c7a48b8
adds more verbosity to unknown Instructions for interp
EAlexJ Jul 24, 2025
c000fd6
fixes #19
EAlexJ Jul 25, 2025
183d6e3
removes medeleg and mideleg registers as spec states "In harts withou…
EAlexJ Jul 25, 2025
0c0676a
adds medeleg and mideleg to msu_vp
EAlexJ Jul 25, 2025
ad6863a
corrects medeleg behavior
EAlexJ Jul 27, 2025
49550d1
removes magic numbers when setting trap state
EAlexJ Jul 27, 2025
858353a
enforces C++ Standard Specification, makes clangd happy
EAlexJ Jul 27, 2025
ebdc278
corrects mmu, adds flushing mechanisms to priv wrapper
EAlexJ Jul 27, 2025
12122c7
changes fence behavior for m and mu priv wrappers
EAlexJ Jul 27, 2025
d72d941
updates ISA submodule
EAlexJ Jul 27, 2025
ecfb414
updates core.h, decouples regs from traits
EAlexJ Jul 27, 2025
19b825f
updates interp cores, adds MSU privilege wrapper
EAlexJ Jul 27, 2025
4a00b46
updates tgc5c.h to use fencevma instead of upper and lower
EAlexJ Jul 27, 2025
c393063
corrects interp template
EAlexJ Jul 27, 2025
b1d72d1
adds corrected tgc5c interp
EAlexJ Jul 27, 2025
012c8da
corrects interp gc cores
EAlexJ Jul 27, 2025
f9a707d
adds msu asmjit and llvm cores
EAlexJ Jul 27, 2025
28879e7
checkin for mmu refactor
EAlexJ Jul 28, 2025
1a17e6b
changes msu wrapper to use the correct state for mstatus
EAlexJ Jul 30, 2025
9879309
adds missing access faults to riscv_common
EAlexJ Jul 31, 2025
441cd97
adds mstatush to riscv_common
EAlexJ Jul 31, 2025
474dfb5
cleans up unused mstatus fn in riscv_common
EAlexJ Jul 31, 2025
de0341c
adds Endianness control to mstatus type
EAlexJ Jul 31, 2025
4f2becd
corrects template for interp wrt trap handling for fetches
EAlexJ Aug 1, 2025
e0260a1
moves mmu flush from read to write where it belongs
EAlexJ Aug 1, 2025
d12ee50
adds mstatush register to msu wrapper
EAlexJ Aug 1, 2025
8594ec5
replaces magic numbers in enter_trap with traits values
EAlexJ Aug 1, 2025
6ed2319
corrects mstatus for msu
EAlexJ Aug 1, 2025
84130bc
corrects mmu, sv32 and sv39 are architectural compliant
EAlexJ Aug 1, 2025
a67d0c5
removes error regarding duplicate case in msu wrapper
EAlexJ Aug 2, 2025
5931742
improves mmu by moving check for page fault
EAlexJ Aug 2, 2025
7f5162b
changes Log Level for MMU
EAlexJ Aug 2, 2025
230e50b
corrects typo for core registration
EAlexJ Aug 3, 2025
78cead4
corrects creation of arbitrary cores using the CLI
EAlexJ Aug 3, 2025
c9adbd9
allows loading of PIE Executables
EAlexJ Aug 7, 2025
8b03fa2
privilige wrappers now set S and U bit in misa
EAlexJ Aug 7, 2025
3ab4343
adds scounteren reg to msu wrapper
EAlexJ Aug 7, 2025
c4311f1
refactors sc_core_adapter interface to a facade
eyck Jul 30, 2025
1c8e1be
fixes debug server interactions with cores
eyck Aug 8, 2025
82b7653
adds MISA modification based on privilege wrapper
eyck Aug 12, 2025
82f9996
Revert "adds MISA modification based on privilege wrapper" as functio…
EAlexJ Aug 13, 2025
f4bfd06
corrects mip writing in priv wrappers
EAlexJ Aug 14, 2025
48f8983
fixes typo in gdb xml description of 64bit core
eyck Aug 14, 2025
0cd1755
adds missing CSR names
eyck Aug 15, 2025
c99d195
applies some cleanup on CSR registration
eyck Aug 15, 2025
dda9a52
removes single unused line in MMU
EAlexJ Aug 2, 2025
7d410ea
corrects rdcycle and rdcycleh behavior
EAlexJ Aug 26, 2025
8643187
addresses #23, adding handling of INSTRET and INSTRUCTION register, a…
EAlexJ Aug 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module load tools/vscode
distro=`/bin/lsb_release -i -s`
if [ $distro == "CentOS" ]; then
. /opt/rh/devtoolset-8/enable
Expand Down
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@ include(GNUInstallDirs)
include(flink)

set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

include(FetchContent)
if(NOT TARGET dbt-rise-core)
FetchContent_Declare(
dbt_rise_core_git
GIT_REPOSITORY "https://github.com/Minres/DBT-RISE-Core.git"
#GIT_TAG "origin/develop"
GIT_TAG 4d1bf6
GIT_SHALLOW ON
GIT_TAG 718f877
GIT_SHALLOW OFF
UPDATE_DISCONNECTED NOT ${UPDATE_EXTERNAL_PROJECT} # When enabled, this option causes the update step to be skipped.
)
FetchContent_GetProperties(dbt_rise_core_git)
Expand Down
1 change: 1 addition & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"CMAKE_INSTALL_PREFIX": "${sourceDir}/install/${presetName}",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"CMAKE_PROJECT_TOP_LEVEL_INCLUDES": "contrib/cmake/conan_provider.cmake",
"CONAN_BUILD_PROFILE": "auto-cmake",
"WITH_TCC": "OFF"
}
},
Expand Down
2 changes: 1 addition & 1 deletion gen_input/ISA
Submodule ISA updated 2 files
+1 −2 RISCVBase.core_desc
+6 −0 RVI.core_desc
4 changes: 2 additions & 2 deletions gen_input/cores.core_desc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Core RV32IMAC provides RVI, Zicsr, Zifencei, RVM, RVA, Zca {
}
}

Core RV32GC provides RVI, Zicsr, Zifencei, RVM, RVA, Zca, Zcf, Zcd {
Core RV32GC provides RVI, Zicsr, Zifencei, RVM, RVA, Zca, Zcf, Zcd, RVSMode {
architectural_state {
XLEN=32;
FLEN=64;
Expand All @@ -51,7 +51,7 @@ Core RV64I provides RVI, Zicsr, Zifencei {
}
}

Core RV64GC provides RVI, Zicsr, Zifencei, RVM, RVA, Zca, Zcd {
Core RV64GC provides RVI, Zicsr, Zifencei, RVM, RVA, Zca, Zcd, RVSMode {
architectural_state {
XLEN=64;
FLEN=64;
Expand Down
137 changes: 70 additions & 67 deletions gen_input/templates/CORENAME.h.gtl
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,6 @@ def nativeSize(int size){
if(size<=4096) return 4096;
throw new IllegalArgumentException("Unsupported size in nativeSize in CORENAME.h.gtl");
}
def getRegisterSizes(){
def regs = registers.collect{nativeSize(it.size)}
regs+=[32,32, 64, 64, 64, 32, 32] // append TRAP_STATE, PENDING_TRAP, ICOUNT, CYCLE, INSTRET, INSTRUCTION, LAST_BRANCH
return regs
}
def getRegisterOffsets(){
def offset = 0
def offsets = []
getRegisterSizes().each { size ->
offsets<<offset
offset+=size/8
}
return offsets
}

def getCString(def val){
return val.toString()+'ULL'
}
Expand All @@ -73,62 +58,13 @@ def getCString(def val){
namespace iss {
namespace arch {

struct ${coreDef.name.toLowerCase()};

template <> struct traits<${coreDef.name.toLowerCase()}> {

constexpr static char const* const core_type = "${coreDef.name}";

static constexpr std::array<const char*, ${registers.size()}> reg_names{
{"${registers.collect{it.name.toLowerCase()}.join('", "')}"}};

static constexpr std::array<const char*, ${registers.size()}> reg_aliases{
{"${registers.collect{it.alias.toLowerCase()}.join('", "')}"}};

enum constants {${constants.collect{c -> c.name+"="+getCString(c.value)}.join(', ')}};

constexpr static unsigned FP_REGS_SIZE = ${constants.find {it.name=='FLEN'}?.value?:0};
constexpr static unsigned V_REGS_SIZE = ${constants.find {it.name=='VLEN'}?.value?:0};


enum reg_e {
${registers.collect{it.name}.join(', ')}, NUM_REGS, TRAP_STATE=NUM_REGS, PENDING_TRAP, ICOUNT, CYCLE, INSTRET, INSTRUCTION, LAST_BRANCH
};
struct ${coreDef.name.toLowerCase()}: public arch_if {

using reg_t = uint${addrDataWidth}_t;

using addr_t = uint${addrDataWidth}_t;

using code_word_t = uint${addrDataWidth}_t; //TODO: check removal

using virt_addr_t = iss::typed_addr_t<iss::address_type::VIRTUAL>;
using virt_addr_t = iss::virt_addr_t;

using phys_addr_t = iss::typed_addr_t<iss::address_type::PHYSICAL>;

static constexpr std::array<const uint32_t, ${getRegisterSizes().size()}> reg_bit_widths{
{${getRegisterSizes().join(',')}}};

static constexpr std::array<const uint32_t, ${getRegisterOffsets().size()}> reg_byte_offsets{
{${getRegisterOffsets().join(',')}}};

static const uint64_t addr_mask = (reg_t(1) << (XLEN - 1)) | ((reg_t(1) << (XLEN - 1)) - 1);

enum sreg_flag_e { FLAGS };

enum mem_type_e { ${spaces.collect{it.name}.join(', ')}, IMEM = MEM };

enum class opcode_e {<%instructions.eachWithIndex{instr, index -> %>
${instr.instruction.name} = ${index},<%}%>
MAX_OPCODE
};
};

struct ${coreDef.name.toLowerCase()}: public arch_if {

using virt_addr_t = typename traits<${coreDef.name.toLowerCase()}>::virt_addr_t;
using phys_addr_t = typename traits<${coreDef.name.toLowerCase()}>::phys_addr_t;
using reg_t = typename traits<${coreDef.name.toLowerCase()}>::reg_t;
using addr_t = typename traits<${coreDef.name.toLowerCase()}>::addr_t;
using phys_addr_t = iss::phys_addr_t;

${coreDef.name.toLowerCase()}();
~${coreDef.name.toLowerCase()}();
Expand Down Expand Up @@ -200,6 +136,73 @@ if(vtype != null) {%>
<%}%>
};

struct ${coreDef.name.toLowerCase()};

template <> struct traits<${coreDef.name.toLowerCase()}> {

constexpr static char const* const core_type = "${coreDef.name}";

static constexpr std::array<const char*, ${registers.size()}> reg_names{
{"${registers.collect{it.name.toLowerCase()}.join('", "')}"}};

static constexpr std::array<const char*, ${registers.size()}> reg_aliases{
{"${registers.collect{it.alias.toLowerCase()}.join('", "')}"}};

enum constants {
${constants.collect{c -> c.name+"="+getCString(c.value)}.collate(4).collect { it.join(', ') }.join(',\n ')}
};

constexpr static unsigned FP_REGS_SIZE = ${constants.find {it.name=='FLEN'}?.value?:0};
constexpr static unsigned V_REGS_SIZE = ${constants.find {it.name=='VLEN'}?.value?:0};


enum reg_e {
${registers.collect{it.name}.join(', ')}, NUM_REGS, TRAP_STATE=NUM_REGS, PENDING_TRAP, ICOUNT, CYCLE, INSTRET, INSTRUCTION, LAST_BRANCH
};

using reg_t = uint${addrDataWidth}_t;

using addr_t = uint${addrDataWidth}_t;

using code_word_t = uint${addrDataWidth}_t; //TODO: check removal

using virt_addr_t = iss::virt_addr_t;

using phys_addr_t = iss::phys_addr_t;

static constexpr std::array<const uint32_t, ${registers.size() + 7}> reg_bit_widths{{
${registers.collect{'sizeof('+coreDef.name.toLowerCase()+'::'+coreDef.name+'_regs::'+it.name+') * 8'}.join(',\n ')},
sizeof(${coreDef.name.toLowerCase()}::${coreDef.name}_regs::trap_state) * 8,
sizeof(${coreDef.name.toLowerCase()}::${coreDef.name}_regs::pending_trap) * 8,
sizeof(${coreDef.name.toLowerCase()}::${coreDef.name}_regs::icount) * 8,
sizeof(${coreDef.name.toLowerCase()}::${coreDef.name}_regs::cycle) * 8,
sizeof(${coreDef.name.toLowerCase()}::${coreDef.name}_regs::instret) * 8,
sizeof(${coreDef.name.toLowerCase()}::${coreDef.name}_regs::instruction) * 8,
sizeof(${coreDef.name.toLowerCase()}::${coreDef.name}_regs::last_branch) * 8,
}};

static constexpr std::array<const uint32_t, ${registers.size() + 7}> reg_byte_offsets{{
${registers.collect{'offsetof('+coreDef.name.toLowerCase()+'::'+coreDef.name+'_regs, '+coreDef.name.toLowerCase()+'::'+coreDef.name+'_regs::'+it.name+')'}.join(',\n ')},
offsetof(${coreDef.name.toLowerCase()}::${coreDef.name}_regs, ${coreDef.name.toLowerCase()}::${coreDef.name}_regs::trap_state),
offsetof(${coreDef.name.toLowerCase()}::${coreDef.name}_regs, ${coreDef.name.toLowerCase()}::${coreDef.name}_regs::pending_trap),
offsetof(${coreDef.name.toLowerCase()}::${coreDef.name}_regs, ${coreDef.name.toLowerCase()}::${coreDef.name}_regs::icount),
offsetof(${coreDef.name.toLowerCase()}::${coreDef.name}_regs, ${coreDef.name.toLowerCase()}::${coreDef.name}_regs::cycle),
offsetof(${coreDef.name.toLowerCase()}::${coreDef.name}_regs, ${coreDef.name.toLowerCase()}::${coreDef.name}_regs::instret),
offsetof(${coreDef.name.toLowerCase()}::${coreDef.name}_regs, ${coreDef.name.toLowerCase()}::${coreDef.name}_regs::instruction),
offsetof(${coreDef.name.toLowerCase()}::${coreDef.name}_regs, ${coreDef.name.toLowerCase()}::${coreDef.name}_regs::last_branch),
}};

static const uint64_t addr_mask = (reg_t(1) << (XLEN - 1)) | ((reg_t(1) << (XLEN - 1)) - 1);

enum sreg_flag_e { FLAGS };

enum mem_type_e { ${spaces.collect{it.name}.join(', ')}, IMEM = MEM };

enum class opcode_e {<%instructions.eachWithIndex{instr, index -> %>
${instr.instruction.name} = ${index},<%}%>
MAX_OPCODE
};
};
}
}
#endif /* _${coreDef.name.toUpperCase()}_H_ */
Expand Down
21 changes: 18 additions & 3 deletions gen_input/templates/asmjit/CORENAME.cpp.gtl
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ private:
gen_set_tval(jh, instr);
pc = pc+${instr.length/8};
mov(cc, jh.next_pc, pc.val);
cc.mov(get_ptr_for(jh, traits::INSTRUCTION), instr);

gen_instr_prologue(jh);
/*generate behavior*/
Expand Down Expand Up @@ -276,13 +277,14 @@ template <typename ARCH>
void vm_impl<ARCH>::gen_instr_epilogue(jit_holder& jh) {
auto& cc = jh.cc;

cc.comment("//gen_instr_epilogue");
cc.comment("//Instruction epilogue begin");
cc.inc(get_ptr_for(jh, traits::CYCLE));
x86_reg_t current_trap_state = get_reg_for(cc, traits::TRAP_STATE);
mov(cc, current_trap_state, get_ptr_for(jh, traits::TRAP_STATE));
cmp(cc, current_trap_state, 0);
cc.jne(jh.trap_entry);
cc.inc(get_ptr_for(jh, traits::ICOUNT));
cc.inc(get_ptr_for(jh, traits::CYCLE));
cc.inc(get_ptr_for(jh, traits::INSTRET));
cc.comment("//Instruction epilogue end");

}
Expand Down Expand Up @@ -360,10 +362,23 @@ std::unique_ptr<vm_if> create<arch::${coreDef.name.toLowerCase()}>(arch::${coreD

#include <iss/arch/riscv_hart_m_p.h>
#include <iss/arch/riscv_hart_mu_p.h>
#include <iss/arch/riscv_hart_msu_vp.h>
#include <iss/factory.h>
namespace iss {
namespace {
volatile std::array<bool, 2> dummy = {
<% if(instructions.find{it.instruction.name.toLowerCase() == "sret"}) {%>
volatile std::array<bool, 3> dummy = {
core_factory::instance().register_creator("${coreDef.name.toLowerCase()}|msu_vp|asmjit", [](unsigned port, void* init_data) -> std::tuple<cpu_ptr, vm_ptr>{
auto* cpu = new iss::arch::riscv_hart_msu_vp<iss::arch::${coreDef.name.toLowerCase()}>();
auto vm = new asmjit::${coreDef.name.toLowerCase()}::vm_impl<arch::${coreDef.name.toLowerCase()}>(*cpu, false);
if (port != 0) debugger::server<debugger::gdb_session>::run_server(vm, port);
if(init_data){
auto* cb = reinterpret_cast<semihosting_cb_t<arch::traits<arch::${coreDef.name.toLowerCase()}>::reg_t>*>(init_data);
cpu->set_semihosting_callback(*cb);
}
return {cpu_ptr{cpu}, vm_ptr{vm}};
}),<% } else { %>
volatile std::array<bool, 2> dummy = {<%}%>
core_factory::instance().register_creator("${coreDef.name.toLowerCase()}|m_p|asmjit", [](unsigned port, void* init_data) -> std::tuple<cpu_ptr, vm_ptr>{
auto* cpu = new iss::arch::riscv_hart_m_p<iss::arch::${coreDef.name.toLowerCase()}>();
auto vm = new asmjit::${coreDef.name.toLowerCase()}::vm_impl<arch::${coreDef.name.toLowerCase()}>(*cpu, false);
Expand Down
23 changes: 20 additions & 3 deletions gen_input/templates/interp/CORENAME.cpp.gtl
Original file line number Diff line number Diff line change
Expand Up @@ -1096,7 +1096,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
if(this->sync_exec && PRE_SYNC) this->do_sync(PRE_SYNC, std::numeric_limits<unsigned>::max());
process_spawn_blocks();
if(this->sync_exec && POST_SYNC) this->do_sync(PRE_SYNC, std::numeric_limits<unsigned>::max());
pc.val = super::core.enter_trap(arch::traits<ARCH>::RV_CAUSE_FETCH_ACCESS<<16, pc.val, 0);
*PC = super::core.enter_trap(trap_state, pc.val, instr);
} else {
if (is_jump_to_self_enabled(cond) &&
(instr == 0x0000006f || (instr&0xffff)==0xa001)) throw simulation_stopped(0); // 'J 0' or 'C.J 0'
Expand Down Expand Up @@ -1128,8 +1128,12 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
break;
}// @suppress("No break at end of case")<%}%>
default: {
if(this->disass_enabled){
std::string mnemonic = "Illegal Instruction";
this->core.disass_output(pc.val, mnemonic);
}
*NEXT_PC = *PC + ((instr & 3) == 3 ? 4 : 2);
raise(0, 2);
raise(0, traits::RV_CAUSE_ILLEGAL_INSTRUCTION);
}
}
}catch(memory_access_exception& e){}
Expand Down Expand Up @@ -1169,10 +1173,23 @@ std::unique_ptr<vm_if> create<arch::${coreDef.name.toLowerCase()}>(arch::${coreD

#include <iss/arch/riscv_hart_m_p.h>
#include <iss/arch/riscv_hart_mu_p.h>
#include <iss/arch/riscv_hart_msu_vp.h>
#include <iss/factory.h>
namespace iss {
namespace {
volatile std::array<bool, 2> dummy = {
<% if(instructions.find{it.instruction.name.toLowerCase() == "sret"}) {%>
volatile std::array<bool, 3> dummy = {
core_factory::instance().register_creator("${coreDef.name.toLowerCase()}|msu_vp|interp", [](unsigned port, void* init_data) -> std::tuple<cpu_ptr, vm_ptr>{
auto* cpu = new iss::arch::riscv_hart_msu_vp<iss::arch::${coreDef.name.toLowerCase()}>();
auto vm = new interp::${coreDef.name.toLowerCase()}::vm_impl<arch::${coreDef.name.toLowerCase()}>(*cpu, false);
if (port != 0) debugger::server<debugger::gdb_session>::run_server(vm, port);
if(init_data){
auto* cb = reinterpret_cast<semihosting_cb_t<arch::traits<arch::${coreDef.name.toLowerCase()}>::reg_t>*>(init_data);
cpu->set_semihosting_callback(*cb);
}
return {cpu_ptr{cpu}, vm_ptr{vm}};
}),<% } else { %>
volatile std::array<bool, 2> dummy = {<%}%>
core_factory::instance().register_creator("${coreDef.name.toLowerCase()}|m_p|interp", [](unsigned port, void* init_data) -> std::tuple<cpu_ptr, vm_ptr>{
auto* cpu = new iss::arch::riscv_hart_m_p<iss::arch::${coreDef.name.toLowerCase()}>();
auto vm = new interp::${coreDef.name.toLowerCase()}::vm_impl<arch::${coreDef.name.toLowerCase()}>(*cpu, false);
Expand Down
15 changes: 14 additions & 1 deletion gen_input/templates/llvm/CORENAME.cpp.gtl
Original file line number Diff line number Diff line change
Expand Up @@ -381,10 +381,23 @@ std::unique_ptr<vm_if> create<arch::${coreDef.name.toLowerCase()}>(arch::${coreD

#include <iss/arch/riscv_hart_m_p.h>
#include <iss/arch/riscv_hart_mu_p.h>
#include <iss/arch/riscv_hart_msu_vp.h>
#include <iss/factory.h>
namespace iss {
namespace {
volatile std::array<bool, 2> dummy = {
<% if(instructions.find{it.instruction.name.toLowerCase() == "sret"}) {%>
volatile std::array<bool, 3> dummy = {
core_factory::instance().register_creator("${coreDef.name.toLowerCase()}|msu_vp|llvm", [](unsigned port, void* init_data) -> std::tuple<cpu_ptr, vm_ptr>{
auto* cpu = new iss::arch::riscv_hart_msu_vp<iss::arch::${coreDef.name.toLowerCase()}>();
auto vm = new llvm::${coreDef.name.toLowerCase()}::vm_impl<arch::${coreDef.name.toLowerCase()}>(*cpu, false);
if (port != 0) debugger::server<debugger::gdb_session>::run_server(vm, port);
if(init_data){
auto* cb = reinterpret_cast<semihosting_cb_t<arch::traits<arch::${coreDef.name.toLowerCase()}>::reg_t>*>(init_data);
cpu->set_semihosting_callback(*cb);
}
return {cpu_ptr{cpu}, vm_ptr{vm}};
}),<% } else { %>
volatile std::array<bool, 2> dummy = {<%}%>
core_factory::instance().register_creator("${coreDef.name.toLowerCase()}|m_p|llvm", [](unsigned port, void* init_data) -> std::tuple<cpu_ptr, vm_ptr>{
auto* cpu = new iss::arch::riscv_hart_m_p<iss::arch::${coreDef.name.toLowerCase()}>();
auto vm = new llvm::${coreDef.name.toLowerCase()}::vm_impl<arch::${coreDef.name.toLowerCase()}>(*cpu, false);
Expand Down
3 changes: 0 additions & 3 deletions src-gen/.gitignore

This file was deleted.

2 changes: 1 addition & 1 deletion src/elfio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ using namespace ELFIO;

int main(int argc, char** argv) {
if(argc != 2) {
printf("Usage: elfdump <file_name>\n");
printf("Usage: elfio-test <file_name>\n");
return 1;
}

Expand Down
14 changes: 13 additions & 1 deletion src/iss/arch/mstatus.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ namespace arch {
template <class T, class Enable = void> struct status {};
// specialization 32bit
template <typename T> struct status<T, typename std::enable_if<std::is_same<T, uint32_t>::value>::type> {
static inline unsigned SD(T v) { return bit_sub<63, 1>(v); }
static inline unsigned SD(T v) { return bit_sub<63, 1>(v); };
// Machine mode big endian
static inline unsigned MBE(T v) { return bit_sub<37, 1>(v); };
// Supervisor mode big endian
static inline unsigned SBE(T v) { return bit_sub<36, 1>(v); };
// value of XLEN for S-mode
static inline unsigned SXL(T v) { return bit_sub<34, 2>(v); };
// value of XLEN for U-mode
Expand Down Expand Up @@ -90,6 +94,10 @@ template <typename T> struct status<T, typename std::enable_if<std::is_same<T, u
// SD bit is read-only and is set when either the FS or XS bits encode a Dirty state (i.e., SD=((FS==11) OR
// XS==11)))
static inline unsigned SD(T v) { return bit_sub<63, 1>(v); };
// Machine mode big endian
static inline unsigned MBE(T v) { return bit_sub<37, 1>(v); };
// Supervisor mode big endian
static inline unsigned SBE(T v) { return bit_sub<36, 1>(v); };
// value of XLEN for S-mode
static inline unsigned SXL(T v) { return bit_sub<34, 2>(v); };
// value of XLEN for U-mode
Expand Down Expand Up @@ -185,6 +193,10 @@ template <typename T> class hart_state<T, typename std::enable_if<std::is_same<T
// SD bit is read-only and is set when either the FS or XS bits encode a Dirty state (i.e., SD=((FS==11) OR
// XS==11)))
BF_FIELD(SD, 63, 1);
// Machine mode big endian
BF_FIELD(MBE, 37, 1);
// Supervisor mode big endian
BF_FIELD(SBE, 36, 1);
// value of XLEN for S-mode
BF_FIELD(SXL, 34, 2);
// value of XLEN for U-mode
Expand Down
Loading