我是靠谱客的博主 笑点低宝贝,最近开发中收集的这篇文章主要介绍[UVM]UVM TLM FIFO使用方法總結                     UVM TLM FIFO用法總結,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

                     UVM TLM FIFO用法總結

 

  • 目录

一、TLM FIFO Overview

二、TLM FIFO Classes

三、TLM FIFO Methods

3.1、new

3.2、size

3.3、used

3.4、is_empty

3.5、is_full

3.6、flush

四、Summary of TLM FIFOs


       The TLM FIFO provides storage for the transactions between two independently running processes. We have seen put and get methods operates with only one outstanding transaction at a time i.e it is allowed to send the transaction Only after consumption of the previously sent transaction, in this case, the sender and receiver must be in sync else lead to blocking in one of the components.

       What if the case where the sender needs not wait for the receiver acknowledgment, it just wants to store it in memory and the receiver can consume whenever required. in this sender and The receiver needs not to be in sync. Yes With TLM FIFO it is possible.

            

 

一、TLM FIFO Overview

  • In TLM FIFO, the sender pushes the transactions to FIFO and whenever it required reiver pops it out or fetches from the FIFO
  • Transactions are put into the FIFO via the put_export method
  • Transactions are fetched from the FIFO via the get_peek_export method
  • As its FIFO (First In First Out), transactions are fetched from the FIFO in the order they are put

 

二、TLM FIFO Classes

uvm_tlm_fifo #(T)

       This class provides storage of transactions between two independently running processes

 

三、TLM FIFO Methods

3.1、new

  •   This is a constructor method used for the creation of TLM FIFO
function new (string name,
              uvm_component parent,
              int size=1);
  • The name and parent are the normal uvm_component constructor arguments
  • The size indicates the maximum size of the FIFO; a value of zero indicates no upper bound

3.2、size

  • Calling size() returns the size of the FIFO
  • A return value of 0 indicates the FIFO capacity has no limit

3.3、used

  • Returns the number of entries put into the FIFO

3.4、is_empty

  • Returns 1 when there are no entries in the FIFO, 0 otherwise

3.5、is_full

  • Returns 1 when the number of entries in the FIFO is equal to its size, 0 otherwise

3.6、flush

  • Calling flush method will Remove all entries from the FIFO
  • after the flush method call used method returns 0 and the is_empty method returns 1

 

四、Summary of TLM FIFOs

             

 

五、TLM Analysis FIFO Example

 5.1、

            

 5.2 

           

 

 5.2、Implementing analysis port in comp_a

class component_a extends uvm_component;
  
  transaction                             trans;
  //Step-1. Declaring analysis port
  uvm_analysis_port#(transaction)         analysis_port;
  
  `uvm_component_utils(component_a)
  
  //---------------------------------------
  // Constructor
  //---------------------------------------
  function new(string name, uvm_component parent);
    super.new(name, parent);
    
    //Step-2. Creating analysis port
    analysis_port = new("analysis_port", this);
  endfunction : new
  //---------------------------------------
  // run_phase
  //---------------------------------------
  virtual task run_phase(uvm_phase phase);
    phase.raise_objection(this);
    
    trans = transaction::type_id::create("trans", this);
    void'(trans.randomize());
    `uvm_info(get_type_name(), $sformatf(" tranaction randomized"), UVM_LOW)
    `uvm_info(get_type_name(), $sformatf(" Printing trans, n %s", trans.sprint()), UVM_LOW)
    
    `uvm_info(get_type_name(),$sformatf(" Before calling port write method"),UVM_LOW)
    //Ste-3. Calling write method
    analysis_port.write(trans);
    `uvm_info(get_type_name(), $sformatf(" After  calling port write method"), UVM_LOW)
    
    phase.drop_objection(this);

  endtask : run_phase

endclass : component_a

 5.3、Implementing analysis FIFO in comp_b

class component_b extends uvm_component;
  
  transaction                              trans;
  //Step-1. Declaring analysis FIFO
  uvm_tlm_analysis_fifo #(transaction)     analy_fifo;  
  `uvm_component_utils(component_b)
  
  //---------------------------------------
  // Constructor
  //---------------------------------------
  function new(string name, uvm_component parent);
    super.new(name, parent);
    //Step-2. Creating analysis FIFO
    analy_fifo = new("analy_fifo", this);
  endfunction : new
  
  //---------------------------------------
  // run_phase
  //---------------------------------------
  virtual task run_phase(uvm_phase phase);
    phase.raise_objection(this);
    
    #100;
    `uvm_info(get_type_name(), $sformatf(" Before calling analysis fifo get method"), UVM_LOW)
    //Step.3 - Getting trans from FIFO
    analy_fifo.get(trans);
    `uvm_info(get_type_name(), $sformatf(" After  calling analysis fifo get method"), UVM_LOW)
    `uvm_info(get_type_name(), $sformatf(" Printing trans, n %s",trans.sprint()), UVM_LOW)
    
    phase.drop_objection(this);

  endtask : run_phase

endclass : component_b

5.4、Connecting analysis port and analysis FIFO in env

function void connect_phase(uvm_phase phase);
  //Connecting analysis port to analysis FIFO
  comp_a.analysis_port.connect(comp_b.analy_fifo.analysis_export);
endfunction : connect_phase

 

最后

以上就是笑点低宝贝为你收集整理的[UVM]UVM TLM FIFO使用方法總結                     UVM TLM FIFO用法總結的全部内容,希望文章能够帮你解决[UVM]UVM TLM FIFO使用方法總結                     UVM TLM FIFO用法總結所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(43)

评论列表共有 0 条评论

立即
投稿
返回
顶部