Changes between Version 137 and Version 138 of Writing Rules/Tlmt


Ignore:
Timestamp:
Mar 3, 2009, 2:09:42 PM (15 years ago)
Author:
alinevieiramello@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Writing Rules/Tlmt

    v137 v138  
    150150
    151151The initiator uses the class '''pdes_local_time''' for managing and interacting with his local time and with the interval between two consecutive null messages.
     152The class '''pdes_local_time''' is described in section D.5.
     153
     154The initiator activity status (used by the temporal filtering, as described in section F) is managed for the class '''pdes_activity_status'''.
     155The corresponding access functions are '''set()''' and '''get()'''.
     156
     157The '''execLoop()''' method, describing the initiator behaviour must be declared as a member function.
     158
     159The '''my_initiator''' class contains a member variable '''p_vci_init''', of type '''tlm_utils::simple_initiator_socket''', representing the VCI initiator port.
     160
     161It must also define an interface function to handle the VCI response packets.
     162
     163== D.2) Sending a VCI command packet ==
     164
     165To send a VCI command packet, the '''execLoop()''' method must use the '''nb_transport_fw()''' method, defined by TLM2.0,
     166that is a member function of the '''p_vci_init''' port. The prototype of this method is the following:
     167{{{
     168  tlm::tlm_sync_enum nb_transport_fw           
     169  ( tlm::tlm_generic_payload &payload,      // payload
     170    tlm::tlm_phase           &phase,        // phase (TLM::BEGIN_REQ)
     171    sc_core::sc_time         &time);        // absolute local time
     172}}}
     173
     174The first argument is a pointer to the payload (including the soclib payload extension),
     175the second represents the phase (always set to TLM::BEGIN_REQ for requests), and the third
     176argument contains the initiator local time. The return value is not used in this TLM-T implementation.
     177
     178The '''nb_transport_fw()''' function is non-blocking.
     179To implement a blocking transaction (such as a cache line read, where the processor is stalled during the VCI transaction),
     180the model designer must use the SystemC '''sc_core::wait(x)''' primitive ('''x''' being of type '''sc_core::sc_event'''):
     181the '''execLoop()''' thread is then suspended, and will be reactivated when the response packet is actually received.
     182
     183== D.3) Receiving a VCI response packet ==
     184
     185To receive a VCI response packet, an interface function must be defined as a member function of the
     186class '''my_initiator'''. This function (named '''nb_transport_bw()''' in the example), must be linked to
     187the '''p_vci_init''' port, and is executed each time a VCI response packet is received on the '''p_vci_init''' port.
     188The function name is not constrained, but the arguments must respect the following prototype:
     189{{{
     190  tlm::tlm_sync_enum nb_transport_bw             
     191  ( tlm::tlm_generic_payload &payload,      // payload
     192    tlm::tlm_phase           &phase,        // phase (TLM::BEGIN_RESP)
     193    sc_core::sc_time         &time);        // response time
     194}}}
     195The return value (type tlm::tlm_sync_enum)  is not used in this TLM-T implementation, and must be sytematically set to tlm::TLM_COMPLETED.
     196
     197== D.4) Initiator Constructor ==
     198
     199The constructor of the class '''my_initiator''' must initialize all the member variables, including
     200the '''p_vci_init''' port. The '''nb_transport_bw()''' function being executed in the context of the thread sending
     201the response packet, a link between the '''p_vci_init''' port and this interface function must be established.
     202
     203The constructor for the '''p_vci_init''' port must be called with the following arguments:
     204{{{
     205  p_vci_init.register_nb_transport_bw(this, &my_initiator::nb_transport_bw);
     206}}}
     207
     208== D.5) Local Time Representation & Synchronization  ==
     209
     210The SystemC simulation engine behaves as a cooperative, non-preemptive multi-tasks system. Any thread in the system must stop execution at some point, in order to allow the other threads to execute. Moreover each PDES process must send null message periodically.
     211
     212To solve this issue, it is necessary to define -for each initiator module- a '''synchronization time quantum''' parameter. This parameter defines
     213the maximum delay between two successive timed messages. When this time quantum is elapsed, the component send a null message,
     214and the corresponding thread is descheduled.
     215
     216This time quantum mechanism is implemented in the '''pdes_local_time''' class.
     217For each initiator, the time quantum value is a parameter defined as a constructor argument.
     218The three members methods are...
    152219The '''pdes_local_time''' has the following access functions:
    153220{{{
     
    162229  bool need_sync();                                  // check if a synchronization is required
    163230}}}
    164 
    165 The initiator activity status (used by the temporal filtering, as described in section F) is managed for the class '''pdes_activity_status'''.
    166 The corresponding access functions are '''set()''' and '''get()'''.
    167 {{{
    168   bool m_activity_status;                           // the initiator activity status
    169   ...
    170   pdes_activity_status();                           // constructor
    171   void set(bool a);                                 // set the activity status (true if the component is active)
    172   bool get();                                       // get the activity state
    173 }}}
    174 
    175 The '''execLoop()''' method, describing the initiator behaviour must be declared as a member function.
    176 
    177 The '''my_initiator''' class contains a member variable '''p_vci_init''', of type '''tlm_utils::simple_initiator_socket''', representing the VCI initiator port.
    178 
    179 It must also define an interface function to handle the VCI response packets.
    180 
    181 == D.2) Sending a VCI command packet ==
    182 
    183 To send a VCI command packet, the '''execLoop()''' method must use the '''nb_transport_fw()''' method, defined by TLM2.0,
    184 that is a member function of the '''p_vci_init''' port. The prototype of this method is the following:
    185 {{{
    186   tlm::tlm_sync_enum nb_transport_fw           
    187   ( tlm::tlm_generic_payload &payload,      // payload
    188     tlm::tlm_phase           &phase,        // phase (TLM::BEGIN_REQ)
    189     sc_core::sc_time         &time);        // absolute local time
    190 }}}
    191 
    192 The first argument is a pointer to the payload (including the soclib payload extension),
    193 the second represents the phase (always set to TLM::BEGIN_REQ for requests), and the third
    194 argument contains the initiator local time. The return value is not used in this TLM-T implementation.
    195 
    196 The '''nb_transport_fw()''' function is non-blocking.
    197 To implement a blocking transaction (such as a cache line read, where the processor is stalled during the VCI transaction),
    198 the model designer must use the SystemC '''sc_core::wait(x)''' primitive ('''x''' being of type '''sc_core::sc_event'''):
    199 the '''execLoop()''' thread is then suspended, and will be reactivated when the response packet is actually received.
    200 
    201 == D.3) Receiving a VCI response packet ==
    202 
    203 To receive a VCI response packet, an interface function must be defined as a member function of the
    204 class '''my_initiator'''. This function (named '''nb_transport_bw()''' in the example), must be linked to
    205 the '''p_vci_init''' port, and is executed each time a VCI response packet is received on the '''p_vci_init''' port.
    206 The function name is not constrained, but the arguments must respect the following prototype:
    207 {{{
    208   tlm::tlm_sync_enum nb_transport_bw             
    209   ( tlm::tlm_generic_payload &payload,      // payload
    210     tlm::tlm_phase           &phase,        // phase (TLM::BEGIN_RESP)
    211     sc_core::sc_time         &time);        // response time
    212 }}}
    213 The return value (type tlm::tlm_sync_enum)  is not used in this TLM-T implementation, and must be sytematically set to tlm::TLM_COMPLETED.
    214 
    215 == D.4) Initiator Constructor ==
    216 
    217 The constructor of the class '''my_initiator''' must initialize all the member variables, including
    218 the '''p_vci_init''' port. The '''nb_transport_bw()''' function being executed in the context of the thread sending
    219 the response packet, a link between the '''p_vci_init''' port and this interface function must be established.
    220 
    221 The constructor for the '''p_vci_init''' port must be called with the following arguments:
    222 {{{
    223   p_vci_init.register_nb_transport_bw(this, &my_initiator::nb_transport_bw);
    224 }}}
    225 
    226 == D.5) Local Time Representation & Synchronization  ==
    227 
    228 The SystemC simulation engine behaves as a cooperative, non-preemptive multi-tasks system. Any thread in the system must stop execution at some point, in order to allow the other threads to execute. Moreover each PDES process must send null message periodically.
    229 
    230 To solve this issue, it is necessary to define -for each initiator module- a '''synchronization time quantum''' parameter. This parameter defines
    231 the maximum delay between two successive timed messages. When this time quantum is elapsed, the component send a null message,
    232 and the corresponding thread is descheduled.
    233 
    234 This time quantum mechanism is implemented in the '''pdes_local_time''' class.
    235 For each initiator, the time quantum value is a parameter defined as a constructor argument.
    236 The three members methods are...
    237 
    238231
    239232== D.6) VCI initiator example ==