首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >uvm中的tlm通信机制

uvm中的tlm通信机制

原创
作者头像
用户9546848
发布2025-10-05 19:16:22
发布2025-10-05 19:16:22
5400
代码可运行
举报
运行总次数:0
代码可运行
代码语言:cpp
代码运行次数:0
运行
复制
class in_monitor#(parameter WIDTH=8,parameter DEPTH=16) extends uvm_monitor#(in_transaction);

    in_interface              in_bus;

    logic                     winc;
    logic                     ricn;
    bit[WIDTH-1:0]            wdata;

    uvm_tlm_analysis_fifo#(in_transaction)          in_mon2rm_fifo;

    `uvm_component_utils(in_monitor)

    extern virtual function new(string name = "in_monitor",uvm_component parent);
    extern virtual function void build_phase(uvm_phase phase);
    extern virtual task main_phase(uvm_phase phase);

endclass:in_monitor

function in_monitor::new(string name, uvm_component parent);

    super.new(name,parent);

endfunction:new

function void in_monitor::build_phase(uvm_phase phase);

    super.build_phase(phase);
    if(!uvm_config_db#(virtual in_interface)::get(this,"","in_bus",this.in_bus))begin
        `uvm_fatal("","")
    end

endfunction:build_phase

task in_monitor::main_phase(uvm_phase phase);

    automatic in_transaction            req;
    super.main_phase(phase);
    while(1)begin
        @this.in_bus.mon_cb;
        this.winc <= this.in_bus.winc;
        this.rinc <= this.in_bus.rinc;
        this.wdata <= this.in_bus.wdata;

        this.req = in_transaction::type_id::create("req",this);
        this.req.winc = this.winc;
        this.req.rinc = this.rinc;
        this.req.wdata = this.wdata;

        if(this.in_mon2rm_fifo != null)begin
            this.in_mon2rm_fifo.write(this.req);
        end

    end
endtask:main_phase

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
作者已关闭评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档