From 301edff9e800af0d66a8decb99c8fb3224cd901e Mon Sep 17 00:00:00 2001 From: Simon Southwell Date: Sun, 15 Dec 2024 11:32:47 +0000 Subject: [PATCH] Added more configurability to VerilatorSimCtrl --- code/VProc.h | 2 +- verilator/src/VerilatorSimCtrl.cpp | 12 ++++++++---- verilator/src/VerilatorSimCtrl.h | 2 +- verilator/verilator_sim_ctrl.sv | 8 ++++---- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/code/VProc.h b/code/VProc.h index 52b6814..2c79d57 100644 --- a/code/VProc.h +++ b/code/VProc.h @@ -35,7 +35,7 @@ #include #include -#define VERSION_STRING "VProc version 1.12.1. Copyright (c) 2004-2024 Simon Southwell." +#define VERSION_STRING "VProc version 1.12.2. Copyright (c) 2004-2024 Simon Southwell." #ifndef VP_MAX_NODES #define VP_MAX_NODES 64 diff --git a/verilator/src/VerilatorSimCtrl.cpp b/verilator/src/VerilatorSimCtrl.cpp index e536f18..35b4071 100644 --- a/verilator/src/VerilatorSimCtrl.cpp +++ b/verilator/src/VerilatorSimCtrl.cpp @@ -278,9 +278,13 @@ static int parse_command(const std::string &command, VProc *vp, uint32_t &cyc_co // Function to run gtkwave in a thread // --------------------------------------------- -void rungtkwave (void) +void rungtkwave (const char* wavefnameprefix, const bool fst = false) { - system("gtkwave -A waves.vcd > gtkwave.log 2>&1"); + char sbuf[256]; + + sprintf(sbuf, "gtkwave -A %s.%s > gtkwave.log 2>&1", wavefnameprefix, fst ? "fst" : "vcd"); + + system(sbuf); } // --------------------------------------------- @@ -288,7 +292,7 @@ void rungtkwave (void) // function // --------------------------------------------- -void VerilatorSimCtrl (const uint32_t node) +void VerilatorSimCtrl (const uint32_t node, const char* wavefnameprefix, const bool usefst) { uint32_t clk_period_ps; uint32_t cyc_count_now; @@ -303,7 +307,7 @@ void VerilatorSimCtrl (const uint32_t node) vp->read(VSC_CLK_PERIOD_ADDR, &clk_period_ps); flushfst(); vp->read(VSC_CYC_COUNT_ADDR, &cyc_count_now); flushfst(); - std::thread thread_obj(rungtkwave); + std::thread thread_obj(rungtkwave, wavefnameprefix, usefst); // Print initial prompt std::cout << std::fixed << std::showpoint << std::setprecision(3); diff --git a/verilator/src/VerilatorSimCtrl.h b/verilator/src/VerilatorSimCtrl.h index 5d7cbda..0a1cb6b 100644 --- a/verilator/src/VerilatorSimCtrl.h +++ b/verilator/src/VerilatorSimCtrl.h @@ -64,6 +64,6 @@ 1000000000000.0)) extern void flushfst (void); -extern void VerilatorSimCtrl(const uint32_t node); +extern void VerilatorSimCtrl(const uint32_t node, const char* wavefnameprefix = "waves", const bool usefst = false); #endif \ No newline at end of file diff --git a/verilator/verilator_sim_ctrl.sv b/verilator/verilator_sim_ctrl.sv index e904c4b..d618067 100644 --- a/verilator/verilator_sim_ctrl.sv +++ b/verilator/verilator_sim_ctrl.sv @@ -115,10 +115,10 @@ if (DISABLE_SIM_CTRL == 0) begin `endif `ifdef VPROC_BURST_IF - // Burst count - Burst (), - BurstFirst (), - BurstLast (), + // Burst count + .Burst (), + .BurstFirst (), + .BurstLast (), `endif // Interrupts