From 49ca3eed1caa4afdf6469c835f9b6f57ec35b1dd Mon Sep 17 00:00:00 2001 From: alaindargelas <63669492+alaindargelas@users.noreply.github.com> Date: Fri, 23 Aug 2024 14:48:17 -0700 Subject: [PATCH] Info getters (#1684) * Verilator flags * Getter Tcl functions * Incremented patch version --------- Co-authored-by: alaindargelas --- CMakeLists.txt | 2 +- src/Compiler/Compiler.cpp | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6555de6e6..4702bda59 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,7 +39,7 @@ set(VERSION_MINOR 0) # Add the spdlog directory to the include path include_directories(${CMAKE_CURRENT_SOURCE_DIR}/third_party/spdlog/include ${CMAKE_CURRENT_SOURCE_DIR}/third_party/exprtk ${CMAKE_CURRENT_SOURCE_DIR}/third_party/scope_guard) -set(VERSION_PATCH 420) +set(VERSION_PATCH 421) option( diff --git a/src/Compiler/Compiler.cpp b/src/Compiler/Compiler.cpp index 5d129f6a2..3709e3089 100644 --- a/src/Compiler/Compiler.cpp +++ b/src/Compiler/Compiler.cpp @@ -414,6 +414,34 @@ bool Compiler::RegisterCommands(TclInterpreter* interp, bool batchMode) { }; interp->registerCmd("get_state", get_state, this, nullptr); + auto get_design_name = [](void* clientData, Tcl_Interp* interp, int argc, + const char* argv[]) -> int { + Compiler* compiler = (Compiler*)clientData; + std::string name = compiler->ProjManager()->projectName(); + Tcl_AppendResult(interp, strdup(name.c_str()), nullptr); + return TCL_OK; + }; + interp->registerCmd("get_design_name", get_design_name, this, nullptr); + + auto get_top_module = [](void* clientData, Tcl_Interp* interp, int argc, + const char* argv[]) -> int { + Compiler* compiler = (Compiler*)clientData; + std::string name = compiler->ProjManager()->DesignTopModule(); + Tcl_AppendResult(interp, strdup(name.c_str()), nullptr); + return TCL_OK; + }; + interp->registerCmd("get_top_module", get_top_module, this, nullptr); + + auto get_top_simulation_module = [](void* clientData, Tcl_Interp* interp, + int argc, const char* argv[]) -> int { + Compiler* compiler = (Compiler*)clientData; + std::string name = compiler->ProjManager()->SimulationTopModule(); + Tcl_AppendResult(interp, strdup(name.c_str()), nullptr); + return TCL_OK; + }; + interp->registerCmd("get_top_simulation_module", get_top_simulation_module, + this, nullptr); + auto create_design = [](void* clientData, Tcl_Interp* interp, int argc, const char* argv[]) -> int { Compiler* compiler = (Compiler*)clientData;