Add traceCapable indication to model header (#5053).

This commit is contained in:
Wilson Snyder 2024-05-03 20:18:06 -04:00
parent 80b08b71aa
commit 298e0f24d1
3 changed files with 15 additions and 1 deletions

View File

@ -19,6 +19,7 @@ Verilator 5.025 devel
* Add CITATION.cff (#5057) (#5058). [Gijs Burghoorn]
* Add VPI eval needed tracking (#5065). [Todd Strader]
* Add `--localize-max-size` option and optimization (#5072).
* Add traceCapable indication to model header (#5053). [Vito Gamberini]
* Fix missing flex include path variable (#4970) (#4971). [Christopher Taylor]
* Fix missing parameters with comma to be errors (#4979) (#5012). [Paul Swirhun]
* Fix bound queue printing (#5032). [Aleksander Kiryk, Antmicro Ltd.]

View File

@ -101,6 +101,12 @@ class EmitCModel final : public EmitCFunc {
puts("\n");
ofp()->putsPrivate(false); // public:
puts("\n// CONSTEXPR CAPABILITIES\n");
puts("// Verilated with --trace?\n");
puts("static constexpr bool traceCapable = "s
+ (v3Global.opt.trace() ? "true;\n"s : "false;\n"s));
// User accessible IO
puts("\n// PORTS\n"
"// The application code writes and reads these signals to\n"

View File

@ -13,6 +13,10 @@
#include VM_PREFIX_INCLUDE
#include "TestCheck.h"
int errors = 0;
unsigned long long main_time = 0;
double sc_time_stamp() { return (double)main_time; }
@ -32,6 +36,9 @@ int main(int argc, char** argv) {
std::unique_ptr<VerilatedVcdC> tfp{new VerilatedVcdC};
top->trace(tfp.get(), 99);
// Test for traceCapable - randomly-ish selected this test
TEST_CHECK_EQ(top->traceCapable, true);
tfp->open(trace_name());
top->clk = 0;
@ -63,5 +70,5 @@ int main(int argc, char** argv) {
tfp.reset();
top.reset();
printf("*-* All Finished *-*\n");
return 0;
return errors;
}