Skip to content

Commit c5592c9

Browse files
committed
Fix multidimensional cell/interfaces, bug1505.
1 parent d93c895 commit c5592c9

File tree

5 files changed

+38
-5
lines changed

5 files changed

+38
-5
lines changed

Changes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ indicates the contributor was also the author of the fix; Thanks!
88

99
**** Support ${} for env vars in file lists, msg3065.
1010

11+
**** Fix multidimensional cell/interfaces, bug1505. [Anderson Ignacio Da Silva]
12+
1113

1214
* Verilog::Language 3.466 2019-05-04
1315

Parser/VParseBison.y

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2210,7 +2210,7 @@ mpInstnameParen: // Similar to instnameParen, but for modport instantiations wh
22102210

22112211
mpInstname: // Similar to instname, but for modport instantiations which have no parenthesis
22122212
// // id is-a: interface_port_identifier (interface.modport)
2213-
id instRangeE { PARSEP->instantCb($<fl>1, GRAMMARP->m_cellMod, $1, $2); }
2213+
id instRangeListE { PARSEP->instantCb($<fl>1, GRAMMARP->m_cellMod, $1, $2); }
22142214
;
22152215

22162216
instnameList:
@@ -2227,13 +2227,22 @@ instname:
22272227
// // or instance_identifier (module)
22282228
// // or instance_identifier (program)
22292229
// // or udp_instance (udp)
2230-
id instRangeE '(' { PARSEP->instantCb($<fl>1, GRAMMARP->m_cellMod, $1, $2); PINPARAMS(); }
2231-
| instRangeE '(' { PARSEP->instantCb($<fl>2, GRAMMARP->m_cellMod, "", $1); PINPARAMS(); } // UDP
2230+
id instRangeListE '(' { PARSEP->instantCb($<fl>1, GRAMMARP->m_cellMod, $1, $2); PINPARAMS(); }
2231+
| instRangeListE '(' { PARSEP->instantCb($<fl>2, GRAMMARP->m_cellMod, "", $1); PINPARAMS(); } // UDP
22322232
;
22332233

2234-
instRangeE<str>:
2234+
instRangeListE<str>:
22352235
/* empty */ { $$ = ""; }
2236-
| '[' constExpr ']' { $<fl>$=$<fl>1; $$ = "["+$2+"]"; }
2236+
| instRangeList { $<fl>$=$<fl>1; $$ = $1; }
2237+
;
2238+
2239+
instRangeList<str>:
2240+
instRange { $<fl>$=$<fl>1; $$ = $1; }
2241+
| instRangeList instRange { $<fl>$=$<fl>1; $$ = $1+$2; }
2242+
;
2243+
2244+
instRange<str>:
2245+
'[' constExpr ']' { $<fl>$=$<fl>1; $$ = "["+$2+"]"; }
22372246
| '[' constExpr ':' constExpr ']' { $<fl>$=$<fl>1; $$ = "["+$2+":"+$4+"]"; }
22382247
;
22392248

t/35_sigparser.out

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,14 @@ verilog/parser_bugs.v:576: VAR 'var' 'mynet1' 'module' '' 'net1_t' '' ''
543543
verilog/parser_bugs.v:578: VAR 'var' 'mynet2' 'module' '' 'net2_t' '' ''
544544
verilog/parser_bugs.v:580: VAR 'var' 'mynet3' 'module' '' 'net3_t' '' ''
545545
verilog/parser_bugs.v:581: ENDMODULE 'endmodule'
546+
verilog/parser_bugs.v:583: MODULE 'module' 'bug1505' undef '0'
547+
verilog/parser_bugs.v:584: INSTANT 'sub' 'i_suba' ''
548+
verilog/parser_bugs.v:584: ENDCELL ''
549+
verilog/parser_bugs.v:585: INSTANT 'sub' 'i_subb' '[1:2]'
550+
verilog/parser_bugs.v:585: ENDCELL ''
551+
verilog/parser_bugs.v:586: INSTANT 'sub' 'i_subc' '[1:2][3:4][5:6]'
552+
verilog/parser_bugs.v:586: ENDCELL ''
553+
verilog/parser_bugs.v:587: ENDMODULE 'endmodule'
546554
verilog/pinorder.v:001: COMMENT '// DESCRIPTION: Verilog-Perl: Example Verilog for testing package'
547555
verilog/pinorder.v:002: COMMENT '//'
548556
verilog/pinorder.v:003: COMMENT '// This file ONLY is placed into the Public Domain, for any use,'

t/35_sigparser_ps.out

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,14 @@ verilog/parser_bugs.v:576: VAR 'var' 'mynet1' 'module' '' 'net1_t' '' ''
571571
verilog/parser_bugs.v:578: VAR 'var' 'mynet2' 'module' '' 'net2_t' '' ''
572572
verilog/parser_bugs.v:580: VAR 'var' 'mynet3' 'module' '' 'net3_t' '' ''
573573
verilog/parser_bugs.v:581: ENDMODULE 'endmodule'
574+
verilog/parser_bugs.v:583: MODULE 'module' 'bug1505' undef '0'
575+
verilog/parser_bugs.v:584: INSTANT 'sub' 'i_suba' ''
576+
verilog/parser_bugs.v:584: ENDCELL ''
577+
verilog/parser_bugs.v:585: INSTANT 'sub' 'i_subb' '[1:2]'
578+
verilog/parser_bugs.v:585: ENDCELL ''
579+
verilog/parser_bugs.v:586: INSTANT 'sub' 'i_subc' '[1:2][3:4][5:6]'
580+
verilog/parser_bugs.v:586: ENDCELL ''
581+
verilog/parser_bugs.v:587: ENDMODULE 'endmodule'
574582
verilog/pinorder.v:001: COMMENT '// DESCRIPTION: Verilog-Perl: Example Verilog for testing package'
575583
verilog/pinorder.v:002: COMMENT '//'
576584
verilog/pinorder.v:003: COMMENT '// This file ONLY is placed into the Public Domain, for any use,'

verilog/parser_bugs.v

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,3 +579,9 @@ module msg2931;
579579
nettype net_t net3_t;
580580
net3_t mynet3;
581581
endmodule
582+
583+
module bug1505;
584+
sub i_suba ();
585+
sub i_subb[1:2] ();
586+
sub i_subc[1:2][3:4][5:6] ();
587+
endmodule

0 commit comments

Comments
 (0)