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

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

日志

Testbench_Testbench/Build(从Factory Overrides开始)

已有 782 次阅读| 2018-9-7 16:37 |系统分类:芯片设计

       Factory Overrides

      从construction这个观点来说,UVM factory允许一个UVM 类被另一个继承类替换。此工具可用于更改或更新组件行为或扩展配置对象。必须在构造目标对象之前指定factory重载,因此在构建过程开始时这样做很方便。

      Sub-Component Configuration Objects

      每个集合组件(如agent或env)都应具有定义其结构和行为的配置对象。这些配置对象应该在test build method里被创建,并根据测试用例的要求进行配置。如果子组件的配置要么复杂,要么可能会发生变化,那么值得添加一个虚函数调用来处理配置,因为这可能会在从基本测试类扩展来的测试用例中过载。

      //
      // Class Description:
      //
      // class spi_test_base extends uvm_test;


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

      //------------------------------------------
      // Data Members
      //------------------------------------------

      //------------------------------------------
      // Component Members
      //------------------------------------------
      // The environment class
      spi_env m_env;
      // Configuration objects
      spi_env_config m_env_cfg;
      apb_agent_config m_apb_cfg;
      spi_agent_config m_spi_cfg;    
     

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

       // Standard UVM Methods:
       extern function new(string name = "spi_test_base", uvm_component parent = null);
       extern function void build_phase( uvm_phase phase );
       extern virtual function void configure_env(spi_env_config cfg);
       extern virtual function void configure_apb_agent(apb_agent_config cfg);

       endclass: spi_test_base

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

       // Build the env, create the env configuration
       // including any sub configurations and assigning virtual interfaces
       function void spi_test_base::build_phase( uvm_phase phase );
        // Create env configuration object
       m_env_cfg = spi_env_config::type_id::create("m_env_cfg");
       // Call function to configure the env
        m_apb_cfg = apb_agent_config::type_id::create("m_apb_cfg");
       // Call function to configure the apb_agent
       configure_apb_agent(m_apb_cfg);
       // More to follow
       endfunction: build_phase

       //
       // Convenience function to configure the env
       //
       // This can be overloaded by extensions to this base class
       function void spi_test_base::configure_env(spi_env_config cfg);
           cfg.has_functional_coverage = 1;
           cfg.has_reg_scoreboard = 0;
           cfg.has_spi_scoreboard = 1;
       endfunction: configure_env

       //
       // Convenience function to configure the apb agent
       //
       // This can be overloaded by extensions to this base class
       function void spi_test_base::configure_apb_agent(apb_agent_config cfg);
           cfg.active = UVM_ACTIVE;
           cfg.has_functional_coverage = 0;
           cfg.has_scoreboard = 0;
       endfunction: configure_apb_agent

     


点赞

评论 (0 个评论)

facelist

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

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

    周排名
  • 0

    月排名
  • 0

    总排名
  • 0

    关注
  • 2

    粉丝
  • 0

    好友
  • 0

    获赞
  • 6

    评论
  • 访问数
关闭

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

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

GMT+8, 2024-4-26 18:03 , Processed in 0.033066 second(s), 18 queries , Gzip On, Redis On.

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