Changes between Version 29 and Version 30 of Writing Rules/Tlmt
- Timestamp:
- Jan 7, 2008, 9:00:03 PM (17 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Writing Rules/Tlmt
v29 v30 73 73 }}} 74 74 75 The informations transported by a VCI commandpacket are defined below:75 The informations transported by a VCI response packet are defined below: 76 76 {{{ 77 77 class vci_rsp_t { … … 131 131 132 132 private: 133 tlmt_time m_time; 134 uint32_t m_index; 135 uint32_t m_counter; 136 uint32_t m_lookahed; 137 vci_param::data_t m_data[8]; // local buffer138 vci_cmd_t m_cmd; 139 sc_event m_rsp_received // synchronisation signal133 tlmt_time m_time; // local clock 134 uint32_t m_index; // initiator index 135 uint32_t m_counter; // iteration counter 136 uint32_t m_lookahed; // lookahead value 137 vci_param::data_t m_data[8]; // local buffer 138 vci_cmd_t m_cmd; // paquet VCI commande 139 sc_event m_rsp_received; // synchronisation signal 140 140 141 141 //////// thread … … 145 145 … 146 146 m_cmd.cmd = VCI_CMD_READ; 147 p_vci. cmdSend(&m_cmd, m_time.getTime()); // lecture bloquante147 p_vci.send(&m_cmd, m_time.getTime()); // lecture bloquante 148 148 wait(m_rsp_resceived); 149 149 … 150 m_cmd.cmd = VCI_CMD_WRITE; 151 p_vci.send(VCI_CMD_WRITE,…); 152 p_vci.cmdSend(&m_cmd, m_time.getTime()); // écriture non bloquante 150 m_cmd.cmd = VCI_CMD_WRITE; 151 p_vci.send(&m_cmd, m_time.getTime()); // écriture non bloquante 153 152 ... 154 153 // lookahead management … … 191 190 == D.2) Sending a VCI response packet == 192 191 193 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:194 {{{ 195 void rspSend( vci_rsp_t *cmd,192 To send a VCI response packet the '''cmdReceived()''' function must use the '''send()''' method, that is a member function of the class '''!VciTargetPort''', and has the following prototype: 193 {{{ 194 void send( vci_rsp_t *cmd, 196 195 uint32_t time) 197 196 }}} … … 246 245 m_rsp.error = 0; 247 246 rsp_time = cmd_time + latency; 248 p_vci. rspSend(&m_rsp, rsp_time) ;247 p_vci.send(&m_rsp, rsp_time) ; 249 248 return (rsp_time + cmd->length); 250 249 } // end cmdReceived() … … 291 290 == F.1) Source modeling == 292 291 293 The source module (named '''my_source''' in this example) must contain a member variable '''p_irq''' of type '''!SynchroOutPort'''. To activate, or desactivate an interruption, the source module must use the '''s ynchroSend()''' method, that is a member function of the '''!SynchroOutPort''' class. Those interrupt packets transport both a Boolean, and a date. The '''synchroSend()''' prototype is defined as follows :294 {{{ 295 void s ynchroSend( bool val, uint32_t time)292 The source module (named '''my_source''' in this example) must contain a member variable '''p_irq''' of type '''!SynchroOutPort'''. To activate, or desactivate an interruption, the source module must use the '''send()''' method, that is a member function of the '''!SynchroOutPort''' class. Those interrupt packets transport both a Boolean, and a date. The '''send()''' prototype is defined as follows : 293 {{{ 294 void send( bool val, uint32_t time) 296 295 }}} 297 296 … … 299 298 300 299 The destination module (named here '''my_processor''') must contain a member variable '''p_irq''' of type 301 '''!SynchroInPortt''', and a call-back function (named here ''' synchroReceived()''' that is executed when an interrupt packet is received on the '''p_irq''' port.300 '''!SynchroInPortt''', and a call-back function (named here '''irqReceived()''' that is executed when an interrupt packet is received on the '''p_irq''' port. 302 301 303 302 A link between the '''p_irq''' port and the call-back function mus be established by the port constructor in the constructor of the class '''my_processor''' : 304 303 {{{ 305 p_irq(“irq”, this, &my_processor:: synchroReceived)304 p_irq(“irq”, this, &my_processor::irqReceived) 306 305 }}} 307 306 … … 311 310 312 311 The recommended policy for handling interrupts is the following: 313 * The call-back function ''' synchroReceived()''' sets the member variables '''m_irqpending''' and '''m_irqtime''', when a interrupt packet is received on the '''p_irq''' port.312 * The call-back function '''irqReceived()''' sets the member variables '''m_irqpending''' and '''m_irqtime''', when a interrupt packet is received on the '''p_irq''' port. 314 313 * The '''execLoop()''' thread must test the '''m_irqpending''' variable at each cycle (i.e. in each iteration of the infinite loop). 315 314 * If there is no interrupt pending, the thread continues execution. If an interrupt is pending, and the interrupt date is larger than the local time, the thread continues execution. If the interrupt date is equal or smaller than the local time, the interrupt is handled. … … 324 323 SynchroInPort p_irq; 325 324 326 325 ////// constructor 327 326 my_processor (sc_module_name name, 328 327 uint32_t lookahead) : 329 p_irq(“irq”, this, &my_initiator:: synchroReceived),328 p_irq(“irq”, this, &my_initiator::irqReceived), 330 329 m_time(0), 331 330 tlmt::BaseModule(name) … … 344 343 uint32_t m_lookahed; // lookahead value 345 344 346 // thread345 /////////////// thread 347 346 void execLoop() 348 347 { … … 364 363 } // end execLoop() 365 364 366 // call-back function367 void synchroReceived(bool val, sc_time time)365 /////////////////////////////////////// 366 void irqReceived(bool val, sc_time time) 368 367 { 369 368 m_irqpending = val;