Skip to content

Commit

Permalink
Tests: Add support for Questa in TestSimulator class (verilator#5718)
Browse files Browse the repository at this point in the history
  • Loading branch information
ksstrike authored Jan 8, 2025
1 parent 87d8563 commit 260ac34
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion test_regress/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -1418,7 +1418,7 @@ def execute(self, **kwargs) -> None:
cmd = [
"echo q | " + run_env + VtOs.getenv_def('VERILATOR_MODELSIM', "vsim"),
' '.join(param['ms_run_flags']), ' '.join(param['all_run_flags']), pli_opt,
(" top")
(" t")
]
self.run(cmd=cmd,
check_finished=param['check_finished'],
Expand Down
16 changes: 10 additions & 6 deletions test_regress/t/TestSimulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
class TestSimulator {
private:
struct SimTypes {
int verilator;
int icarus;
int mti;
int ncsim;
int vcs;
bool verilator = false;
bool icarus = false;
bool mti = false;
bool ncsim = false;
bool vcs = false;
bool questa = false;
};
s_vpi_vlog_info m_info;
SimTypes m_simulators;
Expand All @@ -37,6 +38,8 @@ class TestSimulator {
== strncmp(m_info.product, "Chronologic Simulation VCS",
std::strlen("Chronologic Simulation VCS"))) {
m_simulators.vcs = true;
} else if (0 == strcmp(m_info.product, "ModelSim for Questa-64")) {
m_simulators.questa = true;
} else {
printf("%%Warning: %s:%d: Unknown simulator in TestSimulator.h: %s\n", __FILE__,
__LINE__, m_info.product);
Expand All @@ -59,12 +62,13 @@ class TestSimulator {
static bool is_mti() { return simulators().mti; }
static bool is_ncsim() { return simulators().ncsim; }
static bool is_vcs() { return simulators().vcs; }
static bool is_questa() { return simulators().questa; }
// Simulator properties
static bool is_event_driven() { return !simulators().verilator; }
static bool has_get_scalar() { return !simulators().icarus; }
// return test level scope
static const char* top() {
if (simulators().verilator || simulators().icarus) {
if (simulators().verilator || simulators().icarus || simulators().questa) {
return "t";
} else {
return "top.t";
Expand Down

0 comments on commit 260ac34

Please sign in to comment.