Tutorials
Learn More
TLM 2.0
- TLM 2.0 passes transactions by reference but TLM 1.0 passes by value. Due to this, the speed of TLM 2.0 is higher than TLM 1.0
- What makes TLM 2.0 different from TLM 1.0?
a. TLM 2.0 provides a generic payload as a built-in class that has set methods and members. This is useful in interacting with the bus or memory.
b. TLM 1.0 has all ports default parameterized by data type int whereas In TLM 2.0 by the generic payload.
c. TLM 2.0 provides the class uvm_tlm_time which can be used in different timescales. The time values can be represented in canonical form that can bridge initiators and targets located in different time precisions and timescales. - It mainly has
a. Transport
b. Time
c. Generic Payload
d. Socket
Transport
There are three transport functions/tasks.
1. b_transport
virtual task b_transport (T t, uvm_tlm_time tlm_delay)
2. nb_transport_fw
virtual function uvm_tlm_sync_e nb_transport_fw (T t, ref P p, input uvm_tlm_time tlm_delay)
3. nb_transport_bw
virtual function uvm_tlm_sync_e nb_transport_bw (T t, ref P p, input uvm_tlm_time tlm_delay)
Where,
1. ‘b’ stands for blocking, ‘nb’ stands for non_blocking.
2. ‘fw’ stands for forward, ‘bw’ stands for backward
3. T – uvm_tlm_generic_payload, P – uvm_tlm_phase_e
uvm_tlm_time
- uvm_tlm_time type represents a time value in an ordered manner.
- This type can bridge producers (initiators) and consumers (targets) located in different time precisions and timescales. This is useful when we have two different VIPs (Verification IPs) that have different time scales.
- Helpful in synchronization of two different timescale packages.
uvm_tlm_time Methods
Few available Methods are mentioned below:
Methods |
Descriptions |
new |
Create a new time value |
reset |
Reset the value to 0 |
get _name |
Return the name of this instance |
set_time_resolution |
Set default time resolution |
get_realtime |
Return current time value, scaled for caller’s timescale. |
decr |
Decrement time value by a specific number of the scaled time unit. |
incr |
Increment time value by a specific number of the scaled time unit. |
uvm_tlm_time example
time.sv
`timescale 1ns/1ps
package time_pkg;
import uvm_pkg::*;
class increment_time;
function void inc(inout time t);
t += 10ns;
endfunction
endclass
endpackage
tlm_time.sv
`timescale 1ns/1ps
package tlm_time_pkg;
import uvm_pkg::*;
class increment_tlm_time;
function void inc(uvm_tlm_time tlm_t);
tlm_t.incr(10ns, 1ns);
endfunction
endclass
endpackage
testbench.sv
`include "uvm_macros.svh"
import uvm_pkg::*;
`include "time.sv"
`timescale 1ps/1ps
program time_tb;
import time_pkg::*;
initial begin
time t;
increment_time inc_time_o = new();
inc_time_o.inc(t);
#t;
`uvm_info("time", $sformatf("time value = %0d in ps", $realtime), UVM_LOW); // 10 ps. This happened as retun value do not have details of time.
end
endprogram
`include "tlm_time.sv"
`timescale 1ps/1ps
program tlm_time_tb;
import tlm_time_pkg::*;
initial begin
uvm_tlm_time tlm_t = new();
increment_tlm_time inc_tlm_time_o = new();
inc_tlm_time_o.inc(tlm_t);
#(tlm_t.get_realtime(1ns));
`uvm_info("uvm_tlm_time", $sformatf("time value = %0d in ps", $realtime), UVM_LOW); //Expected - 10000
end
endprogram
Output:
UVM_INFO testbench.sv(13) @ 0: reporter [time] time value = 10 in ps
UVM_INFO testbench.sv(26) @ 10000: reporter [uvm_tlm_time] time value = 10000 in ps
TLM Tutorials