Changes between Version 125 and Version 126 of Writing Rules/Tlmt
- Timestamp:
- Mar 3, 2009, 11:21:40 AM (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Writing Rules/Tlmt
v125 v126 251 251 p_vci_init("socket") // vci initiator socket name 252 252 { 253 //register callback function VCI INITIATOR SOCKET253 //register callback function (VCI INITIATOR SOCKET) 254 254 p_vci_init.register_nb_transport_bw(this, &my_initiator::my_nb_transport_bw); 255 255 //initiator identification … … 281 281 time = m_pdes_local_time->get(); 282 282 //send a message with command equals to PDES_ACTIVE or PDES_INACTIVE 283 p_vci_init iator->nb_transport_fw(*payload_ptr, phase, time);283 p_vci_init->nb_transport_fw(*payload_ptr, phase, time); 284 284 //wait a response 285 285 wait(m_rspEvent); … … 303 303 time = m_pdes_local_time->get(); 304 304 //send a null message 305 p_vci_init iator->nb_transport_fw(*payload_ptr, phase, time);305 p_vci_init->nb_transport_fw(*payload_ptr, phase, time); 306 306 //deschedule the initiator thread 307 307 wait(sc_core::SC_ZERO_TIME); … … 345 345 time = m_pdes_local_time->get(); 346 346 // send the transaction and wait a response 347 p_vci_init iator->nb_transport_fw(*payload_ptr, phase, time);347 p_vci_init->nb_transport_fw(*payload_ptr, phase, time); 348 348 wait(m_rspEvent); 349 349 … … 433 433 == E.5) VCI target example == 434 434 {{{ 435 #include "my_target.h" 435 #include "my_target.h" // header 436 436 437 437 my_target::my_target 438 ( sc_core::sc_module_name name, 439 const soclib::common::IntTab &index, 440 const soclib::common::MappingTable &mt) 441 : sc_module(name), 442 m_mt(mt), 443 p_vci_target("socket") 438 ( sc_core::sc_module_name name, // module name 439 const soclib::common::IntTab &index, // index of mapping table 440 const soclib::common::MappingTable &mt) // mapping table 441 : sc_module(name), // init module name 442 m_mt(mt), // mapping table 443 p_vci_target("socket") // vci target socket name 444 444 { 445 // register callback fuction445 // register callback fuction (VCI TARGET SOCKET) 446 446 p_vci_target.register_nb_transport_fw(this, &my_target::my_nb_transport_fw); 447 448 //identification 447 // identification 449 448 m_tgtid = m_mt.indexForId(index); 450 449 } 451 450 452 my_target::~my_target(){} 453 454 ///////////////////////////////////////////////////////////////////////////////////// 455 // Virtual Fuctions tlm::tlm_fw_transport_if (VCI TARGET SOCKET) 456 ///////////////////////////////////////////////////////////////////////////////////// 457 tlm::tlm_sync_enum my_target::my_nb_transport_fw // non-blocking transport call through Bus 458 ( tlm::tlm_generic_payload &payload, // generic payoad pointer 459 tlm::tlm_phase &phase, // transaction phase 460 sc_core::sc_time &time) // time it should take for transport 451 // inbound nb_transport_fw (VCI TARGET SOCKET) 452 tlm::tlm_sync_enum my_target::my_nb_transport_fw 453 ( tlm::tlm_generic_payload &payload, // payload 454 tlm::tlm_phase &phase, // phase 455 sc_core::sc_time &time) // time 461 456 { 457 // get the payload extension 462 458 soclib_payload_extension *extension_pointer; 463 459 payload.get_extension(extension_pointer); 464 460 465 // this target does not treat the null message461 // this target does not treat the null message 466 462 if(extension_pointer->is_null_message()){ 467 463 return tlm::TLM_COMPLETED; 468 464 } 469 470 uint32_t srcid = extension_pointer->get_src_id(); 465 // get the number of words 471 466 uint32_t nwords = payload.get_data_length() / vci_param::nbytes; 472 uint32_t address = payload.get_address(); 473 467 474 468 switch(extension_pointer->get_command()){ 475 469 case soclib::tlmt::VCI_READ_COMMAND: … … 479 473 ... 480 474 481 //set response status475 //set ok to response status 482 476 payload.set_response_status(tlm::TLM_OK_RESPONSE); 483 //modify the phase484 phase = tlm::BEGIN_RESP;485 //increment the target processing time486 time = time + (nwords * UNIT_TIME);487 //send the response488 p_vci_target->nb_transport_bw(payload, phase, time);489 return tlm::TLM_COMPLETED;490 477 break; 491 478 default: 479 //set error to response status 480 payload.set_response_status(tlm::TLM_GENERIC_ERROR_RESPONSE); 492 481 break; 493 482 } 494 483 495 //send error message496 payload.set_response_status(tlm::TLM_COMMAND_ERROR_RESPONSE);497 484 //modify the phase 498 485 phase = tlm::BEGIN_RESP; 499 486 //increment the target processing time 500 time = time + nwords * UNIT_TIME;487 time = time + (nwords * UNIT_TIME); 501 488 //send the response 502 489 p_vci_target->nb_transport_bw(payload, phase, time);