mirror of
https://github.com/verilator/verilator.git
synced 2025-01-01 04:07:34 +00:00
Remove tabs inside generated files/quotes.
This commit is contained in:
parent
9e3a88c41d
commit
a0b09b6450
@ -104,39 +104,39 @@ VLCOVGEN_ITEM("name=>'weight', short=>'w', group=>0, default=>undef, descr
|
||||
class VerilatedCovKey {
|
||||
public:
|
||||
static std::string shortKey(const std::string& key) VL_PURE {
|
||||
// VLCOVGEN_SHORT_AUTO_EDIT_BEGIN
|
||||
if (key == "col0") return VL_CIK_COL0;
|
||||
if (key == "col0_name") return VL_CIK_COL0_NAME;
|
||||
if (key == "col1") return VL_CIK_COL1;
|
||||
if (key == "col1_name") return VL_CIK_COL1_NAME;
|
||||
if (key == "col2") return VL_CIK_COL2;
|
||||
if (key == "col2_name") return VL_CIK_COL2_NAME;
|
||||
if (key == "col3") return VL_CIK_COL3;
|
||||
if (key == "col3_name") return VL_CIK_COL3_NAME;
|
||||
if (key == "column") return VL_CIK_COLUMN;
|
||||
if (key == "comment") return VL_CIK_COMMENT;
|
||||
if (key == "filename") return VL_CIK_FILENAME;
|
||||
if (key == "groupcmt") return VL_CIK_GROUPCMT;
|
||||
if (key == "groupdesc") return VL_CIK_GROUPDESC;
|
||||
if (key == "groupname") return VL_CIK_GROUPNAME;
|
||||
if (key == "hier") return VL_CIK_HIER;
|
||||
if (key == "limit") return VL_CIK_LIMIT;
|
||||
if (key == "lineno") return VL_CIK_LINENO;
|
||||
if (key == "per_instance") return VL_CIK_PER_INSTANCE;
|
||||
if (key == "row0") return VL_CIK_ROW0;
|
||||
if (key == "row0_name") return VL_CIK_ROW0_NAME;
|
||||
if (key == "row1") return VL_CIK_ROW1;
|
||||
if (key == "row1_name") return VL_CIK_ROW1_NAME;
|
||||
if (key == "row2") return VL_CIK_ROW2;
|
||||
if (key == "row2_name") return VL_CIK_ROW2_NAME;
|
||||
if (key == "row3") return VL_CIK_ROW3;
|
||||
if (key == "row3_name") return VL_CIK_ROW3_NAME;
|
||||
if (key == "table") return VL_CIK_TABLE;
|
||||
if (key == "thresh") return VL_CIK_THRESH;
|
||||
if (key == "type") return VL_CIK_TYPE;
|
||||
if (key == "weight") return VL_CIK_WEIGHT;
|
||||
// VLCOVGEN_SHORT_AUTO_EDIT_END
|
||||
return key;
|
||||
// VLCOVGEN_SHORT_AUTO_EDIT_BEGIN
|
||||
if (key == "col0") return VL_CIK_COL0;
|
||||
if (key == "col0_name") return VL_CIK_COL0_NAME;
|
||||
if (key == "col1") return VL_CIK_COL1;
|
||||
if (key == "col1_name") return VL_CIK_COL1_NAME;
|
||||
if (key == "col2") return VL_CIK_COL2;
|
||||
if (key == "col2_name") return VL_CIK_COL2_NAME;
|
||||
if (key == "col3") return VL_CIK_COL3;
|
||||
if (key == "col3_name") return VL_CIK_COL3_NAME;
|
||||
if (key == "column") return VL_CIK_COLUMN;
|
||||
if (key == "comment") return VL_CIK_COMMENT;
|
||||
if (key == "filename") return VL_CIK_FILENAME;
|
||||
if (key == "groupcmt") return VL_CIK_GROUPCMT;
|
||||
if (key == "groupdesc") return VL_CIK_GROUPDESC;
|
||||
if (key == "groupname") return VL_CIK_GROUPNAME;
|
||||
if (key == "hier") return VL_CIK_HIER;
|
||||
if (key == "limit") return VL_CIK_LIMIT;
|
||||
if (key == "lineno") return VL_CIK_LINENO;
|
||||
if (key == "per_instance") return VL_CIK_PER_INSTANCE;
|
||||
if (key == "row0") return VL_CIK_ROW0;
|
||||
if (key == "row0_name") return VL_CIK_ROW0_NAME;
|
||||
if (key == "row1") return VL_CIK_ROW1;
|
||||
if (key == "row1_name") return VL_CIK_ROW1_NAME;
|
||||
if (key == "row2") return VL_CIK_ROW2;
|
||||
if (key == "row2_name") return VL_CIK_ROW2_NAME;
|
||||
if (key == "row3") return VL_CIK_ROW3;
|
||||
if (key == "row3_name") return VL_CIK_ROW3_NAME;
|
||||
if (key == "table") return VL_CIK_TABLE;
|
||||
if (key == "thresh") return VL_CIK_THRESH;
|
||||
if (key == "type") return VL_CIK_TYPE;
|
||||
if (key == "weight") return VL_CIK_WEIGHT;
|
||||
// VLCOVGEN_SHORT_AUTO_EDIT_END
|
||||
return key;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -106,8 +106,8 @@ sub write_verilog {
|
||||
$fh->print('int main() {' ,"\n");
|
||||
$fh->print(' Vfoo *top = new Vfoo;' ,"\n");
|
||||
$fh->print(' while (!Verilated::gotFinish()) {',"\n");
|
||||
$fh->print(' top->eval();' ,"\n");
|
||||
$fh->print(' main_time++;' ,"\n");
|
||||
$fh->print(' top->eval();' ,"\n");
|
||||
$fh->print(' main_time++;' ,"\n");
|
||||
$fh->print(' }' ,"\n");
|
||||
$fh->print(' top->final();' ,"\n");
|
||||
$fh->print('}' ,"\n");
|
||||
|
@ -312,7 +312,7 @@ private:
|
||||
if (!scp)
|
||||
continue;
|
||||
if (scp->user1() == 0) {
|
||||
UINFO(4, " Dead AstScope " << scp << endl);
|
||||
UINFO(4, " Dead AstScope " << scp << endl);
|
||||
scp->aboveScopep()->user1Inc(-1);
|
||||
if (scp->dtypep()) {
|
||||
scp->dtypep()->user1Inc(-1);
|
||||
@ -344,7 +344,7 @@ private:
|
||||
pair <AssignMap::iterator,AssignMap::iterator> eqrange = m_assignMap.equal_range(vscp);
|
||||
for (AssignMap::iterator itr = eqrange.first; itr != eqrange.second; ++itr) {
|
||||
AstNodeAssign* assp = itr->second;
|
||||
UINFO(4," Dead assign "<<assp<<endl);
|
||||
UINFO(4," Dead assign "<<assp<<endl);
|
||||
assp->dtypep()->user1Inc(-1);
|
||||
assp->unlinkFrBack()->deleteTree(); VL_DANGLING(assp);
|
||||
}
|
||||
@ -360,7 +360,7 @@ private:
|
||||
if (!varp)
|
||||
continue;
|
||||
if (varp->user1() == 0) {
|
||||
UINFO(4, " Dead " << varp << endl);
|
||||
UINFO(4, " Dead " << varp << endl);
|
||||
if (varp->dtypep()) {
|
||||
varp->dtypep()->user1Inc(-1);
|
||||
}
|
||||
|
32
src/astgen
32
src/astgen
@ -19,11 +19,11 @@ my @Opt_Cpt;
|
||||
my @Opt_I;
|
||||
Getopt::Long::config ("pass_through", "no_auto_abbrev");
|
||||
if (! GetOptions (
|
||||
"help" => \&usage,
|
||||
"debug" => sub { $Debug = 1; },
|
||||
"classes!" => \$opt_classes,
|
||||
"report!" => \$opt_report,
|
||||
"<>" => \¶meter,
|
||||
"help" => \&usage,
|
||||
"debug" => sub { $Debug = 1; },
|
||||
"classes!" => \$opt_classes,
|
||||
"report!" => \$opt_report,
|
||||
"<>" => \¶meter,
|
||||
)) {
|
||||
usage();
|
||||
}
|
||||
@ -238,7 +238,7 @@ sub write_visitor {
|
||||
sub write_intf {
|
||||
my $fh = open_file(@_);
|
||||
foreach my $type (sort (keys %Classes)) {
|
||||
next if $type eq "Node"; # Special, just a return (this);
|
||||
next if $type eq "Node"; # Special, just a return (this);
|
||||
printf $fh " Ast%-16s cast${type}();\n"
|
||||
,$type."*";
|
||||
}
|
||||
@ -248,7 +248,7 @@ sub write_intf {
|
||||
sub write_impl {
|
||||
my $fh = open_file(@_);
|
||||
foreach my $type (sort (keys %Classes)) {
|
||||
next if $type eq "Node"; # Special, just a return (this);
|
||||
next if $type eq "Node"; # Special, just a return (this);
|
||||
# For performance, prefer static_cast where we can
|
||||
if (children_of($type)) {
|
||||
printf $fh "inline Ast%-16s AstNode::cast${type}() { return (dynamic_cast<Ast${type}*>(this)); }\n"
|
||||
@ -273,14 +273,14 @@ sub write_types {
|
||||
printf $fh "\t_ENUM_END\n";
|
||||
printf $fh " };\n";
|
||||
printf $fh " const char* ascii() const {\n";
|
||||
printf $fh " const char* const names[] = {\n";
|
||||
printf $fh " const char* const names[] = {\n";
|
||||
foreach my $type (sort (keys %Classes)) {
|
||||
next if $type =~ /^Node/;
|
||||
print $fh "\t\"", uc $type, "\",\n";
|
||||
}
|
||||
printf $fh "\t\"_ENUM_END\"\n";
|
||||
printf $fh " };\n";
|
||||
printf $fh " return names[m_e];\n";
|
||||
printf $fh " };\n";
|
||||
printf $fh " return names[m_e];\n";
|
||||
printf $fh " };\n";
|
||||
$fh->close();
|
||||
}
|
||||
@ -575,7 +575,7 @@ sub tree_base {
|
||||
my @out_for_type;
|
||||
foreach my $base (::subclasses_of($type), $type) {
|
||||
foreach my $typefunc (@{$self->{treeop}{$base}}) {
|
||||
my @lines = (" if ($typefunc->{match_func}(nodep)) return;\n",);
|
||||
my @lines = (" if ($typefunc->{match_func}(nodep)) return;\n",);
|
||||
if ($typefunc->{short_circuit}) { # short-circuit match fn
|
||||
push @out_for_type_sc, @lines;
|
||||
} else { # Standard match fn
|
||||
@ -598,11 +598,11 @@ sub tree_base {
|
||||
if ($out_for_type_sc[0]) { # Short-circuited types
|
||||
$self->print(" // Generated by astgen with short-circuiting\n",
|
||||
" virtual void visit(Ast${type}* nodep) {\n",
|
||||
" nodep->lhsp()->iterateAndNext(*this);\n",
|
||||
" nodep->lhsp()->iterateAndNext(*this);\n",
|
||||
@out_for_type_sc);
|
||||
$self->print(" nodep->rhsp()->iterateAndNext(*this);\n",
|
||||
" AstNodeTriop *tnp = nodep->castNodeTriop();\n",
|
||||
" if (tnp && tnp->thsp()) tnp->thsp()->iterateAndNext(*this);\n",
|
||||
$self->print(" nodep->rhsp()->iterateAndNext(*this);\n",
|
||||
" AstNodeTriop *tnp = nodep->castNodeTriop();\n",
|
||||
" if (tnp && tnp->thsp()) tnp->thsp()->iterateAndNext(*this);\n",
|
||||
@out_for_type,
|
||||
" }\n") if ($out_for_type[0]);
|
||||
} elsif ($out_for_type[0]) { # Other types with something to print
|
||||
@ -611,7 +611,7 @@ sub tree_base {
|
||||
$self->print(" // Generated by astgen\n",
|
||||
" virtual void visit$gen(Ast${type}* nodep) {\n",
|
||||
($skip?"":
|
||||
" nodep->iterateChildren(*this);\n"),
|
||||
" nodep->iterateChildren(*this);\n"),
|
||||
@out_for_type,
|
||||
" }\n");
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ sub write_keys {
|
||||
$deleting = 1;
|
||||
push @out, $line;
|
||||
foreach my $keyref (sort {$a->{name} cmp $b->{name}} @Items) {
|
||||
push @out, sprintf("\tif (key == \"%s\") return VL_CIK_%s;\n",
|
||||
push @out, sprintf(" if (key == \"%s\") return VL_CIK_%s;\n",
|
||||
$keyref->{name}, uc $keyref->{name});
|
||||
}
|
||||
}
|
||||
|
@ -1234,7 +1234,7 @@ sub _make_main {
|
||||
$fh->print(" topp->trace (tfp, 99);\n");
|
||||
$fh->print(" tfp->open (\"$self->{obj_dir}/simx.vcd\");\n");
|
||||
if ($self->{trace} && !$self->sc) {
|
||||
$fh->print(" if (tfp) tfp->dump (main_time);\n");
|
||||
$fh->print(" if (tfp) tfp->dump (main_time);\n");
|
||||
}
|
||||
$fh->print("#endif\n");
|
||||
}
|
||||
@ -1262,19 +1262,19 @@ sub _make_main {
|
||||
for (my $i=0; $i<5; $i++) {
|
||||
my $action = 0;
|
||||
if ($self->{inputs}{fastclk}) {
|
||||
print $fh " ${set}fastclk=!${set}fastclk;\n";
|
||||
print $fh " ${set}fastclk=!${set}fastclk;\n";
|
||||
$action = 1;
|
||||
}
|
||||
if ($i==0 && $self->{inputs}{clk}) {
|
||||
print $fh " ${set}clk=!${set}clk;\n";
|
||||
print $fh " ${set}clk=!${set}clk;\n";
|
||||
$action = 1;
|
||||
}
|
||||
if ($self->{savable}) {
|
||||
$fh->print(" if (sc_time_stamp() == save_time && save_time) {\n");
|
||||
$fh->print(" save_model(\"$self->{obj_dir}/saved.vltsv\");\n");
|
||||
$fh->print(" printf(\"Exiting after save_model\\n\");\n");
|
||||
$fh->print(" exit(0);\n");
|
||||
$fh->print(" }\n");
|
||||
$fh->print(" if (sc_time_stamp() == save_time && save_time) {\n");
|
||||
$fh->print(" save_model(\"$self->{obj_dir}/saved.vltsv\");\n");
|
||||
$fh->print(" printf(\"Exiting after save_model\\n\");\n");
|
||||
$fh->print(" exit(0);\n");
|
||||
$fh->print(" }\n");
|
||||
}
|
||||
_print_advance_time($self, $fh, 1, $action);
|
||||
}
|
||||
@ -1291,7 +1291,7 @@ sub _make_main {
|
||||
}
|
||||
if ($self->{trace}) {
|
||||
$fh->print("#if VM_TRACE\n");
|
||||
$fh->print(" if (tfp) tfp->close();\n");
|
||||
$fh->print(" if (tfp) tfp->close();\n");
|
||||
$fh->print("#endif //VM_TRACE\n");
|
||||
}
|
||||
$fh->print("\n");
|
||||
@ -1314,20 +1314,20 @@ sub _print_advance_time {
|
||||
|
||||
if ($self->sc) {
|
||||
print $fh "#if (SYSTEMC_VERSION>=20070314)\n";
|
||||
print $fh " sc_start(${time},SC_NS);\n";
|
||||
print $fh " sc_start(${time},SC_NS);\n";
|
||||
print $fh "#else\n";
|
||||
print $fh " sc_start(${time});\n";
|
||||
print $fh " sc_start(${time});\n";
|
||||
print $fh "#endif\n";
|
||||
} else {
|
||||
if ($action) {
|
||||
print $fh " ${set}eval();\n";
|
||||
print $fh " ${set}eval();\n";
|
||||
if ($self->{trace} && !$self->sc) {
|
||||
$fh->print("#if VM_TRACE\n");
|
||||
$fh->print(" if (tfp) tfp->dump (main_time);\n");
|
||||
$fh->print(" if (tfp) tfp->dump (main_time);\n");
|
||||
$fh->print("#endif //VM_TRACE\n");
|
||||
}
|
||||
}
|
||||
print $fh " main_time += ${time};\n";
|
||||
print $fh " main_time += ${time};\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user