Compare commits
5 Commits
766f3ba9ee
...
0703a0a845
Author | SHA1 | Date | |
---|---|---|---|
0703a0a845 | |||
0c542d42aa | |||
966d1616c5 | |||
df16378605 | |||
1438f0f373 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -30,6 +30,5 @@ language.settings.xml
|
||||
/.gdbinit
|
||||
/*.out
|
||||
/dump.json
|
||||
/src-gen/
|
||||
/*.yaml
|
||||
/*.json
|
||||
|
@ -29,32 +29,35 @@ endif()
|
||||
add_subdirectory(softfloat)
|
||||
|
||||
# library files
|
||||
FILE(GLOB TGC_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/iss/*.cpp)
|
||||
FILE(GLOB TGC_VM_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/vm/interp/vm_*.cpp)
|
||||
FILE(GLOB GEN_SOURCES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src-gen/iss/arch/*.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src-gen/vm/interp/vm_*.cpp
|
||||
)
|
||||
|
||||
set(LIB_SOURCES
|
||||
src/vm/fp_functions.cpp
|
||||
src/plugin/instruction_count.cpp
|
||||
|
||||
${TGC_SOURCES}
|
||||
${TGC_VM_SOURCES}
|
||||
src/iss/plugin/instruction_count.cpp
|
||||
src/iss/arch/tgc_c.cpp
|
||||
src/vm/interp/vm_tgc_c.cpp
|
||||
src/vm/fp_functions.cpp
|
||||
${GEN_SOURCES}
|
||||
)
|
||||
if(TARGET RapidJSON)
|
||||
list(APPEND LIB_SOURCES src/plugin/cycle_estimate.cpp src/plugin/pctrace.cpp)
|
||||
list(APPEND LIB_SOURCES src/iss/plugin/cycle_estimate.cpp src/iss/plugin/pctrace.cpp)
|
||||
endif()
|
||||
|
||||
if(WITH_LLVM)
|
||||
FILE(GLOB TGC_LLVM_SOURCES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/vm/llvm/vm_*.cpp
|
||||
FILE(GLOB LLVM_GEN_SOURCES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src-gen/vm/llvm/vm_*.cpp
|
||||
)
|
||||
list(APPEND LIB_SOURCES ${TGC_LLVM_SOURCES})
|
||||
list(APPEND LIB_SOURCES ${LLVM_GEN_SOURCES})
|
||||
endif()
|
||||
|
||||
if(WITH_TCC)
|
||||
FILE(GLOB TGC_TCC_SOURCES
|
||||
FILE(GLOB TCC_GEN_SOURCES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/vm/tcc/vm_*.cpp
|
||||
)
|
||||
list(APPEND LIB_SOURCES ${TGC_TCC_SOURCES})
|
||||
list(APPEND LIB_SOURCES ${TCC_GEN_SOURCES})
|
||||
endif()
|
||||
|
||||
# Define the library
|
||||
@ -69,7 +72,8 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE /wd4293)
|
||||
endif()
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC incl)
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC src)
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC src-gen)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC softfloat scc-util jsoncpp Boost::coroutine)
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC -Wl,--whole-archive dbt-rise-core -Wl,--no-whole-archive)
|
||||
|
@ -37,9 +37,9 @@ def getRegisterSizes(){
|
||||
return regs
|
||||
}
|
||||
%>
|
||||
#include "${coreDef.name.toLowerCase()}.h"
|
||||
#include "util/ities.h"
|
||||
#include <util/logging.h>
|
||||
#include <iss/arch/${coreDef.name.toLowerCase()}.h>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
|
@ -36,7 +36,7 @@ def nativeTypeSize(int size){
|
||||
if(size<=8) return 8; else if(size<=16) return 16; else if(size<=32) return 32; else return 64;
|
||||
}
|
||||
%>
|
||||
#include "../fp_functions.h"
|
||||
#include <vm/fp_functions.h>
|
||||
#include <iss/arch/${coreDef.name.toLowerCase()}.h>
|
||||
#include <iss/arch/riscv_hart_m_p.h>
|
||||
#include <iss/debugger/gdb_session.h>
|
||||
@ -314,11 +314,9 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
|
||||
<%}}%>// calculate next pc value
|
||||
*NEXT_PC = *PC + ${instr.length/8};
|
||||
// execute instruction
|
||||
try {
|
||||
<%instr.behavior.eachLine{%>${it}
|
||||
<%}%>} catch(...){}
|
||||
}
|
||||
break;<%}%>
|
||||
<%}%>TRAP_${instr.name}:break;
|
||||
}// @suppress("No break at end of case")<%}%>
|
||||
default: {
|
||||
*NEXT_PC = *PC + ((instr & 3) == 3 ? 4 : 2);
|
||||
raise(0, 2);
|
||||
|
1
incl/iss/arch/.gitignore
vendored
1
incl/iss/arch/.gitignore
vendored
@ -1 +0,0 @@
|
||||
/tgc_*.h
|
2
src-gen/.gitignore
vendored
Normal file
2
src-gen/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/iss
|
||||
/vm
|
@ -30,9 +30,9 @@
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
#include "tgc_c.h"
|
||||
#include "util/ities.h"
|
||||
#include <util/logging.h>
|
||||
#include <iss/arch/tgc_c.h>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
@ -4,39 +4,44 @@
|
||||
#include "riscv_hart_m_p.h"
|
||||
#include "tgc_c.h"
|
||||
using tgc_c_plat_type = iss::arch::riscv_hart_m_p<iss::arch::tgc_c>;
|
||||
#ifdef CORE_TGC_A
|
||||
#include "riscv_hart_m_p.h"
|
||||
#include <iss/arch/tgc_a.h>
|
||||
using tgc_a_plat_type = iss::arch::riscv_hart_m_p<iss::arch::tgc_a>;
|
||||
#endif
|
||||
#ifdef CORE_TGC_B
|
||||
#include "riscv_hart_m_p.h"
|
||||
#include "tgc_b.h"
|
||||
#include <iss/arch/tgc_b.h>
|
||||
using tgc_b_plat_type = iss::arch::riscv_hart_m_p<iss::arch::tgc_b>;
|
||||
#endif
|
||||
#ifdef CORE_TGC_C_XRB_NN
|
||||
#include "riscv_hart_m_p.h"
|
||||
#include "tgc_c_xrb_nn.h"
|
||||
#include <iss/arch/tgc_c_xrb_nn.h>
|
||||
using tgc_c_xrb_nn_plat_type = iss::arch::riscv_hart_m_p<iss::arch::tgc_c_xrb_nn>;
|
||||
#endif
|
||||
#ifdef CORE_TGC_D
|
||||
#include "riscv_hart_mu_p.h"
|
||||
#include "tgc_d.h"
|
||||
#include <iss/arch/tgc_d.h>
|
||||
using tgc_d_plat_type = iss::arch::riscv_hart_mu_p<iss::arch::tgc_d, (iss::arch::features_e)(iss::arch::FEAT_PMP | iss::arch::FEAT_CLIC | iss::arch::FEAT_EXT_N)>;
|
||||
#endif
|
||||
#ifdef CORE_TGC_D_XRB_MAC
|
||||
#include "riscv_hart_mu_p.h"
|
||||
#include "tgc_d_xrb_mac.h"
|
||||
#include <iss/arch/tgc_d_xrb_mac.h>
|
||||
using tgc_d_xrb_mac_plat_type = iss::arch::riscv_hart_mu_p<iss::arch::tgc_d_xrb_mac, (iss::arch::features_e)(iss::arch::FEAT_PMP | iss::arch::FEAT_CLIC | iss::arch::FEAT_EXT_N)>;
|
||||
#endif
|
||||
#ifdef CORE_TGC_D_XRB_NN
|
||||
#include "riscv_hart_mu_p.h"
|
||||
#include "tgc_d_xrb_nn.h"
|
||||
#include <iss/arch/tgc_d_xrb_nn.h>
|
||||
using tgc_d_xrb_nn_plat_type = iss::arch::riscv_hart_mu_p<iss::arch::tgc_d_xrb_nn, (iss::arch::features_e)(iss::arch::FEAT_PMP | iss::arch::FEAT_CLIC | iss::arch::FEAT_EXT_N)>;
|
||||
#endif
|
||||
#ifdef CORE_TGC_E
|
||||
#include "riscv_hart_mu_p.h"
|
||||
#include "tgc_e.h"
|
||||
#include <iss/arch/tgc_e.h>
|
||||
using tgc_e_plat_type = iss::arch::riscv_hart_mu_p<iss::arch::tgc_e, (iss::arch::features_e)(iss::arch::FEAT_PMP | iss::arch::FEAT_CLIC | iss::arch::FEAT_EXT_N)>;
|
||||
#endif
|
||||
#ifdef CORE_TGC_X
|
||||
#include "riscv_hart_mu_p.h"
|
||||
#include "tgc_x.h"
|
||||
#include <iss/arch/tgc_x.h>
|
||||
using tgc_x_plat_type = iss::arch::riscv_hart_mu_p<iss::arch::tgc_x, (iss::arch::features_e)(iss::arch::FEAT_PMP | iss::arch::FEAT_CLIC | iss::arch::FEAT_EXT_N | iss::arch::FEAT_TCM)>;
|
||||
#endif
|
||||
|
@ -32,14 +32,14 @@
|
||||
* eyck@minres.com - initial API and implementation
|
||||
******************************************************************************/
|
||||
|
||||
#include "iss/plugin/cycle_estimate.h"
|
||||
#include "cycle_estimate.h"
|
||||
|
||||
#include <iss/arch_if.h>
|
||||
#include <util/logging.h>
|
||||
#include <rapidjson/document.h>
|
||||
#include <rapidjson/istreamwrapper.h>
|
||||
#include "rapidjson/writer.h"
|
||||
#include "rapidjson/stringbuffer.h"
|
||||
#include <rapidjson/writer.h>
|
||||
#include <rapidjson/stringbuffer.h>
|
||||
#include <rapidjson/ostreamwrapper.h>
|
||||
#include <rapidjson/error/en.h>
|
||||
#include <fstream>
|
||||
@ -48,7 +48,7 @@ using namespace rapidjson;
|
||||
using namespace std;
|
||||
|
||||
iss::plugin::cycle_estimate::cycle_estimate(string const& config_file_name)
|
||||
: arch_instr(nullptr)
|
||||
: instr_if(nullptr)
|
||||
, config_file_name(config_file_name)
|
||||
{
|
||||
}
|
||||
@ -57,9 +57,9 @@ iss::plugin::cycle_estimate::~cycle_estimate() {
|
||||
}
|
||||
|
||||
bool iss::plugin::cycle_estimate::registration(const char* const version, vm_if& vm) {
|
||||
arch_instr = vm.get_arch()->get_instrumentation_if();
|
||||
if(!arch_instr) return false;
|
||||
const string core_name = arch_instr->core_type_name();
|
||||
instr_if = vm.get_arch()->get_instrumentation_if();
|
||||
if(!instr_if) return false;
|
||||
const string core_name = instr_if->core_type_name();
|
||||
if (config_file_name.length() > 0) {
|
||||
ifstream is(config_file_name);
|
||||
if (is.is_open()) {
|
||||
@ -108,11 +108,11 @@ bool iss::plugin::cycle_estimate::registration(const char* const version, vm_if&
|
||||
}
|
||||
|
||||
void iss::plugin::cycle_estimate::callback(instr_info_t instr_info, exec_info const& exc_info) {
|
||||
assert(arch_instr && "No instrumentation interface available but callback executed");
|
||||
assert(instr_if && "No instrumentation interface available but callback executed");
|
||||
auto entry = delays[instr_info.instr_id];
|
||||
bool taken = exc_info.branch_taken;
|
||||
if (exc_info.branch_taken && (entry.taken > 1))
|
||||
arch_instr->set_curr_instr_cycles(entry.taken);
|
||||
instr_if->set_curr_instr_cycles(entry.taken);
|
||||
else if (entry.not_taken > 1)
|
||||
arch_instr->set_curr_instr_cycles(entry.not_taken);
|
||||
instr_if->set_curr_instr_cycles(entry.not_taken);
|
||||
}
|
@ -81,7 +81,7 @@ public:
|
||||
void callback(instr_info_t instr_info, exec_info const&) override;
|
||||
|
||||
private:
|
||||
iss::instrumentation_if *arch_instr;
|
||||
iss::instrumentation_if *instr_if;
|
||||
std::vector<instr_desc> delays;
|
||||
struct pair_hash {
|
||||
size_t operator()(const std::pair<uint64_t, uint64_t> &p) const {
|
@ -32,8 +32,8 @@
|
||||
* eyck@minres.com - initial API and implementation
|
||||
******************************************************************************/
|
||||
|
||||
#include "iss/plugin/instruction_count.h"
|
||||
#include "iss/instrumentation_if.h"
|
||||
#include "instruction_count.h"
|
||||
#include <iss/instrumentation_if.h>
|
||||
|
||||
#include <iss/arch_if.h>
|
||||
#include <util/logging.h>
|
@ -1,11 +1,11 @@
|
||||
#include <iss/arch_if.h>
|
||||
#include <iss/plugin/pctrace.h>
|
||||
#include "pctrace.h"
|
||||
#include <util/logging.h>
|
||||
#include <util/ities.h>
|
||||
#include <rapidjson/document.h>
|
||||
#include <rapidjson/istreamwrapper.h>
|
||||
#include "rapidjson/writer.h"
|
||||
#include "rapidjson/stringbuffer.h"
|
||||
#include <rapidjson/writer.h>
|
||||
#include <rapidjson/stringbuffer.h>
|
||||
#include <rapidjson/ostreamwrapper.h>
|
||||
#include <rapidjson/error/en.h>
|
||||
#include <fstream>
|
||||
@ -159,10 +159,15 @@ void cov::callback(instr_info_t iinfo, const exec_info& einfo) {
|
||||
auto instr = instr_if->get_instr_word();
|
||||
auto call = (id==2 || id==3) && bit_sub<7,5>(instr)!=0;
|
||||
bool taken = einfo.branch_taken;
|
||||
if (einfo.branch_taken)
|
||||
if (einfo.branch_taken) {
|
||||
delay = entry.taken;
|
||||
else
|
||||
if(entry.taken > 1)
|
||||
instr_if->set_curr_instr_cycles(entry.taken);
|
||||
} else {
|
||||
delay = entry.not_taken;
|
||||
if (entry.not_taken > 1)
|
||||
instr_if->set_curr_instr_cycles(entry.not_taken);
|
||||
}
|
||||
#ifndef WITH_LZ4
|
||||
output<<std::hex <<"0x" << instr_if->get_pc() <<"," << delay <<"," << call<< "\n";
|
||||
#else
|
@ -35,14 +35,14 @@
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/program_options.hpp>
|
||||
#include <iss/arch/tgc_mapper.h>
|
||||
#include "iss/arch/tgc_mapper.h"
|
||||
#ifdef WITH_LLVM
|
||||
#include <iss/llvm/jit_helper.h>
|
||||
#endif
|
||||
#include <iss/log_categories.h>
|
||||
#include <iss/plugin/cycle_estimate.h>
|
||||
#include <iss/plugin/instruction_count.h>
|
||||
#include <iss/plugin/pctrace.h>
|
||||
#include "iss/plugin/cycle_estimate.h"
|
||||
#include "iss/plugin/instruction_count.h"
|
||||
#include "iss/plugin/pctrace.h"
|
||||
#include <iss/plugin/loader.h>
|
||||
#if defined(HAS_LUA)
|
||||
#include <iss/plugin/lua.h>
|
||||
|
@ -38,7 +38,7 @@
|
||||
#include <iss/iss.h>
|
||||
#include <iss/vm_types.h>
|
||||
#include <iss/plugin/loader.h>
|
||||
#include <sysc/core_complex.h>
|
||||
#include "core_complex.h"
|
||||
#include <iss/arch/tgc_mapper.h>
|
||||
#include <scc/report.h>
|
||||
#include <util/ities.h>
|
||||
|
1
src/vm/interp/.gitignore
vendored
1
src/vm/interp/.gitignore
vendored
@ -1 +0,0 @@
|
||||
/vm_tgc_*.cpp
|
File diff suppressed because it is too large
Load Diff
@ -30,7 +30,7 @@
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
#include <iss/arch/tgf_c.h>
|
||||
#include <iss/arch/tgc_c.h>
|
||||
#include <iss/arch/riscv_hart_m_p.h>
|
||||
#include <iss/debugger/gdb_session.h>
|
||||
#include <iss/debugger/server.h>
|
||||
@ -52,7 +52,7 @@ namespace fp_impl {
|
||||
void add_fp_functions_2_module(::llvm::Module *, unsigned, unsigned);
|
||||
}
|
||||
|
||||
namespace tgf_c {
|
||||
namespace tgc_c {
|
||||
using namespace ::llvm;
|
||||
using namespace iss::arch;
|
||||
using namespace iss::debugger;
|
||||
@ -4151,11 +4151,11 @@ template <typename ARCH> inline void vm_impl<ARCH>::gen_trap_check(BasicBlock *b
|
||||
bb, this->trap_blk, 1);
|
||||
}
|
||||
|
||||
} // namespace tgf_c
|
||||
} // namespace tgc_c
|
||||
|
||||
template <>
|
||||
std::unique_ptr<vm_if> create<arch::tgf_c>(arch::tgf_c *core, unsigned short port, bool dump) {
|
||||
auto ret = new tgf_c::vm_impl<arch::tgf_c>(*core, dump);
|
||||
std::unique_ptr<vm_if> create<arch::tgc_c>(arch::tgc_c *core, unsigned short port, bool dump) {
|
||||
auto ret = new tgc_c::vm_impl<arch::tgc_c>(*core, dump);
|
||||
if (port != 0) debugger::server<debugger::gdb_session>::run_server(ret, port);
|
||||
return std::unique_ptr<vm_if>(ret);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -30,7 +30,7 @@
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
#include <iss/arch/tgf_c.h>
|
||||
#include <iss/arch/tgc_c.h>
|
||||
#include <iss/arch/riscv_hart_m_p.h>
|
||||
#include <iss/debugger/gdb_session.h>
|
||||
#include <iss/debugger/server.h>
|
||||
@ -49,7 +49,7 @@
|
||||
|
||||
namespace iss {
|
||||
namespace tcc {
|
||||
namespace tgf_c {
|
||||
namespace tgc_c {
|
||||
using namespace iss::arch;
|
||||
using namespace iss::debugger;
|
||||
|
||||
@ -3251,8 +3251,8 @@ template <typename ARCH> void vm_impl<ARCH>::gen_trap_behavior(tu_builder& tu) {
|
||||
} // namespace mnrv32
|
||||
|
||||
template <>
|
||||
std::unique_ptr<vm_if> create<arch::tgf_c>(arch::tgf_c *core, unsigned short port, bool dump) {
|
||||
auto ret = new tgf_c::vm_impl<arch::tgf_c>(*core, dump);
|
||||
std::unique_ptr<vm_if> create<arch::tgc_c>(arch::tgc_c *core, unsigned short port, bool dump) {
|
||||
auto ret = new tgc_c::vm_impl<arch::tgc_c>(*core, dump);
|
||||
if (port != 0) debugger::server<debugger::gdb_session>::run_server(ret, port);
|
||||
return std::unique_ptr<vm_if>(ret);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user