Add --debug-check flag

git-svn-id: file://localhost/svn/verilator/trunk/verilator@802 77ca24e4-aefa-0310-84f0-b9a241c72d87
This commit is contained in:
Wilson Snyder 2006-10-02 17:09:56 +00:00
parent 7738b202ac
commit 79e02858cb
6 changed files with 16 additions and 4 deletions

View File

@ -292,6 +292,11 @@ the comment "DefaultClock":
Select the debug built image of Verilator (if available), and enable more Select the debug built image of Verilator (if available), and enable more
internal assertions, debugging messages, and intermediate form dump files. internal assertions, debugging messages, and intermediate form dump files.
=item --debug-check
Rarely needed. Enable internal debugging assertion checks, without
changing debug verbosity. Enabled automatically when --debug specified.
=item -E =item -E
Preprocess the source code, but do not compile, as with 'gcc -E'. Output Preprocess the source code, but do not compile, as with 'gcc -E'. Output

View File

@ -784,14 +784,16 @@ void AstNode::dumpTreeFile(const string& filename, bool append) {
dumpTree(*logsp); dumpTree(*logsp);
} }
} }
}
if (v3Global.opt.debugCheck() || v3Global.opt.dumpTree()) {
// Error check // Error check
checkTree(); checkTree();
// Broken isn't part of check tree because it can munge iterp's // Broken isn't part of check tree because it can munge iterp's
// set by other steps if it is called in the middle of other operations // set by other steps if it is called in the middle of other operations
if (AstNetlist* netp=this->castNetlist()) V3Broken::brokenAll(netp); if (AstNetlist* netp=this->castNetlist()) V3Broken::brokenAll(netp);
// Next dump can indicate start from here
editCountSetLast();
} }
// Next dump can indicate start from here
editCountSetLast();
} }
void AstNode::v3errorEnd(ostringstream& str) { void AstNode::v3errorEnd(ostringstream& str) {

View File

@ -366,6 +366,7 @@ void V3Options::parseOptsList(FileLine* fl, int argc, char** argv) {
else if ( onoff (sw, "-coverage-line", flag/*ref*/) ){ m_coverageLine = flag; } else if ( onoff (sw, "-coverage-line", flag/*ref*/) ){ m_coverageLine = flag; }
else if ( onoff (sw, "-coverage-user", flag/*ref*/) ){ m_coverageUser = flag; } else if ( onoff (sw, "-coverage-user", flag/*ref*/) ){ m_coverageUser = flag; }
else if ( onoff (sw, "-covsp", flag/*ref*/) ) { } // TBD else if ( onoff (sw, "-covsp", flag/*ref*/) ) { } // TBD
else if ( onoff (sw, "-debug-check", flag/*ref*/) ){ m_debugCheck = flag; }
else if ( onoff (sw, "-dump-tree", flag/*ref*/) ) { m_dumpTree = flag; } else if ( onoff (sw, "-dump-tree", flag/*ref*/) ) { m_dumpTree = flag; }
else if ( onoff (sw, "-exe", flag/*ref*/) ) { m_exe = flag; } else if ( onoff (sw, "-exe", flag/*ref*/) ) { m_exe = flag; }
else if ( onoff (sw, "-ignc", flag/*ref*/) ) { m_ignc = flag; } else if ( onoff (sw, "-ignc", flag/*ref*/) ) { m_ignc = flag; }
@ -557,6 +558,7 @@ V3Options::V3Options() {
m_coverageLine = false; m_coverageLine = false;
m_coverageUser = false; m_coverageUser = false;
m_debugCheck = false;
m_dumpTree = false; m_dumpTree = false;
m_exe = false; m_exe = false;
m_ignc = false; m_ignc = false;
@ -603,6 +605,7 @@ void V3Options::setDebugMode(int level) {
V3Error::debugDefault(level); V3Error::debugDefault(level);
m_dumpTree = true; m_dumpTree = true;
m_stats = true; m_stats = true;
m_debugCheck = true;
cout << "Starting "<<version()<<endl; cout << "Starting "<<version()<<endl;
} }

View File

@ -49,6 +49,7 @@ class V3Options {
bool m_assert; // main switch: --assert bool m_assert; // main switch: --assert
bool m_coverageLine; // main switch: --coverage-block bool m_coverageLine; // main switch: --coverage-block
bool m_coverageUser; // main switch: --coverage-func bool m_coverageUser; // main switch: --coverage-func
bool m_debugCheck; // main switch: --debug-check
bool m_dumpTree; // main switch: --dump-tree bool m_dumpTree; // main switch: --dump-tree
bool m_exe; // main switch: --exe bool m_exe; // main switch: --exe
bool m_ignc; // main switch: --ignc bool m_ignc; // main switch: --ignc
@ -134,6 +135,7 @@ class V3Options {
bool coverage() const { return m_coverageUser || m_coverageLine; } bool coverage() const { return m_coverageUser || m_coverageLine; }
bool coverageLine() const { return m_coverageLine; } bool coverageLine() const { return m_coverageLine; }
bool coverageUser() const { return m_coverageUser; } bool coverageUser() const { return m_coverageUser; }
bool debugCheck() const { return m_debugCheck; }
bool dumpTree() const { return m_dumpTree; } bool dumpTree() const { return m_dumpTree; }
bool exe() const { return m_exe; } bool exe() const { return m_exe; }
bool trace() const { return m_trace; } bool trace() const { return m_trace; }

View File

@ -187,7 +187,7 @@ sub new {
make_top_shell => 1, # Make a default __top.v file make_top_shell => 1, # Make a default __top.v file
make_main => 1, # Make __main.cpp make_main => 1, # Make __main.cpp
# All compilers # All compilers
v_flags => [split(/\s+/," -f input.vc")], v_flags => [split(/\s+/," -f input.vc --debug-check")],
v_flags2 => [], # Overridden in some sim files v_flags2 => [], # Overridden in some sim files
v_other_filenames => [], # After the filename so we can spec multiple files v_other_filenames => [], # After the filename so we can spec multiple files
# VCS # VCS

View File

@ -20,7 +20,7 @@ module t (/*AUTOARG*/
sub sub (.in(crc[23:0]), .out1(out1), .out2(out2)); sub sub (.in(crc[23:0]), .out1(out1), .out2(out2));
always @ (posedge clk) begin always @ (posedge clk) begin
$write("[%0t] cyc==%0d crc=%x sum=%x out=%x,%x\n",$time, cyc, crc, sum, out1,out2); //$write("[%0t] cyc==%0d crc=%x sum=%x out=%x,%x\n",$time, cyc, crc, sum, out1,out2);
cyc <= cyc + 1; cyc <= cyc + 1;
crc <= {crc[62:0], crc[63]^crc[2]^crc[0]}; crc <= {crc[62:0], crc[63]^crc[2]^crc[0]};
sum <= {sum[62:0], sum[63]^sum[2]^sum[0]} ^ {58'h0,out1,out2}; sum <= {sum[62:0], sum[63]^sum[2]^sum[0]} ^ {58'h0,out1,out2};