TLM Implementation Port Declaration Macros

The TLM implementation declaration macros provide a way for components to provide multiple implementation ports of the same implementation interface.  When an implementation port is defined using the built-in set of imps, there must be exactly one implementation of the interface.

For example, if a component needs to provide a put implementation then it would have an implementation port defined like:

class mycomp extends uvm_component;
  uvm_put_imp#(data_type, mycomp) put_imp;
  ...
  virtual task put (data_type t);
    ...
  endtask
endclass

There are times, however, when you need more than one implementation for an interface.  This set of declarations allow you to easily create a new implementation class to allow for multiple implementations.  Although the new implementation class is a different class, it can be bound to the same types of exports and ports as the original class.  Extending the put example above, let’s say that mycomp needs to provide two put implementation ports.  In that case, you would do something like:

//Define two new put interfaces which are compatible with uvm_put_ports
//and uvm_put_exports.

`uvm_put_imp_decl(_1)
`uvm_put_imp_decl(_2)

class my_put_imp#(type T=int) extends uvm_component;
   uvm_put_imp_1#(T,my_put_imp#(T)) put_imp1;
   uvm_put_imp_2#(T,my_put_imp#(T)) put_imp2;
   ...
   function void put_1 (input T t);
     //puts coming into put_imp1
     ...
   endfunction
   function void put_2(input T t);
     //puts coming into put_imp2
     ...
   endfunction
endclass

The important thing to note is that each `uvm_<interface>_imp_decl creates a new class of type uvm_<interface>_imp<suffix>, where suffix is the input argument to the macro.  For this reason, you will typically want to put these macros in a separate package to avoid collisions and to allow sharing of the definitions.

`uvm_blocking_put_imp_decl

`uvm_blocking_put_imp_decl(SFX)

Define the class uvm_blocking_put_impSFX for providing blocking put implementations.  SFX is the suffix for the new class type.

`uvm_nonblocking_put_imp_decl

`uvm_nonblocking_put_imp_decl(SFX)

Define the class uvm_nonblocking_put_impSFX for providing non-blocking put implementations.  SFX is the suffix for the new class type.

`uvm_put_imp_decl

`uvm_put_imp_decl(SFX)

Define the class uvm_put_impSFX for providing both blocking and non-blocking put implementations.  SFX is the suffix for the new class type.

`uvm_blocking_get_imp_decl

`uvm_blocking_get_imp_decl(SFX)

Define the class uvm_blocking_get_impSFX for providing blocking get implementations.  SFX is the suffix for the new class type.

`uvm_nonblocking_get_imp_decl

`uvm_nonblocking_get_imp_decl(SFX)

Define the class uvm_nonblocking_get_impSFX for providing non-blocking get implementations.  SFX is the suffix for the new class type.

`uvm_get_imp_decl

`uvm_get_imp_decl(SFX)

Define the class uvm_get_impSFX for providing both blocking and non-blocking get implementations.  SFX is the suffix for the new class type.

`uvm_blocking_peek_imp_decl

`uvm_blocking_peek_imp_decl(SFX)

Define the class uvm_blocking_peek_impSFX for providing blocking peek implementations.  SFX is the suffix for the new class type.

`uvm_nonblocking_peek_imp_decl

`uvm_nonblocking_peek_imp_decl(SFX)

Define the class uvm_nonblocking_peek_impSFX for providing non-blocking peek implementations.  SFX is the suffix for the new class type.

`uvm_peek_imp_decl

`uvm_peek_imp_decl(SFX)

Define the class uvm_peek_impSFX for providing both blocking and non-blocking peek implementations.  SFX is the suffix for the new class type.

`uvm_blocking_get_peek_imp_decl

`uvm_blocking_get_peek_imp_decl(SFX)

Define the class uvm_blocking_get_peek_impSFX for providing the blocking get_peek implementation.

`uvm_nonblocking_get_peek_imp_decl

`uvm_nonblocking_get_peek_imp_decl(SFX)

Define the class uvm_nonblocking_get_peek_impSFX for providing non-blocking get_peek implementation.

`uvm_get_peek_imp_decl

`uvm_get_peek_imp_decl(SFX)

Define the class uvm_get_peek_impSFX for providing both blocking and non-blocking get_peek implementations.  SFX is the suffix for the new class type.

`uvm_blocking_master_imp_decl

`uvm_blocking_master_imp_decl(SFX)

Define the class uvm_blocking_master_impSFX for providing the blocking master implementation.

`uvm_nonblocking_master_imp_decl

`uvm_nonblocking_master_imp_decl(SFX)

Define the class uvm_nonblocking_master_impSFX for providing the non-blocking master implementation.

`uvm_master_imp_decl

`uvm_master_imp_decl(SFX)

Define the class uvm_master_impSFX for providing both blocking and non-blocking master implementations.  SFX is the suffix for the new class type.

`uvm_blocking_slave_imp_decl

`uvm_blocking_slave_imp_decl(SFX)

Define the class uvm_blocking_slave_impSFX for providing the blocking slave implementation.

`uvm_nonblocking_slave_imp_decl

`uvm_nonblocking_slave_imp_decl(SFX)

Define the class uvm_nonblocking_slave_impSFX for providing the non-blocking slave implementation.

`uvm_slave_imp_decl

`uvm_slave_imp_decl(SFX)

Define the class uvm_slave_impSFX for providing both blocking and non-blocking slave implementations.  SFX is the suffix for the new class type.

`uvm_blocking_transport_imp_decl

`uvm_blocking_transport_imp_decl(SFX)

Define the class uvm_blocking_transport_impSFX for providing the blocking transport implementation.

`uvm_nonblocking_transport_imp_decl

`uvm_nonblocking_transport_imp_decl(SFX)

Define the class uvm_nonblocking_transport_impSFX for providing the non-blocking transport implementation.

`uvm_transport_imp_decl

`uvm_transport_imp_decl(SFX)

Define the class uvm_transport_impSFX for providing both blocking and non-blocking transport implementations.  SFX is the suffix for the new class type.

`uvm_analysis_imp_decl

`uvm_analysis_imp_decl(SFX)

Define the class uvm_analysis_impSFX for providing an analysis implementation.  SFX is the suffix for the new class type.  The analysis implementation is the write function.  The `uvm_analysis_imp_decl allows for a scoreboard (or other analysis component) to support input from many places.  For example:

`uvm_analysis_imp_decl(_ingress)
`uvm_analysis_imp_decl(_egress)

class myscoreboard extends uvm_component;
  uvm_analysis_imp_ingress#(mydata, myscoreboard) ingress;
  uvm_analysis_imp_egress#(mydata, myscoreboard) egress;
  mydata ingress_list[$];
  ...

  function new(string name, uvm_component parent);
    super.new(name,parent);
    ingress = new("ingress", this);
    egress = new("egress", this);
  endfunction

  function void write_ingress(mydata t);
    ingress_list.push_back(t);
  endfunction

  function void write_egress(mydata t);
    find_match_in_ingress_list(t);
  endfunction

  function void find_match_in_ingress_list(mydata t);
    //implement scoreboarding for this particular dut
    ...
  endfunction
endclass