このページは機械翻訳を使用して翻訳されました。最新版の英語を参照するには、ここをクリックします。
UVM テストベンチでシーケンスにランダム制約を追加する
この例では、 Simulink®から生成されたユニバーサル検証手法 (UVM) テストベンチに制約付きランダム検証を追加する方法を示します。Simulinkパラメーターとスティミュラス生成への入力ポートの両方により、UVM テストベンチでランダム化可能なシーケンス クラス データ メンバーが生成されます。標準の UVM クラス継承とファクトリ オーバーライドを通じて、設計検証エンジニアは、新しく価値のある制約付きランダム テスト ケースを UVM テスト スイートに追加できます。
設計の説明と UVM テストベンチ生成の背景については、サンプルSimulinkからパラメーター化された UVM テストベンチを生成を参照してください。
UVM テストベンチの生成
まず、プロジェクトとモデルを開きます。
openProject('pulsedetector_proj'); model = 'pulsedetector_tb'; open_system(model);
この例のデフォルトの UVM テストベンチを生成するには、次を実行します。
design = [model '/PulseDetector']; sequence = [model '/GenPulse']; scoreboard = [model '/CheckDetection']; predictor = [model '/PulseDetectorRef']; driver = [model '/InputDriver']; monitor = [model '/OutputMonitor']; uvmbuild(design, sequence, scoreboard, Predictor=predictor, Driver=driver, Monitor=monitor);
### Starting DPI subsystem generation for UVM test bench ### Starting build procedure for model: PulseDetector ### Starting SystemVerilog DPI Component Generation ### Generating DPI H Wrapper PulseDetector_dpi.h ### Generating DPI C Wrapper PulseDetector_dpi.c ### Generating UVM module package PulseDetector_dpi_pkg.sv ### Generating SystemVerilog module PulseDetector_dpi.sv ### Generating makefiles for: PulseDetector_dpi ### Invoking make to build the DPI Shared Library ### Successful completion of build procedure for model: PulseDetector Build Summary Top model targets built: Model Action Rebuild Reason =============================================================================================== PulseDetector Code generated and compiled. Code generation information file does not exist. 1 of 1 models built (0 models already up to date) Build duration: 0h 1m 33.3774039999992s ### Starting build procedure for model: GenPulse ### Starting SystemVerilog DPI Component Generation ### Generating DPI H Wrapper GenPulse_dpi.h ### Generating DPI C Wrapper GenPulse_dpi.c ### Generating UVM module package GenPulse_dpi_pkg.sv ### Generating SystemVerilog module GenPulse_dpi.sv ### Generating makefiles for: GenPulse_dpi ### Invoking make to build the DPI Shared Library ### Successful completion of build procedure for model: GenPulse Build Summary Top model targets built: Model Action Rebuild Reason ========================================================================================== GenPulse Code generated and compiled. Code generation information file does not exist. 1 of 1 models built (0 models already up to date) Build duration: 0h 0m 37.1534900000021s ### Starting build procedure for model: InputDriver ### Starting SystemVerilog DPI Component Generation ### Generating DPI H Wrapper InputDriver_dpi.h ### Generating DPI C Wrapper InputDriver_dpi.c ### Generating UVM module package InputDriver_dpi_pkg.sv ### Generating SystemVerilog module InputDriver_dpi.sv ### Generating makefiles for: InputDriver_dpi ### Invoking make to build the DPI Shared Library ### Successful completion of build procedure for model: InputDriver Build Summary Top model targets built: Model Action Rebuild Reason ============================================================================================= InputDriver Code generated and compiled. Code generation information file does not exist. 1 of 1 models built (0 models already up to date) Build duration: 0h 0m 24.3891730000004s ### Starting build procedure for model: OutputMonitor ### Starting SystemVerilog DPI Component Generation ### Generating DPI H Wrapper OutputMonitor_dpi.h ### Generating DPI C Wrapper OutputMonitor_dpi.c ### Generating UVM module package OutputMonitor_dpi_pkg.sv ### Generating SystemVerilog module OutputMonitor_dpi.sv ### Generating makefiles for: OutputMonitor_dpi ### Invoking make to build the DPI Shared Library ### Successful completion of build procedure for model: OutputMonitor Build Summary Top model targets built: Model Action Rebuild Reason =============================================================================================== OutputMonitor Code generated and compiled. Code generation information file does not exist. 1 of 1 models built (0 models already up to date) Build duration: 0h 0m 21.6421199999973s ### Starting build procedure for model: CheckDetection ### Starting SystemVerilog DPI Component Generation ### Generating DPI H Wrapper CheckDetection_dpi.h ### Generating DPI C Wrapper CheckDetection_dpi.c ### Generating UVM module package CheckDetection_dpi_pkg.sv ### Generating SystemVerilog module CheckDetection_dpi.sv ### Generating makefiles for: CheckDetection_dpi ### Invoking make to build the DPI Shared Library ### Successful completion of build procedure for model: CheckDetection Build Summary Top model targets built: Model Action Rebuild Reason ================================================================================================ CheckDetection Code generated and compiled. Code generation information file does not exist. 1 of 1 models built (0 models already up to date) Build duration: 0h 0m 46.7670979999974s ### Starting build procedure for model: PulseDetectorRef ### Starting SystemVerilog DPI Component Generation ### Generating DPI H Wrapper PulseDetectorRef_dpi.h ### Generating DPI C Wrapper PulseDetectorRef_dpi.c ### Generating UVM module package PulseDetectorRef_dpi_pkg.sv ### Generating SystemVerilog module PulseDetectorRef_dpi.sv ### Generating makefiles for: PulseDetectorRef_dpi ### Invoking make to build the DPI Shared Library ### Successful completion of build procedure for model: PulseDetectorRef Build Summary Top model targets built: Model Action Rebuild Reason ================================================================================================== PulseDetectorRef Code generated and compiled. Code generation information file does not exist. 1 of 1 models built (0 models already up to date) Build duration: 0h 0m 23.1728219999969s ### Starting UVM test bench generation for model: pulsedetector_tb ### Generating UVM transaction object ./uvm_build/pulsedetector_tb_uvm_testbench/scoreboard/mw_PulseDetector_scoreboard_trans.sv ### Generating UVM interface ./uvm_build/pulsedetector_tb_uvm_testbench/uvm_artifacts/mw_PulseDetector_if.sv ### Generating UVM sequence ./uvm_build/pulsedetector_tb_uvm_testbench/sequence/mw_PulseDetector_sequence.sv ### Generating UVM sequencer ./uvm_build/pulsedetector_tb_uvm_testbench/sequence/mw_PulseDetector_sequencer.sv ### Generating UVM sequence transaction ./uvm_build/pulsedetector_tb_uvm_testbench/sequence/mw_PulseDetector_sequence_trans.sv ### Generating UVM driver ./uvm_build/pulsedetector_tb_uvm_testbench/driver/mw_PulseDetector_driver.sv ### Generating UVM monitor ./uvm_build/pulsedetector_tb_uvm_testbench/monitor/mw_PulseDetector_monitor.sv ### Generating UVM input monitor ./uvm_build/pulsedetector_tb_uvm_testbench/uvm_artifacts/mw_PulseDetector_monitor_input.sv ### Generating UVM Reference Model ./uvm_build/pulsedetector_tb_uvm_testbench/predictor/mw_PulseDetector_predictor.sv ### Generating UVM transaction object ./uvm_build/pulsedetector_tb_uvm_testbench/predictor/mw_PulseDetector_predictor_trans.sv ### Generating UVM agent ./uvm_build/pulsedetector_tb_uvm_testbench/uvm_artifacts/mw_PulseDetector_agent.sv ### Generating UVM scoreboard ./uvm_build/pulsedetector_tb_uvm_testbench/scoreboard/mw_PulseDetector_scoreboard.sv ### Generating UVM scoreboard configuration object ./uvm_build/pulsedetector_tb_uvm_testbench/scoreboard/mw_PulseDetector_scoreboard_cfg_obj.sv ### Generating UVM environment ./uvm_build/pulsedetector_tb_uvm_testbench/uvm_artifacts/mw_PulseDetector_environment.sv ### Generating UVM test ./uvm_build/pulsedetector_tb_uvm_testbench/uvm_artifacts/mw_PulseDetector_test.sv ### Generating UVM top ./uvm_build/pulsedetector_tb_uvm_testbench/top/mw_PulseDetector_top.sv ### Generating UVM test package ./uvm_build/pulsedetector_tb_uvm_testbench/top/pulsedetector_tb_pkg.sv ### Generating UVM test bench simulation script for Mentor Graphics QuestaSim/Modelsim ./uvm_build/pulsedetector_tb_uvm_testbench/top/run_tb_mq.do ### Generating UVM test bench simulation script for Cadence Xcelium ./uvm_build/pulsedetector_tb_uvm_testbench/top/run_tb_xcelium.sh ### Generating UVM test bench simulation script for Synopsys VCS ./uvm_build/pulsedetector_tb_uvm_testbench/top/run_tb_vcs.sh
パルスジェネレータのパラメータ化
モデルでは、刺激の生成は、パルス位置のダイアログ ボックスパラメーターと信号対雑音比 (SNR) の入力ポートを使用してパラメーター化されます。生成された UVM では、これらのパラメーターは、モデルからの情報を反映する制約を持つmw_PulseDetector_sequence
クラスのデータ メンバーです。
mw_PulseDetector_sequence.sv
を参照してください。
Simulinkとしてのパルス位置。パラメーター
pPulseLocation
:GenPulse
サブシステムのこのダイアログ ボックスパラメーターは、より大きな 5000 サンプル フレーム内の 64 サンプル パルスの開始位置を示します。SystemVerilog 環境でパラメーター値を保持するには、Simulink.Parameter
を使用します。このパラメーターのデフォルト値は 2100 で、有効範囲は [0, 4936] です。(パルスは完全に 5000 サンプルのフレーム内にある必要があります。)
生成された UVM コードでは、次のコード スニペットに示すように、パルス位置シーケンス メンバーにデフォルト値と最小値と最大値の範囲の 2 つの制約が設定されます。
入力ポートとしての SNR
SNR ポート:生成サブシステムへのこの入力ポートは、生成されたパルスと生成されたノイズの全体的な大きさの関係を示します。そのデータ型は、固有範囲が [0, 3.984375] の
ufix8_En6
固定小数点数です。ポート自体には、より制限された範囲[0, 2.984375] が与えられており、これは固定小数点ビット値 0b00_000000、0b10_111111 に対応します。
端子は入力端子であるため、 Simulinkにはデフォルト値の概念がありません。生成された UVM コードでは、最小値、最大範囲と最小値に一致するデフォルト値の 2 つの制約がシーケンス メンバーに設定されます。プラス引数によるコマンドラインのデフォルト値のオーバーライドをサポートするコードも追加されています。以下に例を示します。
デフォルトの UVM シミュレーション動作
デフォルトのシーケンス生成body()
は、許可を取得し、シーケンス項目をランダム化し、シーケンサーに送信し、完了を待つという通常のパターンに従います。
この例には、Questa® を実行するためのMathWorks固有のセットアップが含まれています。HDL シミュレーターのインストールに一致するようにコマンドを調整します。
current_simulator = 'Questa';
setup_questa();
次に、UVM シミュレーションに影響を与える環境変数をクリアします。
setenv EXTRA_UVM_SIM_ARGS setenv EXTRA_UVM_COMP_ARGS setenv UVM_TOP_MODULE
デフォルト値の制約のため、デフォルトのテストを実行すると、パラメーターに固定値が使用されます。このモデルの場合、これはパルス開始位置が 2100、SNR が 0.0 であることを意味します。SNR が 0.0 の場合、パルスは検出されないため、plusarg はより興味深いデフォルト値を指定します。固定小数点ビット値 8'b10000000 は、浮動小数点値 2.0 です。
cd uvm_build/pulsedetector_tb_uvm_testbench/top % Simulate with an SNR of 2.0 setenv EXTRA_UVM_SIM_ARGS '+SNR_default_inp_val=10000000' switch current_simulator case 'Questa', ! vsim -c -do run_tb_mq.do case 'Questa_gui', ! vsim -do run_tb_mq.do case 'Xcelium', ! ./run_tb_xcelium.sh case 'VCS', ! ./run_tb_vcs.sh end
Reading pref.tcl # 2022.2 # do run_tb_mq.do # +SNR_default_inp_val=10000000 # mw_PulseDetector_top.sv # QuestaSim-64 vlog 2022.2 Compiler 2022.04 Apr 25 2022 # Start time: 16:16:36 on Jun 16,2023 # vlog -timescale 1ns/1ns ../DPI_dut/PulseDetector_dpi_pkg.sv ../sequence/GenPulse_dpi_pkg.sv ../scoreboard/CheckDetection_dpi_pkg.sv ../driver/InputDriver_dpi_pkg.sv ../monitor/OutputMonitor_dpi_pkg.sv ../predictor/PulseDetectorRef_dpi_pkg.sv pulsedetector_tb_pkg.sv mw_PulseDetector_top.sv "+define+MG_SIM" # -- Compiling package PulseDetector_dpi_pkg # -- Compiling package GenPulse_dpi_pkg # -- Compiling package CheckDetection_dpi_pkg # -- Compiling package InputDriver_dpi_pkg # -- Compiling package OutputMonitor_dpi_pkg # -- Compiling package PulseDetectorRef_dpi_pkg # ** Note: (vlog-2286) pulsedetector_tb_pkg.sv(5): Using implicit +incdir+/mathworks/hub/3rdparty/R2023a/8709182/share/Questasim/Lin/uvm-1.1d/../verilog_src/uvm-1.1d/src from import uvm_pkg # -- Compiling package pulsedetector_tb_pkg # -- Importing package mtiUvm.uvm_pkg (uvm-1.1d Built-in) # -- Importing package GenPulse_dpi_pkg # -- Importing package CheckDetection_dpi_pkg # -- Importing package PulseDetectorRef_dpi_pkg # -- Importing package InputDriver_dpi_pkg # -- Importing package OutputMonitor_dpi_pkg # ** Warning: ** while parsing file included at mw_PulseDetector_top.sv(5) # ** at ../DPI_dut/PulseDetector_dpi.sv(15): (vlog-13314) Defaulting port 'coeff_in' kind to 'var' rather than 'wire' due to default compile option setting of -svinputport=relaxed. # -- Compiling package mw_PulseDetector_top_sv_unit # -- Importing package PulseDetector_dpi_pkg # -- Importing package pulsedetector_tb_pkg # -- Compiling module PulseDetector_dpi # ** Warning: ../DPI_dut/PulseDetector_dpi.sv(15): (vlog-13314) Defaulting port 'coeff_in' kind to 'var' rather than 'wire' due to default compile option setting of -svinputport=relaxed. # -- Compiling interface mw_PulseDetector_if # -- Compiling module mw_PulseDetector_top # # Top level modules: # mw_PulseDetector_top # End time: 16:16:36 on Jun 16,2023, Elapsed time: 0:00:00 # Errors: 0, Warnings: 2 # vsim "+SNR_default_inp_val=10000000" -L work -voptargs="+acc" -sv_lib ../DPI_dut/PulseDetector -sv_lib ../sequence/GenPulse -sv_lib ../scoreboard/CheckDetection -sv_lib ../driver/InputDriver -sv_lib ../monitor/OutputMonitor -sv_lib ../predictor/PulseDetectorRef "+UVM_TESTNAME=mw_PulseDetector_test" mw_PulseDetector_top "+define+MG_SIM" # Start time: 16:16:36 on Jun 16,2023 # ** Note: (vsim-3812) Design is being optimized... # ** Warning: (vopt-10587) Some optimizations are turned off because the +acc switch is in effect. This will cause your simulation to run slowly. Please use -access/-debug to maintain needed visibility. # ** Warning: ../DPI_dut/PulseDetector_dpi.sv(15): (vopt-13314) Defaulting port 'coeff_in' kind to 'var' rather than 'wire' due to default compile option setting of -svinputport=relaxed. # ** Note: (vsim-12126) Error and warning message counts have been restored: Errors=0, Warnings=2. # // Questa Sim-64 # // Version 2022.2 linux_x86_64 Apr 25 2022 # // # // Copyright 1991-2022 Mentor Graphics Corporation # // All Rights Reserved. # // # // QuestaSim and its associated documentation contain trade # // secrets and commercial or financial information that are the property of # // Mentor Graphics Corporation and are privileged, confidential, # // and exempt from disclosure under the Freedom of Information Act, # // 5 U.S.C. Section 552. Furthermore, this information # // is prohibited from disclosure under the Trade Secrets Act, # // 18 U.S.C. Section 1905. # // # Loading sv_std.std # Loading work.mw_PulseDetector_if(fast) # Loading work.OutputMonitor_dpi_pkg(fast) # Loading work.InputDriver_dpi_pkg(fast) # Loading work.PulseDetectorRef_dpi_pkg(fast) # Loading work.CheckDetection_dpi_pkg(fast) # Loading work.GenPulse_dpi_pkg(fast) # Loading mtiUvm.uvm_pkg(fast) # Loading work.pulsedetector_tb_pkg(fast) # Loading work.PulseDetector_dpi_pkg(fast) # Loading work.mw_PulseDetector_top_sv_unit(fast) # Loading mtiUvm.questa_uvm_pkg(fast) # Loading work.mw_PulseDetector_top(fast) # Loading work.mw_PulseDetector_if(fast__2) # Loading work.PulseDetector_dpi(fast) # Loading ./../DPI_dut/PulseDetector.so # Loading ./../sequence/GenPulse.so # Loading ./../scoreboard/CheckDetection.so # Loading ./../driver/InputDriver.so # Loading ./../monitor/OutputMonitor.so # Loading ./../predictor/PulseDetectorRef.so # Loading /mathworks/hub/3rdparty/R2023a/8709182/share/Questasim/Lin/uvm-1.1d/linux_x86_64/uvm_dpi.so # ---------------------------------------------------------------- # UVM-1.1d # (C) 2007-2013 Mentor Graphics Corporation # (C) 2007-2013 Cadence Design Systems, Inc. # (C) 2006-2013 Synopsys, Inc. # (C) 2011-2013 Cypress Semiconductor Corp. # ---------------------------------------------------------------- # # *********** IMPORTANT RELEASE NOTES ************ # # You are using a version of the UVM library that has been compiled # with `UVM_NO_DEPRECATED undefined. # See http://www.eda.org/svdb/view.php?id=3313 for more details. # # You are using a version of the UVM library that has been compiled # with `UVM_OBJECT_MUST_HAVE_CONSTRUCTOR undefined. # See http://www.eda.org/svdb/view.php?id=3770 for more details. # # (Specify +UVM_NO_RELNOTES to turn off this notice) # # UVM_INFO verilog_src/questa_uvm_pkg-1.2/src/questa_uvm_pkg.sv(277) @ 0: reporter [Questa UVM] QUESTA_UVM-1.2.3 # UVM_INFO verilog_src/questa_uvm_pkg-1.2/src/questa_uvm_pkg.sv(278) @ 0: reporter [Questa UVM] questa_uvm::init(+struct) # UVM_INFO @ 0: reporter [RNTST] Running test mw_PulseDetector_test... # ** Info: Gathering coverage for 2 Simulink verify() calls. # Time: 0 ns Scope: CheckDetection_dpi_pkg.VerifyInterfaceT.initVerifyInfo File: ../scoreboard/CheckDetection_dpi_pkg.sv Line: 251 # # [FrameNum= 0] No peak found in Ref or Impl. # # [FrameNum= 1] PREDICTED: Peak location=2163.000000, mag-squared=0.280 using global max # # [FrameNum= 1] ACTUAL : Peak location=2170.000000, mag-squared=0.285 using global max # # [FrameNum= 1] DIFF : Peak location=7, mag-squared=0.004 (1.551%) # # [FrameNum= 2] PREDICTED: Peak location=2163.000000, mag-squared=0.200 using global max # # [FrameNum= 2] ACTUAL : Peak location=2170.000000, mag-squared=0.194 using global max # # [FrameNum= 2] DIFF : Peak location=7, mag-squared=0.006 (2.881%) # # [FrameNum= 3] PREDICTED: Peak location=2163.000000, mag-squared=0.224 using global max # # [FrameNum= 3] ACTUAL : Peak location=2170.000000, mag-squared=0.234 using global max # # [FrameNum= 3] DIFF : Peak location=7, mag-squared=0.010 (4.623%) # # [FrameNum= 4] PREDICTED: Peak location=2163.000000, mag-squared=0.200 using global max # # [FrameNum= 4] ACTUAL : Peak location=2170.000000, mag-squared=0.209 using global max # # [FrameNum= 4] DIFF : Peak location=7, mag-squared=0.009 (4.346%) # # [FrameNum= 5] PREDICTED: Peak location=2163.000000, mag-squared=0.255 using global max # # [FrameNum= 5] ACTUAL : Peak location=2170.000000, mag-squared=0.257 using global max # # [FrameNum= 5] DIFF : Peak location=7, mag-squared=0.002 (0.735%) # # [FrameNum= 6] PREDICTED: Peak location=2163.000000, mag-squared=0.241 using global max # # [FrameNum= 6] ACTUAL : Peak location=2170.000000, mag-squared=0.250 using global max # # [FrameNum= 6] DIFF : Peak location=7, mag-squared=0.009 (3.660%) # # [FrameNum= 7] PREDICTED: Peak location=2163.000000, mag-squared=0.241 using global max # # [FrameNum= 7] ACTUAL : Peak location=2170.000000, mag-squared=0.243 using global max # # [FrameNum= 7] DIFF : Peak location=7, mag-squared=0.002 (0.790%) # # [FrameNum= 8] PREDICTED: Peak location=2163.000000, mag-squared=0.225 using global max # # [FrameNum= 8] ACTUAL : Peak location=2170.000000, mag-squared=0.231 using global max # # [FrameNum= 8] DIFF : Peak location=7, mag-squared=0.007 (3.076%) # # [FrameNum= 9] PREDICTED: Peak location=2163.000000, mag-squared=0.239 using global max # # [FrameNum= 9] ACTUAL : Peak location=2170.000000, mag-squared=0.254 using global max # # [FrameNum= 9] DIFF : Peak location=7, mag-squared=0.015 (6.083%) # ** Error: pulsedetector_tb:744: # Time: 450020 ns Scope: pulsedetector_tb_pkg.mw_PulseDetector_scoreboard.run_phase File: ../scoreboard/mw_PulseDetector_scoreboard.sv Line: 84 # ** Error: pulsedetector_tb:744: At step 'inferred verify call' verify id 'CheckDetection/CheckDetection/Check Static # Upper Bound' Failed # Time: 450020 ns Scope: CheckDetection_dpi_pkg.VerifyInterfaceT.checkVerifyStatus File: ../scoreboard/CheckDetection_dpi_pkg.sv Line: 347 # # [FrameNum= 10] PREDICTED: Peak location=2163.000000, mag-squared=0.225 using global max # # [FrameNum= 10] ACTUAL : Peak location=2170.000000, mag-squared=0.230 using global max # # [FrameNum= 10] DIFF : Peak location=7, mag-squared=0.005 (2.242%) # # [FrameNum= 11] PREDICTED: Peak location=2163.000000, mag-squared=0.207 using global max # # [FrameNum= 11] ACTUAL : Peak location=2170.000000, mag-squared=0.221 using global max # # [FrameNum= 11] DIFF : Peak location=7, mag-squared=0.014 (6.697%) # ** Error: pulsedetector_tb:744: # Time: 550020 ns Scope: pulsedetector_tb_pkg.mw_PulseDetector_scoreboard.run_phase File: ../scoreboard/mw_PulseDetector_scoreboard.sv Line: 84 # ** Error: pulsedetector_tb:744: At step 'inferred verify call' verify id 'CheckDetection/CheckDetection/Check Static # Upper Bound' Failed # Time: 550020 ns Scope: CheckDetection_dpi_pkg.VerifyInterfaceT.checkVerifyStatus File: ../scoreboard/CheckDetection_dpi_pkg.sv Line: 347 # # [FrameNum= 12] PREDICTED: Peak location=2163.000000, mag-squared=0.265 using global max # # [FrameNum= 12] ACTUAL : Peak location=2170.000000, mag-squared=0.260 using global max # # [FrameNum= 12] DIFF : Peak location=7, mag-squared=0.005 (2.014%) # UVM_INFO verilog_src/uvm-1.1d/src/base/uvm_objection.svh(1267) @ 650000: reporter [TEST_DONE] 'run' phase is ready to proceed to the 'extract' phase # ** Info: Instance coverage for verify 'pulsedetector_tb:757', coverpoint 'pass_cp': metric=100.00, at_least= 1 ( COVERED) # Time: 650 us Scope: CheckDetection_dpi_pkg.VerifyInterfaceT.reportVerifyCoverage File: ../scoreboard/CheckDetection_dpi_pkg.sv Line: 369 # ** Info: Instance coverage for verify 'pulsedetector_tb:744', coverpoint 'pass_cp': metric=100.00, at_least= 1 ( COVERED) # Time: 650 us Scope: CheckDetection_dpi_pkg.VerifyInterfaceT.reportVerifyCoverage File: ../scoreboard/CheckDetection_dpi_pkg.sv Line: 369 # ** Info: Overall coverage for CheckDetection_dpi_verify_calls: metric=100.00 ( COVERED) # Time: 650 us Scope: CheckDetection_dpi_pkg.VerifyInterfaceT.reportVerifyCoverage File: ../scoreboard/CheckDetection_dpi_pkg.sv Line: 376 # # --- UVM Report Summary --- # # ** Report counts by severity # UVM_INFO : 4 # UVM_WARNING : 0 # UVM_ERROR : 0 # UVM_FATAL : 0 # ** Report counts by id # [Questa UVM] 2 # [RNTST] 1 # [TEST_DONE] 1 # ** Note: $finish : /mathworks/hub/3rdparty/R2023a/8709182/share/Questasim/Lin/linux_x86_64/../verilog_src/uvm-1.1d/src/base/uvm_root.svh(430) # Time: 650 us Iteration: 61 Instance: /mw_PulseDetector_top # End time: 16:17:01 on Jun 16,2023, Elapsed time: 0:00:25 # Errors: 4, Warnings: 2
cd ../../..
インライン制約を使用した制約付きランダム検証
標準の UVM テクニックを使用して、刺激の生成にランダム化された動作を追加できます。この例では、テスト計画では、0.75 ~ 1.00 の SNR 値を使用して、この範囲のパルスを検出する際のアルゴリズムの堅牢性を判断する必要があります。この場合、パルスの位置は重要ではなく、5000 サンプル フレームの終わりに固定されます。
mw_PulseDetector_SEQCRT_param_overrides.sv
を参照してください。
このテスト計画の目標を達成するには、派生シーケンス クラスを作成します。次のような追加の動作があります。
pre_body()
オーバーライドでは、デフォルト値制約の使用がオフになります。post_randomize()
オーバーライドでは、SNR 値をパルスが検出されたかどうかに関連付けることができるように、ランダム化された値が出力されます。クラス ユーティリティ関数fixed2real
を使用してわかりやすい値を与えます。randomize_params()
オーバーライドでは、「ランダム化」のインライン制約により、SNR 値が 0.75 ~ 1.0 の間に制限されます。(これらのビット値は、fi
変数とそのbin
メソッドを使用してMATLAB®から取得できます。)
新しいテストが作成され、テストベンチを構築するときに新しいシーケンス クラスを使用するようにファクトリに指示されます。
これらの新しいクラスを使用して UVM シミュレーションを実行するには、環境変数を通じて追加の引数を指定して元のスクリプトを使用できます。
% Simulate the UVM test bench using inlined constraint overrides cd uvm_build/pulsedetector_tb_uvm_testbench/top setenv EXTRA_UVM_COMP_ARGS '-f ../../../overrides_SEQCRT/extra_comp_args.f' setenv EXTRA_UVM_SIM_ARGS +UVM_TESTNAME=mw_PulseDetector_test_inlineCRT switch current_simulator case 'Questa', ! vsim -c -do run_tb_mq.do case 'Questa_gui', ! vsim -do run_tb_mq.do case 'Xcelium', ! ./run_tb_xcelium.sh case 'VCS', ! ./run_tb_vcs.sh end
Reading pref.tcl # 2022.2 # do run_tb_mq.do # -f ../../../overrides_SEQCRT/extra_comp_args.f # +UVM_TESTNAME=mw_PulseDetector_test_inlineCRT # mw_PulseDetector_top.sv # ** Warning: (vlib-34) Library already exists at "work". # Errors: 0, Warnings: 1 # QuestaSim-64 vlog 2022.2 Compiler 2022.04 Apr 25 2022 # Start time: 16:17:02 on Jun 16,2023 # vlog -timescale 1ns/1ns ../DPI_dut/PulseDetector_dpi_pkg.sv ../sequence/GenPulse_dpi_pkg.sv ../scoreboard/CheckDetection_dpi_pkg.sv ../driver/InputDriver_dpi_pkg.sv ../monitor/OutputMonitor_dpi_pkg.sv ../predictor/PulseDetectorRef_dpi_pkg.sv pulsedetector_tb_pkg.sv -f ../../../overrides_SEQCRT/extra_comp_args.f mw_PulseDetector_top.sv "+define+MG_SIM" # -- Compiling package PulseDetector_dpi_pkg # -- Compiling package GenPulse_dpi_pkg # -- Compiling package CheckDetection_dpi_pkg # -- Compiling package InputDriver_dpi_pkg # -- Compiling package OutputMonitor_dpi_pkg # -- Compiling package PulseDetectorRef_dpi_pkg # ** Note: (vlog-2286) pulsedetector_tb_pkg.sv(5): Using implicit +incdir+/mathworks/hub/3rdparty/R2023a/8709182/share/Questasim/Lin/uvm-1.1d/../verilog_src/uvm-1.1d/src from import uvm_pkg # -- Compiling package pulsedetector_tb_pkg # -- Importing package mtiUvm.uvm_pkg (uvm-1.1d Built-in) # -- Importing package GenPulse_dpi_pkg # -- Importing package CheckDetection_dpi_pkg # -- Importing package PulseDetectorRef_dpi_pkg # -- Importing package InputDriver_dpi_pkg # -- Importing package OutputMonitor_dpi_pkg # -- Compiling package pulsedetector_tb_extension_pkg # -- Importing package pulsedetector_tb_pkg # ** Warning: ** while parsing file included at mw_PulseDetector_top.sv(5) # ** at ../DPI_dut/PulseDetector_dpi.sv(15): (vlog-13314) Defaulting port 'coeff_in' kind to 'var' rather than 'wire' due to default compile option setting of -svinputport=relaxed. # ** Warning: ../DPI_dut/PulseDetector_dpi.sv(6): (vlog-13233) Design unit "mw_PulseDetector_top_sv_unit" already exists and will be overwritten. Design unit compiled with different set of options. # -- Compiling package mw_PulseDetector_top_sv_unit # -- Importing package PulseDetector_dpi_pkg # -- Importing package pulsedetector_tb_extension_pkg # -- Compiling module PulseDetector_dpi # ** Warning: ../DPI_dut/PulseDetector_dpi.sv(15): (vlog-13314) Defaulting port 'coeff_in' kind to 'var' rather than 'wire' due to default compile option setting of -svinputport=relaxed. # -- Compiling interface mw_PulseDetector_if # -- Compiling module mw_PulseDetector_top # # Top level modules: # mw_PulseDetector_top # End time: 16:17:02 on Jun 16,2023, Elapsed time: 0:00:00 # Errors: 0, Warnings: 3 # vsim "+UVM_TESTNAME=mw_PulseDetector_test_inlineCRT" -L work -voptargs="+acc" -sv_lib ../DPI_dut/PulseDetector -sv_lib ../sequence/GenPulse -sv_lib ../scoreboard/CheckDetection -sv_lib ../driver/InputDriver -sv_lib ../monitor/OutputMonitor -sv_lib ../predictor/PulseDetectorRef "+UVM_TESTNAME=mw_PulseDetector_test" mw_PulseDetector_top "+define+MG_SIM" # Start time: 16:17:02 on Jun 16,2023 # ** Note: (vsim-3813) Design is being optimized due to module recompilation... # ** Warning: (vopt-10587) Some optimizations are turned off because the +acc switch is in effect. This will cause your simulation to run slowly. Please use -access/-debug to maintain needed visibility. # ** Warning: ../DPI_dut/PulseDetector_dpi.sv(15): (vopt-13314) Defaulting port 'coeff_in' kind to 'var' rather than 'wire' due to default compile option setting of -svinputport=relaxed. # ** Note: (vsim-12126) Error and warning message counts have been restored: Errors=0, Warnings=2. # // Questa Sim-64 # // Version 2022.2 linux_x86_64 Apr 25 2022 # // # // Copyright 1991-2022 Mentor Graphics Corporation # // All Rights Reserved. # // # // QuestaSim and its associated documentation contain trade # // secrets and commercial or financial information that are the property of # // Mentor Graphics Corporation and are privileged, confidential, # // and exempt from disclosure under the Freedom of Information Act, # // 5 U.S.C. Section 552. Furthermore, this information # // is prohibited from disclosure under the Trade Secrets Act, # // 18 U.S.C. Section 1905. # // # Loading sv_std.std # Loading work.mw_PulseDetector_if(fast) # Loading work.OutputMonitor_dpi_pkg(fast) # Loading work.InputDriver_dpi_pkg(fast) # Loading work.PulseDetectorRef_dpi_pkg(fast) # Loading work.CheckDetection_dpi_pkg(fast) # Loading work.GenPulse_dpi_pkg(fast) # Loading mtiUvm.uvm_pkg(fast) # Loading work.pulsedetector_tb_pkg(fast) # Loading work.pulsedetector_tb_extension_pkg(fast) # Loading work.PulseDetector_dpi_pkg(fast) # Loading work.mw_PulseDetector_top_sv_unit(fast) # Loading mtiUvm.questa_uvm_pkg(fast) # Loading work.mw_PulseDetector_top(fast) # Loading work.mw_PulseDetector_if(fast__2) # Loading work.PulseDetector_dpi(fast) # Loading ./../DPI_dut/PulseDetector.so # Loading ./../sequence/GenPulse.so # Loading ./../scoreboard/CheckDetection.so # Loading ./../driver/InputDriver.so # Loading ./../monitor/OutputMonitor.so # Loading ./../predictor/PulseDetectorRef.so # Loading /mathworks/hub/3rdparty/R2023a/8709182/share/Questasim/Lin/uvm-1.1d/linux_x86_64/uvm_dpi.so # ---------------------------------------------------------------- # UVM-1.1d # (C) 2007-2013 Mentor Graphics Corporation # (C) 2007-2013 Cadence Design Systems, Inc. # (C) 2006-2013 Synopsys, Inc. # (C) 2011-2013 Cypress Semiconductor Corp. # ---------------------------------------------------------------- # # *********** IMPORTANT RELEASE NOTES ************ # # You are using a version of the UVM library that has been compiled # with `UVM_NO_DEPRECATED undefined. # See http://www.eda.org/svdb/view.php?id=3313 for more details. # # You are using a version of the UVM library that has been compiled # with `UVM_OBJECT_MUST_HAVE_CONSTRUCTOR undefined. # See http://www.eda.org/svdb/view.php?id=3770 for more details. # # (Specify +UVM_NO_RELNOTES to turn off this notice) # # UVM_INFO verilog_src/questa_uvm_pkg-1.2/src/questa_uvm_pkg.sv(277) @ 0: reporter [Questa UVM] QUESTA_UVM-1.2.3 # UVM_INFO verilog_src/questa_uvm_pkg-1.2/src/questa_uvm_pkg.sv(278) @ 0: reporter [Questa UVM] questa_uvm::init(+struct) # UVM_WARNING @ 0: reporter [MULTTST] Multiple (2) +UVM_TESTNAME arguments provided on the command line. 'mw_PulseDetector_test_inlineCRT' will be used. Provided list: mw_PulseDetector_test_inlineCRT, mw_PulseDetector_test. # UVM_INFO @ 0: reporter [RNTST] Running test mw_PulseDetector_test_inlineCRT... # ** Info: Gathering coverage for 2 Simulink verify() calls. # Time: 0 ns Scope: CheckDetection_dpi_pkg.VerifyInterfaceT.initVerifyInfo File: ../scoreboard/CheckDetection_dpi_pkg.sv Line: 251 # UVM_INFO ../../../overrides_SEQCRT/./mw_PulseDetector_SEQCRT_param_overrides.sv(27) @ 10: uvm_test_top.env.PulseDetector_agent.sqr@@seq [mw_PulseDetector_sequence_inlineCRT] # Seq param vals: SNR=0.7656, Loc=4936 # # # [FrameNum= 0] No peak found in Ref or Impl. # UVM_INFO ../../../overrides_SEQCRT/./mw_PulseDetector_SEQCRT_param_overrides.sv(27) @ 50010: uvm_test_top.env.PulseDetector_agent.sqr@@seq [mw_PulseDetector_sequence_inlineCRT] # Seq param vals: SNR=0.9219, Loc=4936 # # # [FrameNum= 1] PREDICTED: Peak location=4999.000000, mag-squared=0.056 using global max # [FrameNum= 1] No peak detected from impl error(pct)=100.000 # ** Error: pulsedetector_tb:744: # Time: 50020 ns Scope: pulsedetector_tb_pkg.mw_PulseDetector_scoreboard.run_phase File: ../scoreboard/mw_PulseDetector_scoreboard.sv Line: 84 # ** Error: pulsedetector_tb:744: At step 'inferred verify call' verify id 'CheckDetection/CheckDetection/Check Static # Upper Bound' Failed # Time: 50020 ns Scope: CheckDetection_dpi_pkg.VerifyInterfaceT.checkVerifyStatus File: ../scoreboard/CheckDetection_dpi_pkg.sv Line: 347 # UVM_INFO ../../../overrides_SEQCRT/./mw_PulseDetector_SEQCRT_param_overrides.sv(27) @ 100010: uvm_test_top.env.PulseDetector_agent.sqr@@seq [mw_PulseDetector_sequence_inlineCRT] # Seq param vals: SNR=0.9062, Loc=4936 # # # [FrameNum= 2] PREDICTED: Peak location=4999.000000, mag-squared=0.039 using global max # # [FrameNum= 2] ACTUAL : Peak location=6.000000, mag-squared=0.056 using global max # # [FrameNum= 2] DIFF : Peak location=4993, mag-squared=0.016 (40.988%) # ** Error: pulsedetector_tb:744: # Time: 100020 ns Scope: pulsedetector_tb_pkg.mw_PulseDetector_scoreboard.run_phase File: ../scoreboard/mw_PulseDetector_scoreboard.sv Line: 84 # ** Error: pulsedetector_tb:744: At step 'inferred verify call' verify id 'CheckDetection/CheckDetection/Check Static # Upper Bound' Failed # Time: 100020 ns Scope: CheckDetection_dpi_pkg.VerifyInterfaceT.checkVerifyStatus File: ../scoreboard/CheckDetection_dpi_pkg.sv Line: 347 # UVM_INFO ../../../overrides_SEQCRT/./mw_PulseDetector_SEQCRT_param_overrides.sv(27) @ 150010: uvm_test_top.env.PulseDetector_agent.sqr@@seq [mw_PulseDetector_sequence_inlineCRT] # Seq param vals: SNR=0.8438, Loc=4936 # # # [FrameNum= 3] PREDICTED: Peak location=4999.000000, mag-squared=0.040 using global max # # [FrameNum= 3] ACTUAL : Peak location=6.000000, mag-squared=0.039 using global max # # [FrameNum= 3] DIFF : Peak location=4993, mag-squared=0.001 (2.145%) # UVM_INFO ../../../overrides_SEQCRT/./mw_PulseDetector_SEQCRT_param_overrides.sv(27) @ 200010: uvm_test_top.env.PulseDetector_agent.sqr@@seq [mw_PulseDetector_sequence_inlineCRT] # Seq param vals: SNR=0.8750, Loc=4936 # # # [FrameNum= 4] PREDICTED: Peak location=4999.000000, mag-squared=0.036 using global max # # [FrameNum= 4] ACTUAL : Peak location=6.000000, mag-squared=0.041 using global max # # [FrameNum= 4] DIFF : Peak location=4993, mag-squared=0.005 (13.811%) # ** Error: pulsedetector_tb:744: # Time: 200020 ns Scope: pulsedetector_tb_pkg.mw_PulseDetector_scoreboard.run_phase File: ../scoreboard/mw_PulseDetector_scoreboard.sv Line: 84 # ** Error: pulsedetector_tb:744: At step 'inferred verify call' verify id 'CheckDetection/CheckDetection/Check Static # Upper Bound' Failed # Time: 200020 ns Scope: CheckDetection_dpi_pkg.VerifyInterfaceT.checkVerifyStatus File: ../scoreboard/CheckDetection_dpi_pkg.sv Line: 347 # UVM_INFO ../../../overrides_SEQCRT/./mw_PulseDetector_SEQCRT_param_overrides.sv(27) @ 250010: uvm_test_top.env.PulseDetector_agent.sqr@@seq [mw_PulseDetector_sequence_inlineCRT] # Seq param vals: SNR=0.9844, Loc=4936 # # # [FrameNum= 5] PREDICTED: Peak location=4999.000000, mag-squared=0.056 using global max # # [FrameNum= 5] ACTUAL : Peak location=6.000000, mag-squared=0.037 using global max # # [FrameNum= 5] DIFF : Peak location=4993, mag-squared=0.020 (34.786%) # ** Error: pulsedetector_tb:744: # Time: 250020 ns Scope: pulsedetector_tb_pkg.mw_PulseDetector_scoreboard.run_phase File: ../scoreboard/mw_PulseDetector_scoreboard.sv Line: 84 # ** Error: pulsedetector_tb:744: At step 'inferred verify call' verify id 'CheckDetection/CheckDetection/Check Static # Upper Bound' Failed # Time: 250020 ns Scope: CheckDetection_dpi_pkg.VerifyInterfaceT.checkVerifyStatus File: ../scoreboard/CheckDetection_dpi_pkg.sv Line: 347 # UVM_INFO ../../../overrides_SEQCRT/./mw_PulseDetector_SEQCRT_param_overrides.sv(27) @ 300010: uvm_test_top.env.PulseDetector_agent.sqr@@seq [mw_PulseDetector_sequence_inlineCRT] # Seq param vals: SNR=0.9062, Loc=4936 # # # [FrameNum= 6] PREDICTED: Peak location=4999.000000, mag-squared=0.047 using global max # # [FrameNum= 6] ACTUAL : Peak location=6.000000, mag-squared=0.057 using global max # # [FrameNum= 6] DIFF : Peak location=4993, mag-squared=0.010 (21.300%) # ** Error: pulsedetector_tb:744: # Time: 300020 ns Scope: pulsedetector_tb_pkg.mw_PulseDetector_scoreboard.run_phase File: ../scoreboard/mw_PulseDetector_scoreboard.sv Line: 84 # ** Error: pulsedetector_tb:744: At step 'inferred verify call' verify id 'CheckDetection/CheckDetection/Check Static # Upper Bound' Failed # Time: 300020 ns Scope: CheckDetection_dpi_pkg.VerifyInterfaceT.checkVerifyStatus File: ../scoreboard/CheckDetection_dpi_pkg.sv Line: 347 # UVM_INFO ../../../overrides_SEQCRT/./mw_PulseDetector_SEQCRT_param_overrides.sv(27) @ 350010: uvm_test_top.env.PulseDetector_agent.sqr@@seq [mw_PulseDetector_sequence_inlineCRT] # Seq param vals: SNR=0.8281, Loc=4936 # # # [FrameNum= 7] PREDICTED: Peak location=4999.000000, mag-squared=0.054 using global max # # [FrameNum= 7] ACTUAL : Peak location=6.000000, mag-squared=0.050 using global max # # [FrameNum= 7] DIFF : Peak location=4993, mag-squared=0.004 (8.111%) # ** Error: pulsedetector_tb:744: # Time: 350020 ns Scope: pulsedetector_tb_pkg.mw_PulseDetector_scoreboard.run_phase File: ../scoreboard/mw_PulseDetector_scoreboard.sv Line: 84 # ** Error: pulsedetector_tb:744: At step 'inferred verify call' verify id 'CheckDetection/CheckDetection/Check Static # Upper Bound' Failed # Time: 350020 ns Scope: CheckDetection_dpi_pkg.VerifyInterfaceT.checkVerifyStatus File: ../scoreboard/CheckDetection_dpi_pkg.sv Line: 347 # UVM_INFO ../../../overrides_SEQCRT/./mw_PulseDetector_SEQCRT_param_overrides.sv(27) @ 400010: uvm_test_top.env.PulseDetector_agent.sqr@@seq [mw_PulseDetector_sequence_inlineCRT] # Seq param vals: SNR=0.7656, Loc=4936 # # # [FrameNum= 8] PREDICTED: Peak location=4999.000000, mag-squared=0.041 using global max # # [FrameNum= 8] ACTUAL : Peak location=6.000000, mag-squared=0.053 using global max # # [FrameNum= 8] DIFF : Peak location=4993, mag-squared=0.012 (30.146%) # ** Error: pulsedetector_tb:744: # Time: 400020 ns Scope: pulsedetector_tb_pkg.mw_PulseDetector_scoreboard.run_phase File: ../scoreboard/mw_PulseDetector_scoreboard.sv Line: 84 # ** Error: pulsedetector_tb:744: At step 'inferred verify call' verify id 'CheckDetection/CheckDetection/Check Static # Upper Bound' Failed # Time: 400020 ns Scope: CheckDetection_dpi_pkg.VerifyInterfaceT.checkVerifyStatus File: ../scoreboard/CheckDetection_dpi_pkg.sv Line: 347 # UVM_INFO ../../../overrides_SEQCRT/./mw_PulseDetector_SEQCRT_param_overrides.sv(27) @ 450010: uvm_test_top.env.PulseDetector_agent.sqr@@seq [mw_PulseDetector_sequence_inlineCRT] # Seq param vals: SNR=0.7500, Loc=4936 # # # [FrameNum= 9] PREDICTED: Peak location=4999.000000, mag-squared=0.051 using global max # # [FrameNum= 9] ACTUAL : Peak location=6.000000, mag-squared=0.044 using global max # # [FrameNum= 9] DIFF : Peak location=4993, mag-squared=0.007 (13.104%) # ** Error: pulsedetector_tb:744: # Time: 450020 ns Scope: pulsedetector_tb_pkg.mw_PulseDetector_scoreboard.run_phase File: ../scoreboard/mw_PulseDetector_scoreboard.sv Line: 84 # ** Error: pulsedetector_tb:744: At step 'inferred verify call' verify id 'CheckDetection/CheckDetection/Check Static # Upper Bound' Failed # Time: 450020 ns Scope: CheckDetection_dpi_pkg.VerifyInterfaceT.checkVerifyStatus File: ../scoreboard/CheckDetection_dpi_pkg.sv Line: 347 # UVM_INFO ../../../overrides_SEQCRT/./mw_PulseDetector_SEQCRT_param_overrides.sv(27) @ 500010: uvm_test_top.env.PulseDetector_agent.sqr@@seq [mw_PulseDetector_sequence_inlineCRT] # Seq param vals: SNR=0.8125, Loc=4936 # # # [FrameNum= 10] PREDICTED: Peak location=4999.000000, mag-squared=0.030 using global max # # [FrameNum= 10] ACTUAL : Peak location=6.000000, mag-squared=0.054 using global max # # [FrameNum= 10] DIFF : Peak location=4993, mag-squared=0.024 (79.450%) # ** Error: pulsedetector_tb:744: # Time: 500020 ns Scope: pulsedetector_tb_pkg.mw_PulseDetector_scoreboard.run_phase File: ../scoreboard/mw_PulseDetector_scoreboard.sv Line: 84 # ** Error: pulsedetector_tb:744: At step 'inferred verify call' verify id 'CheckDetection/CheckDetection/Check Static # Upper Bound' Failed # Time: 500020 ns Scope: CheckDetection_dpi_pkg.VerifyInterfaceT.checkVerifyStatus File: ../scoreboard/CheckDetection_dpi_pkg.sv Line: 347 # UVM_INFO ../../../overrides_SEQCRT/./mw_PulseDetector_SEQCRT_param_overrides.sv(27) @ 550010: uvm_test_top.env.PulseDetector_agent.sqr@@seq [mw_PulseDetector_sequence_inlineCRT] # Seq param vals: SNR=0.9531, Loc=4936 # # # [FrameNum= 11] PREDICTED: Peak location=4999.000000, mag-squared=0.033 using global max # # [FrameNum= 11] ACTUAL : Peak location=6.000000, mag-squared=0.031 using global max # # [FrameNum= 11] DIFF : Peak location=4993, mag-squared=0.002 (5.866%) # ** Error: pulsedetector_tb:744: # Time: 550020 ns Scope: pulsedetector_tb_pkg.mw_PulseDetector_scoreboard.run_phase File: ../scoreboard/mw_PulseDetector_scoreboard.sv Line: 84 # ** Error: pulsedetector_tb:744: At step 'inferred verify call' verify id 'CheckDetection/CheckDetection/Check Static # Upper Bound' Failed # Time: 550020 ns Scope: CheckDetection_dpi_pkg.VerifyInterfaceT.checkVerifyStatus File: ../scoreboard/CheckDetection_dpi_pkg.sv Line: 347 # # [FrameNum= 12] PREDICTED: Peak location=4999.000000, mag-squared=0.059 using global max # # [FrameNum= 12] ACTUAL : Peak location=6.000000, mag-squared=0.035 using global max # # [FrameNum= 12] DIFF : Peak location=4993, mag-squared=0.025 (41.710%) # ** Error: pulsedetector_tb:744: # Time: 600020 ns Scope: pulsedetector_tb_pkg.mw_PulseDetector_scoreboard.run_phase File: ../scoreboard/mw_PulseDetector_scoreboard.sv Line: 84 # ** Error: pulsedetector_tb:744: At step 'inferred verify call' verify id 'CheckDetection/CheckDetection/Check Static # Upper Bound' Failed # Time: 600020 ns Scope: CheckDetection_dpi_pkg.VerifyInterfaceT.checkVerifyStatus File: ../scoreboard/CheckDetection_dpi_pkg.sv Line: 347 # UVM_INFO verilog_src/uvm-1.1d/src/base/uvm_objection.svh(1267) @ 650000: reporter [TEST_DONE] 'run' phase is ready to proceed to the 'extract' phase # ** Info: Instance coverage for verify 'pulsedetector_tb:757', coverpoint 'pass_cp': metric=100.00, at_least= 1 ( COVERED) # Time: 650 us Scope: CheckDetection_dpi_pkg.VerifyInterfaceT.reportVerifyCoverage File: ../scoreboard/CheckDetection_dpi_pkg.sv Line: 369 # ** Info: Instance coverage for verify 'pulsedetector_tb:744', coverpoint 'pass_cp': metric=100.00, at_least= 1 ( COVERED) # Time: 650 us Scope: CheckDetection_dpi_pkg.VerifyInterfaceT.reportVerifyCoverage File: ../scoreboard/CheckDetection_dpi_pkg.sv Line: 369 # ** Info: Overall coverage for CheckDetection_dpi_verify_calls: metric=100.00 ( COVERED) # Time: 650 us Scope: CheckDetection_dpi_pkg.VerifyInterfaceT.reportVerifyCoverage File: ../scoreboard/CheckDetection_dpi_pkg.sv Line: 376 # # --- UVM Report Summary --- # # ** Report counts by severity # UVM_INFO : 16 # UVM_WARNING : 1 # UVM_ERROR : 0 # UVM_FATAL : 0 # ** Report counts by id # [MULTTST] 1 # [Questa UVM] 2 # [RNTST] 1 # [TEST_DONE] 1 # [mw_PulseDetector_sequence_inlineCRT] 12 # ** Note: $finish : /mathworks/hub/3rdparty/R2023a/8709182/share/Questasim/Lin/linux_x86_64/../verilog_src/uvm-1.1d/src/base/uvm_root.svh(430) # Time: 650 us Iteration: 61 Instance: /mw_PulseDetector_top # End time: 16:17:23 on Jun 16,2023, Elapsed time: 0:00:21 # Errors: 22, Warnings: 2
cd ../../..
出力を調べると、生成された SNR が常に [0.75, 1.00] の間にあり、パルス開始位置が常に 4936 であることがわかります。このような SNR範囲では、パルスが検出される場合と検出されない場合があることに注意してください。
クラスベースの制約を使用した制約付きランダム検証
インライン制約は、特定のテスト条件に焦点を当てるのに適しています。より複雑な制約付きランダム テストの場合は、派生シーケンス クラスで新しい制約ステートメント ブロックを作成できます。ここで、テスト計画では、フレームの先頭、中間、および末尾の関心のある位置の特定の「バケット」を使用して、パルスの位置がフレーム全体で変化することが必要です。特別な位置 0 により、パルスが作成されないときはパルスが検出されないことが保証されます。同様に、SNR については、 SNR_never_detected
やSNR_always_detected
など、興味深い SNR範囲のいくつかのカテゴリが定義されています。これらの制約を使用して、これらのシナリオを簡単にカバーできるようになりました。
mw_PulseDetector_SEQCRT_param_overrides.sv
を参照してください。
これらの目標を達成するために、派生シーケンス クラスには次の追加の動作があります。
「randc」として宣言された「loc_bucket」メンバーを追加します。
loc_bucket メンバーを使用して、場所の範囲を指定します。
「snr_bucket」メンバーを追加します。これはランダム化されず、テスト作成者によって設定されます。
選択した snr_bucket を使用して、特定の SNR範囲内でランダム化を暗黙的に指定します。
競合するデフォルト値の制約をオフにします。
シミュレーション中に検査するために、ランダム化された値を出力します。
新しいテストが作成され、テストベンチの構築時に新しいシーケンス クラスを使用するように UVM ファクトリに指示し、 uvm_resource_db
を通じて特定の SNR バケットも設定します。
これらの新しいクラスを使用して UVM シミュレーションを実行するには、環境変数を通じて追加の引数を指定して元のスクリプトを使用できます。
% Simulate the UVM test bench using derived sequence class overrides cd uvm_build/pulsedetector_tb_uvm_testbench/top setenv EXTRA_UVM_COMP_ARGS '-f ../../../overrides_SEQCRT/extra_comp_args.f' setenv EXTRA_UVM_SIM_ARGS +UVM_TESTNAME=mw_PulseDetector_test_classCRT switch current_simulator case 'Questa', ! vsim -c -do run_tb_mq.do case 'Questa_gui', ! vsim -do run_tb_mq.do case 'Xcelium', ! ./run_tb_xcelium.sh case 'VCS', ! ./run_tb_vcs.sh end
Reading pref.tcl # 2022.2 # do run_tb_mq.do # -f ../../../overrides_SEQCRT/extra_comp_args.f # +UVM_TESTNAME=mw_PulseDetector_test_classCRT # mw_PulseDetector_top.sv # ** Warning: (vlib-34) Library already exists at "work". # Errors: 0, Warnings: 1 # QuestaSim-64 vlog 2022.2 Compiler 2022.04 Apr 25 2022 # Start time: 16:17:25 on Jun 16,2023 # vlog -timescale 1ns/1ns ../DPI_dut/PulseDetector_dpi_pkg.sv ../sequence/GenPulse_dpi_pkg.sv ../scoreboard/CheckDetection_dpi_pkg.sv ../driver/InputDriver_dpi_pkg.sv ../monitor/OutputMonitor_dpi_pkg.sv ../predictor/PulseDetectorRef_dpi_pkg.sv pulsedetector_tb_pkg.sv -f ../../../overrides_SEQCRT/extra_comp_args.f mw_PulseDetector_top.sv "+define+MG_SIM" # -- Compiling package PulseDetector_dpi_pkg # -- Compiling package GenPulse_dpi_pkg # -- Compiling package CheckDetection_dpi_pkg # -- Compiling package InputDriver_dpi_pkg # -- Compiling package OutputMonitor_dpi_pkg # -- Compiling package PulseDetectorRef_dpi_pkg # ** Note: (vlog-2286) pulsedetector_tb_pkg.sv(5): Using implicit +incdir+/mathworks/hub/3rdparty/R2023a/8709182/share/Questasim/Lin/uvm-1.1d/../verilog_src/uvm-1.1d/src from import uvm_pkg # -- Compiling package pulsedetector_tb_pkg # -- Importing package mtiUvm.uvm_pkg (uvm-1.1d Built-in) # -- Importing package GenPulse_dpi_pkg # -- Importing package CheckDetection_dpi_pkg # -- Importing package PulseDetectorRef_dpi_pkg # -- Importing package InputDriver_dpi_pkg # -- Importing package OutputMonitor_dpi_pkg # -- Compiling package pulsedetector_tb_extension_pkg # -- Importing package pulsedetector_tb_pkg # ** Warning: ** while parsing file included at mw_PulseDetector_top.sv(5) # ** at ../DPI_dut/PulseDetector_dpi.sv(15): (vlog-13314) Defaulting port 'coeff_in' kind to 'var' rather than 'wire' due to default compile option setting of -svinputport=relaxed. # -- Compiling package mw_PulseDetector_top_sv_unit # -- Importing package PulseDetector_dpi_pkg # -- Importing package pulsedetector_tb_extension_pkg # -- Compiling module PulseDetector_dpi # ** Warning: ../DPI_dut/PulseDetector_dpi.sv(15): (vlog-13314) Defaulting port 'coeff_in' kind to 'var' rather than 'wire' due to default compile option setting of -svinputport=relaxed. # -- Compiling interface mw_PulseDetector_if # -- Compiling module mw_PulseDetector_top # # Top level modules: # mw_PulseDetector_top # End time: 16:17:25 on Jun 16,2023, Elapsed time: 0:00:00 # Errors: 0, Warnings: 2 # vsim "+UVM_TESTNAME=mw_PulseDetector_test_classCRT" -L work -voptargs="+acc" -sv_lib ../DPI_dut/PulseDetector -sv_lib ../sequence/GenPulse -sv_lib ../scoreboard/CheckDetection -sv_lib ../driver/InputDriver -sv_lib ../monitor/OutputMonitor -sv_lib ../predictor/PulseDetectorRef "+UVM_TESTNAME=mw_PulseDetector_test" mw_PulseDetector_top "+define+MG_SIM" # Start time: 16:17:25 on Jun 16,2023 # ** Note: (vsim-8009) Loading existing optimized design _opt # // Questa Sim-64 # // Version 2022.2 linux_x86_64 Apr 25 2022 # // # // Copyright 1991-2022 Mentor Graphics Corporation # // All Rights Reserved. # // # // QuestaSim and its associated documentation contain trade # // secrets and commercial or financial information that are the property of # // Mentor Graphics Corporation and are privileged, confidential, # // and exempt from disclosure under the Freedom of Information Act, # // 5 U.S.C. Section 552. Furthermore, this information # // is prohibited from disclosure under the Trade Secrets Act, # // 18 U.S.C. Section 1905. # // # Loading sv_std.std # Loading work.mw_PulseDetector_if(fast) # Loading work.OutputMonitor_dpi_pkg(fast) # Loading work.InputDriver_dpi_pkg(fast) # Loading work.PulseDetectorRef_dpi_pkg(fast) # Loading work.CheckDetection_dpi_pkg(fast) # Loading work.GenPulse_dpi_pkg(fast) # Loading mtiUvm.uvm_pkg(fast) # Loading work.pulsedetector_tb_pkg(fast) # Loading work.pulsedetector_tb_extension_pkg(fast) # Loading work.PulseDetector_dpi_pkg(fast) # Loading work.mw_PulseDetector_top_sv_unit(fast) # Loading mtiUvm.questa_uvm_pkg(fast) # Loading work.mw_PulseDetector_top(fast) # Loading work.mw_PulseDetector_if(fast__2) # Loading work.PulseDetector_dpi(fast) # Loading ./../DPI_dut/PulseDetector.so # Loading ./../sequence/GenPulse.so # Loading ./../scoreboard/CheckDetection.so # Loading ./../driver/InputDriver.so # Loading ./../monitor/OutputMonitor.so # Loading ./../predictor/PulseDetectorRef.so # Loading /mathworks/hub/3rdparty/R2023a/8709182/share/Questasim/Lin/uvm-1.1d/linux_x86_64/uvm_dpi.so # ---------------------------------------------------------------- # UVM-1.1d # (C) 2007-2013 Mentor Graphics Corporation # (C) 2007-2013 Cadence Design Systems, Inc. # (C) 2006-2013 Synopsys, Inc. # (C) 2011-2013 Cypress Semiconductor Corp. # ---------------------------------------------------------------- # # *********** IMPORTANT RELEASE NOTES ************ # # You are using a version of the UVM library that has been compiled # with `UVM_NO_DEPRECATED undefined. # See http://www.eda.org/svdb/view.php?id=3313 for more details. # # You are using a version of the UVM library that has been compiled # with `UVM_OBJECT_MUST_HAVE_CONSTRUCTOR undefined. # See http://www.eda.org/svdb/view.php?id=3770 for more details. # # (Specify +UVM_NO_RELNOTES to turn off this notice) # # UVM_INFO verilog_src/questa_uvm_pkg-1.2/src/questa_uvm_pkg.sv(277) @ 0: reporter [Questa UVM] QUESTA_UVM-1.2.3 # UVM_INFO verilog_src/questa_uvm_pkg-1.2/src/questa_uvm_pkg.sv(278) @ 0: reporter [Questa UVM] questa_uvm::init(+struct) # UVM_WARNING @ 0: reporter [MULTTST] Multiple (2) +UVM_TESTNAME arguments provided on the command line. 'mw_PulseDetector_test_classCRT' will be used. Provided list: mw_PulseDetector_test_classCRT, mw_PulseDetector_test. # UVM_INFO @ 0: reporter [RNTST] Running test mw_PulseDetector_test_classCRT... # ** Info: Gathering coverage for 2 Simulink verify() calls. # Time: 0 ns Scope: CheckDetection_dpi_pkg.VerifyInterfaceT.initVerifyInfo File: ../scoreboard/CheckDetection_dpi_pkg.sv Line: 251 # UVM_INFO ../../../overrides_SEQCRT/./mw_PulseDetector_SEQCRT_param_overrides.sv(95) @ 10: uvm_test_top.env.PulseDetector_agent.sqr@@seq [mw_PulseDetector_sequence_classCRT] # Seq param vals: loc_bucket= 1 -> Loc= 11, snr_bucket= 3 -> SNR=2.3906 # # # [FrameNum= 0] No peak found in Ref or Impl. # UVM_INFO ../../../overrides_SEQCRT/./mw_PulseDetector_SEQCRT_param_overrides.sv(95) @ 50010: uvm_test_top.env.PulseDetector_agent.sqr@@seq [mw_PulseDetector_sequence_classCRT] # Seq param vals: loc_bucket= 2 -> Loc=1126, snr_bucket= 3 -> SNR=2.2188 # # # [FrameNum= 1] PREDICTED: Peak location=74.000000, mag-squared=0.334 using global max # # [FrameNum= 1] ACTUAL : Peak location=118.000000, mag-squared=0.036 using global max # # [FrameNum= 1] DIFF : Peak location=44, mag-squared=0.298 (89.197%) # ** Error: pulsedetector_tb:744: # Time: 50020 ns Scope: pulsedetector_tb_pkg.mw_PulseDetector_scoreboard.run_phase File: ../scoreboard/mw_PulseDetector_scoreboard.sv Line: 84 # ** Error: pulsedetector_tb:744: At step 'inferred verify call' verify id 'CheckDetection/CheckDetection/Check Static # Upper Bound' Failed # Time: 50020 ns Scope: CheckDetection_dpi_pkg.VerifyInterfaceT.checkVerifyStatus File: ../scoreboard/CheckDetection_dpi_pkg.sv Line: 347 # UVM_INFO ../../../overrides_SEQCRT/./mw_PulseDetector_SEQCRT_param_overrides.sv(95) @ 100010: uvm_test_top.env.PulseDetector_agent.sqr@@seq [mw_PulseDetector_sequence_classCRT] # Seq param vals: loc_bucket= 0 -> Loc= 0, snr_bucket= 3 -> SNR=2.9688 # # # [FrameNum= 2] PREDICTED: Peak location=1189.000000, mag-squared=0.299 using global max # # [FrameNum= 2] ACTUAL : Peak location=1196.000000, mag-squared=0.294 using global max # # [FrameNum= 2] DIFF : Peak location=7, mag-squared=0.005 (1.631%) # UVM_INFO ../../../overrides_SEQCRT/./mw_PulseDetector_SEQCRT_param_overrides.sv(95) @ 150010: uvm_test_top.env.PulseDetector_agent.sqr@@seq [mw_PulseDetector_sequence_classCRT] # Seq param vals: loc_bucket= 3 -> Loc=4520, snr_bucket= 3 -> SNR=1.6719 # # # [FrameNum= 3] No peak found in Ref or Impl. # UVM_INFO ../../../overrides_SEQCRT/./mw_PulseDetector_SEQCRT_param_overrides.sv(95) @ 200010: uvm_test_top.env.PulseDetector_agent.sqr@@seq [mw_PulseDetector_sequence_classCRT] # Seq param vals: loc_bucket= 3 -> Loc=4256, snr_bucket= 3 -> SNR=2.4062 # # # [FrameNum= 4] PREDICTED: Peak location=4583.000000, mag-squared=0.157 using global max # # [FrameNum= 4] ACTUAL : Peak location=4590.000000, mag-squared=0.162 using global max # # [FrameNum= 4] DIFF : Peak location=7, mag-squared=0.005 (3.476%) # UVM_INFO ../../../overrides_SEQCRT/./mw_PulseDetector_SEQCRT_param_overrides.sv(95) @ 250010: uvm_test_top.env.PulseDetector_agent.sqr@@seq [mw_PulseDetector_sequence_classCRT] # Seq param vals: loc_bucket= 1 -> Loc= 901, snr_bucket= 3 -> SNR=2.0469 # # # [FrameNum= 5] PREDICTED: Peak location=4319.000000, mag-squared=0.287 using global max # # [FrameNum= 5] ACTUAL : Peak location=4326.000000, mag-squared=0.291 using global max # # [FrameNum= 5] DIFF : Peak location=7, mag-squared=0.004 (1.390%) # UVM_INFO ../../../overrides_SEQCRT/./mw_PulseDetector_SEQCRT_param_overrides.sv(95) @ 300010: uvm_test_top.env.PulseDetector_agent.sqr@@seq [mw_PulseDetector_sequence_classCRT] # Seq param vals: loc_bucket= 2 -> Loc=1961, snr_bucket= 3 -> SNR=1.9062 # # # [FrameNum= 6] PREDICTED: Peak location=964.000000, mag-squared=0.227 using global max # # [FrameNum= 6] ACTUAL : Peak location=971.000000, mag-squared=0.232 using global max # # [FrameNum= 6] DIFF : Peak location=7, mag-squared=0.005 (2.246%) # UVM_INFO ../../../overrides_SEQCRT/./mw_PulseDetector_SEQCRT_param_overrides.sv(95) @ 350010: uvm_test_top.env.PulseDetector_agent.sqr@@seq [mw_PulseDetector_sequence_classCRT] # Seq param vals: loc_bucket= 0 -> Loc= 0, snr_bucket= 3 -> SNR=1.7188 # # # [FrameNum= 7] PREDICTED: Peak location=2024.000000, mag-squared=0.202 using global max # # [FrameNum= 7] ACTUAL : Peak location=2031.000000, mag-squared=0.200 using global max # # [FrameNum= 7] DIFF : Peak location=7, mag-squared=0.002 (1.043%) # UVM_INFO ../../../overrides_SEQCRT/./mw_PulseDetector_SEQCRT_param_overrides.sv(95) @ 400010: uvm_test_top.env.PulseDetector_agent.sqr@@seq [mw_PulseDetector_sequence_classCRT] # Seq param vals: loc_bucket= 2 -> Loc=2005, snr_bucket= 3 -> SNR=1.6719 # # # [FrameNum= 8] No peak found in Ref or Impl. # UVM_INFO ../../../overrides_SEQCRT/./mw_PulseDetector_SEQCRT_param_overrides.sv(95) @ 450010: uvm_test_top.env.PulseDetector_agent.sqr@@seq [mw_PulseDetector_sequence_classCRT] # Seq param vals: loc_bucket= 3 -> Loc=3461, snr_bucket= 3 -> SNR=2.7344 # # # [FrameNum= 9] PREDICTED: Peak location=2068.000000, mag-squared=0.202 using global max # # [FrameNum= 9] ACTUAL : Peak location=2075.000000, mag-squared=0.213 using global max # # [FrameNum= 9] DIFF : Peak location=7, mag-squared=0.012 (5.859%) # ** Error: pulsedetector_tb:744: # Time: 450020 ns Scope: pulsedetector_tb_pkg.mw_PulseDetector_scoreboard.run_phase File: ../scoreboard/mw_PulseDetector_scoreboard.sv Line: 84 # ** Error: pulsedetector_tb:744: At step 'inferred verify call' verify id 'CheckDetection/CheckDetection/Check Static # Upper Bound' Failed # Time: 450020 ns Scope: CheckDetection_dpi_pkg.VerifyInterfaceT.checkVerifyStatus File: ../scoreboard/CheckDetection_dpi_pkg.sv Line: 347 # UVM_INFO ../../../overrides_SEQCRT/./mw_PulseDetector_SEQCRT_param_overrides.sv(95) @ 500010: uvm_test_top.env.PulseDetector_agent.sqr@@seq [mw_PulseDetector_sequence_classCRT] # Seq param vals: loc_bucket= 0 -> Loc= 0, snr_bucket= 3 -> SNR=1.6406 # # # [FrameNum= 10] PREDICTED: Peak location=3524.000000, mag-squared=0.331 using global max # # [FrameNum= 10] ACTUAL : Peak location=3531.000000, mag-squared=0.330 using global max # # [FrameNum= 10] DIFF : Peak location=7, mag-squared=0.002 (0.534%) # UVM_INFO ../../../overrides_SEQCRT/./mw_PulseDetector_SEQCRT_param_overrides.sv(95) @ 550010: uvm_test_top.env.PulseDetector_agent.sqr@@seq [mw_PulseDetector_sequence_classCRT] # Seq param vals: loc_bucket= 1 -> Loc= 817, snr_bucket= 3 -> SNR=2.0938 # # # [FrameNum= 11] No peak found in Ref or Impl. # # [FrameNum= 12] PREDICTED: Peak location=880.000000, mag-squared=0.163 using global max # # [FrameNum= 12] ACTUAL : Peak location=887.000000, mag-squared=0.159 using global max # # [FrameNum= 12] DIFF : Peak location=7, mag-squared=0.004 (2.517%) # UVM_INFO verilog_src/uvm-1.1d/src/base/uvm_objection.svh(1267) @ 650000: reporter [TEST_DONE] 'run' phase is ready to proceed to the 'extract' phase # ** Info: Instance coverage for verify 'pulsedetector_tb:757', coverpoint 'pass_cp': metric=100.00, at_least= 1 ( COVERED) # Time: 650 us Scope: CheckDetection_dpi_pkg.VerifyInterfaceT.reportVerifyCoverage File: ../scoreboard/CheckDetection_dpi_pkg.sv Line: 369 # ** Info: Instance coverage for verify 'pulsedetector_tb:744', coverpoint 'pass_cp': metric=100.00, at_least= 1 ( COVERED) # Time: 650 us Scope: CheckDetection_dpi_pkg.VerifyInterfaceT.reportVerifyCoverage File: ../scoreboard/CheckDetection_dpi_pkg.sv Line: 369 # ** Info: Overall coverage for CheckDetection_dpi_verify_calls: metric=100.00 ( COVERED) # Time: 650 us Scope: CheckDetection_dpi_pkg.VerifyInterfaceT.reportVerifyCoverage File: ../scoreboard/CheckDetection_dpi_pkg.sv Line: 376 # # --- UVM Report Summary --- # # ** Report counts by severity # UVM_INFO : 16 # UVM_WARNING : 1 # UVM_ERROR : 0 # UVM_FATAL : 0 # ** Report counts by id # [MULTTST] 1 # [Questa UVM] 2 # [RNTST] 1 # [TEST_DONE] 1 # [mw_PulseDetector_sequence_classCRT] 12 # ** Note: $finish : /mathworks/hub/3rdparty/R2023a/8709182/share/Questasim/Lin/linux_x86_64/../verilog_src/uvm-1.1d/src/base/uvm_root.svh(430) # Time: 650 us Iteration: 61 Instance: /mw_PulseDetector_top # End time: 16:17:44 on Jun 16,2023, Elapsed time: 0:00:19 # Errors: 4, Warnings: 0
cd ../../..
出力を調べて、生成された SNR が常に 1.4844 を上回っており、パルス開始位置がloc_bucket
に定義された各範囲に入っていることを確認します。また、位置が0の場合はパルスが発生していないため、パルスが検出されないことも確認できます。
Simulinkスティミュラス生成のバイパス
上記の生成されたシーケンスは、ランダム化を使用して、基礎となる GenPulse DPI-C 関数への入力パラメーターと引数に影響を与えます。実際のトランザクション値は、これらの関数の出力です。シーケンサーに配信される実際のトランザクションを完全に制御したい場合は、通常の DPI 呼び出しをバイパスし、 req
データ メンバーをランダム化できます。
mw_PulseDetector_SEQCRT_param_overrides.sv
を参照してください。
この場合、パルス、係数、ノイズはすべて相互に関連しているため、それらの値を完全にランダム化しても有効なテスト ケースは得られません。ただし、この手法は他のトランザクション タイプにも役立ちます。
結論と次のステップ
完全な UVM 環境では、ランダム化が導入される場合は常に、カバレッジを含め、環境のさまざまな部分がどのランダム値が生成されたかを確実に認識することが不可欠です。これらの例では、ランダム化された値が単純に出力されます。生成された SNR と位置の値のカバレッジを追加し、それらを検出とエラーのしきい値に関連付けるのは、読者に任せる作業です。