Commentary: Debugging and some astgen code cleanup.

No functional change.
This commit is contained in:
Wilson Snyder 2008-11-22 17:37:20 -05:00
parent 6ad21b3b3b
commit b07dd622fa
7 changed files with 31 additions and 11 deletions

View File

@ -3,7 +3,7 @@ Revision history for Verilator
The contributors that suggested a given feature are shown in []. [by ...]
indicates the contributor was also the author of the fix; Thanks!
* Verilator 3.68***
* Verilator 3.700***
*** Optimize two-level shift and and/or trees, +23% on one test.

View File

@ -53,6 +53,16 @@ more messy than the above and is deprecated. (V3Width was nearly the first
module written. Someday this scheme may be removed, as it slows the
program down to have to pass vup everywhere.)
=head1 DEBUGGING WITH GDB
The test_regress/driver.pl script accepts --gdb to start Verilator under
gdb.
To break at a specific edit number which changed a node (presumably to find
what made a <e####> line in the tree dumps):
watch AstNode::s_editCntGbl==####
=head1 DISTRIBUTION
Copyright 2008-2008 by Wilson Snyder. This program is free software; you

View File

@ -226,7 +226,7 @@ V3Number_test: V3Number_test.o
#### Modules
%__gen.cpp: %.cpp $(ASTGEN)
%__gen.cpp: %.cpp $(ASTGEN) V3Ast.h V3AstNodes.h
$(PERL) $(ASTGEN) -I$(srcdir) $*.cpp
%.o: %.cpp

View File

@ -732,7 +732,7 @@ public:
static void user5ClearTree() { AstUser5InUse::clear(); }
vluint64_t editCount() const { return m_editCount; }
void editCountInc() { m_editCount = s_editCntGbl++; }
void editCountInc() { m_editCount = ++s_editCntGbl; }
static vluint64_t editCountLast() { return s_editCntLast; }
static vluint64_t editCountGbl() { return s_editCntGbl; }
static void editCountSetLast() { s_editCntLast = editCountGbl(); }
@ -1027,7 +1027,7 @@ struct AstNodeCase : public AstNodeStmt {
};
struct AstNodeSenItem : public AstNode {
// A AstSenItem under
// An AstSenItem or AstSenGate
AstNodeSenItem(FileLine* fl) : AstNode(fl) {}
ASTNODE_BASE_FUNCS(NodeSenItem)
virtual bool isClocked() const = 0;
@ -1038,7 +1038,7 @@ struct AstNodeSenItem : public AstNode {
};
class AstNodeVarRef : public AstNodeMath {
// A AstVarRef or AstVarXRef
// An AstVarRef or AstVarXRef
private:
bool m_lvalue; // Left hand side assignment
AstVar* m_varp; // [AfterLink] Pointer to variable itself

View File

@ -1255,9 +1255,18 @@ private:
// $accessor_name, ...
// # ,, gets replaced with a , rather than &&
// }" # bracket not paren
// ,"function to call"
// or ,"AstREPLACEMENT_TYPE{ $accessor }"
// or ,"! # Print line number when matches, so can see operations
// ,"what to call"
//
// Where "what_to_call" is:
// "function to call"
// "AstREPLACEMENT_TYPE{ $accessor }"
// "! # Print line number when matches, so can see operations
// "NEVER" # Print error message
// "DONE" # Process of matching did the transform already
// In the future maybe support more complicated match & replace:
// ("AstOr {%a, AstAnd{AstNot{%b}, %c}} if %a.width1 if %a==%b", "AstOr{%a,%c}; %b.delete");
// Lhs/rhs would be implied; for non math operations you'd need $lhsp etc.
// Lint Checks
// v--- *1* These ops are always first, as we warn before replacing

View File

@ -276,7 +276,7 @@ void V3Graph::dumpDotFile(const string& filename, bool colorAsSubgraph) {
// Header
*logp<<"digraph v3graph {\n";
*logp<<"\trankdir="<<dotRankDir()<<"\n";
*logp<<"\tsize="<<"\"7.5,10\""<<"\n";
*logp<<"\t//size="<<"\"7.5,10\""<<"\n";
*logp<<"\tnTITLE\t[fontsize=20 label=\""<<filename<<"\", shape=box, style=bold, color=black];\n";
*logp<<"\n";

View File

@ -376,7 +376,7 @@ sub treeop_exec_func {
$func =~ s/^!//;
if ($func =~ /^\s*[a-zA-Z0-9]+\s*\(/) { # Function call
(my $outl = $func) =~ s/\$([a-zA-Z0-9]+)/nodep->$1()/g;
$out .= $outl;
$out .= $outl.";";
}
elsif ($func =~ /^\s*Ast([a-zA-Z0-9]+) \s*\{\s* (.*) \s* \}$/x) {
@ -433,6 +433,7 @@ sub treeop_exec_func {
#print "FF $out\n" if $Debug;
} elsif ($func eq "NEVER") {
$out .= "nodep->v3fatalSrc(\"Executing transform that was NEVERed\");";
} elsif ($func eq "DONE") {
} else {
$self->error("Unknown execution function format: $func\n");
}
@ -450,7 +451,7 @@ sub tree_match {
"\t// $typefunc->{comment}\n",);
$self->print( "\tif ($typefunc->{match_if}) {\n");
$self->print( "\t UINFO($typefunc->{uinfo_level},(void*)(nodep)<<\" $typefunc->{uinfo}\\n\");\n");
$self->print( "\t $typefunc->{exec_func};\n");
$self->print( "\t $typefunc->{exec_func}\n");
$self->print( "\t return true;\n");
$self->print( "\t}\n");
$self->print( "\treturn false;\n");