First of all, I should remember you what means loosely-timed: we use the blocking function b_transport and therefore we have two synchronization points per transaction, that corresponds to the beginning and the end of the transaction. These two points can be in the same simulation time or in different simulation time. In case we have the two synchronization points in the same simulation time, we are using untimed).
A DMI example
Let’s go with the Direct Memory Inteface (DMI) defined in TLM-2.0. DMI mechanism in roughly speaking is to pass over transactions, protocols and so on. In short, the Target sends a pointer to its memory region (o part of it) to the Initiator to allow him to that memory region directly, without using transaction. This way, we speed up the simulation, because everything is more easy. DMI is focsed on memory type devices connected to modules that are accessing very frequently to that memory devices, like CPUs or DMAs. But the mechanism is there, and we can use it in any of our modules.
Continue reading »
Loosely time and temporal decoupling
This coding style works with 2 timing points in each transaction, one in the function call and the other in the return for the b_transport function (using the base protocol these points corresponds to the start of the petition and the start of the response). We can put these two points in the same time to mark that the transaction is not using time.
Untimed example
Let’s start with the first example…
Initiator
We shall start with the include’s
#include
using namespace sc_core;
#include "tlm.h"
#include "tlm_utils/simple_initiator_socket.h"
Firstly we include systemc and then tlm.h
Then we include the easiest socket for that example.
Now it’s time to declare the Initiator class
class Initiator: sc_module
{
public:
tlm_utils::simple_initiator_socket initiator_socket;
SC_HAS_PROCESS(Initiator);
Initiator(sc_module_name name_);
private:
void initiator_thread();
};
Interfaces, sockets, DMI y more
Sorry, this entry is only available in Español.
Coding Styles
TLM-2 lists modeling 3 different modes (called Coding Styles in official documents): untimed, Loosely-timed and Approximately-timed. Each serves a specific purpose, and to model different types of systems. We must also take into account the cost of each simulation mode (untimed less expensive, Approximatelly-timed more expensive).