Main Content

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

svdpiConfiguration

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

R2023a 以降

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

    説明

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

    作成

    説明

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

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

    プロパティ

    すべて展開する

    コード生成

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

    DPI コンポーネントを生成する MATLAB 関数の名前。文字ベクトルまたは文字列として指定されます。

    これはオプションのプロパティです。uvmfTestBenchConfiguration オブジェクトを使用する場合、これがこのオブジェクトに関連付けられた MATLAB 関数名を指定できる唯一の方法です。

    例: "funcName"

    データ型: char | string

    ポートの SystemVerilog データ型を次のいずれかの値として選択します。

    • CompatibleCType – ポートに互換性のある C タイプ インターフェースを生成します。

    • BitVector – ポートのビットベクター型インターフェースを生成します。

    • LogicVector – ポートのロジックベクター型インターフェースを生成します。

    このプロパティの詳細については、-PortsDataType を参照してください。

    依存関係

    このプロパティを有効にするには、ComponentKind プロパティを 'uvmf-predictor''uvmf-sequence'、または 'uvmf-custom' に設定します。

    MATLAB 関数入力のデータ型とサイズ。セル配列として指定されます。生成された DPI コンポーネントが受け入れる入力タイプを指定します。InputArgs は、各関数引数のタイプを指定するセル配列です。要素は coder.typeof を使用して型に変換されます。

    このプロパティは、codegen (MATLAB Coder) 関数の引数 args と同じ機能を持ちます。

    例: {double(0),int8(0)}

    依存関係

    このプロパティを有効にするには、ComponentKind プロパティを 'uvmf-predictor''uvmf-sequence'、または 'uvmf-custom' に設定します。

    コンポーネントの情報

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

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

    すべてのテンプレートに共通するオーバーライドは次のとおりです。

    • ComponentTypeNameTestBenchTypeNamesvdpiConfiguration オブジェクトの ComponentTypeName および TestBenchTypeName プロパティを設定してデフォルト値を上書きします。

    • ComponentPackageTypeNamesvdpiConfiguration オブジェクトの TemplateDictionary プロパティを設定してデフォルト値を上書きします。

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

    • UVMシーケンス:

      • SequenceTransTypeNameSequencerTypeNameSequenceCountSequenceFlushCountConfigObjTypeNamesvdpiConfiguration オブジェクトの TemplateDictionary プロパティを設定してデフォルト値を上書きします。

    • UVM予測:

      • InputTransTypeNameOutputTransTypeNameConfigObjTypeNamesvdpiConfiguration オブジェクトの TemplateDictionary プロパティを設定してデフォルト値を上書きします。

    • UVM スコアボード:

      • InputTransTypeNameOutputTransTypeNameConfigObjTypeNamesvdpiConfiguration オブジェクトの TemplateDictionary プロパティを設定してデフォルト値を上書きします。

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

    テンプレート エンジンの詳細については、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 シーケンス コンポーネントのシーケンス数などのデフォルトのテンプレート値を上書きします。例を確認するには、テンプレート変数値の上書き に進んでください。

    例:

    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 つ以上のテンプレートのセル配列として指定されます。

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

    依存関係

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

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

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

    依存関係

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

    オブジェクト関数

    addPortGroupsvdpiConfiguration オブジェクトにポート グループ マッピングを追加する
    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/Bdoc24a_2589924_894856/tpcc27045f/hdlverifier-ex13685125/codegen/dll/sineWaveGen/sineWaveGen_dpi.c
    ### Generating DPI-C Wrapper header file /tmp/Bdoc24a_2589924_894856/tpcc27045f/hdlverifier-ex13685125/codegen/dll/sineWaveGen/sineWaveGen_dpi.h
    ### Generating source code file /tmp/Bdoc24a_2589924_894856/tpcc27045f/hdlverifier-ex13685125/codegen/dll/sineWaveGen/sineWaveGen_pkg.sv from template text.
    ### Generating source code file /tmp/Bdoc24a_2589924_894856/tpcc27045f/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/Bdoc24a_2589924_894856/tpcc27045f/hdlverifier-ex13685125/codegen/dll/sineWaveGen/sineWaveGen_dpi.c
    ### Generating DPI-C Wrapper header file /tmp/Bdoc24a_2589924_894856/tpcc27045f/hdlverifier-ex13685125/codegen/dll/sineWaveGen/sineWaveGen_dpi.h
    ### Generating source code file /tmp/Bdoc24a_2589924_894856/tpcc27045f/hdlverifier-ex13685125/codegen/dll/sineWaveGen/myDut_pkg.sv from template text.
    ### Generating source code file /tmp/Bdoc24a_2589924_894856/tpcc27045f/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/Bdoc24a_2589924_894856/tpcc27045f/hdlverifier-ex13685125/codegen/dll/sineWaveGen/sineWaveGen_dpi.c
    ### Generating DPI-C Wrapper header file /tmp/Bdoc24a_2589924_894856/tpcc27045f/hdlverifier-ex13685125/codegen/dll/sineWaveGen/sineWaveGen_dpi.h
    ### Generating source code file /tmp/Bdoc24a_2589924_894856/tpcc27045f/hdlverifier-ex13685125/codegen/dll/sineWaveGen/sinWave_predictor_pkg.sv from template text.
    ### Generating source code file /tmp/Bdoc24a_2589924_894856/tpcc27045f/hdlverifier-ex13685125/codegen/dll/sineWaveGen/predictor_input_trans.sv from template text.
    ### Generating source code file /tmp/Bdoc24a_2589924_894856/tpcc27045f/hdlverifier-ex13685125/codegen/dll/sineWaveGen/predictor_output_trans.sv from template text.
    ### Generating source code file /tmp/Bdoc24a_2589924_894856/tpcc27045f/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/Bdoc24a_2589924_894856/tpcc27045f/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/Bdoc24a_2589924_894856/tpcc27045f/hdlverifier-ex13685125/codegen/dll/sineWaveGen/sineWaveGen_dpi.c
    ### Generating DPI-C Wrapper header file /tmp/Bdoc24a_2589924_894856/tpcc27045f/hdlverifier-ex13685125/codegen/dll/sineWaveGen/sineWaveGen_dpi.h
    ### Generating source code file /tmp/Bdoc24a_2589924_894856/tpcc27045f/hdlverifier-ex13685125/codegen/dll/sineWaveGen/sinWave_predictor_pkg.sv from template text.
    ### Generating source code file /tmp/Bdoc24a_2589924_894856/tpcc27045f/hdlverifier-ex13685125/codegen/dll/sineWaveGen/sineWaveTrans.sv from template text.
    ### Generating source code file /tmp/Bdoc24a_2589924_894856/tpcc27045f/hdlverifier-ex13685125/codegen/dll/sineWaveGen/sineWaveOut.sv from template text.
    ### Generating source code file /tmp/Bdoc24a_2589924_894856/tpcc27045f/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/Bdoc24a_2589924_894856/tpcc27045f/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 で導入

    すべて展開する