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

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

日志

Testbench/Agent(从The Agent Build Phase开始)

已有 679 次阅读| 2018-9-18 10:24 |系统分类:芯片设计

        The Agent Build Phase     

        在agent的build phase中发生的操作由其配置对象的内容确定。method中的第一个操作是获取对配置对象的引用。然后,从这点来说,测试适当的配置字段以确定它们是否应该被构造。

        【此处需一幅图】
 
        此规则的例外情况是始终构建的monitor,因为无论agent是active还是passive,都会使用它。
 
        The Agent Connect Phase
      
        一旦构建了agent的子组件,就需要连接它们。 通常需要的连接是:
  • Monitor analysis port to the agent's analysis port
  • The sequencer's seq_item_pull_export to the driver's seq_item_pull_port (If the agent is active).
  • Any agent analysis sub-components analysis exports to the monitor's analysis port
  • 将driver和monitor中的虚拟接口分配给配置对象中的虚拟接口

        Notes:
        1.可以从monitor的analysis port为agent的analysis port句柄分配指针。这节省了必须在agent中构建单独的analysis port对象。
        2.在agent中为driver和monitor分配虚拟接口,这就不需要这些子组件具有配置表查找的代价了。

        apb agent的以下代码说明了配置对象如何确定在build phase和connect phase期间发生的情况:

        //
        // Class Description:
        //
        //
        class apb_agent extends uvm_component;

        // UVM Factory Registration Macro
        //
        `uvm_component_utils(apb_agent)

        //------------------------------------------
        // Data Members
        //------------------------------------------
        apb_agent_config m_cfg;
        //------------------------------------------
        // Component Members
        //------------------------------------------
        uvm_analysis_port #(apb_seq_item) ap;
        apb_monitor m_monitor;
        apb_sequencer m_sequencer;
        apb_driver m_driver;
        apb_coverage_monitor m_fcov_monitor;        

        //------------------------------------------
        // Methods
        //------------------------------------------

        // Standard UVM Methods:
        extern function new(string name = "apb_agent", uvm_component parent = null);
        extern function void build_phase( uvm_phase phase );
        extern function void connect_phase( uvm_phase phase );

        endclass: apb_agent

        function apb_agent::new(string name = "apb_agent", uvm_component parent = null);
             super.new(name, parent);
        endfunction

        function void apb_agent::build_phase( uvm_phase phase );
             if( !uvm_config_db #( apb_agent_config )::get(this,"apb_agent_config",m_cfg) ) `uvm_error(...)
             // Monitor is always present
             m_monitor = apb_monitor::type_id::create("m_monitor", this);
             // Only build the driver and sequencer if active
             if(m_cfg.active == UVM_ACTIVE) begin
                   m_driver = apb_driver::type_id::create("m_driver", this);
                   m_sequencer = apb_sequencer::type_id::create("m_sequencer", this);
             end
             if(m_cfg.has_functional_coverage) begin
                   m_fcov_monitor = apb_coverage_monitor::type_id::create("m_fcov_monitor", this);
             end

         endfunction: build_phase

         function void apb_agent::connect_phase( uvm_phase phsae );
              m_monitor.APB = m_cfg.APB;
              ap = m_monitor.ap;
              // Only connect the driver and the sequencer if active
              if(m_cfg.active == UVM_ACTIVE) begin
                   m_driver.seq_item_port.connect(m_sequencer.seq_item_export);
                   m_driver.APB = m_cfg.APB;
              end
              if(m_cfg.has_functional_coverage) begin
                   m_monitor.ap.connect(m_fcov_monitor.analysis_export);
              end

         endfunction: connect_phase

         在块级测试平台示例中agent的构建过程可以遵循此处APB agent的构建过程:

         (可以从网站http://verificationacademy.com/uvm-ovm在线下载源代码示例

点赞

评论 (0 个评论)

facelist

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

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

    周排名
  • 0

    月排名
  • 0

    总排名
  • 0

    关注
  • 2

    粉丝
  • 0

    好友
  • 0

    获赞
  • 6

    评论
  • 访问数
关闭

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

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

GMT+8, 2024-3-28 18:13 , Processed in 0.025567 second(s), 18 queries , Gzip On, Redis On.

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