uvm_primer ch18 put/get port的应用

20 篇文章 10 订阅

uvm_primer ch18 put/get port的应用

用来拆分出sequence

在这里插入图片描述

virtual class base_tester extends uvm_component;
`uvm_component_utils(base_tester)
   virtual tinyalu_bfm bfm;
   uvm_put_port #(command_s) command_port;//重点
   function void build_phase(uvm_phase phase);
      command_port = new("command_port", this);
   endfunction : build_phase
   pure virtual function operation_t get_op();
   pure virtual function byte get_data();
   task run_phase(uvm_phase phase);
      byte         unsigned        iA;
      byte         unsigned        iB;
      operation_t                  op_set;
      command_s    command;
      phase.raise_objection(this);
      command.op = rst_op;
      command_port.put(command); //重点
      repeat (1000) begin : random_loop
         command.op = get_op();
         command.A =  get_data();
         command.B =  get_data();
         command_port.put(command);
      end : random_loop
      #500;
      phase.drop_objection(this);
   endtask : run_phase
   function new (string name, uvm_component parent);
      super.new(name, parent);
   endfunction : new
endclass : base_tester


class driver extends uvm_component;
   `uvm_component_utils(driver)
   virtual tinyalu_bfm bfm;
   uvm_get_port #(command_s) command_port;  //重点
   function void build_phase(uvm_phase phase);
      if(!uvm_config_db #(virtual tinyalu_bfm)::get(null, "*","bfm", bfm))
        $fatal("Failed to get BFM");
      command_port = new("command_port",this);
   endfunction : build_phase
   task run_phase(uvm_phase phase);
      command_s    command;
      shortint     result;
      forever begin : command_loop
         command_port.get(command); //重点
         bfm.send_op(command.A, command.B, command.op, result);
      end : command_loop
   endtask : run_phase

   function new (string name, uvm_component parent);
      super.new(name, parent);
   endfunction : new

endclass : driver

总是将export传入port的connect方法中;

driver 和sequencer连接

在这里插入图片描述

问题

driver侧,是线程间通信,
monitor侧是线程内通信, WHY???

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值