C++11 refactoring
This commit is contained in:
parent
cb8b5e6d4b
commit
7c2539bff0
115
.cproject
115
.cproject
|
@ -28,11 +28,14 @@
|
|||
<option id="gnu.cpp.compiler.option.debugging.level.1161461100" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
|
||||
<option id="gnu.cpp.compiler.option.dialect.std.689478602" name="Language standard" superClass="gnu.cpp.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.cpp.compiler.dialect.c++1y" valueType="enumerated"/>
|
||||
<option id="gnu.cpp.compiler.option.include.paths.842172839" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${SYSTEMC_HOME}/include""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/dbt-riscv/external/libGIS}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/dbt-riscv/external/elfio}""/>
|
||||
<listOptionValue builtIn="false" value="/usr/include/llvm-4.0"/>
|
||||
<listOptionValue builtIn="false" value=""${HOME}/.conan/data/Seasocks/1.3.2/minres/stable/source/seasocks/src/main/c""/>
|
||||
<listOptionValue builtIn="false" value=""${HOME}/.conan/data/Poco/1.7.8p3/pocoproject/stable/package/506dd97d52a31e919c8613e1e6dc66d79f5a9625/include""/>
|
||||
<listOptionValue builtIn="false" value=""${HOME}/.conan/data/SystemCVerification/2.0.0a/minres/stable/package/d9580b78ca474433b46b653ea2c6c83385840479/include""/>
|
||||
<listOptionValue builtIn="false" value=""${HOME}/.conan/data/SystemC/2.3.2/minres/stable/package/5da42a16f2fe7e4182d2c23eaed73d10d0bca3f4/include""/>
|
||||
<listOptionValue builtIn="false" value=""${HOME}/.conan/data/zlib/1.2.11/conan/stable/package/0a813c597d519ec14c71192b99d7de0a92bbc1c3/include""/>
|
||||
</option>
|
||||
<option id="gnu.cpp.compiler.option.preprocessor.def.625649396" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" useByScannerDiscovery="false" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="WITH_SYSTEMC"/>
|
||||
|
@ -78,7 +81,7 @@
|
|||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding="riscv/src-gen|blink.S|scc|flash.s" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry excluding="build_rel|build|riscv/src-gen|blink.S|scc|flash.s" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
|
@ -249,55 +252,6 @@
|
|||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
</scannerConfigBuildInfo>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
|
||||
<buildTargets>
|
||||
<target name="all VERBOSE=1" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments/>
|
||||
<buildTarget>all VERBOSE=1</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="clean" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j8</buildArguments>
|
||||
<buildTarget>clean</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="all" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j8</buildArguments>
|
||||
<buildTarget>all</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="clangformat" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildTarget>clangformat</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="riscv" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildTarget>riscv</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="riscv.sc" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildTarget>riscv.sc</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
</buildTargets>
|
||||
</storageModule>
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.119132886;cdt.managedbuild.config.gnu.exe.debug.119132886.;cdt.managedbuild.tool.gnu.c.compiler.base.492144561;cdt.managedbuild.tool.gnu.c.compiler.input.1379562984">
|
||||
|
@ -343,4 +297,63 @@
|
|||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
</scannerConfigBuildInfo>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
|
||||
<buildTargets>
|
||||
<target name="all VERBOSE=1" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildTarget>all VERBOSE=1</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="clean" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j8</buildArguments>
|
||||
<buildTarget>clean</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="all" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j8</buildArguments>
|
||||
<buildTarget>all</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="clangformat" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments/>
|
||||
<buildTarget>clangformat</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="riscv" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments/>
|
||||
<buildTarget>riscv</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="riscv.sc" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments/>
|
||||
<buildTarget>riscv.sc</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="all -C ../build_rel" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments/>
|
||||
<buildTarget>all -C ../build_rel</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
</buildTargets>
|
||||
</storageModule>
|
||||
</cproject>
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
mkdir -f build_rel
|
||||
cd build_rel/
|
||||
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo && \
|
||||
cmake --build . && \
|
||||
bin/riscv --reset=0x20400000 --verbose=4 $HOME/eclipse-workspace/RiscV-dhrystone/dhrystone
|
||||
|
2
dbt-core
2
dbt-core
|
@ -1 +1 @@
|
|||
Subproject commit 4eb39e8583e591b50c97051db7ac667c209459ab
|
||||
Subproject commit e70839fbf599302c976919afc590492b80bb2995
|
|
@ -47,45 +47,54 @@
|
|||
|
||||
#ifdef WITH_SCV
|
||||
#include <scv.h>
|
||||
#include <array>
|
||||
#endif
|
||||
|
||||
|
||||
namespace sysc {
|
||||
namespace SiFive {
|
||||
using namespace std;
|
||||
using namespace iss;
|
||||
|
||||
namespace {
|
||||
iss::debugger::encoder_decoder encdec;
|
||||
|
||||
}
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
const char lvl[] = {'U', 'S', 'H', 'M'};
|
||||
std::array<const char, 4> lvl = { { 'U', 'S', 'H', 'M' } };
|
||||
|
||||
const char *trap_str[] = {"Instruction address misaligned",
|
||||
"Instruction access fault",
|
||||
"Illegal instruction",
|
||||
"Breakpoint",
|
||||
"Load address misaligned",
|
||||
"Load access fault",
|
||||
"Store/AMO address misaligned",
|
||||
"Store/AMO access fault",
|
||||
"Environment call from U-mode",
|
||||
"Environment call from S-mode",
|
||||
"Reserved",
|
||||
"Environment call from M-mode",
|
||||
"Instruction page fault",
|
||||
"Load page fault",
|
||||
"Reserved",
|
||||
"Store/AMO page fault"};
|
||||
const char *irq_str[] = {
|
||||
"User software interrupt", "Supervisor software interrupt", "Reserved", "Machine software interrupt",
|
||||
"User timer interrupt", "Supervisor timer interrupt", "Reserved", "Machine timer interrupt",
|
||||
"User external interrupt", "Supervisor external interrupt", "Reserved", "Machine external interrupt"};
|
||||
std::array<const char*, 16> trap_str = { {
|
||||
"Instruction address misaligned",
|
||||
"Instruction access fault",
|
||||
"Illegal instruction",
|
||||
"Breakpoint",
|
||||
"Load address misaligned",
|
||||
"Load access fault",
|
||||
"Store/AMO address misaligned",
|
||||
"Store/AMO access fault",
|
||||
"Environment call from U-mode",
|
||||
"Environment call from S-mode",
|
||||
"Reserved",
|
||||
"Environment call from M-mode",
|
||||
"Instruction page fault",
|
||||
"Load page fault",
|
||||
"Reserved",
|
||||
"Store/AMO page fault"
|
||||
} };
|
||||
std::array<const char*, 12> irq_str = { {
|
||||
"User software interrupt", "Supervisor software interrupt", "Reserved", "Machine software interrupt",
|
||||
"User timer interrupt", "Supervisor timer interrupt", "Reserved", "Machine timer interrupt",
|
||||
"User external interrupt", "Supervisor external interrupt", "Reserved", "Machine external interrupt" } };
|
||||
}
|
||||
|
||||
class core_wrapper : public iss::arch::riscv_hart_msu_vp<iss::arch::rv32imac> {
|
||||
public:
|
||||
using core_type = iss::arch::rv32imac;
|
||||
using base_type = iss::arch::riscv_hart_msu_vp<iss::arch::rv32imac>;
|
||||
using phys_addr_t = typename iss::arch::traits<iss::arch::rv32imac>::phys_addr_t;
|
||||
using core_type = arch::rv32imac;
|
||||
using base_type = arch::riscv_hart_msu_vp<arch::rv32imac>;
|
||||
using phys_addr_t = typename arch::traits<arch::rv32imac>::phys_addr_t;
|
||||
core_wrapper(core_complex *owner)
|
||||
: owner(owner)
|
||||
{}
|
||||
|
@ -96,7 +105,7 @@ public:
|
|||
|
||||
void notify_phase(exec_phase) override;
|
||||
|
||||
iss::sync_type needed_sync() const override { return iss::PRE_SYNC; }
|
||||
sync_type needed_sync() const override { return PRE_SYNC; }
|
||||
|
||||
void disass_output(uint64_t pc, const std::string instr) override {
|
||||
if (logging::INFO <= logging::Log<logging::Output2FILE<logging::disass>>::reporting_level() && logging::Output2FILE<logging::disass>::stream()){
|
||||
|
@ -109,22 +118,22 @@ public:
|
|||
owner->disass_output(pc,instr);
|
||||
};
|
||||
|
||||
iss::status read_mem(phys_addr_t addr, unsigned length, uint8_t *const data) {
|
||||
if (addr.access && iss::access_type::DEBUG)
|
||||
return owner->read_mem_dbg(addr.val, length, data) ? iss::Ok : iss::Err;
|
||||
status read_mem(phys_addr_t addr, unsigned length, uint8_t *const data) {
|
||||
if (addr.access && access_type::DEBUG)
|
||||
return owner->read_mem_dbg(addr.val, length, data) ? Ok : Err;
|
||||
else {
|
||||
return owner->read_mem(addr.val, length, data,addr.access && iss::access_type::FETCH) ? iss::Ok : iss::Err;
|
||||
return owner->read_mem(addr.val, length, data,addr.access && access_type::FETCH) ? Ok : Err;
|
||||
}
|
||||
}
|
||||
|
||||
iss::status write_mem(phys_addr_t addr, unsigned length, const uint8_t *const data) {
|
||||
if (addr.access && iss::access_type::DEBUG)
|
||||
return owner->write_mem_dbg(addr.val, length, data) ? iss::Ok : iss::Err;
|
||||
status write_mem(phys_addr_t addr, unsigned length, const uint8_t *const data) {
|
||||
if (addr.access && access_type::DEBUG)
|
||||
return owner->write_mem_dbg(addr.val, length, data) ? Ok : Err;
|
||||
else{
|
||||
auto res = owner->write_mem(addr.val, length, data) ? iss::Ok : iss::Err;
|
||||
auto res = owner->write_mem(addr.val, length, data) ? Ok : Err;
|
||||
// TODO: this is an ugly hack (clear MTIP on mtimecmp write), needs to be fixed
|
||||
if(addr.val==0x2004000)
|
||||
this->csr[iss::arch::mip] &= ~(1ULL<<7);
|
||||
this->csr[arch::mip] &= ~(1ULL<<7);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
@ -140,13 +149,13 @@ public:
|
|||
void local_irq(short id){
|
||||
switch(id){
|
||||
case 16: // SW
|
||||
this->csr[iss::arch::mip] |= 1<<3;
|
||||
this->csr[arch::mip] |= 1<<3;
|
||||
break;
|
||||
case 17: // timer
|
||||
this->csr[iss::arch::mip] |= 1<<7;
|
||||
this->csr[arch::mip] |= 1<<7;
|
||||
break;
|
||||
case 18: //external
|
||||
this->csr[iss::arch::mip] |= 1<<11;
|
||||
this->csr[arch::mip] |= 1<<11;
|
||||
break;
|
||||
default:
|
||||
/* do nothing*/
|
||||
|
@ -159,15 +168,15 @@ private:
|
|||
sc_event wfi_evt;
|
||||
};
|
||||
|
||||
int cmd_sysc(int argc, char* argv[], iss::debugger::out_func of, iss::debugger::data_func df, iss::debugger::target_adapter_if* tgt_adapter){
|
||||
int cmd_sysc(int argc, char* argv[], debugger::out_func of, debugger::data_func df, debugger::target_adapter_if* tgt_adapter){
|
||||
if(argc>1) {
|
||||
if(strcasecmp(argv[1], "print_time")==0){
|
||||
std::string t = sc_core::sc_time_stamp().to_string();
|
||||
of(t.c_str());
|
||||
char buf[64];
|
||||
encdec.enc_string(t.c_str(), buf, 63);
|
||||
df(buf);
|
||||
return iss::Ok;
|
||||
std::array<char, 64> buf;
|
||||
encdec.enc_string(t.c_str(), buf.data(), 63);
|
||||
df(buf.data());
|
||||
return Ok;
|
||||
} else if(strcasecmp(argv[1], "break")==0){
|
||||
sc_core::sc_time t;
|
||||
if(argc==4){
|
||||
|
@ -175,17 +184,17 @@ int cmd_sysc(int argc, char* argv[], iss::debugger::out_func of, iss::debugger::
|
|||
} else if(argc==3){
|
||||
t= scc::parse_from_string(argv[2]);
|
||||
} else
|
||||
return iss::Err;
|
||||
return Err;
|
||||
// no check needed as it is only called if debug server is active
|
||||
tgt_adapter->add_break_condition([t]()->unsigned{
|
||||
LOG(TRACE)<<"Checking condition at "<<sc_core::sc_time_stamp();
|
||||
return sc_core::sc_time_stamp()>=t?std::numeric_limits<unsigned>::max():0;
|
||||
});
|
||||
return iss::Ok;
|
||||
return Ok;
|
||||
}
|
||||
return iss::Err;
|
||||
return Err;
|
||||
}
|
||||
return iss::Err;
|
||||
return Err;
|
||||
|
||||
}
|
||||
|
||||
|
@ -245,15 +254,15 @@ core_complex::~core_complex() = default;
|
|||
void core_complex::trace(sc_core::sc_trace_file *trf) {}
|
||||
|
||||
void core_complex::before_end_of_elaboration() {
|
||||
cpu = std::make_unique<core_wrapper>(this);
|
||||
vm = iss::create<iss::arch::rv32imac>(cpu.get(), gdb_server_port.value, dump_ir.value);
|
||||
cpu = make_unique<core_wrapper>(this);
|
||||
vm = create<arch::rv32imac>(cpu.get(), gdb_server_port.value, dump_ir.value);
|
||||
vm->setDisassEnabled(enable_disass.value);
|
||||
auto* srv = iss::debugger::server<iss::debugger::gdb_session>::get();
|
||||
auto* srv = debugger::server<debugger::gdb_session>::get();
|
||||
if(srv) tgt_adapter = srv->get_target();
|
||||
if(tgt_adapter)
|
||||
tgt_adapter->add_custom_command({
|
||||
"sysc",
|
||||
[this](int argc, char* argv[], iss::debugger::out_func of, iss::debugger::data_func df)-> int {
|
||||
[this](int argc, char* argv[], debugger::out_func of, debugger::data_func df)-> int {
|
||||
return cmd_sysc(argc, argv, of, df, tgt_adapter);
|
||||
},
|
||||
"SystemC sub-commands: break <time>, print_time"});
|
||||
|
@ -306,7 +315,7 @@ void core_complex::run() {
|
|||
cpu->reset(reset_address.value);
|
||||
try {
|
||||
vm->start(-1);
|
||||
} catch (iss::simulation_stopped &e) {
|
||||
} catch (simulation_stopped &e) {
|
||||
}
|
||||
sc_core::sc_stop();
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ InsructionSet RV32IBase {
|
|||
val new_pc[XLEN] <= X[rs1]+ imm;
|
||||
val align[XLEN] <= new_pc & 0x2;
|
||||
if(align != 0){
|
||||
raise(0, 0)
|
||||
raise(0, 0);
|
||||
} else {
|
||||
if(rd!=0) X[rd] <= PC+4;
|
||||
PC<=new_pc & ~0x1;
|
||||
|
@ -160,7 +160,7 @@ InsructionSet RV32IBase {
|
|||
encoding: b0000000 | shamt[4:0] | rs1[4:0] | b001 | rd[4:0] | b0010011;
|
||||
args_disass:"x%rd$d, x%rs1$d, %shamt%";
|
||||
if(shamt > 31){
|
||||
raise(0,0)
|
||||
raise(0,0);
|
||||
} else {
|
||||
if(rd != 0) X[rd] <= shll(X[rs1], shamt);
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ InsructionSet RV32IBase {
|
|||
encoding: b0000000 | shamt[4:0] | rs1[4:0] | b101 | rd[4:0] | b0010011;
|
||||
args_disass:"x%rd$d, x%rs1$d, %shamt%";
|
||||
if(shamt > 31){
|
||||
raise(0,0)
|
||||
raise(0,0);
|
||||
} else {
|
||||
if(rd != 0) X[rd] <= shrl(X[rs1], shamt);
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ InsructionSet RV32IBase {
|
|||
encoding: b0100000 | shamt[4:0] | rs1[4:0] | b101 | rd[4:0] | b0010011;
|
||||
args_disass:"x%rd$d, x%rs1$d, %shamt%";
|
||||
if(shamt > 31){
|
||||
raise(0,0)
|
||||
raise(0,0);
|
||||
} else {
|
||||
if(rd != 0) X[rd] <= shra(X[rs1], shamt);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import "RV64IBase.core_desc"
|
|||
//import "RV64M.core_desc"
|
||||
import "RV64A.core_desc"
|
||||
|
||||
|
||||
Core RV32IMAC provides RV32IBase, RV32M, RV32A, RV32CI {
|
||||
template:"vm_riscv.in.cpp";
|
||||
constants {
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include <util/ities.h>
|
||||
#include <util/sparse_array.h>
|
||||
#include <util/bit_field.h>
|
||||
#include <array>
|
||||
|
||||
namespace iss {
|
||||
namespace arch {
|
||||
|
@ -159,28 +160,29 @@ enum csr_name {
|
|||
|
||||
namespace {
|
||||
|
||||
const char lvl[] = {'U', 'S', 'H', 'M'};
|
||||
std::array<const char, 4> lvl = { { 'U', 'S', 'H', 'M' } };
|
||||
|
||||
const char *trap_str[] = {"Instruction address misaligned", //0
|
||||
"Instruction access fault", //1
|
||||
"Illegal instruction", //2
|
||||
"Breakpoint", //3
|
||||
"Load address misaligned", //4
|
||||
"Load access fault", //5
|
||||
"Store/AMO address misaligned", //6
|
||||
"Store/AMO access fault", //7
|
||||
"Environment call from U-mode", //8
|
||||
"Environment call from S-mode", //9
|
||||
"Reserved", //a
|
||||
"Environment call from M-mode", //b
|
||||
"Instruction page fault", //c
|
||||
"Load page fault", //d
|
||||
"Reserved", //e
|
||||
"Store/AMO page fault"}; //f
|
||||
const char *irq_str[] = {
|
||||
"User software interrupt", "Supervisor software interrupt", "Reserved", "Machine software interrupt",
|
||||
"User timer interrupt", "Supervisor timer interrupt", "Reserved", "Machine timer interrupt",
|
||||
"User external interrupt", "Supervisor external interrupt", "Reserved", "Machine external interrupt"};
|
||||
std::array<const char*, 16> trap_str = { { ""
|
||||
"Instruction address misaligned", //0
|
||||
"Instruction access fault", //1
|
||||
"Illegal instruction", //2
|
||||
"Breakpoint", //3
|
||||
"Load address misaligned", //4
|
||||
"Load access fault", //5
|
||||
"Store/AMO address misaligned", //6
|
||||
"Store/AMO access fault", //7
|
||||
"Environment call from U-mode", //8
|
||||
"Environment call from S-mode", //9
|
||||
"Reserved", //a
|
||||
"Environment call from M-mode", //b
|
||||
"Instruction page fault", //c
|
||||
"Load page fault", //d
|
||||
"Reserved", //e
|
||||
"Store/AMO page fault" } };
|
||||
std::array<const char*, 12> irq_str = { {
|
||||
"User software interrupt", "Supervisor software interrupt", "Reserved", "Machine software interrupt",
|
||||
"User timer interrupt", "Supervisor timer interrupt", "Reserved", "Machine timer interrupt", "User external interrupt",
|
||||
"Supervisor external interrupt", "Reserved", "Machine external interrupt" } };
|
||||
|
||||
enum {
|
||||
PGSHIFT = 12,
|
||||
|
@ -313,7 +315,7 @@ public:
|
|||
|
||||
void write_mstatus(T val, unsigned priv_lvl){
|
||||
auto mask = get_mask(priv_lvl);
|
||||
auto new_val = (mstatus & ~mask) | (val & mask);
|
||||
auto new_val = (mstatus.st.value & ~mask) | (val & mask);
|
||||
mstatus=new_val;
|
||||
}
|
||||
|
||||
|
@ -435,12 +437,12 @@ public:
|
|||
const typename super::reg_t PGMASK = PGSIZE - 1;
|
||||
|
||||
constexpr reg_t get_irq_mask(size_t mode) {
|
||||
const reg_t m[4] = {
|
||||
0b000100010001, // U mode
|
||||
0b001100110011, // S-mode
|
||||
0,
|
||||
0b101110111011 // M-mode
|
||||
};
|
||||
std::array<const reg_t,4> m = { {
|
||||
0b000100010001,// U mode
|
||||
0b001100110011,// S mode
|
||||
0,
|
||||
0b101110111011 // M mode
|
||||
}};
|
||||
return m[mode];
|
||||
}
|
||||
|
||||
|
@ -485,7 +487,7 @@ protected:
|
|||
mem_type mem;
|
||||
csr_type csr;
|
||||
hart_state<reg_t> state;
|
||||
vm_info vm[2];
|
||||
std::array<vm_info,2> vm;
|
||||
void update_vm_info();
|
||||
unsigned to_host_wr_cnt = 0;
|
||||
std::stringstream uart_buf;
|
||||
|
@ -552,11 +554,11 @@ riscv_hart_msu_vp<BASE>::riscv_hart_msu_vp()
|
|||
template <typename BASE> void riscv_hart_msu_vp<BASE>::load_file(std::string name, int type) {
|
||||
FILE *fp = fopen(name.c_str(), "r");
|
||||
if (fp) {
|
||||
char buf[5];
|
||||
auto n = fread(buf, 1, 4, fp);
|
||||
std::array<char, 5> buf;
|
||||
auto n = fread(buf.data(), 1, 4, fp);
|
||||
if (n != 4) throw std::runtime_error("input file has insufficient size");
|
||||
buf[4] = 0;
|
||||
if (strcmp(buf + 1, "ELF") == 0) {
|
||||
if (strcmp(buf.data() + 1, "ELF") == 0) {
|
||||
fclose(fp);
|
||||
// Create elfio reader
|
||||
ELFIO::elfio reader;
|
||||
|
@ -1209,10 +1211,10 @@ template <typename BASE> uint64_t riscv_hart_msu_vp<BASE>::enter_trap(uint64_t f
|
|||
// reset trap state
|
||||
this->reg.machine_state = new_priv;
|
||||
this->reg.trap_state = 0;
|
||||
char buffer[32];
|
||||
sprintf(buffer, "0x%016lx", addr);
|
||||
std::array<char, 32> buffer;
|
||||
sprintf(buffer.data(), "0x%016lx", addr);
|
||||
CLOG(INFO, disass) << (trap_id ? "Interrupt" : "Trap") << " with cause '" << (trap_id ? irq_str[cause] : trap_str[cause])<<"' ("<<trap_id<<")"
|
||||
<< " at address " << buffer << " occurred, changing privilege level from " << lvl[cur_priv]
|
||||
<< " at address " << buffer.data() << " occurred, changing privilege level from " << lvl[cur_priv]
|
||||
<< " to " << lvl[new_priv];
|
||||
update_vm_info();
|
||||
return this->reg.NEXT_PC;
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Created on: Sat Dec 30 12:50:15 CET 2017
|
||||
// Created on: Tue Feb 06 17:18:49 UTC 2018
|
||||
// * rv32imac.h Author: <CoreDSL Generator>
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -39,6 +39,7 @@
|
|||
#include <iss/arch_if.h>
|
||||
#include <iss/vm_if.h>
|
||||
#include <iss/arch/traits.h>
|
||||
#include <array>
|
||||
|
||||
namespace iss {
|
||||
namespace arch {
|
||||
|
@ -103,12 +104,12 @@ struct traits<rv32imac> {
|
|||
using phys_addr_t = iss::typed_addr_t<iss::address_type::PHYSICAL>;
|
||||
|
||||
constexpr static unsigned reg_bit_width(unsigned r) {
|
||||
const uint32_t RV32IMAC_reg_size[] = {32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,64};
|
||||
constexpr std::array<const uint32_t, 38> RV32IMAC_reg_size{{32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,64}};
|
||||
return RV32IMAC_reg_size[r];
|
||||
}
|
||||
|
||||
constexpr static unsigned reg_byte_offset(unsigned r) {
|
||||
const uint32_t RV32IMAC_reg_byte_offset[] = {0,4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,116,120,124,128,132,136,140,144,152,160};
|
||||
constexpr std::array<const uint32_t, 39> RV32IMAC_reg_byte_offset{{0,4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,116,120,124,128,132,136,140,144,152,160}};
|
||||
return RV32IMAC_reg_byte_offset[r];
|
||||
}
|
||||
|
||||
|
@ -197,7 +198,7 @@ protected:
|
|||
uint64_t icount = 0;
|
||||
} reg;
|
||||
|
||||
address_type addr_mode[4];
|
||||
std::array<address_type, 4> addr_mode;
|
||||
|
||||
uint64_t cycles = 0;
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Created on: Sat Dec 30 12:50:15 CET 2017
|
||||
// Created on: Tue Feb 06 17:18:50 UTC 2018
|
||||
// * rv64ia.h Author: <CoreDSL Generator>
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -39,6 +39,7 @@
|
|||
#include <iss/arch_if.h>
|
||||
#include <iss/vm_if.h>
|
||||
#include <iss/arch/traits.h>
|
||||
#include <array>
|
||||
|
||||
namespace iss {
|
||||
namespace arch {
|
||||
|
@ -103,12 +104,12 @@ struct traits<rv64ia> {
|
|||
using phys_addr_t = iss::typed_addr_t<iss::address_type::PHYSICAL>;
|
||||
|
||||
constexpr static unsigned reg_bit_width(unsigned r) {
|
||||
const uint32_t RV64IA_reg_size[] = {64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,32,32,32,64};
|
||||
constexpr std::array<const uint32_t, 38> RV64IA_reg_size{{64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,32,32,32,64}};
|
||||
return RV64IA_reg_size[r];
|
||||
}
|
||||
|
||||
constexpr static unsigned reg_byte_offset(unsigned r) {
|
||||
const uint32_t RV64IA_reg_byte_offset[] = {0,8,16,24,32,40,48,56,64,72,80,88,96,104,112,120,128,136,144,152,160,168,176,184,192,200,208,216,224,232,240,248,256,264,272,276,280,288,296};
|
||||
constexpr std::array<const uint32_t, 39> RV64IA_reg_byte_offset{{0,8,16,24,32,40,48,56,64,72,80,88,96,104,112,120,128,136,144,152,160,168,176,184,192,200,208,216,224,232,240,248,256,264,272,276,280,288,296}};
|
||||
return RV64IA_reg_byte_offset[r];
|
||||
}
|
||||
|
||||
|
@ -197,10 +198,10 @@ protected:
|
|||
uint64_t icount = 0;
|
||||
} reg;
|
||||
|
||||
address_type addr_mode[4];
|
||||
std::array<address_type, 4> addr_mode;
|
||||
|
||||
uint64_t cycles = 0;
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
#include <memory>
|
||||
#include <util/logging.h>
|
||||
#include <array>
|
||||
|
||||
namespace iss {
|
||||
namespace debugger {
|
||||
|
@ -279,10 +280,10 @@ template <typename ARCH> status riscv_target_adapter<ARCH>::threadinfo_query(int
|
|||
|
||||
template <typename ARCH>
|
||||
status riscv_target_adapter<ARCH>::threadextrainfo_query(const rp_thread_ref &thread, std::string &out_buf) {
|
||||
char buf[20];
|
||||
memset(buf, 0, 20);
|
||||
sprintf(buf, "%02x%02x%02x%02x%02x%02x%02x%02x%02x", 'R', 'u', 'n', 'n', 'a', 'b', 'l', 'e', 0);
|
||||
out_buf = buf;
|
||||
std::array<char, 20> buf;
|
||||
memset(buf.data(), 0, 20);
|
||||
sprintf(buf.data(), "%02x%02x%02x%02x%02x%02x%02x%02x%02x", 'R', 'u', 'n', 'n', 'a', 'b', 'l', 'e', 0);
|
||||
out_buf = buf.data();
|
||||
return Ok;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include <boost/format.hpp>
|
||||
|
||||
#include <iss/debugger/riscv_target_adapter.h>
|
||||
#include <array>
|
||||
|
||||
namespace iss {
|
||||
namespace CORE_DEF_NAME {
|
||||
|
@ -121,14 +122,14 @@ protected:
|
|||
using compile_func = std::tuple<vm::continuation_e, llvm::BasicBlock *> (this_class::*)(virt_addr_t &pc,
|
||||
code_word_t instr,
|
||||
llvm::BasicBlock *bb);
|
||||
compile_func lut[LUT_SIZE];
|
||||
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;
|
||||
|
||||
compile_func *qlut[4]; // = {lut_00, lut_01, lut_10, lut_11};
|
||||
std::array<compile_func*, 4> qlut;
|
||||
|
||||
const uint32_t lutmasks[4] = {EXTR_MASK16, EXTR_MASK16, EXTR_MASK16, EXTR_MASK32};
|
||||
std::array<const uint32_t, 4> lutmasks = { { EXTR_MASK16, EXTR_MASK16, EXTR_MASK16, EXTR_MASK32 } };
|
||||
|
||||
void expand_bit_mask(int pos, uint32_t mask, uint32_t value, uint32_t valid, uint32_t idx, compile_func lut[],
|
||||
compile_func f) {
|
||||
|
@ -179,14 +180,14 @@ private:
|
|||
};
|
||||
|
||||
/* «start generated code» */
|
||||
InstructionDesriptor instr_descr[0] = {};
|
||||
std::array<InstructionDesriptor, 0> instr_descr = { { } };
|
||||
/* «end generated code» */
|
||||
/****************************************************************************
|
||||
* end opcode definitions
|
||||
****************************************************************************/
|
||||
std::tuple<vm::continuation_e, llvm::BasicBlock *> illegal_intruction(virt_addr_t &pc, code_word_t instr,
|
||||
llvm::BasicBlock *bb) {
|
||||
this->gen_sync(iss::PRE_SYNC, sizeof(instr_descr)/sizeof(InstructionDesriptor));
|
||||
this->gen_sync(iss::PRE_SYNC, instr_descr.size());
|
||||
this->builder.CreateStore(this->builder.CreateLoad(get_reg_ptr(traits<ARCH>::NEXT_PC), true),
|
||||
get_reg_ptr(traits<ARCH>::PC), true);
|
||||
this->builder.CreateStore(
|
||||
|
@ -195,7 +196,7 @@ private:
|
|||
get_reg_ptr(traits<ARCH>::ICOUNT), true);
|
||||
pc = pc + ((instr & 3) == 3 ? 4 : 2);
|
||||
this->gen_raise_trap(0, 2); // illegal instruction trap
|
||||
this->gen_sync(iss::POST_SYNC, sizeof(instr_descr)/sizeof(InstructionDesriptor));
|
||||
this->gen_sync(iss::POST_SYNC, instr_descr.size());
|
||||
this->gen_trap_check(this->leave_blk);
|
||||
return std::make_tuple(iss::vm::BRANCH, nullptr);
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include <boost/format.hpp>
|
||||
|
||||
#include <iss/debugger/riscv_target_adapter.h>
|
||||
#include <array>
|
||||
|
||||
namespace iss {
|
||||
namespace rv32imac {
|
||||
|
@ -121,14 +122,14 @@ protected:
|
|||
using compile_func = std::tuple<vm::continuation_e, llvm::BasicBlock *> (this_class::*)(virt_addr_t &pc,
|
||||
code_word_t instr,
|
||||
llvm::BasicBlock *bb);
|
||||
compile_func lut[LUT_SIZE];
|
||||
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;
|
||||
|
||||
compile_func *qlut[4]; // = {lut_00, lut_01, lut_10, lut_11};
|
||||
std::array<compile_func*, 4> qlut;
|
||||
|
||||
const uint32_t lutmasks[4] = {EXTR_MASK16, EXTR_MASK16, EXTR_MASK16, EXTR_MASK32};
|
||||
std::array<const uint32_t, 4> lutmasks = { { EXTR_MASK16, EXTR_MASK16, EXTR_MASK16, EXTR_MASK32 } };
|
||||
|
||||
void expand_bit_mask(int pos, uint32_t mask, uint32_t value, uint32_t valid, uint32_t idx, compile_func lut[],
|
||||
compile_func f) {
|
||||
|
@ -179,7 +180,7 @@ private:
|
|||
};
|
||||
|
||||
/* start generated code */
|
||||
const InstructionDesriptor instr_descr[99] = {
|
||||
const std::array<InstructionDesriptor, 99> instr_descr = {{
|
||||
/* entries are: valid value, valid mask, function ptr */
|
||||
/* instruction LUI */
|
||||
{32, 0b00000000000000000000000000110111, 0b00000000000000000000000001111111, &this_class::__lui},
|
||||
|
@ -379,7 +380,7 @@ private:
|
|||
{16, 0b1100000000000010, 0b1110000000000011, &this_class::__c_swsp},
|
||||
/* instruction DII */
|
||||
{16, 0b0000000000000000, 0b1111111111111111, &this_class::__dii},
|
||||
};
|
||||
}};
|
||||
//0: instruction LUI
|
||||
std::tuple<vm::continuation_e, llvm::BasicBlock*> __lui(virt_addr_t& pc, code_word_t instr, llvm::BasicBlock* bb){
|
||||
bb->setName("LUI");
|
||||
|
@ -399,6 +400,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -431,11 +434,13 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
Value* X_rd_val = this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(32U, fld_imm_val));
|
||||
this->builder.CreateStore(X_rd_val, get_reg_ptr(fld_rd_val), false);
|
||||
}
|
||||
|
@ -465,16 +470,18 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
Value* X_rd_val = this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(32U, 4));
|
||||
this->builder.CreateStore(X_rd_val, get_reg_ptr(fld_rd_val), false);
|
||||
}
|
||||
Value* PC_val = this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(32U, fld_imm_val));
|
||||
this->builder.CreateStore(PC_val, get_reg_ptr(traits<ARCH>::NEXT_PC), false);
|
||||
this->gen_sync(iss::POST_SYNC, 2);
|
||||
|
@ -502,11 +509,13 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
Value* X_rd_val = this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(32U, 4));
|
||||
this->builder.CreateStore(X_rd_val, get_reg_ptr(fld_rd_val), false);
|
||||
}
|
||||
|
@ -542,6 +551,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* PC_val = this->gen_choose(
|
||||
|
@ -550,10 +561,10 @@ private:
|
|||
this->gen_reg_load(fld_rs1_val, 0),
|
||||
this->gen_reg_load(fld_rs2_val, 0)),
|
||||
this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(32U, fld_imm_val)),
|
||||
this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(32U, 4)),
|
||||
32);
|
||||
this->builder.CreateStore(PC_val, get_reg_ptr(traits<ARCH>::NEXT_PC), false);
|
||||
|
@ -582,6 +593,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* PC_val = this->gen_choose(
|
||||
|
@ -590,10 +603,10 @@ private:
|
|||
this->gen_reg_load(fld_rs1_val, 0),
|
||||
this->gen_reg_load(fld_rs2_val, 0)),
|
||||
this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(32U, fld_imm_val)),
|
||||
this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(32U, 4)),
|
||||
32);
|
||||
this->builder.CreateStore(PC_val, get_reg_ptr(traits<ARCH>::NEXT_PC), false);
|
||||
|
@ -622,6 +635,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* PC_val = this->gen_choose(
|
||||
|
@ -634,10 +649,10 @@ private:
|
|||
this->gen_reg_load(fld_rs2_val, 0),
|
||||
32, true)),
|
||||
this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(32U, fld_imm_val)),
|
||||
this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(32U, 4)),
|
||||
32);
|
||||
this->builder.CreateStore(PC_val, get_reg_ptr(traits<ARCH>::NEXT_PC), false);
|
||||
|
@ -666,6 +681,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* PC_val = this->gen_choose(
|
||||
|
@ -678,10 +695,10 @@ private:
|
|||
this->gen_reg_load(fld_rs2_val, 0),
|
||||
32, true)),
|
||||
this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(32U, fld_imm_val)),
|
||||
this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(32U, 4)),
|
||||
32);
|
||||
this->builder.CreateStore(PC_val, get_reg_ptr(traits<ARCH>::NEXT_PC), false);
|
||||
|
@ -710,6 +727,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* PC_val = this->gen_choose(
|
||||
|
@ -718,10 +737,10 @@ private:
|
|||
this->gen_reg_load(fld_rs1_val, 0),
|
||||
this->gen_reg_load(fld_rs2_val, 0)),
|
||||
this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(32U, fld_imm_val)),
|
||||
this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(32U, 4)),
|
||||
32);
|
||||
this->builder.CreateStore(PC_val, get_reg_ptr(traits<ARCH>::NEXT_PC), false);
|
||||
|
@ -750,6 +769,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* PC_val = this->gen_choose(
|
||||
|
@ -758,10 +779,10 @@ private:
|
|||
this->gen_reg_load(fld_rs1_val, 0),
|
||||
this->gen_reg_load(fld_rs2_val, 0)),
|
||||
this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(32U, fld_imm_val)),
|
||||
this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(32U, 4)),
|
||||
32);
|
||||
this->builder.CreateStore(PC_val, get_reg_ptr(traits<ARCH>::NEXT_PC), false);
|
||||
|
@ -790,6 +811,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->builder.CreateAdd(
|
||||
|
@ -829,6 +852,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->builder.CreateAdd(
|
||||
|
@ -868,6 +893,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->builder.CreateAdd(
|
||||
|
@ -907,6 +934,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->builder.CreateAdd(
|
||||
|
@ -946,6 +975,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->builder.CreateAdd(
|
||||
|
@ -985,6 +1016,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->builder.CreateAdd(
|
||||
|
@ -1022,6 +1055,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->builder.CreateAdd(
|
||||
|
@ -1059,6 +1094,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->builder.CreateAdd(
|
||||
|
@ -1096,6 +1133,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -1131,6 +1170,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -1175,6 +1216,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
int32_t full_imm_val = fld_imm_val;
|
||||
|
@ -1220,6 +1263,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -1255,6 +1300,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -1290,6 +1337,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -1325,6 +1374,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_shamt_val > 31){
|
||||
|
@ -1364,6 +1415,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_shamt_val > 31){
|
||||
|
@ -1403,6 +1456,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_shamt_val > 31){
|
||||
|
@ -1442,6 +1497,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -1477,6 +1534,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -1512,6 +1571,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -1549,6 +1610,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -1593,6 +1656,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -1639,6 +1704,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -1674,6 +1741,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -1711,6 +1780,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -1748,6 +1819,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -1783,6 +1856,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -1817,6 +1892,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* FENCE_fence_val = this->builder.CreateOr(
|
||||
|
@ -1853,6 +1930,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* FENCE_fencei_val = this->gen_const(32U, fld_imm_val);
|
||||
|
@ -1882,6 +1961,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
this->gen_raise_trap(0, 11);
|
||||
|
@ -1906,6 +1987,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
this->gen_raise_trap(0, 3);
|
||||
|
@ -1930,6 +2013,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
this->gen_leave_trap(0);
|
||||
|
@ -1954,6 +2039,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
this->gen_leave_trap(1);
|
||||
|
@ -1978,6 +2065,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
this->gen_leave_trap(3);
|
||||
|
@ -2002,6 +2091,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
this->gen_wait(1);
|
||||
|
@ -2029,6 +2120,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* FENCE_fencevmal_val = this->gen_const(32U, fld_rs1_val);
|
||||
|
@ -2068,6 +2161,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* rs_val_val = this->gen_reg_load(fld_rs1_val, 0);
|
||||
|
@ -2114,6 +2209,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* xrd_val = this->gen_read_mem(traits<ARCH>::CSR, fld_csr_val, 32/8);
|
||||
|
@ -2158,6 +2255,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* xrd_val = this->gen_read_mem(traits<ARCH>::CSR, fld_csr_val, 32/8);
|
||||
|
@ -2202,6 +2301,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -2243,6 +2344,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* res_val = this->gen_read_mem(traits<ARCH>::CSR, fld_csr_val, 32/8);
|
||||
|
@ -2289,6 +2392,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* res_val = this->gen_read_mem(traits<ARCH>::CSR, fld_csr_val, 32/8);
|
||||
|
@ -2335,6 +2440,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -2380,6 +2487,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -2427,6 +2536,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -2474,6 +2585,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -2521,6 +2634,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -2584,6 +2699,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -2647,6 +2764,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -2710,6 +2829,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -2774,6 +2895,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -2821,6 +2944,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->gen_reg_load(fld_rs1_val, 0);
|
||||
|
@ -2885,6 +3010,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->gen_reg_load(fld_rs1_val, 0);
|
||||
|
@ -2929,6 +3056,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->gen_reg_load(fld_rs1_val, 0);
|
||||
|
@ -2977,6 +3106,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->gen_reg_load(fld_rs1_val, 0);
|
||||
|
@ -3025,6 +3156,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->gen_reg_load(fld_rs1_val, 0);
|
||||
|
@ -3073,6 +3206,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->gen_reg_load(fld_rs1_val, 0);
|
||||
|
@ -3121,6 +3256,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->gen_reg_load(fld_rs1_val, 0);
|
||||
|
@ -3178,6 +3315,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->gen_reg_load(fld_rs1_val, 0);
|
||||
|
@ -3235,6 +3374,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->gen_reg_load(fld_rs1_val, 0);
|
||||
|
@ -3288,6 +3429,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->gen_reg_load(fld_rs1_val, 0);
|
||||
|
@ -3342,6 +3485,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+2;
|
||||
|
||||
if(fld_imm_val == 0){
|
||||
|
@ -3380,6 +3525,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+2;
|
||||
|
||||
uint8_t rs1_idx_val = (fld_rs1_val + 8);
|
||||
|
@ -3416,6 +3563,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+2;
|
||||
|
||||
uint8_t rs1_idx_val = (fld_rs1_val + 8);
|
||||
|
@ -3454,6 +3603,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+2;
|
||||
|
||||
Value* X_rs1_val = this->builder.CreateAdd(
|
||||
|
@ -3483,6 +3634,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+2;
|
||||
|
||||
/* TODO: describe operations for C.NOP ! */
|
||||
|
@ -3511,15 +3664,17 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+2;
|
||||
|
||||
uint8_t rd_val = 1;
|
||||
Value* X_rd_val = this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(32U, 2));
|
||||
this->builder.CreateStore(X_rd_val, get_reg_ptr(rd_val), false);
|
||||
Value* PC_val = this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(32U, fld_imm_val));
|
||||
this->builder.CreateStore(PC_val, get_reg_ptr(traits<ARCH>::NEXT_PC), false);
|
||||
this->gen_sync(iss::POST_SYNC, 76);
|
||||
|
@ -3546,6 +3701,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+2;
|
||||
|
||||
if(fld_rd_val == 0){
|
||||
|
@ -3579,6 +3736,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+2;
|
||||
|
||||
if(fld_rd_val == 0){
|
||||
|
@ -3614,6 +3773,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+2;
|
||||
|
||||
uint8_t x2_idx_val = 2;
|
||||
|
@ -3649,6 +3810,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+2;
|
||||
|
||||
uint8_t rs1_idx_val = (fld_rs1_val + 8);
|
||||
|
@ -3682,6 +3845,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+2;
|
||||
|
||||
uint8_t rs1_idx_val = (fld_rs1_val + 8);
|
||||
|
@ -3715,6 +3880,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+2;
|
||||
|
||||
uint8_t rs1_idx_val = (fld_rs1_val + 8);
|
||||
|
@ -3748,6 +3915,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+2;
|
||||
|
||||
uint8_t rd_idx_val = (fld_rd_val + 8);
|
||||
|
@ -3782,6 +3951,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+2;
|
||||
|
||||
uint8_t rd_idx_val = (fld_rd_val + 8);
|
||||
|
@ -3816,6 +3987,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+2;
|
||||
|
||||
uint8_t rd_idx_val = (fld_rd_val + 8);
|
||||
|
@ -3850,6 +4023,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+2;
|
||||
|
||||
uint8_t rd_idx_val = (fld_rd_val + 8);
|
||||
|
@ -3883,10 +4058,12 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+2;
|
||||
|
||||
Value* PC_val = this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(32U, fld_imm_val));
|
||||
this->builder.CreateStore(PC_val, get_reg_ptr(traits<ARCH>::NEXT_PC), false);
|
||||
this->gen_sync(iss::POST_SYNC, 87);
|
||||
|
@ -3913,6 +4090,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+2;
|
||||
|
||||
uint8_t rs1_idx_val = (fld_rs1_val + 8);
|
||||
|
@ -3922,10 +4101,10 @@ private:
|
|||
this->gen_reg_load(rs1_idx_val, 0),
|
||||
this->gen_const(32U, 0)),
|
||||
this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(32U, fld_imm_val)),
|
||||
this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(32U, 2)),
|
||||
32);
|
||||
this->builder.CreateStore(PC_val, get_reg_ptr(traits<ARCH>::NEXT_PC), false);
|
||||
|
@ -3953,6 +4132,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+2;
|
||||
|
||||
uint8_t rs1_idx_val = (fld_rs1_val + 8);
|
||||
|
@ -3962,10 +4143,10 @@ private:
|
|||
this->gen_reg_load(rs1_idx_val, 0),
|
||||
this->gen_const(32U, 0)),
|
||||
this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(32U, fld_imm_val)),
|
||||
this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(32U, 2)),
|
||||
32);
|
||||
this->builder.CreateStore(PC_val, get_reg_ptr(traits<ARCH>::NEXT_PC), false);
|
||||
|
@ -3993,6 +4174,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+2;
|
||||
|
||||
if(fld_rs1_val == 0){
|
||||
|
@ -4028,6 +4211,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+2;
|
||||
|
||||
uint8_t x2_idx_val = 2;
|
||||
|
@ -4062,6 +4247,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+2;
|
||||
|
||||
Value* X_rd_val = this->gen_reg_load(fld_rs2_val, 0);
|
||||
|
@ -4091,6 +4278,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+2;
|
||||
|
||||
Value* PC_val = this->gen_reg_load(fld_rs1_val, 0);
|
||||
|
@ -4119,6 +4308,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+2;
|
||||
|
||||
Value* X_rd_val = this->builder.CreateAdd(
|
||||
|
@ -4150,11 +4341,13 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+2;
|
||||
|
||||
uint8_t r_idx_val = 1;
|
||||
Value* X_r_idx_val = this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(32U, 2));
|
||||
this->builder.CreateStore(X_r_idx_val, get_reg_ptr(r_idx_val), false);
|
||||
Value* PC_val = this->gen_reg_load(fld_rs1_val, 0);
|
||||
|
@ -4180,6 +4373,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+2;
|
||||
|
||||
this->gen_raise_trap(0, 3);
|
||||
|
@ -4207,6 +4402,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+2;
|
||||
|
||||
uint8_t x2_idx_val = 2;
|
||||
|
@ -4241,6 +4438,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(32, pc.val);
|
||||
pc=pc+2;
|
||||
|
||||
this->gen_raise_trap(0, 2);
|
||||
|
@ -4257,7 +4456,7 @@ private:
|
|||
****************************************************************************/
|
||||
std::tuple<vm::continuation_e, llvm::BasicBlock *> illegal_intruction(virt_addr_t &pc, code_word_t instr,
|
||||
llvm::BasicBlock *bb) {
|
||||
this->gen_sync(iss::PRE_SYNC, sizeof(instr_descr)/sizeof(InstructionDesriptor));
|
||||
this->gen_sync(iss::PRE_SYNC, instr_descr.size());
|
||||
this->builder.CreateStore(this->builder.CreateLoad(get_reg_ptr(traits<ARCH>::NEXT_PC), true),
|
||||
get_reg_ptr(traits<ARCH>::PC), true);
|
||||
this->builder.CreateStore(
|
||||
|
@ -4266,7 +4465,7 @@ private:
|
|||
get_reg_ptr(traits<ARCH>::ICOUNT), true);
|
||||
pc = pc + ((instr & 3) == 3 ? 4 : 2);
|
||||
this->gen_raise_trap(0, 2); // illegal instruction trap
|
||||
this->gen_sync(iss::POST_SYNC, sizeof(instr_descr)/sizeof(InstructionDesriptor));
|
||||
this->gen_sync(iss::POST_SYNC, instr_descr.size());
|
||||
this->gen_trap_check(this->leave_blk);
|
||||
return std::make_tuple(iss::vm::BRANCH, nullptr);
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include <boost/format.hpp>
|
||||
|
||||
#include <iss/debugger/riscv_target_adapter.h>
|
||||
#include <array>
|
||||
|
||||
namespace iss {
|
||||
namespace rv64ia {
|
||||
|
@ -121,14 +122,14 @@ protected:
|
|||
using compile_func = std::tuple<vm::continuation_e, llvm::BasicBlock *> (this_class::*)(virt_addr_t &pc,
|
||||
code_word_t instr,
|
||||
llvm::BasicBlock *bb);
|
||||
compile_func lut[LUT_SIZE];
|
||||
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;
|
||||
|
||||
compile_func *qlut[4]; // = {lut_00, lut_01, lut_10, lut_11};
|
||||
std::array<compile_func*, 4> qlut;
|
||||
|
||||
const uint32_t lutmasks[4] = {EXTR_MASK16, EXTR_MASK16, EXTR_MASK16, EXTR_MASK32};
|
||||
std::array<const uint32_t, 4> lutmasks = { { EXTR_MASK16, EXTR_MASK16, EXTR_MASK16, EXTR_MASK32 } };
|
||||
|
||||
void expand_bit_mask(int pos, uint32_t mask, uint32_t value, uint32_t valid, uint32_t idx, compile_func lut[],
|
||||
compile_func f) {
|
||||
|
@ -179,7 +180,7 @@ private:
|
|||
};
|
||||
|
||||
/* start generated code */
|
||||
const InstructionDesriptor instr_descr[86] = {
|
||||
const std::array<InstructionDesriptor, 86> instr_descr = {{
|
||||
/* entries are: valid value, valid mask, function ptr */
|
||||
/* instruction LWU */
|
||||
{32, 0b00000000000000000110000000000011, 0b00000000000000000111000001111111, &this_class::__lwu},
|
||||
|
@ -353,7 +354,7 @@ private:
|
|||
{32, 0b11000000000000000010000000101111, 0b11111000000000000111000001111111, &this_class::__amominu_w},
|
||||
/* instruction AMOMAXU.W */
|
||||
{32, 0b11100000000000000010000000101111, 0b11111000000000000111000001111111, &this_class::__amomaxu_w},
|
||||
};
|
||||
}};
|
||||
//0: instruction LWU
|
||||
std::tuple<vm::continuation_e, llvm::BasicBlock*> __lwu(virt_addr_t& pc, code_word_t instr, llvm::BasicBlock* bb){
|
||||
bb->setName("LWU");
|
||||
|
@ -374,6 +375,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->builder.CreateAdd(
|
||||
|
@ -413,6 +416,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->builder.CreateAdd(
|
||||
|
@ -452,6 +457,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->builder.CreateAdd(
|
||||
|
@ -489,6 +496,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_shamt_val > 31){
|
||||
|
@ -528,6 +537,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_shamt_val > 31){
|
||||
|
@ -567,6 +578,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_shamt_val > 31){
|
||||
|
@ -606,6 +619,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -648,6 +663,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -690,6 +707,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -732,6 +751,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -772,6 +793,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -815,6 +838,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -860,6 +885,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -909,6 +936,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -958,6 +987,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -1006,6 +1037,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -1038,11 +1071,13 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
Value* X_rd_val = this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(64U, fld_imm_val));
|
||||
this->builder.CreateStore(X_rd_val, get_reg_ptr(fld_rd_val), false);
|
||||
}
|
||||
|
@ -1072,16 +1107,18 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
Value* X_rd_val = this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(64U, 4));
|
||||
this->builder.CreateStore(X_rd_val, get_reg_ptr(fld_rd_val), false);
|
||||
}
|
||||
Value* PC_val = this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(64U, fld_imm_val));
|
||||
this->builder.CreateStore(PC_val, get_reg_ptr(traits<ARCH>::NEXT_PC), false);
|
||||
this->gen_sync(iss::POST_SYNC, 17);
|
||||
|
@ -1109,6 +1146,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* new_pc_val = this->builder.CreateAdd(
|
||||
|
@ -1136,7 +1175,7 @@ private:
|
|||
{
|
||||
if(fld_rd_val != 0){
|
||||
Value* X_rd_val = this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 1),
|
||||
cur_pc_val,
|
||||
this->gen_const(64U, 4));
|
||||
this->builder.CreateStore(X_rd_val, get_reg_ptr(fld_rd_val), false);
|
||||
}
|
||||
|
@ -1173,6 +1212,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* PC_val = this->gen_choose(
|
||||
|
@ -1181,10 +1222,10 @@ private:
|
|||
this->gen_reg_load(fld_rs1_val, 0),
|
||||
this->gen_reg_load(fld_rs2_val, 0)),
|
||||
this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(64U, fld_imm_val)),
|
||||
this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(64U, 4)),
|
||||
64);
|
||||
this->builder.CreateStore(PC_val, get_reg_ptr(traits<ARCH>::NEXT_PC), false);
|
||||
|
@ -1213,6 +1254,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* PC_val = this->gen_choose(
|
||||
|
@ -1221,10 +1264,10 @@ private:
|
|||
this->gen_reg_load(fld_rs1_val, 0),
|
||||
this->gen_reg_load(fld_rs2_val, 0)),
|
||||
this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(64U, fld_imm_val)),
|
||||
this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(64U, 4)),
|
||||
64);
|
||||
this->builder.CreateStore(PC_val, get_reg_ptr(traits<ARCH>::NEXT_PC), false);
|
||||
|
@ -1253,6 +1296,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* PC_val = this->gen_choose(
|
||||
|
@ -1265,10 +1310,10 @@ private:
|
|||
this->gen_reg_load(fld_rs2_val, 0),
|
||||
64, true)),
|
||||
this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(64U, fld_imm_val)),
|
||||
this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(64U, 4)),
|
||||
64);
|
||||
this->builder.CreateStore(PC_val, get_reg_ptr(traits<ARCH>::NEXT_PC), false);
|
||||
|
@ -1297,6 +1342,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* PC_val = this->gen_choose(
|
||||
|
@ -1309,10 +1356,10 @@ private:
|
|||
this->gen_reg_load(fld_rs2_val, 0),
|
||||
64, true)),
|
||||
this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(64U, fld_imm_val)),
|
||||
this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(64U, 4)),
|
||||
64);
|
||||
this->builder.CreateStore(PC_val, get_reg_ptr(traits<ARCH>::NEXT_PC), false);
|
||||
|
@ -1341,6 +1388,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* PC_val = this->gen_choose(
|
||||
|
@ -1349,10 +1398,10 @@ private:
|
|||
this->gen_reg_load(fld_rs1_val, 0),
|
||||
this->gen_reg_load(fld_rs2_val, 0)),
|
||||
this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(64U, fld_imm_val)),
|
||||
this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(64U, 4)),
|
||||
64);
|
||||
this->builder.CreateStore(PC_val, get_reg_ptr(traits<ARCH>::NEXT_PC), false);
|
||||
|
@ -1381,6 +1430,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* PC_val = this->gen_choose(
|
||||
|
@ -1389,10 +1440,10 @@ private:
|
|||
this->gen_reg_load(fld_rs1_val, 0),
|
||||
this->gen_reg_load(fld_rs2_val, 0)),
|
||||
this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(64U, fld_imm_val)),
|
||||
this->builder.CreateAdd(
|
||||
this->gen_reg_load(traits<ARCH>::PC, 0),
|
||||
cur_pc_val,
|
||||
this->gen_const(64U, 4)),
|
||||
64);
|
||||
this->builder.CreateStore(PC_val, get_reg_ptr(traits<ARCH>::NEXT_PC), false);
|
||||
|
@ -1421,6 +1472,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->builder.CreateAdd(
|
||||
|
@ -1460,6 +1513,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->builder.CreateAdd(
|
||||
|
@ -1499,6 +1554,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->builder.CreateAdd(
|
||||
|
@ -1538,6 +1595,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->builder.CreateAdd(
|
||||
|
@ -1577,6 +1636,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->builder.CreateAdd(
|
||||
|
@ -1616,6 +1677,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->builder.CreateAdd(
|
||||
|
@ -1653,6 +1716,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->builder.CreateAdd(
|
||||
|
@ -1690,6 +1755,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->builder.CreateAdd(
|
||||
|
@ -1727,6 +1794,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -1762,6 +1831,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -1806,6 +1877,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
int64_t full_imm_val = fld_imm_val;
|
||||
|
@ -1851,6 +1924,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -1886,6 +1961,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -1921,6 +1998,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -1956,6 +2035,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -1991,6 +2072,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -2026,6 +2109,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -2063,6 +2148,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -2107,6 +2194,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -2153,6 +2242,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -2188,6 +2279,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -2225,6 +2318,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -2262,6 +2357,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -2297,6 +2394,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -2331,6 +2430,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* FENCE_fence_val = this->builder.CreateOr(
|
||||
|
@ -2367,6 +2468,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* FENCE_fencei_val = this->gen_const(64U, fld_imm_val);
|
||||
|
@ -2396,6 +2499,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
this->gen_raise_trap(0, 11);
|
||||
|
@ -2420,6 +2525,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
this->gen_raise_trap(0, 3);
|
||||
|
@ -2444,6 +2551,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
this->gen_leave_trap(0);
|
||||
|
@ -2468,6 +2577,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
this->gen_leave_trap(1);
|
||||
|
@ -2492,6 +2603,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
this->gen_leave_trap(3);
|
||||
|
@ -2516,6 +2629,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
this->gen_wait(1);
|
||||
|
@ -2543,6 +2658,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* FENCE_fencevmal_val = this->gen_const(64U, fld_rs1_val);
|
||||
|
@ -2582,6 +2699,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* rs_val_val = this->gen_reg_load(fld_rs1_val, 0);
|
||||
|
@ -2628,6 +2747,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* xrd_val = this->gen_read_mem(traits<ARCH>::CSR, fld_csr_val, 64/8);
|
||||
|
@ -2672,6 +2793,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* xrd_val = this->gen_read_mem(traits<ARCH>::CSR, fld_csr_val, 64/8);
|
||||
|
@ -2716,6 +2839,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -2757,6 +2882,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* res_val = this->gen_read_mem(traits<ARCH>::CSR, fld_csr_val, 64/8);
|
||||
|
@ -2803,6 +2930,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* res_val = this->gen_read_mem(traits<ARCH>::CSR, fld_csr_val, 64/8);
|
||||
|
@ -2850,6 +2979,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -2897,6 +3028,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->gen_reg_load(fld_rs1_val, 0);
|
||||
|
@ -2962,6 +3095,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->gen_reg_load(fld_rs1_val, 0);
|
||||
|
@ -3006,6 +3141,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->gen_reg_load(fld_rs1_val, 0);
|
||||
|
@ -3054,6 +3191,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->gen_reg_load(fld_rs1_val, 0);
|
||||
|
@ -3102,6 +3241,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->gen_reg_load(fld_rs1_val, 0);
|
||||
|
@ -3150,6 +3291,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->gen_reg_load(fld_rs1_val, 0);
|
||||
|
@ -3198,6 +3341,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->gen_reg_load(fld_rs1_val, 0);
|
||||
|
@ -3255,6 +3400,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->gen_reg_load(fld_rs1_val, 0);
|
||||
|
@ -3312,6 +3459,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->gen_reg_load(fld_rs1_val, 0);
|
||||
|
@ -3365,6 +3514,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->gen_reg_load(fld_rs1_val, 0);
|
||||
|
@ -3417,6 +3568,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
if(fld_rd_val != 0){
|
||||
|
@ -3464,6 +3617,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->gen_reg_load(fld_rs1_val, 0);
|
||||
|
@ -3528,6 +3683,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->gen_reg_load(fld_rs1_val, 0);
|
||||
|
@ -3572,6 +3729,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->gen_reg_load(fld_rs1_val, 0);
|
||||
|
@ -3620,6 +3779,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->gen_reg_load(fld_rs1_val, 0);
|
||||
|
@ -3668,6 +3829,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->gen_reg_load(fld_rs1_val, 0);
|
||||
|
@ -3716,6 +3879,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->gen_reg_load(fld_rs1_val, 0);
|
||||
|
@ -3764,6 +3929,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->gen_reg_load(fld_rs1_val, 0);
|
||||
|
@ -3821,6 +3988,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->gen_reg_load(fld_rs1_val, 0);
|
||||
|
@ -3878,6 +4047,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->gen_reg_load(fld_rs1_val, 0);
|
||||
|
@ -3931,6 +4102,8 @@ private:
|
|||
};
|
||||
this->builder.CreateCall(this->mod->getFunction("print_disass"), args);
|
||||
}
|
||||
|
||||
Value* cur_pc_val = this->gen_const(64, pc.val);
|
||||
pc=pc+4;
|
||||
|
||||
Value* offs_val = this->gen_reg_load(fld_rs1_val, 0);
|
||||
|
@ -3972,7 +4145,7 @@ private:
|
|||
****************************************************************************/
|
||||
std::tuple<vm::continuation_e, llvm::BasicBlock *> illegal_intruction(virt_addr_t &pc, code_word_t instr,
|
||||
llvm::BasicBlock *bb) {
|
||||
this->gen_sync(iss::PRE_SYNC, sizeof(instr_descr)/sizeof(InstructionDesriptor));
|
||||
this->gen_sync(iss::PRE_SYNC, instr_descr.size());
|
||||
this->builder.CreateStore(this->builder.CreateLoad(get_reg_ptr(traits<ARCH>::NEXT_PC), true),
|
||||
get_reg_ptr(traits<ARCH>::PC), true);
|
||||
this->builder.CreateStore(
|
||||
|
@ -3981,7 +4154,7 @@ private:
|
|||
get_reg_ptr(traits<ARCH>::ICOUNT), true);
|
||||
pc = pc + ((instr & 3) == 3 ? 4 : 2);
|
||||
this->gen_raise_trap(0, 2); // illegal instruction trap
|
||||
this->gen_sync(iss::POST_SYNC, sizeof(instr_descr)/sizeof(InstructionDesriptor));
|
||||
this->gen_sync(iss::POST_SYNC, instr_descr.size());
|
||||
this->gen_trap_check(this->leave_blk);
|
||||
return std::make_tuple(iss::vm::BRANCH, nullptr);
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 0122e4d3123eff995aa90a08b8fda3e5b94827d9
|
||||
Subproject commit 92802d543014324ad599723ae32d0a84c5162ca8
|
Loading…
Reference in New Issue