• Keine Ergebnisse gefunden

3. Linear Signal Flow modeling

3.2.1 LSF modules

A Linear Signal Flow module is a predefined primitive module to represent a particular function or mathematical relation, which will become part of an overall equation system. The available predefined LSF primitive modules are listed in Table 3.1. Annex A gives the details for each LSF module.

Table 3.1—LSF primitive modules

LSF module name Description

sca_lsf::sca_add Weighted addition of two LSF signals.

LSF module name Description

sca_lsf::sca_sub Weighted subtraction of two LSF signals.

sca_lsf::sca_gain Multiplication of an LSF signal by a constant gain.

sca_lsf::sca_dot Scaled first-order time derivative of an LSF signal.

sca_lsf::sca_integ Scaled time-domain integration of an LSF signal.

sca_lsf::sca_delay Scaled time-delayed version of an LSF signal.

sca_lsf::sca_source LSF source.

sca_lsf::sca_ltf_nd Scaled Laplace transfer function in the time-domain in the numerator-denominator form.

sca_lsf::sca_ltf_zp Scaled Laplace transfer function in the time-domain in the zero-pole form.

sca_lsf::sca_ss Single-input single-output state-space equation.

sca_lsf::sca_tdf::sca_gain,

sca_lsf::sca_tdf_gain Scaled multiplication of a TDF input signal with an LSF input signal.

sca_lsf::sca_tdf::sca_source,

sca_lsf::sca_tdf_source Scaled conversion of a TDF input signal to an LSF output signal.

sca_lsf::sca_tdf::sca_sink,

sca_lsf::sca_tdf_sink Scaled conversion from an LSF input signal to a TDF output signal.

sca_lsf::sca_tdf::sca_mux,

sca_lsf::sca_tdf_mux Selection of one of two LSF input signals by a TDF control signal (multiplexer).

sca_lsf::sca_tdf::sca_demux,

sca_lsf::sca_tdf_demux Routing of an LSF input signal to either one of two LSF output signals controlled by a TDF signal (demultiplexer).

sca_lsf::sca_de::sca_gain,

sca_lsf::sca_de_gain Scaled multiplication of a discrete-event input signal by an LSF input signal.

sca_lsf::sca_de::sca_source,

sca_lsf::sca_de_source Scaled conversion of a discrete-event input signal to an LSF output signal.

sca_lsf::sca_de::sca_sink,

sca_lsf::sca_de_sink Scaled conversion from an LSF input signal to a discrete-event output signal.

sca_lsf::sca_de::sca_mux,

sca_lsf::sca_de_mux Selection of one of two LSF input signals by a discrete-event control signal (multiplexer).

sca_lsf::sca_de::sca_demux,

sca_lsf::sca_de_demux Routing of an LSF input signal to either one of two LSF output signals controlled by a discrete-event signal (demultiplexer).

3.2.1.1 Module time step

In order to solve the LSF equation system, a time step has to be associated to the set of connected LSF modules as part of the elaboration phase. This can be done with the LSF module member function set_timestep.

Alternatively, the LSF model can rely on the time step propagation mechanism, which passes the time step from module to module via its ports across the TDF, LSF, and ELN models of computation. So in the case where an LSF model is connected to a TDF model, the time step from the connected port, if available, is propagated to the LSF model. The consistency between propagated time steps and user-defined time steps is compulsory, as described in Section 2.1.4.

The module time step can be assigned by calling the member function set_timestep of the instantiated object within the constructor of the parent module, and passing a double value and the time unit or an object of type sca_core::sca_time, as shown in Example 3.1.

Example 3.1: SystemC hierarchical module instantiating an LSF source with time step assignment

SC_MODULE(my_lsf_source) {

// port declaration sca_lsf::sca_out y;

// child module declaration

src.set_timestep(0.5, sc_core::SC_MS); // set module time step of source to 0.5 ms src.y(y);

} };

3.2.2 LSF ports

An LSF port is an object that can be used to connect several LSF models together using LSF signals which are bound to this port. Due to the nature of the LSF modeling formalism, an LSF port can be either an input port or an output port, but not inout. LSF ports are used to connect LSF modules using signals of class sca_lsf::sca_signal. As LSF ports are always hierarchical ports inside a parent module, they can be used to connect to the LSF child modules directly, following the port-to-port binding rule (see Section 3.3.1). LSF ports have a predefined data type, also called signal flow nature, which prevents the usage of user-defined data types.

There are currently two classes of LSF ports:

— LSF input ports of class sca_lsf::sca_in.

— LSF output ports of class sca_lsf::sca_out.

Example 3.2 shows how LSF ports are used within an LSF structural model.

Example 3.2: LSF structural model with ports

SC_MODULE(my_lsf_model) {

// port declarations

sca_lsf::sca_in x;

sca_lsf::sca_out y;

SC_CTOR(my_lsf_model) : x("x"), y("y") {

// LSF primitives instantiated here }

};

LSF input port that carries a continuous-time and continuous-value signal x(t).

LSF output port that carries a continuous-time and continuous-value signal y(t).

Using the constructor initialization-list to assign the names “x” and “y” to the input and output ports, respectively.

There are no converter ports available for LSF. Instead, specialized converter modules are provided to connect to the TDF or discrete-event domain. This is explained in Section 3.4. Unlike TDF ports, the LSF ports do not provide member functions to directly read to or write from the channel.

3.2.3 LSF signals

LSF signals are used to connect LSF primitive modules together. LSF signals represent a variable of the time and value continuous equation system, while LSF ports determine the direction of the signals from one LSF module to another. Therefore, the LSF signals are not defined as a template class and should be used according to Example 3.3.

Example 3.3: LSF signal

// signal declaration

sca_lsf::sca_signal sig; // LSF signal

As in SystemC, the constructor initialization-list of the parent module can be used to assign a user-defined name to a signal:

Example 3.4: Assigning names to LSF signals using the SystemC constructor

// assign the names of LSF signal instance in the constructor initialization-list SC_CTOR(my_module) : sig("sig") {}

Section 3.3 will describe the creation of structural LSF models and will show examples of assigning user-defined names to ports and signals.