Analysis Components & Techniques(从PostRunPhases开始)

上一篇 / 下一篇  2018-12-27 20:20:16

   PostRunPhases

  Overview

       许多analysis组件在仿真运行期间持续执行分析。有时您需要推迟分析,直到收集完所有数据,或者组件可能需要在仿真结束时进行最终检查。对于这些组件,UVM提供post-run phases,extract, check, and report。
       这些phases在所有组件上以分层自下而上的方式执行。

   The Extract Phase

       extract phase允许组件检查在仿真运行期间收集的数据,提取有意义的值并对这些值执行算法计算。

  The Check Phase

       check phase允许组件评估在extract phase期间计算的任何值,并判断值是否正确。此外,对于在运行期间连续执行分析的组件,check phase可用于检查任何缺失数据或额外数据,例如记分板中的不匹配事务。

  The Report Phase  

        report phase允许组件在其职责范围内显示有关分析的最终报告。可以配置组件是否显示其本地结果,以允许更高级别组件的累积和显示。

  The Final Phase

        UVM添加了Final phase,这通常是在仿真的$ finish之前执行的最后一个phase。未来的UVM版本旨在支持多个测试功能,该功能会迭代所有前面的phase(例如,完成后的report phase将跳回到build phase以执行另一个test)。完成所有测试后,final phase仅执行一次。

  Example

      `uvm_analysis_imp_decl(_BEFORE)
       `uvm_analysis_imp_decl(_AFTER)

       class delay_analyzer extends uvm_component;
            `uvm_component_utils(delay_analyzer)

            uvm_analysis_imp_BEFORE #(alu_txn, delay_analyzer) before_export;
            uvm_analysis_imp_AFTER #(alu_txn, delay_analyzer) after_export;

            real m_before[$];
            real m_after[$];
            real last_b_time, last_a_time;
            real longest_b_delay, longest_a_delay;

            function new( string name , uvm_component parent) ;
                 super.new( name , parent );
                 last_b_time = 0.0;
                 last_a_time = 0.0;
            endfunction

            // Record when the transaction arrives
            function void write_BEFORE(alu_txn t);
                 real delay; delay = $realtime - last_b_time;
                 last_b_time = $realtime;
                 m_before.push_back(delay);
            endfunction

            // Record when the transaction arrives
            function void write_AFTER(alu_txn t);
                 real delay; delay = $realtime - last_a_time;
                 last_a_time = $realtime;
                 m_after.push_back(delay);
            endfunction

             function void build_phase( uvm_phase phase );
                  before_export = new("before_export", this);
                  after_export = new("after_export", this);
             endfunction

             // Perform. calculation for longest delay metric
             function void extract_phase( uvm_phase phase );
                  foreach (m_before[i])
                      if (m_before[i] > longest_b_delay) longest_b_delay = m_before[i];
                  foreach (m_after[i])
                      if (m_after[i] > longest_a_delay) longest_a_delay = m_after[i];
             endfunction

             function void check_phase( uvm_phase phase );
                  string s;
                  if (longest_a_delay > 100.0) begin
                      $sformat(s, "Transaction delay too long: %5.2f",longest_a_delay);
                      uvm_report_warning("Delay Analyzer",s);
                  end
                  if (longest_b_delay > 100.0) begin
                      $sformat(s, "Transaction delay too long: %5.2f",longest_a_delay);
                      uvm_report_warning("Delay Analyzer",s);
                  end
             endfunction

             function void report_phase( uvm_phase phase );
                  uvm_report_info("Delay Analyzer", $sformatf("Longest BEFORE delay: %5.2f", longest_b_delay));
                  uvm_report_info("Delay Analyzer", $sformatf("Longest AFTER delay: %5.2f", longest_a_delay));
             endfunction

             function void final_phase( uvm_phase phase );
                  my_summarize_test_results();
             endfunction

        endclass

        (在http://verificationacademy.com/uvm-ovm上在线下载源代码示例)。






















        


TAG:

 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

日历

« 2019-01-19  
  12345
6789101112
13141516171819
20212223242526
2728293031  

数据统计

  • 访问量: 19994
  • 日志数: 75
  • 建立时间: 2018-09-03
  • 更新时间: 2018-12-29

RSS订阅

Open Toolbar