永利皇宫官网网址

Analysis Components & Techniques(从MetricAnalyzers开始)

上一篇 / 下一篇  2018-12-27 19:46:37

   MetricAnalyzers

  Overview  

       度量分析器监视和记录非功能行为,如延迟,功率利用率和其他与性能相关的测量。

  Construction

       度量分析仪通常是标准analysis components。它们以一种方式来实现它们的行为,这种方式要么是通过扩展uvm_subscriber的方式要么通过使用analysis imp / exports的方式,这取决于它们观察到的事务流数量。

  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

        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-24  
  12345
6789101112
13141516171819
20212223242526
2728293031  

数据统计

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

RSS订阅

Open Toolbar