Skip to content

Commit

Permalink
Updated VerilatorSimCtrl() to take a node argument
Browse files Browse the repository at this point in the history
  • Loading branch information
wyvernSemi committed Dec 5, 2024
1 parent a6beca6 commit 5f37588
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
7 changes: 5 additions & 2 deletions verilator/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Verilator Simulation Control Module

>[!WARNING]
>EXPERIMENTAL
The Verilator simulor control module is a _VProc_ wrapper that allows control of the running simulation on the console command line from where
the test bench with the module instnatiated is run. It consists of a SystemVerilog module defined in `verilator/verilator_sim_ctrl.sv` with a
single clock input (`clk`) and a clock count output (`clk_count`) for use by the test bench if desired. The only other inputs to the module are
Expand Down Expand Up @@ -35,15 +38,15 @@ static const int node = 0;
extern "C" void VUserMain0 (void)
{
VerilatorSimCtrl();
VerilatorSimCtrl(node);
SLEEPFOREVER;
}
```

## Commands

The code above makes a simple call to a function `VerilatorSimCtrl()` that starts the Verilator Simulation Control features and prints some
The code above makes a simple call to a function `VerilatorSimCtrl()`, with the _VProc_ node number, that starts the Verilator Simulation Control features and prints some
information about the configuration and then a prompt. The user can then enter commands to run the simulation for a given time, relative to
current time, or to a given absolute time in the future. The list below shows the form of the commands available

Expand Down
5 changes: 1 addition & 4 deletions verilator/src/VerilatorSimCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
#include "VProcClass.h"
#include "VerilatorSimCtrl.h"

// I'm node 0
static const int node = 0;

// ---------------------------------------------
// advance_relative_cycles()
// ---------------------------------------------
Expand Down Expand Up @@ -291,7 +288,7 @@ void rungtkwave (void)
// function
// ---------------------------------------------

void VerilatorSimCtrl (void)
void VerilatorSimCtrl (const uint32_t node)
{
uint32_t clk_period_ps;
uint32_t cyc_count_now;
Expand Down
2 changes: 1 addition & 1 deletion verilator/src/VerilatorSimCtrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@
1000000000000.0))

extern void flushfst (void);
extern void VerilatorSimCtrl(void);
extern void VerilatorSimCtrl(const uint32_t node);

#endif
2 changes: 1 addition & 1 deletion verilator/test/usercode/VUserMain0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ static const int node = 0;

extern "C" void VUserMain0 (void)
{
VerilatorSimCtrl();
VerilatorSimCtrl(node);

SLEEPFOREVER;
}

0 comments on commit 5f37588

Please sign in to comment.