diff --git a/CMakeLists.txt b/CMakeLists.txt index 7577443..e0fd2c9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,15 +28,15 @@ endif() add_subdirectory(softfloat) # library files -FILE(GLOB TGC_SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/src/iss/*.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/vm/interp/vm_*.cpp -) +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) + set(LIB_SOURCES src/vm/fp_functions.cpp src/plugin/instruction_count.cpp src/plugin/cycle_estimate.cpp ${TGC_SOURCES} + ${TGC_VM_SOURCES} ) if(WITH_LLVM) @@ -105,8 +105,12 @@ project(tgc-sim) find_package(Boost COMPONENTS program_options thread REQUIRED) add_executable(${PROJECT_NAME} src/main.cpp) -# This sets the include directory for the reference project. This is the -I flag in gcc. -target_compile_definitions(${PROJECT_NAME} PRIVATE CORE_${CORE_NAME}) +foreach(F IN LISTS TGC_SOURCES) + string(REGEX REPLACE ".*/([^/]*)\.cpp" "\\1" CORE_NAME_LC ${F}) + string(TOUPPER ${CORE_NAME_LC} CORE_NAME) + target_compile_definitions(${PROJECT_NAME} PRIVATE CORE_${CORE_NAME}) +endforeach() + if(WITH_LLVM) target_compile_definitions(${PROJECT_NAME} PRIVATE WITH_LLVM) target_link_libraries(${PROJECT_NAME} PUBLIC ${llvm_libs}) diff --git a/src/main.cpp b/src/main.cpp index 358d4a1..ee978e3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -54,6 +54,16 @@ using tgc_d_plat_type = iss::arch::riscv_hart_mu_p; #endif +#ifdef CORE_TGC_D_XRB_NN +#include "iss/arch/riscv_hart_mu_p.h" +#include "iss/arch/tgc_d_xrb_nn.h" +using tgc_d_xrb_nn_plat_type = iss::arch::riscv_hart_mu_p; +#endif +#ifdef CORE_TGC_E +#include "iss/arch/riscv_hart_mu_p.h" +#include "iss/arch/tgc_e.h" +using tgc_e_plat_type = iss::arch::riscv_hart_mu_p; +#endif #ifdef WITH_LLVM #include #endif @@ -153,9 +163,21 @@ int main(int argc, char *argv[]) { std::tie(cpu, vm) = iss::create_cpu(clim["backend"].as(), clim["gdb-port"].as()); } else +#endif +#ifdef CORE_TGC_D_XRB_NN + if (isa_opt == "tgc_d_xrb_nn") { + std::tie(cpu, vm) = + iss::create_cpu(clim["backend"].as(), clim["gdb-port"].as()); + } else +#endif +#ifdef CORE_TGC_E + if (isa_opt == "tgc_e") { + std::tie(cpu, vm) = + iss::create_cpu(clim["backend"].as(), clim["gdb-port"].as()); + } else #endif { - LOG(ERR) << "Illegal argument value for '--isa': " << clim["isa"].as() << std::endl; + LOG(ERR) << "Illegal argument value for '--isa': " << isa_opt << std::endl; return 127; } if (clim.count("plugin")) {