Skip to content

Commit 2a4294c

Browse files
dongwsnyder
dong
authored andcommitted
Fix apostrophe parser in AUTOWIRE (#1854) (#1855).
* verilog-mode.el (verilog-read-sub-decls-expr): Fix apostrophe parser in AUTOWIRE (#1854) (#1855).
1 parent 21a1000 commit 2a4294c

File tree

3 files changed

+81
-1
lines changed

3 files changed

+81
-1
lines changed

tests/autowire_apostrophe.sv

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
module test_port0
2+
(/*AUTOARG*/);
3+
output [31:0] d[2];
4+
endmodule // test_port
5+
6+
module test_port1
7+
(/*AUTOARG*/);
8+
input [31:0] dd[2];
9+
endmodule // test_port1
10+
11+
module top()
12+
/*AUTOWIRE*/
13+
14+
/*
15+
test_port0 AUTO_TEMPLATE
16+
(
17+
.d\(.*\) ('{d_1\1[],d_2\1[]}),
18+
);
19+
*/
20+
test_port0
21+
u0(/*AUTOINST*/);
22+
23+
/*
24+
test_port1 AUTO_TEMPLATE
25+
(
26+
.d\(.*\) ('{d_1\1[],d_2\1[]}),
27+
);
28+
*/
29+
30+
test_port1
31+
u1(/*AUTOINST*/);
32+
33+
endmodule // top

tests_ok/autowire_apostrophe.sv

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
module test_port0
2+
(/*AUTOARG*/
3+
// Outputs
4+
d
5+
);
6+
output [31:0] d[2];
7+
endmodule // test_port
8+
9+
module test_port1
10+
(/*AUTOARG*/
11+
// Inputs
12+
dd
13+
);
14+
input [31:0] dd[2];
15+
endmodule // test_port1
16+
17+
module top()
18+
/*AUTOWIRE*/
19+
// Beginning of automatic wires (for undeclared instantiated-module outputs)
20+
wire [31:0] d_1; // From u0 of test_port0.v
21+
wire [31:0] d_2; // From u0 of test_port0.v
22+
// End of automatics
23+
24+
/*
25+
test_port0 AUTO_TEMPLATE
26+
(
27+
.d\(.*\) ('{d_1\1[],d_2\1[]}),
28+
);
29+
*/
30+
test_port0
31+
u0(/*AUTOINST*/
32+
// Outputs
33+
.d ('{d_1[31:0],d_2[31:0]})); // Templated
34+
35+
/*
36+
test_port1 AUTO_TEMPLATE
37+
(
38+
.d\(.*\) ('{d_1\1[],d_2\1[]}),
39+
);
40+
*/
41+
42+
test_port1
43+
u1(/*AUTOINST*/
44+
// Inputs
45+
.dd ('{d_1d[31:0],d_2d[31:0]})); // Templated
46+
47+
endmodule // top

verilog-mode.el

+1-1
Original file line numberDiff line numberDiff line change
@@ -9680,7 +9680,7 @@ Return an array of [outputs inouts inputs wire reg assign const gparam intf]."
96809680
(cond
96819681
;; {..., a, b} requires us to recurse on a,b
96829682
;; To support {#{},{#{a,b}} we'll just split everything on [{},]
9683-
((string-match "^\\s-*{\\(.*\\)}\\s-*$" expr)
9683+
((string-match "^\\s-*'?{\\(.*\\)}\\s-*$" expr)
96849684
(let ((mlst (split-string (match-string 1 expr) "[{},]"))
96859685
mstr)
96869686
(while (setq mstr (pop mlst))

0 commit comments

Comments
 (0)