Skip to Content

TLM Sockets in VMM 1.2

Posted on  by  from the site Verification Martial Arts
John Aynsley, CTO, Doulos Having introduced both the blocking and the non-blocking transport interfaces in previous blog posts, it’s now time to look at TLM sockets in VMM 1.2. In the SystemC TLM-2.0 standard, sockets are a mechanism that simplifies the instantiation and binding of multiple ports and exports for the various standard transaction-level interfaces by encapsulating several interfaces in a single object, the so-called socket. One initiator socket is bound to one target socket using one bind operator, and it is then possible to call all of the standard TLM-2.0 interface methods through that one pair of sockets. Moreover the socket has a BUSWIDTH parameter which represents the width of the data word transferred over the bus on each beat and which prevents sockets of different widths being inadvertently connected together. Because VMM supports neither the full set of interfaces from the TLM-2.0 standard, nor the functionality of specified bus widths, nor the interoperability achieved by mandating the use of standard socket types, the value of sockets is considerably reduced in VMM compared to the SystemC TLM-2.0 standard. Nonetheless, the TLM sockets in VMM do allow both blocking and non-blocking transport method calls to be made through a single pair of sockets. Let’s look at an example: class initiator extends vmm_xactor;   `vmm_typename(initiator)   vmm_tlm_initiator_socket #(initiator, vmm_tlm_generic_payload) m_socket;   …   begin     …     m_socket.b_transport(tx, delay);     …   end   …   begin     …     status = m_socket.nb_transport_fw(tx, phase, delay);     …   end   virtual function vmm_tlm::sync_e nb_transport_bw( int id=-1,     vmm_tlm_generic_payload trans, ref vmm_tlm::phase_e ph, ref int delay);     …   endfunction : nb_transport_bw   … endclass: initiator As you can see above, the vmm_tlm_initiator_socket allows both b_transport and nb_transport_fw calls to be made through a single socket, as well as being able to accept incoming nb_transport_bw calls. On the target side, the vmm_tlm_target_socket accepts incoming calls to both b_transport and nb_transport_fw as well as allowing outgoing calls to nb_transport_bw: class target extends vmm_xactor;   `vmm_typename(target)   vmm_tlm_target_socket #(target, vmm_tlm_generic_payload) m_socket;   …   task b_transport(int id = -1, vmm_tlm_generic_payload trans, ref int delay);     …   endtask : b_transport     virtual function vmm_tlm::sync_e nb_transport_fw( int id=-1,     vmm_tlm_generic_payload trans, ref vmm_tlm::phase_e ph, ref int delay);     …   endfunction : nb_transport_fw   …   begin     …     status = m_socket.nb_transport_bw(tx, phase, delay);     …   end   … endclass: target Finally, at the top level, there is just a single pair of sockets to bind: class tb_env extends vmm_group;   `vmm_typename(tb_env)   initiator  m_initiator;   target     m_target;   …    virtual function void build_ph;     m_initiator = new( "m_initiator", this );     m_target    = new( "m_target",    this );   endfunction: build_ph   virtual function void connect_ph;       m_initiator.m_socket.tlm_bind( m_target.m_socket );   endfunction: connect_ph endclass: tb_env That’s all there is to it! The SystemC TLM-2.0 standard provides so-called convenient sockets, some of which can automatically convert incoming calls from b_transport to nb_transport and vice-versa. The VMM implementation achieves a similar result using the vmm_connect utility, which I will describe in a future post.
John Aynsley
John Aynsley, CTO, Doulos Having introduced both the blocking and the non-blocking transport interfaces in previous blog posts, it’s now time to look at TLM sockets in VMM 1.2. In the SystemC TLM-2.0 standard, sockets are a mechanism that simplifies the instantiation and binding of multiple ports and exports for the various standard transaction-level interfaces by encapsulating several interfaces in a single object, the so-called socket. One initiator socket is bound to one target socket using one bind operator, and it is then possible to call all of the standard TLM-2.0 interface methods through that one pair of sockets. Moreover the socket has a BUSWIDTH parameter which represents the width of the data word transferred over the bus on each beat and which prevents sockets of different widths being inadvertently connected together. Because VMM supports neither the full set of interfaces from the TLM-2.0 standard, nor the functionality of specified bus widths, nor the interoperability achieved by mandating the use of standard socket types, the value of sockets is considerably reduced in VMM compared to the SystemC TLM-2.0 standard. Nonetheless, the TLM sockets in VMM do allow both blocking and non-blocking transport method calls to be made through a single pair of sockets. Let’s look at an example: class initiator extends vmm_xactor;   `vmm_typename(initiator)   vmm_tlm_initiator_socket #(initiator, vmm_tlm_generic_payload) m_socket;   …   begin     …     m_socket.b_transport(tx, delay);     …   end   …   begin     …     status = m_socket.nb_transport_fw(tx, phase, delay);     …   end   virtual function vmm_tlm::sync_e nb_transport_bw( int id=-1,     vmm_tlm_generic_payload trans, ref vmm_tlm::phase_e ph, ref int delay);     …   endfunction : nb_transport_bw   … endclass: initiator As you can see above, the vmm_tlm_initiator_socket allows both b_transport and nb_transport_fw calls to be made through a single socket, as well as being able to accept incoming nb_transport_bw calls. On the target side, the vmm_tlm_target_socket accepts incoming calls to both b_transport and nb_transport_fw as well as allowing outgoing calls to nb_transport_bw: class target extends vmm_xactor;   `vmm_typename(target)   vmm_tlm_target_socket #(target, vmm_tlm_generic_payload) m_socket;   …   task b_transport(int id = -1, vmm_tlm_generic_payload trans, ref int delay);     …   endtask : b_transport     virtual function vmm_tlm::sync_e nb_transport_fw( int id=-1,     vmm_tlm_generic_payload trans, ref vmm_tlm::phase_e ph, ref int delay);     …   endfunction : nb_transport_fw   …   begin     …     status = m_socket.nb_transport_bw(tx, phase, delay);     …   end   … endclass: target Finally, at the top level, there is just a single pair of sockets to bind: class tb_env extends vmm_group;   `vmm_typename(tb_env)   initiator  m_initiator;   target     m_target;   …    virtual function void build_ph;     m_initiator = new( "m_initiator", this );     m_target    = new( "m_target",    this );   endfunction: build_ph   virtual function void connect_ph;       m_initiator.m_socket.tlm_bind( m_target.m_socket );   endfunction: connect_ph endclass: tb_env That’s all there is to it! The SystemC TLM-2.0 standard provides so-called convenient sockets, some of which can automatically convert incoming calls from b_transport to nb_transport and vice-versa. The VMM implementation achieves a similar result using the vmm_connect utility, which I will describe in a future post.
Posted in
Syndicate content