System verilog Regular expressions

↘锁芯ラ 提交于 2019-12-14 02:06:08

问题


I understood that System verilog does not have very good regular expression support inbuilt.

How can I check in systemVerilog that a srting matches to the following regular expressions: "\d+(ns|ps|us)"


回答1:


You have a number of different options.

Some simulators already support a set of SystemVerilog string method extensions that handle regular expressions such as str.match() and str.search().

result = str.match(“pattern”); // returns true if the pattern is matched with the str.

If you are using the UVM, there is a DPI routine that does the same thing

result = uvm_pkg::uvm_re_match(“pattern”,str);

There are number of other packages out there such as SVunit that also provide the DPI routines for you.



来源:https://stackoverflow.com/questions/44948561/system-verilog-regular-expressions

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