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

        (在上在線下載源代碼示例)。


TAG:

 

評分:0

我來說兩句

顯示全部

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

日歷

« 2019-02-13  
     12
3456789
10111213141516
17181920212223
2425262728  

數據統計

  • 訪問量: 22475
  • 日志數: 75
  • 建立時間: 2018-09-03
  • 更新時間: 2018-12-29

RSS訂閱

Open Toolbar
魔域私服 幸运飞艇官网 幸运飞艇官网 热血江湖私服 天龙八部私服 幸运飞艇官网 魔域私服 幸运飞艇官网 幸运飞艇官网 热血江湖私服