System verilog 正则表达式
System verilog Regular expressions
我了解到 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 例程。
我了解到 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 例程。