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

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

日志

Testbench/Factory

已有 745 次阅读| 2018-9-19 14:04 |系统分类:芯片设计

        The UVM Factory

      UVM factory的目的是允许将一种类型的对象替换为派生类型的对象,而无需更改测试平台的结构或编辑测试平台代码。使用的机制被称为重载,重载可以是by instance or type。此功能对于更改sequence功能或将组件的一个版本更改为另一个版本非常有用。要交换的任何组件必须是多态兼容的。这包括具有所有相同的TLM接口句柄,并且必须由新的替换组件创建TLM对象。另外,为了利用factory,需要遵循某些编码约定。

       Factory Coding Convention 1: Registration

      组件或对象必须包含factory注册代码,该代码包含以下元素:

  • 一个uvm_component_registry包装器,typedefed为type_id
  • 获取type_id的静态函数
  • 获取类型名称的函数

      例如:

        class my_component extends uvm_component;

        // Wrapper class around the component class that is used within the factory
        typedef uvm_component_registry #(my_component, "my_component") type_id;

        // Used to get the type_id wrapper
        static function type_id get_type();
             return type_id::get();
        endfunction

        // Used to get the type_name as a string
        function string get_type_name();
             return "my_component";
       endfunction 

       ...

       endclass: my_component

       注册代码具有常规模式,可以使用一组四个factory注册宏中的一个安全地生成:

       // For a component
       class my_component extends uvm_component;

       // Component factory registration macro
       `uvm_component_utils(my_component)

       // For a parameterised component
       class my_param_component #(int ADD_WIDTH=20, int DATA_WIDTH=23) extends uvm_component;

       typedef my_param_component #(ADD_WIDTH, DATA_WIDTH) this_t;

       // Parameterised component factory registration macro
       `uvm_component_param_utils(this_t)

       // For a class derived from an object (uvm_object, uvm_transaction, uvm_sequence_item, uvm_sequence etc)
      class my_item extends uvm_sequence_item;

      `uvm_object_utils(my_item)

       // For a parameterised object class
       class my_item #(int ADD_WIDTH=20, int DATA_WIDHT=20) extends uvm_sequence_item;

       typedef my_item #(ADD_WIDTH, DATA_WIDTH) this_t

       `uvm_object_param_utils(this_t)
      


点赞

评论 (0 个评论)

facelist

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

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

    周排名
  • 0

    月排名
  • 0

    总排名
  • 0

    关注
  • 2

    粉丝
  • 0

    好友
  • 0

    获赞
  • 6

    评论
  • 访问数
关闭

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

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

GMT+8, 2024-3-29 18:07 , Processed in 0.029088 second(s), 18 queries , Gzip On, Redis On.

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