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

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

日志

Testbench_Testbench/Build(从Nesting Sub-Component Configuration Objects开始)

已有 853 次阅读| 2018-9-10 10:41 |系统分类:芯片设计

       Nesting Sub-Component Configuration Objects

       配置对象通过test的UVM组件配置空间传递给子组件。它们可以使用uvm_config_db :: set  method中的path参数单独传递,以控制哪些组件可以访问对象。但是,常见的要求是中间组件也需要进行一些本地配置。
       因此,通过测试平台层次结构来处理配置对象传递的有效方法是嵌套彼此内部的配置对象以反映层次结构本身的方式。在测试平台的每个中间层次,解压缩该级别的配置对象,然后重新配置其子配置对象(如果需要),然后使用uvm_config_db :: set传递给相关组件。
       在下面的SPI块级环境示例中,每个agent都将具有单独的配置对象。envs配置对象将为每个agent配置对象提供一个句柄。在test中,将从测试用例的角度构造和配置所有配置对象,然后将env配置对象内的agent配置对象句柄分配给实际的agent配置对象。然后将env配置对象设置到配置空间中,以便在构建env时能检测到。

       【此处需插一副图】

        对于更复杂的环境,将需要额外的嵌套层次。

        //
        // Configuration object for the spi_env:
        //

        //
        // Class Description:
        //
        //
        class spi_env_config extends uvm_object;

        // UVM Factory Registration Macro
        //
        `uvm_object_utils(spi_env_config)
       

         //------------------------------------------
         // Data Members
         //------------------------------------------
         // Whether env analysis components are used:
         bit has_functional_coverage = 1;
         bit has_reg_scoreboard = 0;
         bit has_spi_scoreboard = 1;

         // Configurations for the sub_components
         apb_config m_apb_agent_cfg;
         spi_agent_config m_spi_agent_cfg;

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

         // Standard UVM Methods:
         extern function new(string name = "spi_env_config");

         endclass: spi_env_config

         function spi_env_config::new(string name = "spi_env_config");
             super.new(name);
         endfunction

         //
         // Inside the spi_test_base class, the agent config handles are assigned:
         //
         // The build method from before, adding the apb agent virtual interface assignment
         // Build the env, create the env configuration
         // including any sub configurations and assigning virtural 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
         configure_env(m_env_cfg);
        // Create apb agent configuration object
        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);
        // Adding the apb virtual interface:
        if( !uvm_config_db #( virtual apb3_if )::get(this, "" , "APB_vif",m_apb_cfg.APB) ) `uvm_error(...)
        // Assign the apb_angent config handle inside the env_config:
        m_env_cfg.m_apb_agent_cfg = m_apb_cfg;
        // Repeated for the spi configuration object
        m_spi_cfg = spi_agent_config::type_id::create("m_spi_cfg");
        configure_spi_agent(m_spi_cfg);
        if( !uvm_config_db #( virtual apb3_if )::get(this, "" , "SPIvif",m_spi_cfg.SPI) ) `uvm_error(...)
        m_env_cfg.m_spi_agent_cfg = m_spi_cfg;
        // Now env config is complete set it into config space:
        uvm_config_db #( spi_env_config )::set( this , "*m_spi_agent*", "spi_env_config", m_env_cfg) );
        // Now we are ready to build the spi_env:
        m_env = spi_env::type_id::create("m_env", this);


        endfunction: build_phase
       


点赞

评论 (0 个评论)

facelist

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

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

    周排名
  • 0

    月排名
  • 0

    总排名
  • 0

    关注
  • 2

    粉丝
  • 0

    好友
  • 0

    获赞
  • 6

    评论
  • 访问数
关闭

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

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

GMT+8, 2024-3-28 17:20 , Processed in 0.014279 second(s), 11 queries , Gzip On, Redis On.

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