Regex in SV or UVM

你。 提交于 2019-12-19 04:22:04

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/29697147/regex-in-sv-or-uvm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!