Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Unable to use AUTO_TEMPLATE to match leading backslashes in module portnames #627

Closed
veripoolbot opened this issue Mar 4, 2013 · 3 comments
Labels

Comments

@veripoolbot
Copy link
Collaborator


Author Name: Robbie Adler
Original Redmine Message: 1029 from https://www.veripool.org


Hi-

I've been having a devil of a time trying to get an AUTO_TEMPLATE to match leading backslahes in my module's port names. A simple example of my module is:

aunit i_aunit (/*AUTOINST*/
		 // Outputs
		 .\a2b_data.valid 	(\a2b_data.valid ),
		 .\a2b_req.valid 	(\a2b_req.valid ),
		 .\a2t_req.valid 	(\a2t_req.valid ));

my overall goal is to rename the connected wire to a signal without a \ or . (note, as weird as this looks, this is legal verilog).

I've tried just using a \ to match the slash as well as other random multiples of 2 slashes. I've tried a regexp with a [\]. I've tried doing an exclusion regexp to match. Nothing useful is seemingly working, and it all seems to result in an AUTO_TEMPLATE parsing error. It's worth noting that .* seems to match the \ , but that's not so helpful.

Any thoughts would be much appreciated. Thanks!

-Robbie

@veripoolbot
Copy link
Collaborator Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2013-03-04T14:24:58Z


It doesn't presently accept backslashes in the wildcard part, but you can cheat and use .* to hack around this. Escaped identifiers should work fine in the high connection name part. What you might want to do is match .* then write a lisp function to strip the first \ and do whatever other sanitation you need to get rid of the escaping.

/* escape_a AUTO_TEMPLATE(                                                                                                  
            .\(.*o.*10.*\)           (\\oren10 ),                                                                           
 ); */
escape_a a (/*AUTOINST*/
            // Outputs                                                                                                      
            .\o[10]                  (\oren10 ),              // Templated                                                  
            .\o[2]                   (\o[2] ),
            // Inputs                                                                                                       
            .\i&e;                   (\i&e; ));

@veripoolbot
Copy link
Collaborator Author


Original Redmine Comment
Author Name: Robbie Adler
Original Date: 2013-03-04T19:02:36Z


I was able to answer my own question by using an exclusion regexp that got the \ followed by regexps for the other stuff that I needed. The final template is below:

/*
aunit AUTO_TEMPLATE (
.([^.A-Za-z0-9])([A-Za-z0-9_]).(.) (\2_\3),
);

*/

hope someone else finds this useful.

-Robbie

@veripoolbot
Copy link
Collaborator Author


Original Redmine Comment
Author Name: Robbie Adler
Original Date: 2013-03-04T19:04:46Z


Wilson, thanks for taking the time to reply - especially so quickly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant