Skip to content

Commit add90e8

Browse files
committed
add --signal=S arg to AUTONC
1 parent 119f30f commit add90e8

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

verilogpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,6 +1606,8 @@ sub expand_all_macros {
16061606
$self->expand_macro('FORINST', \&expand_forinst);
16071607
$self->expand_macro('AUTOTOSTRING', \&expand_autotostring);
16081608
$self->expand_macro('AUTOINC', \&expand_includes);
1609+
# note: AUTONC should expand before AUTOINTERFACE, as it will change
1610+
# what ports are declared in AUTOINTERFACE.
16091611
$self->expand_macro('AUTONC', \&expand_autonc);
16101612
# note: AUTOINTERFACE must expand before AUTONET, as it will change
16111613
# AUTONET's behavior.
@@ -2410,6 +2412,10 @@ sub expand_autonc($$) {
24102412
my @names = ();
24112413
my @tieoffs = ();
24122414
my @unused = ();
2415+
my $lint_unused_signals = "lint_unused_signals";
2416+
if ($macro =~ s/^(.*)--signal=(\S+)/$1/){
2417+
$lint_unused_signals = $2;
2418+
}
24132419
foreach my $line (split(/\s*\n\s*/, $macro)) {
24142420
chomp($line);
24152421
if ($line =~ m/^\s*$/) {next;}
@@ -2474,8 +2480,8 @@ sub expand_autonc($$) {
24742480
if (@unused) {
24752481
@unused = sort @unused;
24762482
if (@tieoffs) { print "\n"; }
2477-
print "logic lint_unused_signals;\n";
2478-
print "assign lint_unused_signals =\n";
2483+
print "logic ${lint_unused_signals};\n";
2484+
print "assign ${lint_unused_signals} =\n";
24792485
print " ",join((" ||\n ", map { "($_ == '0)" } @unused)),";\n";
24802486
}
24812487
}

verilogpp_tests/autonc2.vpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ wire [7:0] foo[0:5];
1717
wire foo_en[0:5];
1818
/*PPSTOP*/
1919

20-
/**AUTONC
20+
/**AUTONC --signal=lint_my_unused_signals
2121
/.+/
2222
**/
2323
/*PPSTART*/
2424
assign foo = '0;
2525
assign foo_en = '0;
2626

27-
logic lint_unused_signals;
28-
assign lint_unused_signals =
27+
logic lint_my_unused_signals;
28+
assign lint_my_unused_signals =
2929
(another_output == '0) ||
3030
(bar == '0);
3131
/*PPSTOP*/

0 commit comments

Comments
 (0)