Allow constant expressions without parentheses in PATHPULSE$ declaration (#7199)

This commit is contained in:
Pawel Kojma 2026-03-11 11:01:33 +01:00 committed by GitHub
parent 5bf1d060c9
commit 4e6eafd994
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 10 deletions

View File

@ -3038,13 +3038,9 @@ delay_value<nodeExprp>: // ==IEEE:delay_value
| y1STEP { $$ = new AstConst{$<fl>1, AstConst::OneStep{}}; }
;
delayExpr<nodeExprp>:
expr { $$ = $1; }
;
minTypMax<nodeExprp>: // IEEE: mintypmax_expression and constant_mintypmax_expression
delayExpr { $$ = $1; }
| delayExpr ':' delayExpr ':' delayExpr { $$ = $3; MINTYPMAXDLYUNSUP($3); DEL($1); DEL($5); }
expr { $$ = $1; }
| expr ':' expr ':' expr { $$ = $3; MINTYPMAXDLYUNSUP($3); DEL($1); DEL($5); }
;
minTypMaxE<nodeExprp>:
@ -5935,10 +5931,13 @@ specparam_assignment<varp>: // ==IEEE: specparam_assignment
idNotPathpulse sigAttrListE '=' minTypMax
{ $$ = VARDONEA($<fl>1, *$1, nullptr, $2);
if ($4) $$->valuep($4); }
// // IEEE: pulse_control_specparam
| idPathpulse sigAttrListE '=' '(' minTypMax ')'
// // IEEE: pulse_control_specparam
// // LRM grammar requires '(' as the first token after assignment,
// // but IEEE provides an example in 30.7.1 where it is omitted.
// // Other simulators also support it.
| idPathpulse sigAttrListE '=' minTypMax
{ $$ = VARDONEA($<fl>1, *$1, nullptr, $2);
if ($5) $$->valuep($5); }
if ($4) $$->valuep($4); }
| idPathpulse sigAttrListE '=' '(' minTypMax ',' minTypMax ')'
{ $$ = VARDONEA($<fl>1, *$1, nullptr, $2);
if ($5) $$->valuep($5);

View File

@ -1,9 +1,10 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain.
// SPDX-FileCopyrightText: 2025 Wilson Snyder
// SPDX-FileCopyrightText: 2026 Wilson Snyder
// SPDX-License-Identifier: CC0-1.0
module t;
specify
specparam tdevice_PU = 3e8;
@ -13,6 +14,10 @@ module t;
specparam PATHPULSE$a$b = (3.0:3.1:3.2, 4.0:4.1:4.2);
specparam PATHPULSE$a$c = (3.0:3.1:3.2);
specparam randomize = 1; // Special parser corner-case
// Not allowed by the grammar in LRM section 30.7.1,
// but used in an example at the end in the same section
specparam PATHPULSE$ = 0;
endspecify
// Support in other simulators is limited for module specparams