ee_king的个人空间 https://blog.eetop.cn/1494617 [收藏] [复制] [分享] [RSS]

空间首页 动态 记录 日志 相册 主题 分享 留言板 个人资料

日志

Analysis Components & Techniques(从MetricAnalyzers开始)

已有 984 次阅读| 2018-12-27 19:46 |系统分类:芯片设计

   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上在线下载源代码示例)。


点赞

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 注册

  • 关注TA
  • 加好友
  • 联系TA
  • 0

    周排名
  • 0

    月排名
  • 0

    总排名
  • 0

    关注
  • 2

    粉丝
  • 0

    好友
  • 0

    获赞
  • 6

    评论
  • 访问数
关闭

站长推荐 上一条 /2 下一条

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-4-19 04:51 , Processed in 0.027754 second(s), 18 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
返回顶部