Fix negative assignment pattern keys (#5580).

This commit is contained in:
Wilson Snyder 2024-11-02 10:06:01 -04:00
parent ed0e1af7aa
commit 7854118883
3 changed files with 20 additions and 5 deletions

View File

@ -19,6 +19,7 @@ Verilator 5.031 devel
* Fix VPI error instead of fatal for vpi_get_value() on large signals (#5571). [Todd Strader]
* Fix --output-groups leftover files issue (#5574). [Todd Strader]
* Fix slow unsized number parsing (#5577). [Geza Lore]
* Fix negative assignment pattern keys (#5580). [Iztok Jeras]
Verilator 5.030 2024-10-27

View File

@ -4006,11 +4006,18 @@ patternKey<nodep>: // IEEE: merge structure_pattern_key, array_patt
// // "foo"member (if structure)
// // So for now we only allow a true constant number, or an
// // identifier which we treat as a structure member name
yaINTNUM { $$ = new AstConst{$<fl>1, *$1}; }
| yaFLOATNUM { $$ = new AstConst{$<fl>1, AstConst::RealDouble{}, $1}; }
| id { $$ = new AstText{$<fl>1, *$1}; }
| strAsInt { $$ = $1; }
| simple_typeNoRef { $$ = $1; }
yaINTNUM
{ $$ = new AstConst{$<fl>1, *$1}; }
| '-' yaINTNUM
{ V3Number neg{*$2}; neg.opNegate(*$2); $$ = new AstConst{$<fl>2, neg}; }
| yaFLOATNUM
{ $$ = new AstConst{$<fl>1, AstConst::RealDouble{}, $1}; }
| id
{ $$ = new AstText{$<fl>1, *$1}; }
| strAsInt
{ $$ = $1; }
| simple_typeNoRef
{ $$ = $1; }
// // expanded from simple_type ps_type_identifier (part of simple_type)
// // expanded from simple_type ps_parameter_identifier (part of simple_type)
| packageClassScopeE idType

View File

@ -13,6 +13,8 @@ module t (/*AUTOARG*/);
logic [31:0] larray_assign [0:3];
logic [31:0] larray_other [0:3];
logic [31:0] array_neg [-1:1];
initial begin
array_assign[0] = 32'd1;
array_assign[3:1] = '{32'd4, 32'd3, 32'd2};
@ -34,6 +36,11 @@ module t (/*AUTOARG*/);
if (larray_other[2] != 3) $stop;
if (larray_other[3] != 2) $stop;
array_neg = '{-1: 5, 1: 7, default: 'd6};
if (array_neg[-1] != 5) $stop;
if (array_neg[0] != 6) $stop;
if (array_neg[1] != 7) $stop;
$write("*-* All Finished *-*\n");
$finish;
end