Transaction-Level Modeling Framework for Space Applications
sr_signal constitutes in a set of functions that allow signal communication in TLM-Style, without the overhead of maintaining payload objects. Within the library it is mainly used to model interupts and reset distribution.
Signal communication in TLM platforms is usually modeled using SystemC signals (sc_signals). SystemC signals are applied very similar to RTL signals and, more-or-less, represent hardware wires. To achieve the required level of accuracy, all reads and writes of sc_signals need to be scheduled by the SystemC kernel. For modeling at a higher level of abstraction this involves an unwanted overhead. One would prefer a fast function-call based (TLM-style) communication with a preference of retaining the natural, close to hardware, modeling style of sc_signals.
For this purpose this library provides an extra set of functions. The SoCRocket TLM Signals can be found as seperate repository for easy single usage. It is mainly used to model the interrupt and reset distribution, but also for special purposes like dbus snooping. Syntax and application of sr_signal ports are very close to sc_signals. Although, signal transmission is performed by directed function calls, similar to TLM blocking transport. In contrast to TLM no payload handling is required. The general handling is very simple.
A module that is supposed to utilize the signals must include the sr_signal.h header file and must call the SR_HAS_SIGNALS macro in its class definition. The following code example shows a sr_signal module with an outgoing port of type int:
The actual signal output is defined in line 8. The output is written in line 20. Alternatively to to the shown direct data assignment, the write method of the port may be used (out.write(i)).
The next code block shows a signal receiver:
In line 10 the handler function onsignal is registered at sr_signal input in. If any call is received, this function will be triggered. Int value represents the data transmitted.
Sender and receiver can be connected using the sr_signal connect method. An example is given below:
Next to that trivial direct connection, the connect method is capable of handling broadcasting and muxing, and for converting between sr_signal and SystemC signals. For a broadcast the out signal may be directly connected to multiple ins. In the mux case, multiple transmitters are combined into one receiver. If required the transmitter may be identified by a channel number.
This code is avaliable under Apache-2.0 license.