Changes between Version 6 and Version 7 of Writing Rules/Tlmt
- Timestamp:
- Dec 25, 2007, 2:03:30 PM (17 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Writing Rules/Tlmt
v6 v7 18 18 = B) Single VCI initiator and single VCI target = 19 19 20 Figure 1 presents a minimal system containing one single initiator, and asingle target. In the proposed example, the initiator module doesn't contains any parallelism, and can be modeled by a single SC_THREAD, describing a single PDES process. The activity of the '''my_initiator ''' module is described by the SC_THREAD '''execLoop()''', that contain an infinite loop. The variable '''m_time''' represents the PDES process local time.20 Figure 1 presents a minimal system containing one single initiator, and one single target. In the proposed example, the initiator module doesn't contains any parallelism, and can be modeled by a single SC_THREAD, describing a single PDES process. The activity of the '''my_initiator ''' module is described by the SC_THREAD '''execLoop()''', that contain an infinite loop. The variable '''m_time''' represents the PDES process local time. 21 21 22 22 Contrary to the initiator, the target module has a purely reactive behaviour. There is no need to use a SC_THREAD to describe the target behaviour : A simple method is enough. … … 26 26 = C) Initiator Modeling = 27 27 28 In the proposed example, the initiator module is modeled by the '''my_initiator''' class. This class inherit the ''' BaseModule''' class, that is the basis for all TLM-T modules. As there is only one thread in this module, there is only one member variable '''time''' of type '''tlmt_time'''. This object can be accessed through the '''getTime()''', '''addTime()''' and '''setTime()''' methods.28 In the proposed example, the initiator module is modeled by the '''my_initiator''' class. This class inherit the '''!BaseModule''' class, that is the basis for all TLM-T modules. As there is only one thread in this module, there is only one member variable '''time''' of type '''tlmt_time'''. This object can be accessed through the '''getTime()''', '''addTime()''' and '''setTime()''' methods. 29 29 30 30 The '''execLoop()''' method, describing the initiator activity must be declared as a member function of the '''my_initiator''' class. 31 31 32 Finally, the class '''my_initiator''' must contain a member variable '''p_vci''', of type ''' VciInitiatorPort'''. This object has a template parameter <'''vci_param'''> defining the widths of the VCI ADRESS & DATA fields.32 Finally, the class '''my_initiator''' must contain a member variable '''p_vci''', of type '''!VciInitiatorPort'''. This object has a template parameter <'''vci_param'''> defining the widths of the VCI ADRESS & DATA fields. 33 33 34 34 == C.1) Sending a VCI command packet == … … 84 84 == C.3) Initiator Constructor == 85 85 86 The constructor of the class'''my_initiator''' must initialize all the member variables, including the VCI port. The '''rspReceived()''' call-back function being executed in the context of the thread sending the response packet, a link between the '''p_vci''' port and the call-back function must be established. Moreover, the '''p_vci''' port must contain a pointer onthe initiator local time.87 The VciInitiatorPortconstructor must be called with the following arguments:86 The constructor of the class'''my_initiator''' must initialize all the member variables, including the '''p_vci''' port. The '''rspReceived()''' call-back function being executed in the context of the thread sending the response packet, a link between the '''p_vci''' port and the call-back function must be established. Moreover, the '''p_vci''' port must contain a pointer to the initiator local time. 87 The '''!VciInitiatorPort''' constructor must be called with the following arguments: 88 88 {{{ 89 89 p_vci(“vci”, this, &my_initiator::rspReceived, &m_time); … … 163 163 = D) Target Modeling = 164 164 165 In the proposed example, the target handle two types of command : a read burst of 8 words, and a write burst of 8 words. To simplify the model, there is no error management. 166 167 The class '''my_target''' inherit the class '''!BaseModule''', that is the basis for all TLM-T modules. The class '''my_target''' contains a member variable '''p_vci''' of type '''!VciTargetPort'''. This object has a template parameter <'''vci_param'''> defining the widths of the VCI ADRESS & DATA fields. 168 165 169 == D.1) Receiving a VCI command packet == 166 170 171 To receive a VCI command packet, a call-back function must be defined as a member function of the class '''my_target'''. This call-back function (named '''cmdReceived()''' in the example), will be executed each time a VCI command packet is received on the '''p_vci''' port. The function name is not constrained, but the arguments must respect the following prototype: 172 {{{ 173 void cmdReceived(vci_cmd_t *cmd, 174 sc_time time) 175 }}} 176 For the read and write transactions, the actual data transfer is performed by this '''cmdReceived()''' function. 177 To avoid multiple data copies, only the pointer on the initiator data buffer is transported in the VCI command pacquet (source buffer for a write transaction, or destination buffer for a read transaction). 178 167 179 == D.2) Sending a VCI response packet == 168 180 181 To send a VCI response packet the '''cmdReceived()''' function must use the '''rspSend()'' method, that is a member function of the class '''VciTargetPort''', and has the following prototype: 182 {{{ 183 void rspSend( vci_rsp_t *cmd, 184 sc_time time) 185 }}} 186 For a reactive target, the response packet date is computed as the command packet date plus the target intrinsic latency. 187 169 188 == D.3) Target Constructor == 170 189 171 == D4) TLM-T target example 190 The constructor of the class'''my_target''' must initialize all the member variables, including the '''p_vci''' port. The '''cmdReceived()''' call-back function being executed in the context of the thread sending the command packet, a link between the '''p_vci''' port and the call-back function must be established. 191 The '''!VciTargetPort''' constructor must be called with the following arguments: 192 {{{ 193 p_vci(“vci”, this, &my_initiator::cmdReceived); 194 }}} 195 196 == D.4) TLM-T target example == 172 197 {{{ 173 198 template <typename vci_param>