2

What functions do I need to call to use Regular Expressions in Systemverilog/UVM?

Note: I'm not asking how to use regular expressions, just method names.

Tudor Timi
  • 7,453
  • 1
  • 24
  • 53
Karan Shah
  • 1,912
  • 1
  • 29
  • 42
  • This isn't the type of question you ask on StackOverflow, as this is way to broad. This site is for questions to concrete problems, not for tutorials. – Tudor Timi Apr 17 '15 at 11:49
  • @Tudor Yes I know it's too broad. But I know about regex and all, I just want any of the packages or include files and method names for that purpose. – Karan Shah Apr 17 '15 at 12:15

1 Answers1

6

First, if you want to use regular expression, you'll need to make sure you're using a UVM library compiled together with its DPI code (i.e. the UVM_NO_DPI define isn't set).

The methods you want to use are located in dpi/uvm_regex.svh. The main function is uvm_re_match(...), which takes as an argument a regular expression and the string to match against. This is basically a wrapper around the regexec(...) C function found in the regex.h library. It will return 0 on a match.

Another function you might want to use is uvm_glob_to_re(...) which can convert from a glob expression (the kind you get in a Linux shell) to a true regular expression.

Tudor Timi
  • 7,453
  • 1
  • 24
  • 53