From 6e2d8df9e539c041f0ba6a039d4c48b32cc512df Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Mon, 8 Jun 2020 22:10:55 -0400 Subject: [PATCH] Tests: Add --debug-exit-parse --- src/V3Options.cpp | 2 ++ src/V3Options.h | 2 ++ src/Verilator.cpp | 4 ++++ test_regress/t/t_debug_exit_parse.pl | 21 +++++++++++++++++++++ 4 files changed, 29 insertions(+) create mode 100755 test_regress/t/t_debug_exit_parse.pl diff --git a/src/V3Options.cpp b/src/V3Options.cpp index ba8827c96..eebc028be 100644 --- a/src/V3Options.cpp +++ b/src/V3Options.cpp @@ -845,6 +845,7 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, char else if (!strcmp(sw, "-debug-abort")) { V3Error::vlAbort(); } // Undocumented, see also --debug-sigsegv else if ( onoff (sw, "-debug-check", flag/*ref*/)) { m_debugCheck = flag; } else if ( onoff (sw, "-debug-collision", flag/*ref*/)) { m_debugCollision = flag; } // Undocumented + else if ( onoff (sw, "-debug-exit-parse", flag/*ref*/)) { m_debugExitParse = flag; } // Undocumented else if ( onoff (sw, "-debug-leak", flag/*ref*/)) { m_debugLeak = flag; } else if ( onoff (sw, "-debug-nondeterminism", flag/*ref*/)){ m_debugNondeterminism = flag; } else if ( onoff (sw, "-debug-partition", flag/*ref*/)){ m_debugPartition = flag; } // Undocumented @@ -1552,6 +1553,7 @@ V3Options::V3Options() { m_coverageUser = false; m_debugCheck = false; m_debugCollision = false; + m_debugExitParse = false; m_debugLeak = true; m_debugNondeterminism = false; m_debugPartition = false; diff --git a/src/V3Options.h b/src/V3Options.h index 0a4d72f03..54478fe49 100644 --- a/src/V3Options.h +++ b/src/V3Options.h @@ -239,6 +239,7 @@ private: bool m_coverageUser; // main switch: --coverage-func bool m_debugCheck; // main switch: --debug-check bool m_debugCollision; // main switch: --debug-collision + bool m_debugExitParse; // main switch: --debug-exit-parse bool m_debugLeak; // main switch: --debug-leak bool m_debugNondeterminism; // main switch: --debug-nondeterminism bool m_debugPartition; // main switch: --debug-partition @@ -438,6 +439,7 @@ public: bool coverageUser() const { return m_coverageUser; } bool debugCheck() const { return m_debugCheck; } bool debugCollision() const { return m_debugCollision; } + bool debugExitParse() const { return m_debugExitParse; } bool debugLeak() const { return m_debugLeak; } bool debugNondeterminism() const { return m_debugNondeterminism; } bool debugPartition() const { return m_debugPartition; } diff --git a/src/Verilator.cpp b/src/Verilator.cpp index 1ef486096..eb59529e9 100644 --- a/src/Verilator.cpp +++ b/src/Verilator.cpp @@ -104,6 +104,10 @@ static void process() { // Sort modules by level so later algorithms don't need to care V3LinkLevel::modSortByLevel(); V3Error::abortIfErrors(); + if (v3Global.opt.debugExitParse()) { + cout << "--debug-exit-parse: Exiting after parse\n"; + exit(0); + } // Convert parseref's to varrefs, and other directly post parsing fixups V3LinkParse::linkParse(v3Global.rootp()); diff --git a/test_regress/t/t_debug_exit_parse.pl b/test_regress/t/t_debug_exit_parse.pl new file mode 100755 index 000000000..2d41185e7 --- /dev/null +++ b/test_regress/t/t_debug_exit_parse.pl @@ -0,0 +1,21 @@ +#!/usr/bin/env perl +if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; } +# DESCRIPTION: Verilator: Verilog Test driver/expect definition +# +# Copyright 2003 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 + +scenarios(vlt => 1); + +top_filename("t_EXAMPLE.v"); + +lint( + verilator_flags2 => ["--debug-exit-parse"], + expect => '--debug-exit-parse', + ); + +ok(1); +1;