Fix dotted reference in delay value (#2410).

This commit is contained in:
Wilson Snyder 2024-11-10 10:23:29 -05:00
parent 0ec025c40c
commit 7f1aae640f
4 changed files with 56 additions and 23 deletions

View File

@ -21,6 +21,7 @@ Verilator 5.031 devel
* Add error when improperly storing to parameter (#5147). [Gökçe Aydos]
* Add coverage point hierarchy to coverage reports (#5575) (#5576). [Andrew Nolte]
* Add error on `solve before` or soft constraints of `randc` variable.
* Fix dotted reference in delay value (#2410).
* Fix can't locate scope error in interface task delayed assignment (#5462) (#5568). [Zhou Shen]
* Fix BLKANDNBLK for for VARXREFs (#5569). [Todd Strader]
* Fix VPI error instead of fatal for vpi_get_value() on large signals (#5571). [Todd Strader]

View File

@ -3075,7 +3075,7 @@ delay_control<delayp>: //== IEEE: delay_control
delay_value<nodeExprp>: // ==IEEE:delay_value
// // IEEE: ps_identifier
packageClassScopeE varRefBase { $$ = AstDot::newIfPkg($<fl>2, $1, $2); }
idClass { $$ = $1; }
| yaINTNUM { $$ = new AstConst{$<fl>1, *$1}; }
| yaFLOATNUM { $$ = new AstConst{$<fl>1, AstConst::RealDouble{}, $1}; }
| timeNumAdjusted { $$ = $1; }
@ -5810,7 +5810,7 @@ idSVKwd<strp>: // Warn about non-forward compatible Verilog 200
{ static string s = "final"; $$ = &s; ERRSVKWD($1, *$$); $<fl>$ = $<fl>1; }
;
variable_lvalue<nodeExprp>: // IEEE: variable_lvalue or net_lvalue
variable_lvalue<nodeExprp>: // IEEE: variable_lvalue or net_lvalue
// // Note many variable_lvalue's must use exprOkLvalue when arbitrary expressions may also exist
idClassSel { $$ = $1; }
| '{' variable_lvalueConcList '}' { $$ = $2; }
@ -5832,8 +5832,19 @@ variable_lvalueConcList<nodeExprp>: // IEEE: part of variable_lvalue: '{' variab
//UNSUP | variable_lvalueList ',' variable_lvalue { $$ = addNextNull($1, $3); }
//UNSUP ;
// VarRef to dotted, and/or arrayed, and/or bit-ranged variable
idClassSel<nodeExprp>: // Misc Ref to dotted, and/or arrayed, and/or bit-ranged variable
idClass<nodeExprp>: // Misc Ref to dotted, and/or arrayed, and/or bit-ranged variable
idDotted { $$ = $1; }
// // IEEE: [ implicit_class_handle . | package_scope ] hierarchical_variable_identifier select
| yTHIS '.' idDotted
{ $$ = new AstDot{$2, false, new AstParseRef{$<fl>1, VParseRefExp::PX_ROOT, "this"}, $3}; }
| ySUPER '.' idDotted
{ $$ = new AstDot{$2, false, new AstParseRef{$<fl>1, VParseRefExp::PX_ROOT, "super"}, $3}; }
| yTHIS '.' ySUPER '.' idDotted { $$ = $5; BBUNSUP($1, "Unsupported: this.super"); }
// // Expanded: package_scope idDottedSel
| packageClassScope idDotted { $$ = new AstDot{$<fl>2, true, $1, $2}; }
;
idClassSel<nodeExprp>: // Misc Ref to dotted, and/or arrayed, and/or bit-ranged variable
idDottedSel { $$ = $1; }
// // IEEE: [ implicit_class_handle . | package_scope ] hierarchical_variable_identifier select
| yTHIS '.' idDottedSel
@ -5857,6 +5868,12 @@ idClassSelForeach<nodeExprp>:
| packageClassScope idDottedForeach { $$ = new AstDot{$<fl>2, true, $1, $2}; }
;
idDotted<nodeExprp>:
yD_ROOT '.' idDottedMore
{ $$ = new AstDot{$2, false, new AstParseRef{$<fl>1, VParseRefExp::PX_ROOT, "$root"}, $3}; }
| idDottedMore { $$ = $1; }
;
idDottedSel<nodeExprp>:
yD_ROOT '.' idDottedSelMore
{ $$ = new AstDot{$2, false, new AstParseRef{$<fl>1, VParseRefExp::PX_ROOT, "$root"}, $3}; }
@ -5869,6 +5886,11 @@ idDottedForeach<nodeExprp>:
| idDottedMoreForeach { $$ = $1; }
;
idDottedMore<nodeExprp>:
varRefBase { $$ = $1; }
| idDottedMore '.' varRefBase { $$ = new AstDot{$2, false, $1, $3}; }
;
idDottedSelMore<nodeExprp>:
idArrayed { $$ = $1; }
| idDottedSelMore '.' idArrayed { $$ = new AstDot{$2, false, $1, $3}; }

View File

@ -18,12 +18,14 @@ module t (/*AUTOARG*/
wire [31:0] dly1;
wire [31:0] dly2 = dly1 + 32'h1;
wire [31:0] dly3;
wire [31:0] dly4;
typedef struct packed { int dly; } dly_s_t;
dly_s_t dly_s;
assign #(1.2000000000000000) dly1 = dly0 + 32'h1;
assign #(sub.delay) dly3 = dly1 + 1;
assign #sub.delay dly4 = dly1 + 1;
sub sub();

View File

@ -1,39 +1,47 @@
%Warning-ASSIGNDLY: t/t_delay.v:25:11: Ignoring timing control on this assignment/primitive due to --no-timing
%Warning-ASSIGNDLY: t/t_delay.v:26:11: Ignoring timing control on this assignment/primitive due to --no-timing
: ... note: In instance 't'
25 | assign #(1.2000000000000000) dly1 = dly0 + 32'h1;
26 | assign #(1.2000000000000000) dly1 = dly0 + 32'h1;
| ^
... For warning description see https://verilator.org/warn/ASSIGNDLY?v=latest
... Use "/* verilator lint_off ASSIGNDLY */" and lint_on around source to disable this message.
%Warning-ASSIGNDLY: t/t_delay.v:26:11: Ignoring timing control on this assignment/primitive due to --no-timing
%Warning-ASSIGNDLY: t/t_delay.v:27:11: Ignoring timing control on this assignment/primitive due to --no-timing
: ... note: In instance 't'
26 | assign #(sub.delay) dly3 = dly1 + 1;
27 | assign #(sub.delay) dly3 = dly1 + 1;
| ^
%Warning-ASSIGNDLY: t/t_delay.v:33:18: Ignoring timing control on this assignment/primitive due to --no-timing
%Warning-ASSIGNDLY: t/t_delay.v:28:11: Ignoring timing control on this assignment/primitive due to --no-timing
: ... note: In instance 't'
33 | dly0 <= #0 32'h11;
| ^
%Warning-ASSIGNDLY: t/t_delay.v:36:18: Ignoring timing control on this assignment/primitive due to --no-timing
28 | assign #sub.delay dly4 = dly1 + 1;
| ^
%Warning-ASSIGNDLY: t/t_delay.v:35:18: Ignoring timing control on this assignment/primitive due to --no-timing
: ... note: In instance 't'
36 | dly0 <= #0.12 dly0 + 32'h12;
35 | dly0 <= #0 32'h11;
| ^
%Warning-ASSIGNDLY: t/t_delay.v:44:18: Ignoring timing control on this assignment/primitive due to --no-timing
%Warning-ASSIGNDLY: t/t_delay.v:38:18: Ignoring timing control on this assignment/primitive due to --no-timing
: ... note: In instance 't'
44 | dly0 <= #(dly_s.dly) 32'h55;
38 | dly0 <= #0.12 dly0 + 32'h12;
| ^
%Warning-STMTDLY: t/t_delay.v:50:10: Ignoring delay on this statement due to --no-timing
%Warning-ASSIGNDLY: t/t_delay.v:46:18: Ignoring timing control on this assignment/primitive due to --no-timing
: ... note: In instance 't'
46 | dly0 <= #(dly_s.dly) 32'h55;
| ^
%Warning-STMTDLY: t/t_delay.v:52:10: Ignoring delay on this statement due to --no-timing
: ... note: In instance 't'
50 | #100 $finish;
52 | #100 $finish;
| ^
%Warning-UNUSEDSIGNAL: t/t_delay.v:23:12: Signal is not used: 'dly_s'
%Warning-UNUSEDSIGNAL: t/t_delay.v:21:16: Signal is not used: 'dly4'
: ... note: In instance 't'
23 | dly_s_t dly_s;
21 | wire [31:0] dly4;
| ^~~~
%Warning-UNUSEDSIGNAL: t/t_delay.v:24:12: Signal is not used: 'dly_s'
: ... note: In instance 't'
24 | dly_s_t dly_s;
| ^~~~~
%Warning-UNUSEDSIGNAL: t/t_delay.v:57:13: Signal is not used: 'delay'
%Warning-UNUSEDSIGNAL: t/t_delay.v:59:13: Signal is not used: 'delay'
: ... note: In instance 't.sub'
57 | realtime delay = 2.3;
59 | realtime delay = 2.3;
| ^~~~~
%Warning-BLKSEQ: t/t_delay.v:43:20: Blocking assignment '=' in sequential logic process
%Warning-BLKSEQ: t/t_delay.v:45:20: Blocking assignment '=' in sequential logic process
: ... Suggest using delayed assignment '<='
43 | dly_s.dly = 55;
45 | dly_s.dly = 55;
| ^
%Error: Exiting due to