From 7001b693ae6cdd14671df5d42bde13b4cfb48028 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Fri, 27 Oct 2023 22:14:11 +0200 Subject: [PATCH] updates templates for SystemC registration --- gen_input/templates/CORENAME_sysc.cpp.gtl | 46 +++++++++++++++++------ src/sysc/core_complex.cpp | 2 +- 2 files changed, 35 insertions(+), 13 deletions(-) diff --git a/gen_input/templates/CORENAME_sysc.cpp.gtl b/gen_input/templates/CORENAME_sysc.cpp.gtl index dc0d730..238016e 100644 --- a/gen_input/templates/CORENAME_sysc.cpp.gtl +++ b/gen_input/templates/CORENAME_sysc.cpp.gtl @@ -30,18 +30,20 @@ * *******************************************************************************/ -#include "iss_factory.h" +#include #include #include #include -#include "sc_core_adapter.h" -#include "core_complex.h" +#include +#include #include - +<% +def array_count = coreDef.name.toLowerCase()=="tgc5d" || coreDef.name.toLowerCase()=="tgc5e"? 3 : 2; +%> namespace iss { namespace interp { using namespace sysc; -volatile std::array ${coreDef.name.toLowerCase()}_init = { +volatile std::array ${coreDef.name.toLowerCase()}_init = { iss_factory::instance().register_creator("${coreDef.name.toLowerCase()}|m_p|interp", [](unsigned gdb_port, void* data) -> iss_factory::base_t { auto* cc = reinterpret_cast(data); auto* cpu = new sc_core_adapter>(cc); @@ -51,13 +53,18 @@ volatile std::array ${coreDef.name.toLowerCase()}_init = { auto* cc = reinterpret_cast(data); auto* cpu = new sc_core_adapter>(cc); return {sysc::sc_cpu_ptr{cpu}, vm_ptr{create(static_cast(cpu), gdb_port)}}; - }) + })<%if(coreDef.name.toLowerCase()=="tgc5d" || coreDef.name.toLowerCase()=="tgc5e") {%>, + iss_factory::instance().register_creator("${coreDef.name.toLowerCase()}|mu_p_clic_pmp|interp", [](unsigned gdb_port, void* data) -> iss_factory::base_t { + auto* cc = reinterpret_cast(data); + auto* cpu = new sc_core_adapter>(cc); + return {sysc::sc_cpu_ptr{cpu}, vm_ptr{create(static_cast(cpu), gdb_port)}}; + })<%}%> }; } #if defined(WITH_LLVM) namespace llvm { using namespace sysc; -volatile std::array ${coreDef.name.toLowerCase()}_init = { +volatile std::array ${coreDef.name.toLowerCase()}_init = { iss_factory::instance().register_creator("${coreDef.name.toLowerCase()}|m_p|llvm", [](unsigned gdb_port, void* data) -> iss_factory::base_t { auto* cc = reinterpret_cast(data); auto* cpu = new sc_core_adapter>(cc); @@ -67,14 +74,19 @@ volatile std::array ${coreDef.name.toLowerCase()}_init = { auto* cc = reinterpret_cast(data); auto* cpu = new sc_core_adapter>(cc); return {sysc::sc_cpu_ptr{cpu}, vm_ptr{create(static_cast(cpu), gdb_port)}}; - }) + })<%if(coreDef.name.toLowerCase()=="tgc5d" || coreDef.name.toLowerCase()=="tgc5e") {%>, + iss_factory::instance().register_creator("${coreDef.name.toLowerCase()}|mu_p_clic_pmp|llvm", [](unsigned gdb_port, void* data) -> iss_factory::base_t { + auto* cc = reinterpret_cast(data); + auto* cpu = new sc_core_adapter>(cc); + return {sysc::sc_cpu_ptr{cpu}, vm_ptr{create(static_cast(cpu), gdb_port)}}; + })<%}%> }; } #endif #if defined(WITH_TCC) namespace tcc { using namespace sysc; -volatile std::array ${coreDef.name.toLowerCase()}_init = { +volatile std::array ${coreDef.name.toLowerCase()}_init = { iss_factory::instance().register_creator("${coreDef.name.toLowerCase()}|m_p|tcc", [](unsigned gdb_port, void* data) -> iss_factory::base_t { auto* cc = reinterpret_cast(data); auto* cpu = new sc_core_adapter>(cc); @@ -84,14 +96,19 @@ volatile std::array ${coreDef.name.toLowerCase()}_init = { auto* cc = reinterpret_cast(data); auto* cpu = new sc_core_adapter>(cc); return {sysc::sc_cpu_ptr{cpu}, vm_ptr{create(static_cast(cpu), gdb_port)}}; - }) + })<%if(coreDef.name.toLowerCase()=="tgc5d" || coreDef.name.toLowerCase()=="tgc5e") {%>, + iss_factory::instance().register_creator("${coreDef.name.toLowerCase()}|mu_p_clic_pmp|tcc", [](unsigned gdb_port, void* data) -> iss_factory::base_t { + auto* cc = reinterpret_cast(data); + auto* cpu = new sc_core_adapter>(cc); + return {sysc::sc_cpu_ptr{cpu}, vm_ptr{create(static_cast(cpu), gdb_port)}}; + })<%}%> }; } #endif #if defined(WITH_ASMJIT) namespace asmjit { using namespace sysc; -volatile std::array ${coreDef.name.toLowerCase()}_init = { +volatile std::array ${coreDef.name.toLowerCase()}_init = { iss_factory::instance().register_creator("${coreDef.name.toLowerCase()}|m_p|asmjit", [](unsigned gdb_port, void* data) -> iss_factory::base_t { auto* cc = reinterpret_cast(data); auto* cpu = new sc_core_adapter>(cc); @@ -101,7 +118,12 @@ volatile std::array ${coreDef.name.toLowerCase()}_init = { auto* cc = reinterpret_cast(data); auto* cpu = new sc_core_adapter>(cc); return {sysc::sc_cpu_ptr{cpu}, vm_ptr{create(static_cast(cpu), gdb_port)}}; - }) + })<%if(coreDef.name.toLowerCase()=="tgc5d" || coreDef.name.toLowerCase()=="tgc5e") {%>, + iss_factory::instance().register_creator("${coreDef.name.toLowerCase()}|mu_p_clic_pmp|asmjit", [](unsigned gdb_port, void* data) -> iss_factory::base_t { + auto* cc = reinterpret_cast(data); + auto* cpu = new sc_core_adapter>(cc); + return {sysc::sc_cpu_ptr{cpu}, vm_ptr{create(static_cast(cpu), gdb_port)}}; + })<%}%> }; } #endif diff --git a/src/sysc/core_complex.cpp b/src/sysc/core_complex.cpp index faa878a..6c2e2e5 100644 --- a/src/sysc/core_complex.cpp +++ b/src/sysc/core_complex.cpp @@ -148,7 +148,7 @@ public: } else { auto base_isa = type.substr(0, 5); if(base_isa=="tgc5d" || base_isa=="tgc5e") { - std::tie(cpu, vm) = f.create(type + "|mu_p_clic_pmp|" + backend, gdb_port); + std::tie(cpu, vm) = f.create(type + "|mu_p_clic_pmp|" + backend, gdb_port, owner); } else { std::tie(cpu, vm) = f.create(type + "|m_p|" + backend, gdb_port, owner); }