Changes between Version 85 and Version 86 of Writing Rules/Tlmt
- Timestamp:
- Nov 17, 2008, 12:18:54 PM (17 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Writing Rules/Tlmt
v85 v86 423 423 ////////////////////////// my_target.h //////////////////////////////// 424 424 425 #ifndef __MY_TARGET_H__426 #define __MY_TARGET_H__427 428 425 #include "tlm.h" // TLM headers 429 426 #include "tlmt_transactions.h" // TLM-T headers … … 438 435 typedef soclib::tlmt::VciParams<uint32_t,uint32_t,4> vci_param; 439 436 437 /////////////////////// 438 // Member variables 439 /////////////////////// 440 440 uint32_t m_targetid; 441 441 soclib::common::MappingTable m_mt; 442 442 443 444 ///////////////////////////////////////////////////////////////////////////////////// 445 // Interface Fuction tlm::tlm_fw_transport_if (VCI SOCKET) 446 ///////////////////////////////////////////////////////////////////////////////////// 447 448 // receive command from initiator 449 tlm::tlm_sync_enum vci_cmd_received /// 450 ( soclib_vci_types::tlm_payload_type &payload, /// VCI payload pointer 451 soclib_vci_types::tlm_phase_type &phase, /// transaction phase 452 sc_core::sc_time &time); /// time 443 ////////////////////// 444 // Interface Function 445 ////////////////////// 446 tlm::tlm_sync_enum vci_cmd_received 447 ( soclib_vci_types::tlm_payload_type &payload, // payload 448 soclib_vci_types::tlm_phase_type &phase, // phase 449 sc_core::sc_time &time); // time 453 450 454 451 protected: 455 452 SC_HAS_PROCESS(my_target); 453 454 ////////////////////// 455 // ports 456 ////////////////////// 456 457 public: 457 tlmt_simple_target_socket<my_target,32,soclib_vci_types> p_vci_target; ///< VCI target socket 458 458 tlmt_simple_target_socket<my_target,32,soclib_vci_types> p_vci_target; 459 460 ///////////////////// 461 // constructor 462 ///////////////////// 459 463 my_target(sc_core::sc_module_name name, 460 464 const soclib::common::IntTab &index, 461 465 const soclib::common::MappingTable &mt); 462 463 ~my_target();464 466 }; 465 467 466 #endif467 468 468 ////////////////////////// my_target.cpp //////////////////////////////// 469 469 470 #include "my_target.h" 471 472 #ifndef MY_TARGET_DEBUG 473 #define MY_TARGET_DEBUG 1 474 #endif 475 476 #define tmpl(x) x my_target 477 478 ////////////////////////////////////////////////////////////////////////////////////////// 479 // CONSTRUCTOR 480 ////////////////////////////////////////////////////////////////////////////////////////// 481 tmpl(/**/)::my_target 470 ///////////////////// 471 // constructor 472 ///////////////////// 473 my_target::my_target 482 474 ( sc_core::sc_module_name name, 483 475 const soclib::common::IntTab &index, … … 487 479 p_vci_target("p_vci_target") 488 480 { 489 // register callback fuction481 // link the interface function to the VCI port 490 482 p_vci_target.register_nb_transport_fw(this, &my_target::vci_cmd_received); 491 483 … … 493 485 } 494 486 495 tmpl(/**/)::~my_target(){} 496 497 ///////////////////////////////////////////////////////////////////////////////////// 498 // Virtual Fuctions tlm::tlm_fw_transport_if VCI SOCKET 499 ///////////////////////////////////////////////////////////////////////////////////// 500 501 //nb_transport_fw implementation calls from initiators 502 tmpl(tlm::tlm_sync_enum)::vci_cmd_received // 503 ( soclib_vci_types::tlm_payload_type &payload, // VCI payload pointer 504 soclib_vci_types::tlm_phase_type &phase, // transaction phase 487 ////////////////////// 488 // Interface function 489 ////////////////////// 490 tlm::tlm_sync_enum my_target::vci_cmd_received 491 ( soclib_vci_types::tlm_payload_type &payload, // payload 492 soclib_vci_types::tlm_phase_type &phase, // phase 505 493 sc_core::sc_time &time) // time 506 494 { … … 512 500 case soclib::tlmt::VCI_STORE_COND_COMMAND: 513 501 { 514 #if MY_TARGET_DEBUG 515 std::cout << "[RAM " << m_targetid << "] Receive from source " << payload.get_src_id() <<" a packet "<< payload.get_pkt_id() << " Time = " << time.value() << std::endl; 516 #endif 517 518 payload.set_response_status(soclib::tlmt::TLMT_OK_RESPONSE); 502 503 payload.set_response_status(soclib::tlm::TLM_OK_RESPONSE); 519 504 phase = soclib::tlmt::TLMT_RSP; 520 505 time = time + (nwords * UNIT_TIME);