• Keine Ergebnisse gefunden

Modeling embedded analog/mixed-signal systems

8. Modeling strategies

8.2 Modeling embedded analog/mixed-signal systems

This signal is called the complex low-pass equivalent or the complex envelope. For the baseband signal, the carrier frequency fc is set to zero. With si = r cos(ϕ) and sq = r sin(ϕ), the resulting baseband signal becomes:

(8.3) where si represents the in-phase term of the baseband signal, and sq represents the quadrature term. The amplitude and phase of the carrier signal can be computed from these signals at each point in time.

To implement baseband modeling using the SystemC AMS extensions, the C++ data type specialization

std::complex<double> can be used to represent complex numbers. This data type offers arithmetic and associated C++ operators for calculations supporting complex numbers. Example 8.5 shows a simple baseband amplifier with an input and output port supporting complex envelope signals.

Example 8.5: TDF model of an amplifier using baseband modeling

#include <complex>

SCA_TDF_MODULE(baseband_amplifier) {

sca_tdf::sca_in<std::complex<double > > in;

sca_tdf::sca_out<std::complex<double > > out;

baseband_amplifier( sc_core::sc_module_name nm, double gain_ = 1.0 ) : in("in"), out("out"), c1( gain_ ) {}

void processing() {

out.write( c1 * in.read() );

} private:

double c1;

};

The limitation of using std::complex<double> as data type is that it only describes the complex envelope of the modulated signal, and that the carrier frequency information is lost. Due to this, effects like harmonics of the carrier or intermodulation products are not represented. The solution to this is to create a user-defined data type supporting multi-carrier equivalent baseband computations.

8.2 Modeling embedded analog/mixed-signal systems

Behavioral modeling using a single model of computation imposes a number of restrictions as shown in Section 8.1. They can be overcome by combining (the strengths of) different models of computation. The following subsections describe how to partition the functional behavior onto the different models of computation. Then, a number of simple modeling guidelines is given, how to model architecture-level properties of analog circuits.

8.2.1 Partitioning behavior to different models of computation

A simple, but general strategy that allows beginners to distribute a block diagram like specification to the different models of computation provided by the SystemC AMS extensions is shown by Figure 8.6. It can be applied for each block successively.

Figure 8.6—Partitioning of behavior to different models of computation

In the first two steps (see and ), the functionality to be modeled should be investigated to select the most appropriate language. The SystemC AMS extensions are a good choice for modeling signal processing functions and electrical (conservative) networks (see ). Note that signal processing functions implemented in analog, digital or software can be modeled very efficiently using the SystemC AMS extensions at the functional level. For the modeling of digital hardware/software systems (e.g., microcontrollers and processors), interconnect and communication protocols, SystemC and transaction-level modeling approaches are most suitable.

The decomposition of each function is evaluated in the steps labelled to . Here, the most efficient and applicable model of computation is selected. The Timed Data Flow model of computation can be used to model static non-linear behavior (see ). Note that in some cases delays should be introduced in the models to facilitate interpolation or to resolve cyclic dependencies in the static TDF schedule (see ). Dynamic linear systems can be modeled efficiently using the Linear Signal Flow model of computation, enabling a block diagram notation to represent the function (see ).

Another good reason to use the SystemC AMS extensions would be the need for having analog terminals and/or physical quantities such as current available, e.g., for modeling external loads or analog behavior of communication lines. For this purpose, the Electrical Linear Network model of computation offers the most natural modeling approach to include electrical primitives and to capture conservative behavior. In addition, piecewise linear approximation techniques using a combination of TDF and ELN models can be applied to model non-linear behavior. For strong non-linear systems, it is recommended to incorporate (or cosimulate with) a non-linear solver like SPICE (see ).

When the TDF MoC is considered to model the AMS subsystem, different approaches are available to abstract the signal in time (see ). In the most straight forward way, a signal can be sampled or even oversampled in equidistant time steps. In this case, the TDF static mode of operation is used, resulting in fixed time steps during the entire simulation. The TDF model of computation can also be used if the size of the time steps should be determined by events, by time outs, or by other computations. In this case, the TDF dynamic mode of operation can be used, which enable changing TDF attributes such as time steps, delays, or rates during

simulation. Alternatively, regular SystemC discrete-event models can be created to become event-driven and cycle-accurate, but such approach is less efficient due to the additional simulation overhead imposed by the dynamic scheduling mechanism of SystemC for each evaluate/update cycle.

8.2.2 Modeling of architecture-level properties

In order to evaluate feasibility and performance of different architectures, the functional model can be used and refined by adding specific properties. These properties include: noise, attenuation, distortions, limitation, jitter, delays, quantization, sampling frequencies, and many other. In the following, some simple guidelines for handling these effects during architecture exploration are given.

8.2.2.1 Modeling distortions, limitation, and quantization

In order to study the impact of distortions and limitations on the overall system functionality, analog modules should be split into linear dynamic behavior and nonlinear static behavior. Linear dynamic behavior can be specified, e.g., using transfer functions in TDF (see Section 2.3.2). Non-linear behavior such as distortions and limitation can be modeled easily using C++ functions in the TDF module’s member function processing (see Section 8.1.3).

8.2.2.2 Modeling noise in the time domain

Noise in the TDF model of computation can be modeled by adding Gaussian distributed random numbers to a TDF signal. Example 8.6 demonstrates a simple model for (white) noise and attenuation in a wireless communication link. For this purpose, a function gauss_rand is used that generates Gaussian distributed random numbers.

Example 8.6: Modeling Gaussian noise

// the gauss_rand() function returns a Gaussian distributed

// random number with variance "variance", centered around 0, using the Marsaglia polar method

#include <cstdlib> // for std::rand

#include <cmath> // for std::sqrt and std::log double gauss_rand(double variance)

rnd1 = ((double)std::rand()) / ((double)RAND_MAX) ; rnd2 = ((double)std::rand()) / ((double)RAND_MAX) ;

sca_tdf::sca_in<double> in;

sca_tdf::sca_out<double> out;

void processing() {

out.write( in.read() * attenuation + gauss_rand(variance) );

}

air_channel_with_noise( sc_core::sc_module_name nm, double attenuation_, double variance_ )

: in("in"), out("out"), attenuation(attenuation_), variance(variance_) {}

private:

double attenuation;

double variance;

};

In order to get colored noise, the output of the function gauss_rand can be filtered using appropriate transfer functions.