Changes between Version 25 and Version 26 of Writing Rules/Tlmt


Ignore:
Timestamp:
Dec 28, 2007, 4:05:25 PM (16 years ago)
Author:
alain
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Writing Rules/Tlmt

    v25 v26  
    4141{{{
    4242void cmdSend(vci_cmd_t  *cmd,   // VCI command packet   
    43                    sc_time time);       // initiator local time
     43                   uint32_t time);      // initiator local time
    4444}}}
    4545
     
    6262The possible values for the '''cmd''' fied are  `vci_param::CMD_READ`, `vci_param::CMD_WRITE`, `vci_param::CMD_READ_LOCKED`,
    6363and `vci_param::CMD_STORE_COND`.
    64 '''address'''es may be any value contained in the whole system address space.
    6564The '''contig''' field can be used for optimisation.
    6665
     
    7170To receive a VCI response packet, a call-back function must be defined as a member function of the class '''my_initiator'''. This call-back function (named '''rspReceived()''' in the example), will be executed each time a VCI response packet is received on the '''p_vci''' port. The function name is not constrained, but the arguments must respect the following prototype:
    7271{{{
    73 void  rspReceived(vci_rsp_t  *rsp, sc_time  time)
     72void  rspReceived(vci_rsp_t  *rsp, uint32_t  time)
    7473}}}
    7574
     
    103102== C.4) Lookahead parameter ==
    104103
    105 The SystemC simulation engine behaves as a cooperative, non-preemptive multi-tasks system. Any thread in the system must stop execution after a given time, in order to allow the other threads to execute. With the proposed approach, a TLM-T initiator will never stop if it does not execute blocking communication (such as a processor that has all code and data in the L1 caches).
     104The SystemC simulation engine behaves as a cooperative, non-preemptive multi-tasks system. Any thread in the system must stop execution after at some point, in order to allow the other threads to execute. With the proposed approach, a TLM-T initiator will never stop if it does not execute blocking communication (such as a processor that has all code and data in the L1 caches).
    106105
    107106To solve this problem, it is necessary to define - for each initiator module- a '''lookahead''' parameter. This parameter defines the maximum number of cycles that can be executed by the thread before it stops. The '''lookahead''' parameter allows the system designer to bound the de-synchronization between threads.
     
    163162
    164163    //////////////// call-back function
    165     void  rspReceived(vci_cmd_t *cmd, sc_time rsp_time)
     164    void  rspReceived(vci_cmd_t *cmd, uint32_t rsp_time)
    166165    {
    167166    if(cmd == VCI_CMD_READ) {
     
    184183{{{
    185184void  cmdReceived(vci_cmd_t  *cmd,
    186                sc_time  time)
     185               uint32_t  time)
    187186}}} 
    188187For the read and write transactions, the actual data transfer is performed by this '''cmdReceived()''' function.
     
    194193{{{
    195194void  rspSend( vci_rsp_t *cmd, 
    196            sc_time time)       
     195           uint32_t time)       
    197196}}}
    198197For a reactive target, the response packet date is computed as the command packet date plus the target intrinsic latency.
     
    216215    my_target (sc_module_name   name,
    217216              uint32_t  targetIndex,
    218               sc_time  latency):
     217              uint32_t  latency):
    219218    p_vci(“vci”,this, &my_target::cmdReceived),
    220219    tlmt::BaseModule(name)
     
    226225private:
    227226    vci_param::data_t  m_data[8];  // local buffer
    228     sc_time  m_latency;  // target latency
     227    uint32_t  m_latency;         // target latency
    229228    uint32_t  m_index;  // target index
    230229    vci_rsp_t  m_rsp;  // paquet VCI réponse
     
    232231    /////////////// call-back function
    233232    sc_time  cmdReceived(vci_cmd_t *cmd,
    234                 sc_time cmd_time)
     233                uint32_t cmd_time)
    235234    {
    236235    if(cmd->cmd == VCI_CMD_WRITE) {
     
    247246    rsp_time = cmd_time + latency;
    248247    p_vci.rspSend(&m_rsp, rsp_time) ;
    249     return (rsp_time + (sc_time)cmd->length);
     248    return (rsp_time + cmd->length);
    250249   } // end cmdReceived()
    251250} // end class my_target
     
    293292The source module (named '''my_source''' in this example) must contain a member variable '''p_irq''' of type '''!IrqOutPort'''. To activate, or desactivate an interruption, the source module must use the '''irqSend()''' method, that is a member function of the '''!IrqOutPort''' class. Those interrupt packets transport both a Boolean, and a date. The '''irqSend()''' prototype is defined as follows :
    294293{{{
    295 void  irqSend( bool  val, sc_time  time)
     294void  irqSend( bool  val, uint32_t  time)
    296295}}}
    297296
     
    340339    tlmt_time  m_time;  // local clock
    341340    bool  m_irqpendig;  // pending interrupt request
    342     sc_time  m_irqtime;  // irq date
     341    uint32_t  m_irqtime;  // irq date
    343342    uint32_t  m_counter;  // iteration counter
    344343    uint32_t  m_lookahed;  // lookahead value