Changes between Version 6 and Version 7 of Writing Rules/Tlmt


Ignore:
Timestamp:
Dec 25, 2007, 2:03:30 PM (16 years ago)
Author:
alain
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Writing Rules/Tlmt

    v6 v7  
    1818= B) Single VCI initiator and single VCI target =
    1919
    20 Figure 1 presents a minimal system containing one single initiator, and a 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.
     20Figure 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.
    2121
    2222Contrary 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.
     
    2626= C) Initiator Modeling =
    2727
    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.
     28In 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.
    2929
    3030The '''execLoop()''' method, describing the initiator activity must be declared as a member function of the '''my_initiator''' class.
    3131
    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.
     32Finally, 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.
    3333
    3434== C.1) Sending a VCI command packet ==
     
    8484== C.3) Initiator Constructor ==
    8585
    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 on the initiator local time.
    87 The VciInitiatorPort constructor must be called with the following arguments:
     86The 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.
     87The '''!VciInitiatorPort''' constructor must be called with the following arguments:
    8888{{{
    8989p_vci(“vci”, this, &my_initiator::rspReceived, &m_time);
     
    163163= D) Target Modeling =
    164164
     165In 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
     167The 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
    165169== D.1) Receiving a VCI command packet ==
    166170
     171To 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{{{
     173void  cmdReceived(vci_cmd_t  *cmd,
     174               sc_time  time)
     175}}} 
     176For the read and write transactions, the actual data transfer is performed by this '''cmdReceived()''' function.
     177To 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
    167179== D.2) Sending a VCI response packet ==
    168180
     181To 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{{{
     183void  rspSend( vci_rsp_t *cmd, 
     184           sc_time time)       
     185}}}
     186For a reactive target, the response packet date is computed as the command packet date plus the target intrinsic latency.
     187
    169188== D.3) Target Constructor ==
    170189
    171 == D4) TLM-T target example
     190The 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.
     191The '''!VciTargetPort''' constructor must be called with the following arguments:
     192{{{
     193p_vci(“vci”, this, &my_initiator::cmdReceived);
     194}}}
     195 
     196== D.4) TLM-T target example ==
    172197 {{{
    173198template <typename vci_param>