Vengineerの妄想(準備期間)

人生は短いけど、長いです。人生を楽しみましょう!

vmm_str_dpi.c

Verification Engineerの戯言

sv/std_lib/vmm.svファイル内に、4つのvmm_str_xxxマクロがあります。VCSでは、次のように定義されています。
    `define vmm_str_match(str, regex) str.match(regex)
    `define vmm_str_prematch(str)     str.prematch()
    `define vmm_str_postmatch(str)    str.postmatch()
    `define vmm_str_backref(str, n)   str.backref(n)
VCSでないときは、sv/std_lib/vmm_str_dpi.cファイルをライブラリにする必要があります。

そして、sv/std_lib/vmm.svファイル内の次のようにして、4つのマクロを定義しています。
    import "DPI-C" function int    vmm_str_match(input string str1, input string regex);
    import "DPI-C" function string vmm_str_prematch();
    import "DPI-C" function string vmm_str_postmatch();
    import "DPI-C" function string vmm_str_backref(int n);

    `define vmm_str_match(str, regex) vmm_str_match(str, regex)
    `define vmm_str_prematch(str)     vmm_str_prematch()
    `define vmm_str_postmatch(str)    vmm_str_postmatch()
    `define vmm_str_backref(str, n)   vmm_str_backref(n+1)
DPI-Cを使って、各関数を実装しています。

検証、Verification、SystemVerilog、VMM、Verification Methodology Manual