45 | | The TLM2.0 standard allows the user to redefine both the payload and the phases of the transactions. |
46 | | Two classes have been defined in '''soclib_vci_types''' : a '''tlmt_vci_payload''' and a '''tlmt_phase". |
47 | | |
48 | | The payload of a '''tlmt_vci_payload''' contains three groups of information: |
49 | | * TLM2.0 generic fields |
50 | | * TLM-T specific fields |
51 | | * VCI specific fields |
52 | | {{{ |
53 | | class tlmt_vci_payload |
54 | | { |
55 | | ... |
56 | | private: |
57 | | |
58 | | // TLM2.0 related fields and common structure |
59 | | |
60 | | sc_dt::uint64 address; |
61 | | unsigned char* data; |
62 | | unsigned char* byte_enable; |
63 | | unsigned int length; |
64 | | tlm::tlm_response_status response_status; |
65 | | unsigned int streaming_width; |
66 | | |
67 | | // TLM-T related fields |
68 | | |
69 | | bool* activity_status_ptr; |
70 | | sc_core::sc_time* local_time_ptr; |
71 | | |
72 | | // VCI related fields |
73 | | |
74 | | vci_param::cmd_t cmd; |
75 | | vci_param::srcid_t srcid; |
76 | | vci_param::trdid_t trdid; |
77 | | vci_param::pktid_t pktid; |
78 | | }; |
79 | | }}} |
80 | | |
81 | | The TLM2.0 compliant accessors allow to set the TLM2.0 related fields, such as the address, the data & byte enable |
82 | | arrays pointers and its associated size in bytes. |
83 | | |
84 | | Dedicated VCI accessors are used to define the VCI payload type, that can either be '''set_read()''' (for VCI read command), |
85 | | '''set_write()''' (for VCI write command),'''set_locked_read()''' (for VCI atomic locked read), |
86 | | and '''set_store_cond()''' (for VCI atomic store conditional). The '''set_srcid()''', '''set_trdid()''' and '''set_pktid()''' functions |
87 | | respectively set the VCI source, thread and packet identifiers. |
88 | | |
89 | | NB : The char array approach defined by TLM2.0 can degrade the simulation speed, |
90 | | as the existing SoCLib models use uint32_t arrays to model both the embedded memories and the caches... |
91 | | Experiments are currently in progress to evaluate the performance degradation incurred by this char <-> uint formatting. |
92 | | It is therefore possible that the types of the data and byte_enable fields of the '''tlmt_vci_payload''' |
93 | | will be changed to '''uint32*''' . |
| 45 | The TLM2.0 standard defines a generic payload that contains almost all the fields needed to implement the complete vci protocol. In SocLib, the missing fields are defined in what TLM2.0 calls a payload extension. The C++ class used to implement this extension is '''soclib_payload_extension'''. |
| 46 | |
| 47 | The SocLib payload extension only contains four data members: |
| 48 | {{{ |
| 49 | soclib::tlmt::vci_command m_soclib_command; |
| 50 | unsigned int m_src_id; |
| 51 | unsigned int m_trd_id; |
| 52 | unsigned int m_pkt_id; |
| 53 | }}} |
| 54 | The '''m_soclib_command''' data member supersedes the command of the TLM2.0 generic payload. This is why the parameter to |
| 55 | the '''set_command()''' of a generic payload is always set to '''tlm::TLM_IGNORE_COMMAND'''. Up to seven values can be assigned |
| 56 | to '''m_soclib_command'''. These values are: |
| 57 | {{{ |
| 58 | VCI_READ_COMMAND |
| 59 | VCI_WRITE_COMMAND |
| 60 | VCI_LINKED_READ_COMMAND |
| 61 | VCI_STORE_CONDITIONAL_COMMAND |
| 62 | TLMT_NULL_MESSAGE |
| 63 | TLMT_ACTIVE |
| 64 | TLMT_INACTIVE |
| 65 | }}} |
| 66 | |
| 67 | The '''VCI_READ_COMMAND''' (resp. '''VCI_WRITE_COMMAND''') is used to send a VCI read (resp. write) packet command. |
| 68 | The '''VCI_LINKED_READ_COMMAND''' and '''VCI_STORE_CONDITIONAL_COMMAND''' are used to implement atomic operations. The |
| 69 | latter 3 values are not directly related to VCI but rather to the PDES simulation algorithm used. The '''TLMT_NULL_MESSAGE''' value is used whenever an initiator needs to send its local time to the rest of the platform for synchronization purpose. |
| 70 | The '''TLMT_ACTIVE''' and '''TLMT_INACTIVE''' values are used to inform the interconnect that the corresponding initiator must be taken into account during PDES time filtering or not. A programmable component such as a DMA controller, until it |
| 71 | has been programmed and launched should not participate in the PDES time filtering. At the beginning of the simulation, |
| 72 | all the initiators are considered to be active, and therefore send at least one synchronization message. |
| 73 | |
| 74 | The data members of the '''soclib_payload_extension''' can be accessed through the following access functions: |
| 75 | and several member functions: |
| 76 | {{{ |
| 77 | |
| 78 | }}} |
| 79 | |
| 80 | To build a new VCI packet, one has to create a new generic payload and a soclib payload extension, and to call |
| 81 | the appropriate access functions on these two objects. For example, to issue a VCI read command, one should write |
| 82 | the following code: |
| 83 | {{{ |
| 84 | // set the values in tlm payload |
| 85 | payload_ptr->set_command(tlm::TLM_IGNORE_COMMAND); |
| 86 | payload_ptr->set_address(address[idx]); |
| 87 | payload_ptr->set_byte_enable_ptr(byte_enable); |
| 88 | payload_ptr->set_byte_enable_length(nbytes); |
| 89 | payload_ptr->set_data_ptr(data); |
| 90 | payload_ptr->set_data_length(nbytes); |
| 91 | // set the values in payload extension |
| 92 | extension_ptr->set_read(); |
| 93 | extension_ptr->set_src_id(m_srcid); |
| 94 | extension_ptr->set_trd_id(0); |
| 95 | extension_ptr->set_pkt_id(pktid); |
| 96 | // set the extension to tlm payload |
| 97 | payload_ptr->set_extension (extension_ptr ); |
| 98 | // set the tlm phase |
| 99 | phase = tlm::BEGIN_REQ; |
| 100 | // set the local time to transaction time |
| 101 | m_send_time = m_local_time; |
| 102 | |
| 103 | }}} |