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

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

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 10325|回复: 5

[求助] 利用mailbox怎么传递数据

[复制链接]
发表于 2014-6-8 08:37:32 | 显示全部楼层 |阅读模式

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

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

x
小弟有两个UVC(A_UVC和B_UVC),A_UVC的driver里有一个cfg的类,我想通过mailbox机制将这个cfg传送到B_UVC的Driver。

我在A的driver里面定义一个mailbox_A,然后把cfg put进去,在B的driver中定义一个mailbox_B;然后我在B的driver里面怎么get都拿不到东西啊?


除了在两个driver里面定义mailbox之外,还应该怎么处理才能让B的driver拿到A通过mailbox发送的数据呢?


没有用过mailbox,求高人指点一下!
不甚感激!
发表于 2014-6-8 16:41:37 | 显示全部楼层
你需要在一个顶层中将mailbox_A和mailbox_B连接起来,你这么做了吗?
下面是我提出来的一些代码,你看看吧。

在生成器gen.sv中定义mailbox,其中gen是类,所以在构造函数中将其端口连接
  mailbox gen2mas;
  function new(mailbox gen2mas, );
    this.gen2mas       = gen2mas; //将外部的mailbox和class中的mailbox连接
  endfunction
  task put;
   gen2mas.put(my_tr);
  endtask
  

//由于程序要求,有用到interface,你不用管它。
在master.sv中使用mailbox   //class
mailbox apb_mbox();
        function new (virtual apb_if.Master apb,mailbox apb_mbox);
          this.apb      = apb;
          this.apb_mbox = apb_mbox; //将外部的mailbox和class中的mailbox连接
        endfunction
   
        task get();
    apb_mbox.get(tr);
    endtask

       
在顶层Test.sv中将mailbox连接起来。
program automatic test(apb_if.Master apb);
   apb_gen     gen;   
   apb_master  mst;
  
  apb_mbox  = new();
  gen      = new(apb_mbox);
  mst      = new(apb, apb_mbox);
  
endprogram
发表于 2014-6-9 09:49:52 | 显示全部楼层
一直使用TLM port,没怎么用mailbox。
我来追问一句,这种场景下,mailbox和TLM port用什么区别呢?
发表于 2014-6-25 15:04:01 | 显示全部楼层
用UVM的话为什么不直接create A_UVC对应的cfg 然后使用config_db机制把这个cfg 分别set  A_UVC和B_UVC ,还使用SV 底层的mailbox .
如果是A_UVC中要在run_phase 动态的改变 cfg, 建议使用uvm_event trigger  然后B_UVC  里面wait trigger data
发表于 2016-4-19 10:12:24 | 显示全部楼层
本帖最后由 似水如烟 于 2016-4-19 10:18 编辑

不需要2楼说的那样在将两个邮箱接起来,有些地方应该也是有些不准确的。
在A_UVC的driver中:
mailbox mbx;
cfg cfg0;function new(mailbox mbx);
  this.mbx = mbx;
endfunction
task mbx_put;
   cfg0 = new();
   mbx.put(cfg0);
endtask
在B_UVC的Driver中:
mailbox mbx;
cfg cfg0;
function new(mailbox mbx);
  this.mbx = mbx;
endfunction
task mbx_get;
   mbx.get(cfg0);
endtask
这样就可以了,在B_UVC的Driver中后续中调用cfg0,就是你之前从邮箱中取出来的。
只需要在A_UVC和B_UVC共同的顶层实例化mbx即可
发表于 2016-4-19 11:34:25 | 显示全部楼层
你都用 UVM 了, 何不用  uvm_config_db
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

×

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

GMT+8, 2024-9-21 17:58 , Processed in 0.016217 second(s), 6 queries , Gzip On, Redis On.

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