mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 10:03:44 +02:00
Add VerilatedContext::useNumaAssign and set on threads() call (#6954)
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
// -*- mode: C++; c-file-style: "cc-mode" -*-
|
||||
//*************************************************************************
|
||||
//
|
||||
// Copyright 2026 by Wilson Snyder. This program is free software; you can
|
||||
// redistribute it and/or modify it under the terms of either the GNU
|
||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||
// Version 2.0.
|
||||
// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
//
|
||||
//*************************************************************************
|
||||
|
||||
// Generated header
|
||||
#include "Vt_gantt_numa_default_threads.h"
|
||||
// General headers
|
||||
#include "verilated.h"
|
||||
|
||||
#include "TestCheck.h"
|
||||
|
||||
int errors = 0;
|
||||
|
||||
std::unique_ptr<Vt_gantt_numa_default_threads> topp;
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
vluint64_t sim_time = 1100;
|
||||
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
|
||||
contextp->debug(0);
|
||||
contextp->commandArgs(argc, argv);
|
||||
srand48(5);
|
||||
TEST_CHECK_EQ(contextp->useNumaAssign(), false);
|
||||
contextp->threads(3);
|
||||
TEST_CHECK_EQ(contextp->useNumaAssign(), true);
|
||||
contextp->useNumaAssign(false);
|
||||
TEST_CHECK_EQ(contextp->useNumaAssign(), false);
|
||||
topp.reset(new VM_PREFIX{"top"});
|
||||
|
||||
topp->clk = 0;
|
||||
topp->eval();
|
||||
{ contextp->timeInc(10); }
|
||||
|
||||
while ((contextp->time() < sim_time) && !contextp->gotFinish()) {
|
||||
topp->eval();
|
||||
topp->clk = !topp->clk;
|
||||
topp->eval();
|
||||
contextp->timeInc(5);
|
||||
}
|
||||
if (!contextp->gotFinish()) {
|
||||
vl_fatal(__FILE__, __LINE__, "main", "%Error: Timeout; never got a $finish");
|
||||
}
|
||||
topp->final();
|
||||
|
||||
topp.reset();
|
||||
return (errors ? 10 : 0);
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env python3
|
||||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||
#
|
||||
# Copyright 2026 by Wilson Snyder. This program is free software; you
|
||||
# can redistribute it and/or modify it under the terms of either the GNU
|
||||
# Lesser General Public License Version 3 or the Perl Artistic License
|
||||
# Version 2.0.
|
||||
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
import os
|
||||
import sys
|
||||
import vltest_bootstrap
|
||||
|
||||
test.scenarios('vltmt')
|
||||
|
||||
test.top_filename = "t/t_gantt.v"
|
||||
test.pli_filename = "t/t_gantt_numa_default_threads.cpp"
|
||||
|
||||
# Require enough cores so default thread count stays >= model threads
|
||||
# (we don't call contextp->threads in this test)
|
||||
test.skip_if_too_few_cores()
|
||||
|
||||
test.compile(
|
||||
make_main=False,
|
||||
verilator_flags2=[
|
||||
"--prof-exec",
|
||||
"--exe",
|
||||
test.pli_filename,
|
||||
test.t_dir + "/t_gantt_c.cpp",
|
||||
],
|
||||
threads=test.get_default_vltmt_threads,
|
||||
)
|
||||
|
||||
test.execute(all_run_flags=[
|
||||
"+verilator+prof+exec+start+2",
|
||||
" +verilator+prof+exec+window+2",
|
||||
" +verilator+prof+exec+file+" + test.obj_dir + "/profile_exec.dat",
|
||||
])
|
||||
|
||||
gantt_log = test.obj_dir + "/gantt_default_threads.log"
|
||||
test.run(cmd=[
|
||||
os.environ["VERILATOR_ROOT"] + "/bin/verilator_gantt",
|
||||
"--no-vcd",
|
||||
test.obj_dir + "/profile_exec.dat",
|
||||
"| tee " + gantt_log,
|
||||
])
|
||||
|
||||
if sys.platform != "darwin":
|
||||
test.file_grep(gantt_log, r"NUMA status += NUMA assignment not requested")
|
||||
|
||||
test.passes()
|
||||
Reference in New Issue
Block a user