Main Content

このページは機械翻訳を使用して翻訳されました。最新版の英語を参照するには、ここをクリックします。

svdpiConfiguration

MATLABから UVM および SystemVerilog コンポーネントを生成するためのワークフローを構成する

R2023a 以降

    アドオンが必要です: この機能には、 ASIC Testbench for HDL Verifierアドオンが必要です。

    説明

    svdpiConfigurationオブジェクトは、MATLAB®関数からのユニバーサル検証手法 (UVM) コンポーネントまたは SystemVerilog DPI コンポーネントの作成を制御します。

    作成

    説明

    svdpiObj = svdpiConfiguration() は、シーケンシャル モジュールのsvdpiConfigurationオブジェクトを作成します。

    svdpiObj = svdpiConfiguration(ComponentKind) は、 svdpiConfigurationで指定された SystemVerilog モジュールまたは UVM コンポーネントのComponentKind オブジェクトを作成します。

    プロパティ

    すべて展開する

    コード生成

    coder.config('dll')を使用してカスタム構成オブジェクトを指定します。構成オブジェクトのビルド タイプは動的ライブラリとして設定する必要があります。coder.config (MATLAB Coder)を参照してください。

    コンポーネントの情報

    SystemVerilog DPI または UVM コンポーネント生成用の組み込みテンプレートを選択します。'template-name' として指定します。カスタマイズされたテンプレートの場合は、 'custom'を指定します。

    この構成オブジェクトを通じて、組み込みテンプレート変数の値をオーバーライドできます。オーバーライドの一般的な使用法は、型名の競合を回避して、生成されたコードと既存のテストベンチまたはコンポーネント ライブラリとの互換性を確保することです。

    すべてのテンプレートに共通するオーバーライドには次のものがあります。

    • ComponentTypeNameTestBenchTypeName — TGでComponentTypeNameおよびTestBenchTypeNameプロパティを設定してデフォルト値をオーバーライドします。 svdpiConfigurationオブジェクト。

    • ComponentPackageTypeNamesvdpiConfigurationTemplateDictionaryプロパティを設定してデフォルト値をオーバーライドします。

    オプションのテンプレート固有のオーバーライド:

    • UVM シーケンス:

      • SequenceTransTypeNameSequencerTypeNameSequenceCountSequenceFlushCountConfigObjTypeNamesvdpiConfigurationTemplateDictionaryプロパティを設定して、デフォルト値をオーバーライドします。

    • UVM 予測子:

      • InputTransTypeNameOutputTransTypeNameConfigObjTypeName — TGでTemplateDictionaryプロパティを設定してデフォルト値をオーバーライドします。 svdpiConfigurationオブジェクト。

    • UVM スコアボード:

      • InputTransTypeNameOutputTransTypeNameConfigObjTypeName — TGでTemplateDictionaryプロパティを設定してデフォルト値をオーバーライドします。 svdpiConfigurationオブジェクト。

    • PREDICTOR_INPUTSMONITOR_INPUTSCONFIG_OBJECT_INPUTSaddPortGroupオブジェクト関数を使用して、HDL ポートをグループにマップします。 svdpiConfigurationオブジェクト。

    テンプレート エンジンの詳細については、 「 SystemVerilog および UVM テンプレート エンジン 」を参照してください。

    コンポーネントの型名文字列または文字ベクトルとして指定します。dpigen関数は、この引数を使用して、生成されたコンポーネントと SystemVerilog パッケージ ファイルに名前を付けます。コンポーネント タイプ名を指定しない場合、コンポーネント タイプ名はMATLAB関数名になります。

    テストベンチの型名文字列または文字ベクトルとして指定します。dpigen関数は、この引数を使用して、生成された SystemVerilog テストベンチとその関連ファイルに名前を付けます。コンポーネント タイプ名を指定しない場合、テスト ベンチ タイプ名には MATLABテスト ベンチ関数の名前が使用されます。

    以下のコードでは、 dpigen関数は予測子コンポーネントを生成し、指定されたテストベンチ関数名 (my_tb) を使用してそのコンポーネントのテストベンチ モジュールを作成します。

    c = svdpiConfiguration('uvm-predictor');
    dpigen fooBar -testbench my_tb -config c;

    そのテストベンチ名をオーバーライドするには、目的の SystemVerilog 名を指定します。この例では、 pulse_framed_tbとして指定されています。

    c = svdpiConfiguration('uvm-predictor');
    c.TestBenchTypeName = 'pulse_framed_tb';
    dpigen fooBar -testbench my_tb -config c;

    テンプレート

    各テンプレートは、テンプレート固有の変数を宣言するテンプレート ディクショナリを定義します。これらの変数に値を、変数名の後に値が続くセル配列として割り当てます。

    テンプレート ファイルは、 %<Name>という形式のトークンをValueで展開します。名前と値は文字列または文字配列である必要があります。

    ここで、UVM コンポーネントのトランザクション タイプ名や UVM シーケンス コンポーネントのシーケンス カウントなどのデフォルトのテンプレート値をオーバーライドします。例を参照するには、 Override Template Variable Valuesに移動します。

    "例:"

    c = svdpiConfiguration('uvm-sequence');
    c.TemplateDictionary = {
         'SequenceCount',      '15',
         'SequenceFlushCount', '2',
       };

    テンプレート ファイルの次の行:

    repeat (%<SequenceCount>)

    は次のように置き換えられます。

    repeat (15)

    この プロパティ は読み取り専用です。

    ポート グループは、論理的に一緒に属する、生成されたインターフェイスのセクションを表します。以下に例を示します。

    • モジュールへのすべての入力は、組み込みテンプレートの ALL_INPUTSポート グループに属します。

    • モニターから発生する UVM スコアボード モジュールへのすべての入力は、UVM スコアボード テンプレートのMONITOR_INPUTSポート グループに属します。

    • スコアボード、シーケンス、またはプレディクターへの構成入力は、CONFIG_OBJECT_INPUTSインターフェイスに属します。

    ALL_INPUTSALL_OUTPUTSなど、いくつかの組み込みグループが存在します。テンプレートはポート グループを利用して、そのグループに固有のラッパー コードを生成します。

    ポート グループを変更するには、 addPortGroup関数またはremovePortGroup関数をそれぞれ使用します。

    たとえば、ポート グループをスコアボードに追加します。

    c = svdpiConfiguration('uvm-scoreboard');
         addPortGroup(c, 'PREDICTOR_INPUTS', {'PeakSq','Location','FilterOut_re','FilterOut_im'});
         addPortGroup(c, 'MONITOR_INPUTS', {'PeakSqImplIn','LocationImplIn',...
                         'FilterOutImpl_re','FilterOutImpl_im'}); 
         addPortGroup(c, 'CONFIG_OBJECT_INPUTS', 'pErrorPercentThreshold'); 

    テンプレート ファイルの構成オブジェクト定義には、変数のランダム化を可能にする次のコードを含めることができます。

    %<BEGIN_FOREACH_PORT CONFIG_OBJECT_INPUTS>
    %<PORT_RAND_VAR_DECL>
    %<END_FOREACH_PORT>

    モジュールまたはコンポーネントの処理時に使用するテンプレート ファイルへのパス。1 つ以上のテンプレートの cell 配列として指定します。

    テンプレート ファイルは、コンポーネントごとに複数のファイルを生成できます。テンプレート ファイルの場所と名前には、絶対パスまたは相対パスを使用できます。相対パスは絶対パスに変換されます。

    依存関係

    このプロパティを書き込むには、 ComponentKindプロパティを'custom'に設定します。それ以外の場合、このプロパティは読み取り専用です。

    コンポーネントのテストベンチを処理するときに使用するテンプレート ファイルへのパス。文字列または複数のテンプレートの cell 配列として指定します。

    テンプレート ファイルは、コンポーネントごとに複数のファイルを生成できます。ファイル名には絶対パスまたは相対パスを使用できます。相対パスは絶対パスに変換されます。

    依存関係

    このプロパティを書き込むには、 ComponentKindプロパティを'custom'に設定します。それ以外の場合、このプロパティは読み取り専用です。

    オブジェクト関数

    addPortGroupポート グループ マッピングをsvdpiConfigurationオブジェクトに追加します
    removePortGroupsvdpiConfigurationオブジェクトからポート グループ マッピングを削除します

    すべて折りたたむ

    この例では、 HDL Verifier™のデフォルト テンプレートを使用して、 sineWaveGen関数から SystemVerilog DPI (SVDPI) コンポーネントを生成する方法を示します。

    デフォルトのテンプレートを使用して SVDPI モジュールを作成する

    デフォルトのテンプレートを使用して構成オブジェクトを作成し、それをdpigen関数で使用します。生成された SystemVerilog ファイルに注目してください。

    • sineWaveGen.sv

    • sineWaveGen_pkg.sv

    c=svdpiConfiguration();
    dpigen -config c -args {0,0} sineWaveGen
    ### Generating DPI-C Wrapper /tmp/Bdoc23b_2492649_1044276/tpd2444e94/hdlverifier-ex13685125/codegen/dll/sineWaveGen/sineWaveGen_dpi.c
    ### Generating DPI-C Wrapper header file /tmp/Bdoc23b_2492649_1044276/tpd2444e94/hdlverifier-ex13685125/codegen/dll/sineWaveGen/sineWaveGen_dpi.h
    ### Generating source code file /tmp/Bdoc23b_2492649_1044276/tpd2444e94/hdlverifier-ex13685125/codegen/dll/sineWaveGen/sineWaveGen_pkg.sv from template text.
    ### Generating source code file /tmp/Bdoc23b_2492649_1044276/tpd2444e94/hdlverifier-ex13685125/codegen/dll/sineWaveGen/sineWaveGen.sv from template text.
    ### Generating makefiles for: sineWaveGen_dpi
    Code generation successful.
    

    生成されたモジュールの名前をmyDutに変更します。生成された SystemVerilog ファイルに注目してください。

    • マイダット.sv

    • マイダット_pkg.sv

    c.ComponentTypeName = 'myDut';
    dpigen -config c -args {0,0} sineWaveGen
    ### Generating DPI-C Wrapper /tmp/Bdoc23b_2492649_1044276/tpd2444e94/hdlverifier-ex13685125/codegen/dll/sineWaveGen/sineWaveGen_dpi.c
    ### Generating DPI-C Wrapper header file /tmp/Bdoc23b_2492649_1044276/tpd2444e94/hdlverifier-ex13685125/codegen/dll/sineWaveGen/sineWaveGen_dpi.h
    ### Generating source code file /tmp/Bdoc23b_2492649_1044276/tpd2444e94/hdlverifier-ex13685125/codegen/dll/sineWaveGen/myDut_pkg.sv from template text.
    ### Generating source code file /tmp/Bdoc23b_2492649_1044276/tpd2444e94/hdlverifier-ex13685125/codegen/dll/sineWaveGen/myDut.sv from template text.
    ### Generating makefiles for: sineWaveGen_dpi
    Code generation successful.
    

    テンプレートを使用して UVM プレディクターを作成する

    UVM 予測子テンプレートを使用して構成オブジェクトを作成し、それをdpigen関数で使用します。生成された SystemVerilog ファイルに注目してください。

    • predictor_input_trans.sv

    • predictor_output_trans.sv

    • sinWave_predictor_pkg.sv

    • sinWave_predictor.sv

    c = svdpiConfiguration('uvm-predictor');
    c.ComponentTypeName = 'sinWave_predictor';
    dpigen sineWaveGen -config c -args {0,0}
    ### Generating DPI-C Wrapper /tmp/Bdoc23b_2492649_1044276/tpd2444e94/hdlverifier-ex13685125/codegen/dll/sineWaveGen/sineWaveGen_dpi.c
    ### Generating DPI-C Wrapper header file /tmp/Bdoc23b_2492649_1044276/tpd2444e94/hdlverifier-ex13685125/codegen/dll/sineWaveGen/sineWaveGen_dpi.h
    ### Generating source code file /tmp/Bdoc23b_2492649_1044276/tpd2444e94/hdlverifier-ex13685125/codegen/dll/sineWaveGen/sinWave_predictor_pkg.sv from template text.
    ### Generating source code file /tmp/Bdoc23b_2492649_1044276/tpd2444e94/hdlverifier-ex13685125/codegen/dll/sineWaveGen/predictor_input_trans.sv from template text.
    ### Generating source code file /tmp/Bdoc23b_2492649_1044276/tpd2444e94/hdlverifier-ex13685125/codegen/dll/sineWaveGen/predictor_output_trans.sv from template text.
    ### Generating source code file /tmp/Bdoc23b_2492649_1044276/tpd2444e94/hdlverifier-ex13685125/codegen/dll/sineWaveGen/predictor_cfgobj.sv from template text.
    
    Warning: Port group 'CONFIG_OBJECT_INPUTS' was found in the template file but contained no ports in its list. Specify the PortGroups list using the svdpiConfiguration object.
    
    Warning: Port group 'CONFIG_OBJECT_INPUTS' was found in the template file but contained no ports in its list. Specify the PortGroups list using the svdpiConfiguration object.
    
    ### Generating source code file /tmp/Bdoc23b_2492649_1044276/tpd2444e94/hdlverifier-ex13685125/codegen/dll/sineWaveGen/sinWave_predictor.sv from template text.
    
    Warning: Port group 'CONFIG_OBJECT_INPUTS' was found in the template file but contained no ports in its list. Specify the PortGroups list using the svdpiConfiguration object.
    
    ### Generating makefiles for: sineWaveGen_dpi
    Code generation successful.
    

    テンプレート変数値を上書きする

    ここで、生成された SystemVerilog トランザクション名を変更します。

    • デフォルトのpredictor_input_transをオーバーライドし、名前をsineWaveTransに変更します。

    • デフォルトのpredictor_output_transをオーバーライドし、名前をsineWaveOutに変更します。

    テンプレート ディクショナリのInputTransTypeName変数とOutputTransTypeName変数に新しい値を割り当てるには、 TemplateDictionaryプロパティを設定します。

    c.TemplateDictionary = {
        'InputTransTypeName','sineWaveTrans',
        'OutputTransTypeName','sineWaveOut'
    };
    dpigen sineWaveGen -config c -args {0,0}
    ### Generating DPI-C Wrapper /tmp/Bdoc23b_2492649_1044276/tpd2444e94/hdlverifier-ex13685125/codegen/dll/sineWaveGen/sineWaveGen_dpi.c
    ### Generating DPI-C Wrapper header file /tmp/Bdoc23b_2492649_1044276/tpd2444e94/hdlverifier-ex13685125/codegen/dll/sineWaveGen/sineWaveGen_dpi.h
    ### Generating source code file /tmp/Bdoc23b_2492649_1044276/tpd2444e94/hdlverifier-ex13685125/codegen/dll/sineWaveGen/sinWave_predictor_pkg.sv from template text.
    ### Generating source code file /tmp/Bdoc23b_2492649_1044276/tpd2444e94/hdlverifier-ex13685125/codegen/dll/sineWaveGen/sineWaveTrans.sv from template text.
    ### Generating source code file /tmp/Bdoc23b_2492649_1044276/tpd2444e94/hdlverifier-ex13685125/codegen/dll/sineWaveGen/sineWaveOut.sv from template text.
    ### Generating source code file /tmp/Bdoc23b_2492649_1044276/tpd2444e94/hdlverifier-ex13685125/codegen/dll/sineWaveGen/predictor_cfgobj.sv from template text.
    
    Warning: Port group 'CONFIG_OBJECT_INPUTS' was found in the template file but contained no ports in its list. Specify the PortGroups list using the svdpiConfiguration object.
    
    Warning: Port group 'CONFIG_OBJECT_INPUTS' was found in the template file but contained no ports in its list. Specify the PortGroups list using the svdpiConfiguration object.
    
    ### Generating source code file /tmp/Bdoc23b_2492649_1044276/tpd2444e94/hdlverifier-ex13685125/codegen/dll/sineWaveGen/sinWave_predictor.sv from template text.
    
    Warning: Port group 'CONFIG_OBJECT_INPUTS' was found in the template file but contained no ports in its list. Specify the PortGroups list using the svdpiConfiguration object.
    
    ### Generating makefiles for: sineWaveGen_dpi
    Code generation successful.
    

    バージョン履歴

    R2023a で導入

    すべて展開する