我了解到 System verilog 没有很好的内置正则表达式支持。
如何在 systemVerilog 中检查 srting 是否与以下正则表达式匹配: “\d+(ns|ps|us)”
最佳答案
您有多种不同的选择。
一些模拟器已经支持一组 SystemVerilog 字符串方法扩展,用于处理正则表达式,例如 str.match() 和 str.search()。
result = str.match(“pattern”); // returns true if the pattern is matched with the str.
如果您使用 UVM,则有一个 DPI 例程可以执行相同的操作
result = uvm_pkg::uvm_re_match(“pattern”,str);
还有许多其他软件包(例如 SVunit)也为您提供 DPI 例程。
关于regex - 系统verilog正则表达式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44948561/