在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 4624|回复: 1

[求助] 求助:uvm的回调怎么使用`uvm_do_callbacks

[复制链接]
发表于 2012-5-11 16:32:28 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
各位:
      正在看《A practical Guide to Adopting the Universal Verification
》,正看到第四章最后的回调,将书上的例子跑一下,结果有错,我是新手,不知道遇到这种类型的错误该怎么弄,特来请教大家。
      systemverilog代码:
program test;
    import uvm_pkg::*;
    `include "uvm_macros.svh"

    class street extends uvm_component;
        `uvm_component_utils(street)
        function new(string name, uvm_component parent);
            super.new(name, parent);
        endfunction : new
        task run();
            `uvm_info("INFOl", "I vacationed here in 2010", UVM_LOW)
        endtask : run
    endclass : street

    class city extends uvm_component;
        street  Main_St;
        `uvm_component_utils(city)
        `uvm_register_cb(city,city_cbs)
        function new(string name, uvm_component parent);
            super.new(name, parent);
        endfunction : new
        function void build();// note that we allocate in the build()
            super.build();
            Main_St = street::type_id::create("Main_St", this);
        endfunction : build
        task run () ;
            uvm_component child, parent;
            string pr, ch;
            child = get_child("Main_St");
            parent= get_parent();
            //pr= parent.get_full_name();
            pr = parent.get_name();
            ch = child.get_name();
            `uvm_do_callbacks(city,city_cbs,pre_info(this))
            `uvm_info(get_type_name(),$psprintf("Parent:%s Child:%s",pr,ch),UVM_LOW);
        endtask :run
    endclass:city

    virtual class city_cbs extends uvm_callback;
        function new(string name="city_cb");
            super.new(name);
        endfunction
        pure virtual function void pre_info(city c);
    endclass : city_cbs

    class state extends uvm_component;
        city Capital_city;
        `uvm_component_utils(state)
        function new(string name, uvm_component parent);
            super.new(name, parent);
        endfunction : new
        function void build();
            super.build();
            Capital_city=city::type_id::create("Capital_city", this);
        endfunction : build
        function void end_of_elaboration();
            this.print();
        endfunction : end_of_elaboration
    endclass:state
   
    class my_city_cb extends city_cbs;
        function new(string name ="my_city_cb");
            super.new(name);
        endfunction
        virtual function void pre_info(city c);
            `uvm_info("my_city_cb",$psprintf("pre_info called for city %s",c.get_full_name()),UVM_LOW)
        endfunction
    endclass:my_city_cb

    state Florida=state::type_id::create("Florida", null);
    state New_York=state::type_id::create("New_York", null);
    typedef uvm_callbacks#(city,city_cbs) city_cb;
    my_city_cb cb = new;
    // Start UVM Phases
    initial begin
        city_cb::add(null,cb);
        run_test();
    end
    initial #100 global_stop_request();
endprogram: test
用irun -uvm test.sv运行得到的错误提示:
file: test.sv
            `uvm_do_callbacks(city,city_cbs,pre_info(this))
                                                                                   |
ncvlog: *E,SVNOTY (test.sv,34|58): Syntactically this identifier appears to begin a datatype but it does not refer to a visible datatype in the current scope.
(`define macro: uvm_do_obj_callbacks [/opt1/eda_tools/cadence2011/tools/uvm/uvm_lib/uvm_sv/sv/macros/uvm_callback_defines.svh line 162], `define macro: uvm_do_callbacks [/opt1/eda_tools/cadence2011/tools/uvm/uvm_lib/uvm_sv/sv/macros/uvm_callback_defines.svh line 139], file: test.sv line 34)
发表于 2016-11-6 03:48:46 | 显示全部楼层
UVM for analog ?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

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

GMT+8, 2024-9-21 20:46 , Processed in 0.014088 second(s), 6 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表