| 27 | Basically, when an initiator sends a blocking transaction, it needs to be stopped and it waits the 'response caught' event to be awaken. When the response to the blocking transaction is caught, if the initiator is mono-transactionnal, or handled as such, its time is updated with the response's one. In case of a multi-transactionnal initiator, another transaction could be sent before the response's time, so the component needs to simulate those cycles too. |
| 28 | |
| 29 | Sometimes, the response treatment of a transaction doesn't impact the continuation of the simulation. In this case, it's a waste of energy to wait for a response which could be neglected, thus the initiator could pursue its treatment. The transaction can be tagged as non-blocking. |
| 30 | |
| 31 | However, when an initiator sends a transaction, it needs to be stored until the response comes back. In practice, the data structure which stores the requests has a fixed maximum size. When the buffer is full, a response needs to be caught in order to free a slot, thus the initiator needs to be stopped and it waits the 'response caught' event from any of these transactions to be awaken. This is an alternative to the non-blocking transactions which is more precise ,especially when the buffer is often full, but more difficult to implement. This type of transaction is called conditionaly-blocking |
| 32 | |
| 33 | The blocking type of a transaction is a 2 bits data stored in its payload extension. If blocking type is not specified by the user, it is considered as blocking. |
| 34 | {{{#!c++ |
| 35 | tlm::tlm_generic_payload *payload_ptr = new tlm::tlm_generic_payload(); |
| 36 | soclib_payload_extension *extension_ptr = new soclib_payload_extension(); |
| 37 | |
| 38 | //Fill the transaction with the necessary datas |
| 39 | ... |
| 40 | |
| 41 | //Set the transaction as blocking - 2 methods |
| 42 | extension_ptr->set_blocking(); |
| 43 | extension_ptr->set_blocking_type(BLOCKING); |
| 44 | |
| 45 | //Set the transaction as non-blocking - 2 methods |
| 46 | extension_ptr->set_non_blocking(); |
| 47 | extension_ptr->set_blocking_type(NON_BLOCKING); |
| 48 | |
| 49 | //Set the transaction as conditionaly-blocking - 2 methods |
| 50 | extension_ptr->set_cond_blocking(); |
| 51 | extension_ptr->set_blocking_type(COND_BLOCKING); |
| 52 | |
| 53 | //Send the transaction the usual way |
| 54 | ... |
| 55 | }}} |
| 56 | |