sar*_*a r 2 regex system-verilog
据我所知,系统verilog没有很好的内置正则表达式支持。
如何在 systemVerilog 中检查 srting 是否与以下正则表达式匹配:“\d+(ns|ps|us)”
您有多种不同的选择。
\n\n一些模拟器已经支持一组处理正则表达式的 SystemVerilog 字符串方法扩展,例如 str.match() 和 str.search()。
\n\nresult = str.match(\xe2\x80\x9cpattern\xe2\x80\x9d); // returns true if the pattern is matched with the str.\nRun Code Online (Sandbox Code Playgroud)\n\n如果您使用 UVM,则有一个 DPI 例程可以执行相同的操作
\n\nresult = uvm_pkg::uvm_re_match(\xe2\x80\x9cpattern\xe2\x80\x9d,str);\nRun Code Online (Sandbox Code Playgroud)\n\n还有许多其他软件包(例如 SVunit)也为您提供 DPI 例程。
\n