TODO 不完整,有时间再更新
SystemC 介绍
SystemC不是一门新的语言,而是基于C++开发的library
TLM2 介绍
如果都是SV code的话,结构上类型TLM1
TLM2 提供了下面2中传输接口
Blocking (b_transport) | completes the entire transaction within a single method call |
Non-blocking (nb_transport) | describes the progress of a transaction using multiple nb_transport() method calls going back-and-forth between initiator and target |
Contents
passthrough: 可以直接initiator connect到passthrough
uvm_tlm_b_initiator_socket#(uvm_tlm_generic_payload) init_skt;
uvm_tlm_b_passthrough_initiator_socket#(uvm_tlm_generic_payload) pt_init_skt;
init_skt.connect(pt_init_skt);
example:
initiator implement
class initiator extends uvm_component;
`uvm_component_utils (initiator)
// Declare a blocking transport socket (using initiator socket class)
uvm_tlm_b_initiator_socket #(simple_packet) initSocket;
uvm_tlm_time delay;
simple_packet pkt;
function new (string name = "initiator", uvm_component parent= null);
super.new (name, parent);
endfunction
virtual function void build_phase (uvm_phase phase);
super.build_phase (phase);
// Create an instance of the socket
initSocket = new ("initSocket", this);
delay = new ();
endfunction
virtual task run_phase (uvm_phase phase);
pkt = simple_packet::type_id::create ("pkt");
//...
initSocket.b_transport (pkt, delay);
endtask
endclass
target implement
class target extends uvm_component;
`uvm_component_utils (target)
// Declare a blocking target socket
uvm_tlm_b_target_socket #(target, simple_packet) targetSocket;
function new (string name = "target", uvm_component parent = null);
super.new (name, parent);
endfunction
virtual function void build_phase (uvm_phase phase);
super.build_phase (phase);
// Create an instance of the target socket
targetSocket = new ("targetSocket", this);
endfunction
// Provide the implementation method of b_transport in the target class
task b_transport (simple_packet pkt, uvm_tlm_time delay);
pkt.print (uvm_default_line_printer);
endtask
endclass
initiator and target connection
class my_env extends uvm_env;
`uvm_component_utils (my_env)
initiator init;
target tgt;
function new (string name = "my_env", uvm_component parent = null);
super.new (name, parent);
endfunction
virtual function void build_phase (uvm_phase phase);
super.build_phase (phase);
// Create an object of both components
init = initiator::type_id::create ("init", this);
tgt = target::type_id::create ("tgt", this);
endfunction
// Connect both sockets in the connect_phase
virtual function void connect_phase (uvm_phase phase);
init.initSocket.connect (tgt.targetSocket);
endfunction
endclass
SC 与 SV 信息传递
ref: