• factory源码分析——component_registry和object_registry


    registry类主要是为object和component提供一个轻量级的代理(lightweight proxy)来方便factory实现;

    registry class从uvm_object_wrapper继承而来

    uvm_object_wrapper是一个virtual class,内部包含三个virtual function,为create_object,create_component

                              get_type_name,留下接口;

          不包含任何成员变量;也不从其他class继承而来;

          

    uvm_component_registry:包含两个参数,type和string,在宏调用的时候,一般是相同的;

    内部两个static的成员变量:type_name = Tname;

                 this_type = me; this_type是针对某个参数registry的具体的typedef;

          实现function,get_type_name;

            static function, get;同时registry到factory中,所以factory中注册的其实都是class对应的static类型的registry class

          

          

    实现create的两个function:

    1)create_component,factory最终调用的create函数,被调用;

          

    2)create函数,得到factory的唯一实例,调用create_component_by_type,contxt可以是parent的path,

          static的function

          

    两个override的static的function:

          由于registry中,有component的type,所以都是type类型的override;

          

          

    uvm_object_registry类似;

          两个static类型的变量,两个create的function,两个overide的function。

    除了调用uvm提供的宏,也可以自定义type_id的typedef,来完成factory的注册等操作。

          class mycomp extends uvm_component;

            typedef uvm_omponent_registry #(mycomp, "mycomp") type_id;

          endclass

    这样的操作,缺少get_type,get_object_type的function。

  • 相关阅读:
    border-radius的8个属性值_画半圆、叶子等
    CSS的background简写方式(转)
    frameset左右栏锚点定位实例
    HTML5新增
    安装MSI报2503的错误
    当前标识(IIS APPPOOLDefaultWebSite)没有对“C:WindowsMicrosoft.NETFramework64v2.0.50727Temporary ASP.NET Files”的写访问权限 解决方案
    Windows设置相关性AFFINITY,修改使用核心数
    Yaml格式文件处理
    Vs2017离线安装包制作
    Vs2017常用快捷键
  • 原文地址:https://www.cnblogs.com/-9-8/p/7561690.html
Copyright © 2020-2023  润新知