Skip to content

Commit

Permalink
Add TRACE_THREADS to CMake (verilator#2934)
Browse files Browse the repository at this point in the history
  • Loading branch information
corco committed May 8, 2021
1 parent 39ce2f7 commit 2bf248b
Show file tree
Hide file tree
Showing 8 changed files with 1,190 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Jean Berniolles
Jeremy Bennett
John Coiner
John Demme
Jonathan Drolet
Josh Redford
Julien Margetts
Kaleb Barrett
Expand Down
12 changes: 11 additions & 1 deletion docs/guide/verilating.rst
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,8 @@ Verilate in CMake
verilate(target SOURCES source ... [TOP_MODULE top] [PREFIX name]
[TRACE] [TRACE_FST] [SYSTEMC] [COVERAGE]
[INCLUDE_DIRS dir ...] [OPT_SLOW ...] [OPT_FAST ...]
[OPT_GLOBAL ..] [DIRECTORY dir] [VERILATOR_ARGS ...])
[OPT_GLOBAL ..] [DIRECTORY dir] [THREADS num]
[TRACE_THREADS num] [VERILATOR_ARGS ...])
Lowercase and ... should be replaced with arguments, the uppercase parts
delimit the arguments and can be passed in any order, or left out entirely
Expand Down Expand Up @@ -429,6 +430,15 @@ SystemC include directories and link to the SystemC libraries.
the SystemC library. This can be specified using the SYSTEMC_CXX_FLAGS
environment variable.

.. describe:: THREADS

Optional. Generated a multi-threaded model, same as "--threads".

.. describe:: TRACE_THREADS

Optional. Generated multi-threaded trace dumping, same as
"--trace-threads".

.. describe:: TOP_MODULE

Optional. Sets the name of the top module. Defaults to the name of the
Expand Down
2 changes: 2 additions & 0 deletions src/V3EmitCMake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ class CMakeEmitter final {
cmake_set_raw(*of, name + "_COVERAGE", v3Global.opt.coverage() ? "1" : "0");
*of << "# Threaded output mode? 0/1/N threads (from --threads)\n";
cmake_set_raw(*of, name + "_THREADS", cvtToStr(v3Global.opt.threads()));
*of << "# Threaded tracing output mode? 0/1/N threads (from --trace-threads)\n";
cmake_set_raw(*of, name + "_TRACE_THREADS", cvtToStr(v3Global.opt.traceThreads()));
*of << "# VCD Tracing output mode? 0/1 (from --trace)\n";
cmake_set_raw(*of, name + "_TRACE_VCD",
(v3Global.opt.trace() && (v3Global.opt.traceFormat() == TraceFormat::VCD))
Expand Down
6 changes: 5 additions & 1 deletion test_regress/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ string(REGEX REPLACE "(^|;)--" "\\1-"

getarg(TEST_VERILATOR_ARGS_NORM "-prefix" TEST_PREFIX)
getarg(TEST_VERILATOR_ARGS_NORM "-threads" TEST_THREADS)
getarg(TEST_VERILATOR_ARGS_NORM "-trace-threads" TEST_TRACE_THREADS)

# Strip unwanted args with 1 parameter
string(REGEX REPLACE "(^|;)--?(Mdir|make|prefix|threads);[^;]*" ""
string(REGEX REPLACE "(^|;)--?(Mdir|make|prefix|threads|trace-threads);[^;]*" ""
TEST_VERILATOR_ARGS
"${TEST_VERILATOR_ARGS}")
# Strip unwanted args
Expand All @@ -81,6 +82,9 @@ endif()
if(TEST_THREADS)
list(APPEND verilate_ARGS THREADS ${TEST_THREADS})
endif()
if(TEST_TRACE_THREADS)
list(APPEND verilate_ARGS TRACE_THREADS ${TEST_TRACE_THREADS})
endif()
if(TEST_SYSTEMC)
list(APPEND verilate_ARGS SYSTEMC)
endif()
Expand Down
Loading

0 comments on commit 2bf248b

Please sign in to comment.