@@ -12256,18 +12256,12 @@ If PAR-VALUES replace final strings with these parameter values."
12256
12256
(vl-memory (verilog-sig-memory port-st))
12257
12257
(vl-mbits (if (verilog-sig-multidim port-st)
12258
12258
(verilog-sig-multidim-string port-st) ""))
12259
- (vl-bits (if (or (eq verilog-auto-inst-vector t)
12260
- (and (eq verilog-auto-inst-vector `unsigned)
12261
- (not (verilog-sig-signed port-st)))
12262
- (not (assoc port (verilog-decls-get-signals moddecls)))
12263
- (not (equal (verilog-sig-bits port-st)
12264
- (verilog-sig-bits
12265
- (assoc port (verilog-decls-get-signals moddecls))))))
12266
- (or (verilog-sig-bits port-st) "")
12267
- ""))
12259
+ (vl-bits (or (verilog-sig-bits port-st) ""))
12268
12260
(case-fold-search nil)
12269
12261
(check-values par-values)
12270
- tpl-net dflt-bits)
12262
+ auto-inst-vector
12263
+ auto-inst-vector-tpl
12264
+ tpl-net dflt-bits)
12271
12265
;; Replace parameters in bit-width
12272
12266
(when (and check-values
12273
12267
(not (equal vl-bits "")))
@@ -12290,6 +12284,16 @@ If PAR-VALUES replace final strings with these parameter values."
12290
12284
vl-mbits (verilog-simplify-range-expression vl-mbits)
12291
12285
vl-memory (when vl-memory (verilog-simplify-range-expression vl-memory))
12292
12286
vl-width (verilog-make-width-expression vl-bits))) ; Not in the loop for speed
12287
+ (setq auto-inst-vector
12288
+ (if (or (eq verilog-auto-inst-vector t)
12289
+ (and (eq verilog-auto-inst-vector `unsigned)
12290
+ (not (verilog-sig-signed port-st)))
12291
+ (not (assoc port (verilog-decls-get-signals moddecls)))
12292
+ (not (equal (verilog-sig-bits port-st)
12293
+ (verilog-sig-bits
12294
+ (assoc port (verilog-decls-get-signals moddecls))))))
12295
+ vl-bits
12296
+ ""))
12293
12297
;; Default net value if not found
12294
12298
(setq dflt-bits (if (or (and (verilog-sig-bits port-st)
12295
12299
(verilog-sig-multidim port-st))
@@ -12299,7 +12303,7 @@ If PAR-VALUES replace final strings with these parameter values."
12299
12303
(if vl-memory "." "")
12300
12304
(if vl-memory vl-memory "")
12301
12305
"*/")
12302
- (concat vl-bits ))
12306
+ (concat auto-inst-vector ))
12303
12307
tpl-net (concat port
12304
12308
(if (and vl-modport
12305
12309
;; .modport cannot be added if attachment is
@@ -12338,10 +12342,21 @@ If PAR-VALUES replace final strings with these parameter values."
12338
12342
(if (numberp value) (setq value (number-to-string value)))
12339
12343
value))
12340
12344
(substring tpl-net (match-end 0))))))
12345
+ ;; Get range based off template net
12346
+ (setq auto-inst-vector-tpl
12347
+ (if (or (eq verilog-auto-inst-vector t)
12348
+ (and (eq verilog-auto-inst-vector `unsigned)
12349
+ (not (verilog-sig-signed port-st)))
12350
+ (not (assoc tpl-net (verilog-decls-get-signals moddecls)))
12351
+ (not (equal (verilog-sig-bits port-st)
12352
+ (verilog-sig-bits
12353
+ (assoc tpl-net (verilog-decls-get-signals moddecls))))))
12354
+ vl-bits
12355
+ ""))
12341
12356
;; Replace @ and [] magic variables in final output
12342
12357
(setq tpl-net (verilog-string-replace-matches "@" tpl-num nil nil tpl-net))
12343
12358
(setq tpl-net (verilog-string-replace-matches "\\[\\]\\[\\]" dflt-bits nil nil tpl-net))
12344
- (setq tpl-net (verilog-string-replace-matches "\\[\\]" vl-bits nil nil tpl-net)))
12359
+ (setq tpl-net (verilog-string-replace-matches "\\[\\]" auto-inst-vector-tpl nil nil tpl-net)))
12345
12360
;; Insert it
12346
12361
(when (or tpl-ass (not verilog-auto-inst-template-required))
12347
12362
(verilog--auto-inst-first indent-pt section)
0 commit comments