Commentary: Debugging and some astgen code cleanup.
No functional change.
This commit is contained in:
parent
6ad21b3b3b
commit
b07dd622fa
2
Changes
2
Changes
|
|
@ -3,7 +3,7 @@ Revision history for Verilator
|
||||||
The contributors that suggested a given feature are shown in []. [by ...]
|
The contributors that suggested a given feature are shown in []. [by ...]
|
||||||
indicates the contributor was also the author of the fix; Thanks!
|
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.
|
*** Optimize two-level shift and and/or trees, +23% on one test.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
module written. Someday this scheme may be removed, as it slows the
|
||||||
program down to have to pass vup everywhere.)
|
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
|
=head1 DISTRIBUTION
|
||||||
|
|
||||||
Copyright 2008-2008 by Wilson Snyder. This program is free software; you
|
Copyright 2008-2008 by Wilson Snyder. This program is free software; you
|
||||||
|
|
|
||||||
|
|
@ -226,7 +226,7 @@ V3Number_test: V3Number_test.o
|
||||||
|
|
||||||
#### Modules
|
#### Modules
|
||||||
|
|
||||||
%__gen.cpp: %.cpp $(ASTGEN)
|
%__gen.cpp: %.cpp $(ASTGEN) V3Ast.h V3AstNodes.h
|
||||||
$(PERL) $(ASTGEN) -I$(srcdir) $*.cpp
|
$(PERL) $(ASTGEN) -I$(srcdir) $*.cpp
|
||||||
|
|
||||||
%.o: %.cpp
|
%.o: %.cpp
|
||||||
|
|
|
||||||
|
|
@ -732,7 +732,7 @@ public:
|
||||||
static void user5ClearTree() { AstUser5InUse::clear(); }
|
static void user5ClearTree() { AstUser5InUse::clear(); }
|
||||||
|
|
||||||
vluint64_t editCount() const { return m_editCount; }
|
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 editCountLast() { return s_editCntLast; }
|
||||||
static vluint64_t editCountGbl() { return s_editCntGbl; }
|
static vluint64_t editCountGbl() { return s_editCntGbl; }
|
||||||
static void editCountSetLast() { s_editCntLast = editCountGbl(); }
|
static void editCountSetLast() { s_editCntLast = editCountGbl(); }
|
||||||
|
|
@ -1027,7 +1027,7 @@ struct AstNodeCase : public AstNodeStmt {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct AstNodeSenItem : public AstNode {
|
struct AstNodeSenItem : public AstNode {
|
||||||
// A AstSenItem under
|
// An AstSenItem or AstSenGate
|
||||||
AstNodeSenItem(FileLine* fl) : AstNode(fl) {}
|
AstNodeSenItem(FileLine* fl) : AstNode(fl) {}
|
||||||
ASTNODE_BASE_FUNCS(NodeSenItem)
|
ASTNODE_BASE_FUNCS(NodeSenItem)
|
||||||
virtual bool isClocked() const = 0;
|
virtual bool isClocked() const = 0;
|
||||||
|
|
@ -1038,7 +1038,7 @@ struct AstNodeSenItem : public AstNode {
|
||||||
};
|
};
|
||||||
|
|
||||||
class AstNodeVarRef : public AstNodeMath {
|
class AstNodeVarRef : public AstNodeMath {
|
||||||
// A AstVarRef or AstVarXRef
|
// An AstVarRef or AstVarXRef
|
||||||
private:
|
private:
|
||||||
bool m_lvalue; // Left hand side assignment
|
bool m_lvalue; // Left hand side assignment
|
||||||
AstVar* m_varp; // [AfterLink] Pointer to variable itself
|
AstVar* m_varp; // [AfterLink] Pointer to variable itself
|
||||||
|
|
|
||||||
|
|
@ -1255,9 +1255,18 @@ private:
|
||||||
// $accessor_name, ...
|
// $accessor_name, ...
|
||||||
// # ,, gets replaced with a , rather than &&
|
// # ,, gets replaced with a , rather than &&
|
||||||
// }" # bracket not paren
|
// }" # bracket not paren
|
||||||
// ,"function to call"
|
// ,"what to call"
|
||||||
// or ,"AstREPLACEMENT_TYPE{ $accessor }"
|
//
|
||||||
// or ,"! # Print line number when matches, so can see operations
|
// 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
|
// Lint Checks
|
||||||
// v--- *1* These ops are always first, as we warn before replacing
|
// v--- *1* These ops are always first, as we warn before replacing
|
||||||
|
|
|
||||||
|
|
@ -276,7 +276,7 @@ void V3Graph::dumpDotFile(const string& filename, bool colorAsSubgraph) {
|
||||||
// Header
|
// Header
|
||||||
*logp<<"digraph v3graph {\n";
|
*logp<<"digraph v3graph {\n";
|
||||||
*logp<<"\trankdir="<<dotRankDir()<<"\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<<"\tnTITLE\t[fontsize=20 label=\""<<filename<<"\", shape=box, style=bold, color=black];\n";
|
||||||
*logp<<"\n";
|
*logp<<"\n";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -376,7 +376,7 @@ sub treeop_exec_func {
|
||||||
$func =~ s/^!//;
|
$func =~ s/^!//;
|
||||||
if ($func =~ /^\s*[a-zA-Z0-9]+\s*\(/) { # Function call
|
if ($func =~ /^\s*[a-zA-Z0-9]+\s*\(/) { # Function call
|
||||||
(my $outl = $func) =~ s/\$([a-zA-Z0-9]+)/nodep->$1()/g;
|
(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) {
|
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;
|
#print "FF $out\n" if $Debug;
|
||||||
} elsif ($func eq "NEVER") {
|
} elsif ($func eq "NEVER") {
|
||||||
$out .= "nodep->v3fatalSrc(\"Executing transform that was NEVERed\");";
|
$out .= "nodep->v3fatalSrc(\"Executing transform that was NEVERed\");";
|
||||||
|
} elsif ($func eq "DONE") {
|
||||||
} else {
|
} else {
|
||||||
$self->error("Unknown execution function format: $func\n");
|
$self->error("Unknown execution function format: $func\n");
|
||||||
}
|
}
|
||||||
|
|
@ -450,7 +451,7 @@ sub tree_match {
|
||||||
"\t// $typefunc->{comment}\n",);
|
"\t// $typefunc->{comment}\n",);
|
||||||
$self->print( "\tif ($typefunc->{match_if}) {\n");
|
$self->print( "\tif ($typefunc->{match_if}) {\n");
|
||||||
$self->print( "\t UINFO($typefunc->{uinfo_level},(void*)(nodep)<<\" $typefunc->{uinfo}\\n\");\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 return true;\n");
|
||||||
$self->print( "\t}\n");
|
$self->print( "\t}\n");
|
||||||
$self->print( "\treturn false;\n");
|
$self->print( "\treturn false;\n");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue