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

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

日志

Connections to DUT Interfaces(从Config/VirtInterfaceConfigDb开始)

已有 864 次阅读| 2018-9-27 09:21 |系统分类:芯片设计

        Config/VirtInterfaceConfigDb

      Setting Virtual Interface Properties in the Testbench with the Configuration Database using the config_db API   

       这是将实际接口引用分配给测试平台内的虚拟接口句柄的推荐方法。这种方法通常有三个步骤。
       1.使用config_db API将指向特定接口实例的虚拟接口放入配置数据库。
       2.test class从配置数据库中提取虚拟接口,并将其放置在一个配置对象中,该配置对象可用于通过该特定接口与DUT通信的特定组件(agent,driver,monitor等)。
       3.通过虚拟接口实际访问DUT的组件将从提供的配置对象中的虚拟接口设置其虚拟接口属性。
       这里有一个讨论,为什么人们会采用test class的方法来获取信息并将信息分发给agent和事务传输器(如driver,monitor等),而不是让事务传输器或agent直接获取数据。
       此方法支持可伸缩性(即可变化性,即使接口变化了我改test class就行,不用改从test class往下传的多个组件的接口)和可重用性:

  • 由于事务传输器从配置对象接收接口实例信息,因此它不受DUT配置变化的影响。
  • 如果您使用emulation,则此方法适用于“双顶层”方法学中的协议模块。

       【此处需一幅图】

       Placing a Virtual Interface into the Configuration Database using the config_db API

       与OVM(其中代码仅限于存储从ovm_object派生的整数值,字符串或对象)不同,就将所有类型的信息存储在资源/配置数据库中而言,UVM允许更大的灵活性。这包括虚拟接口句柄,用户自定义类型等。使用config_db API时,将使用要存储的信息类型设置参数。这允许进行简单的set()和get()调用,而无需将信息包装在容器对象(如ovm_container)中。

       // Top level module for a wishbone system with bus connection
       // multiple masters and slaves
       module top_mac;
       ...
             // WISHBONE interface instance
             // Supports up to 8 masters and up to 8 slaves
             wishbone_bus_syscon_if wb_bus_if();
             ...

             initial begin
                //set interfaces in config space
                uvm_config_db #(virtual wishbone_bus_syscon_if)::set(null, "uvm_test_top",
                                                                                                         "WB_BUS_IF", wb_bus_if);

                 run_test("test_mac_simple_duplex"); // create and start running test
             end

         endmodule

         注意:

  • 我们使用“uvm_test_top”因为它比“*”更精确,更有效。除非您的顶层test在test组件的构造函数中执行除super.new(name,parent)之外的操作,否则这将始终有效。如果在test组件中执行了不同的操作,则必须相应地调整实例名称。
  • 我们在第一个参数中使用“null”,因为此代码位于顶层模块中,而不是某个组件中。

       Making the Virtual Interface Available in the Testbench

       test class创建一个具有虚拟接口属性的配置对象。然后,它通过调用config_db :: get()函数来对此属性进行分配,该函数从配置数据库传递虚拟接口。此method(此处指函数 config_db::get() )的第二个参数必须与用于将虚拟接口放置在配置数据库中的字符串相同。
       然后,test将配置对象放入配置数据库,以便为通过该特定接口与DUT通信的特定组件(agents, drivers, monitors等)提供访问。

       class test_mac_simple_duplex extends uvm_test;
       ...

          wb_config wb_config_0; // config object for WISHBONE BUS
          ...

          function void set_wishbone_config_params();
               //set configuration info
               wb_config_0 = new();

               if (!uvm_config_db #(virtual wishbone_bus_syscon_if)::get(this, "",
                                                                                                             "WB_BUS_IF",
                                                                                                             wb_config_0.v_wb_bus_if)) // virtual interface
                   `uvm_fatal("TEST_MAC_SIMPLE_DUPLEX", "Can't read WB_BUS_IF");

               ... // other WISHBONE bus configuration settings

               uvm_config_db#(wb_config)::set(this, "*", "wb_config", wb_config_0); // put in config

            endfunction

            function void build_phase(uvm_phase phase);
                super.build_phase(phase);
                set_wishbone_config_params();
                ...
            endfunction : build_phase
            ...
        endclass

        Assigning Virtual Interface Property in Transactor

        通过虚拟接口实际访问DUT的组件将从提供的配置对象中的虚拟接口设置其虚拟接口属性。

        // WISHBONE master driver
        class wb_m_bus_driver extends uvm_driver #(wb_txn, wb_txn);
        ...

            virtual wishbone_bus_syscon_if m_v_wb_bus_if; // Virtual Interface
            wb_config m_config;
            ...
            function void build_phase(uvm_phase phase);
                 super.build_phase(phase);
                 if (!uvm_config_db #(wb_config)::get(this, "", "wb_config", m_config)) // get config object
                     `uvm_fatal("Config Fatal", "Can't get the wb_config")
                 ...
             endfunction : build_phase

             function void connect_phase(uvm_phase phase);
                  super.connect_phase(phase);
                  m_v_wb_bus_if = m_config.v_wb_bus_if; // set local virtual if property
             endfunction : connect_phase

             ...
          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-16 16:30 , Processed in 0.029751 second(s), 18 queries , Gzip On, Redis On.

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