Sockets & b_transport

The standard plumbing of TLM 2.0. How Initiators talk to Targets.

Combined Port & Export

In TLM 2.0, the unidirectional Port/Export model is replaced by the Socket. A socket is a combined object that handles both the Initiator (Requestor) and Target (Responder) logic in a single connection.

Types of Sockets:

  • Initiator Socket: Sits in the master component. It "starts" the call.
  • Target Socket: Sits in the slave component. It "implements" the call.

Blocking Transport (b_transport)

The b_transport task is the workhorse of TLM 2.0. It is a blocking call that passes a Generic Payload and a Time Delay object.

Target Implementation: Memory Model

task b_transport(uvm_tlm_generic_payload trans, uvm_tlm_time delay);
    // 1. Validate the command
    if (trans.get_command() == UVM_TLM_READ_COMMAND) begin
        // Perform read from memory array
        // ...
        trans.set_response_status(UVM_TLM_OK_RESPONSE);
    end
    // 2. Add local delay (Temporal Decoupling)
    delay.add(10, UVM_NS); 
endtask
                            

Temporal Decoupling & Quantum

Why pass a uvm_tlm_time object instead of calling #10ns? This enables Loosely-Timed (LT) modeling. Components accumulate local time offsets and only synchronize with the simulation kernel periodically.

The Performance Gain:

By avoiding actual simulator #wait calls, TLM 2.0 models can run 100x to 1000x faster than RTL, making them ideal for software development and architectural exploration.

UVM Simple Sockets

UVM provides "Simple Sockets" (Initiator and Target) which handle most of the boilerplate code like registration and callback binding.

Connection in Environment

function void connect_phase(uvm_phase phase);
    // Simple 1-to-1 socket binding
    my_master.isock.connect(my_slave.tsock);
endfunction
                            

TLM 2.0 Casting Rule

Unlike TLM 1.0, sockets are bound to the Generic Payload type by default. If you need custom fields, use the Extension Mechanism rather than creating custom socket types. This maintains interoperability.