Project

General

Profile

[logo] 
 
Home
News
Activity
About/Contact
Major Tools
  Dinotrace
  Verilator
  Verilog-mode
  Verilog-Perl
Other Tools
  IPC::Locker
  Parallel::Forker
  Voneline
General Info
  Papers

Issue #1662

How to access multiple capture groups in AUTOINST REGEXP?

Added by Shareef Jalloq 28 days ago. Updated 28 days ago.

Status:
NoFixNeeded
Priority:
Low
Assignee:
-
Category:
-
% Done:

0%


Description

Hi,

I'm wanting to pull out a number of terms from an AUTOINST regexp but can't find an example. If I have two module instance names of "u_tx0" and "u_tx1" with a regext of "_\(tx\([0-9]\)\)", I'm expecting to see two capture groups. The first would have the full "tx0" or "tx1" ; the second "0" and "1".

How do I access the second capture group? The documentation/manual talks about using multiple groups but only gives the example of using @ to get the first group.

Shareef.

History

#1 Updated by Wilson Snyder 28 days ago

  • Status changed from New to NoFixNeeded

Use backslash 1, 2, 3 etc. Please see https://github.com/veripool/verilog-mode/blob/master/FAQ.adoc#how-do-i-use-auto_template-to-match-multiple-port-names

#2 Updated by Shareef Jalloq 28 days ago

What about in the instance name rather than the ports? Or what happens if I have two lots of regex?

/* mymodule AUTO_TEMPLATE "\(tx\([0-9]+\)\)" 
.\(CTRL[0-9]+\) (@_\1[X]),
); */

In the above example, I want to replace X with the second capture group from the instance name.

I want the following:


mymodule
  u_tx5 (.CTRL0 (tx5_CTRL0[5]));

#3 Updated by Wilson Snyder 28 days ago

Sorry, thought you were referring to a template of a AUTOINST. The cell name regexp attached to the AUTOINST itself only uses \\1 as @. For anything else you need lisp code using vl-cell, see https://github.com/veripool/verilog-mode/blob/master/FAQ.adoc#how-do-i-have-auto_template-use-the-second-number-in-a-instance-name

Also available in: Atom