Using Data Types
This topic reviews some basic material on Data Types that was introduced in Data Types, Controllers, Sinks, and Components, but then goes into more detail.
ADS Ptolemy uses different data types such as integer, fixed-point, floating-point (real), and complex in scalar or matrix forms. In ADS Ptolemy documentation there are numerous references to data and signal types. When data is presented versus an independent variable such as time, the data can be thought of as a signal. Regardless of the terminology, data or signals consist of packets of information that are passed from one component to another.
Representation of Data Types
ADS Ptolemy schematics contain component stems with different colors and thicknesses. Each component input and output pin has an associated data type, and each type is represented in the component symbol by use of a color code and a thickness of stem. And, each component stem may have single or multiple arrowheads. The following table lists the data types.
Component Stem Color and Thickness
| Data Type | Stem Color | Stem Thickness |
|---|---|---|
| Scalar Fixed Point | Magenta | Thin |
| Scalar Floating Point (Real) | Blue | Thin |
| Scalar Integer | Orange | Thin |
| Scalar Complex | Green | Thin |
| Matrix Fixed Point | Magenta | Thick |
| Matrix Floating Point (Real) | Blue | Thick |
| Matrix Integer | Orange | Thick |
| Matrix Complex | Green | Thick |
| Timed | Black | Thin |
| AnyType | Red | Thin |
Stem Thickness
The following figure illustrates stem thickness:
Matrix Data (Thick Lines) and Scalar Data (Thin Lines)
Single and Multiple Arrowheads
ADS Ptolemy uses block diagram schematics to enter information for simulation, which implies that all signals flowing between components are directional. Therefore, each input or output stem has arrowheads indicating the signal flow direction. This is not the case in circuit schematics where signals (wires) are generally bidirectional.
The signal flow is indicated by a single arrowhead. While single arrowhead stems carry only one distinct signal, double arrowhead stems can carry any number of independent signals or data. The following figure shows the difference between single and multiple arrowheads. In this figure, the input of the multiplier component is a single multiple input carrying data from any number of inputs.
Single and Multiple Arrowheads
Data Types Defined
There are two general signal types in ADS Ptolemy, numeric and timed. The numeric type has several subtypes, such as fixed-point, real, scalar, and matrix. Numeric signals have sequential numbers as the independent variable. Timed signals have time as the independent variable and are derived from complex data. Timed signals have additional attributes.
Typically, numeric data is used for algorithmic development in the baseband portion of a communication system. Timed signals are used to simulate the signal in the modulation channel, as well as for cosimulation with certain ADS circuit simulators.
Numeric Scalar Data
Numeric scalar data is defined as follows:
- int single, integer value (signed value defined with a 32-bit value)
- fixed single, fixed-point value with the following properties and operation attributes:
- precision defined using x.y or y/w where
x = bits to the left of the decimal point
y = bits to the right of the decimal point
w = x+y = total bit width, 1 to 255 - arithmetic type
twos complement (with sign bit included in x)
unsigned - quantization type
truncate, round - overflow type
saturate, saturate to zero, wrapped
- precision defined using x.y or y/w where
- floating-point (real) double precision floating-point (real) number
- complex pair of double precision floating-point (real) number for real and imaginary parts
Numeric Matrix Data
All matrix data is defined as a two-dimensional array (rows, columns) of either int, fixed, floating-point (real), or complex values. All matrix data types are indicated by thick stems, in contrast with the thin stems used for scalar data types.
Timed Data
ADS Ptolemy supports timed data. This signal is derived from complex data and includes additional attributes. The timed signal packet includes five members
{i(t), q(t), flavor, F c and t}
where i(t) and q(t) are the timed signal in phase and quadrature components, flavor indicates the representation of a modulated signal, Fc is the carrier (or characterization) frequency, and t is the time.
There are two equivalent representations (flavors) of a timed signal:
complex envelope (ComplexEnv) _v(t)
_ real baseband (BaseBand) V(t)
RF signals that are represented in the ComplexEnv flavor v(t) together with Fc can be converted to the real BaseBand flavor V(t) as:

Conversion of Data Types
We introduced this topic in Data Types, Controllers, Sinks, and Components. In this section, we go into more detail. Most conversions do what you expect. For example, when converting from lower to higher precision data types such as integer to floating-point (real), no data is lost; only the format is changed.
When converting from higher to lower precision data types, such as floating-point (real) to integer, the outcome is determined by the computer's math rounding rules.
Whether you manually place a converter, or the simulator splices in a converter, the conversion process is the same. It is similar to the casting operation used in C or C++ languages. If the conversion from A to B requires more information (integer to floating-point (real), floating-point (real) to complex, etc.) the obvious happens. For example, conversion from floating-point (real) to complex is done by setting the imaginary part of the complex number equal to 0.0. However, if the conversion involves loss of information (complex to double, double to integer, etc.), a set of rules is followed that is generally simple and intuitive.
Numeric Scalar and Matrix Conversions
The following table outlines the rules regarding scalar conversions among numeric data types:
| From | To | ||
|---|---|---|---|
| Integer | Fixed | Real | |
| Complex | round mag | round/truncate mag | mag |
| Real | round | round/truncate | |
| Fixed | round | ||
Note that mag means the magnitude of the complex number C = a + jb which is equal to

For automatic conversion (when no converter is explicitly used) to the Fixed data type, the resulting fixed-point number has the default length of 54 bits with the minimum number of integer bits needed to represent the value in twos complement representation. For example, the integer 5 is converted to the fixed point number 0101.00000000000000000000000000000000000000000000000000 (precision "4.50"), whereas the floating-point (real) number 3.375 is converted to 011.011000000000000000000000000000000000000000000000000 (precision "3.51"). If this is not the behavior you want, you must explicitly use a converter.
For matrix conversions, the above operations hold for all entries in the matrix.
Timed Data Conversions
You can convert between timed and scalar numeric data types by placing one of the following converters and supplying the parameters as needed:
- Timed to Complex or Complex to Timed
- Timed to Float (real) or Float (real) to Timed
- Timed to Fixed or Fixed to Timed
- Timed to Integer or Integer to Timed
Given the Timed data type {i(t), q(t), flavor, Fc and t}, the conversions between input and output of a converter are summarized below:
Timed To Float (Real)

If x is the input and y is the output for the TimedToFloat converter, then:
y[n] = i(t)*cos(2*Π*F c *t)-q(t)*sin(2*Π*F c *t)
when flavor = ComplexEnv
y[n] = x(t)
when flavor = BaseBand
Float (Real) To Timed

The FloatToTimed converter has one specific parameter, TStep. If x is the input and y is the output for this converter, then the y(t) packet has the following parts:
i(t) = x[n*TStep]
q(t) = 0.0
F c = 0.0
flavor = BaseBand
Timed To Complex

The Timed To Complex converter has no parameters. If x is the input and y is the output for this converter, then:
y[n] = i(t) + j*q(t) when flavor = ComplexEnv
y[n] = i(t) + j*0.0 when flavor = BaseBand
Complex To Timed

The Complex To Timed converter has two specific parameters, TStep and FCarrier. If x is the input and y is the output for this converter, then the y(t) packet has the following parts:
i(t) = Real{x[n*TStep] }
q(t) = Imag{x[n*TStep] }
F c = FCarrier
flavor = ComplexEnv
Rules and Exceptions
The converter devices are in general not reciprocal, i.e., putting two converters with opposite functionality back-to-back does not necessarily recover the original signal.
Based on the numeric scalar, numeric matrix, and timed data categories discussed previously, consider the following:
- Conversion between numeric scalar and numeric matrix types is done by explicitly placing Pack and UnPack components. Automatic conversion is not performed between these two categories.
- Conversion between numeric scalar and timed data is done by placing the appropriate converters. Automatic conversion between these two categories is allowed.
- Direct conversion is not done between numeric matrix and timed data types.
The following figure illustrates the conversion among data types; timed data must be converted to numeric scalar before being converted to matrix.
Data Type Conversions
Automatic or Manual Data Type Conversion
If the output of component A and the input of component B is the same (they are represented by the same color), data is simply copied from A to B. If the output of component A and the input of component B is different, conversion is needed.
Automatic conversion means that an appropriate converter is spliced in behind the scenes (not shown on the schematic). You may want to manually place an appropriate converter (from the Signal Converters library) in your schematic, which will be a visual conversion reminder and will help you decode any error messages.
Automatic conversion is allowed among scalar data types and among matrix data types, but not between scalar and matrix data types.
Allowed and Disallowed Automatic Conversions
Automatic conversion is available among all numeric scalar types. The same is true for matrix types. The following figure summarizes the allowed conversions.
Automatic Conversion Among Numeric Scalar and Matrix Types
With one exception (complex to timed), automatic conversion between timed and numeric scalar types is also supported, as illustrated in the following figure.
Automatic Conversion of Timed and Scalar Numeric Types
Automatic complex-to-timed conversion is not supported because carrier frequency information must be supplied by the user; for complex-to-timed conversion, place a ComplexToTimed converter and enter the appropriate parameters.
Automatic conversion of float (real) to timed, fixed to timed, integer to timed, or complex to timed must have at least one component in the design defining the TStep.
There is no automatic conversion between scalar and matrix data (or vice versa). In the Numeric Matrix Library, Pack_M, PackCx_M, PackFix_M, and PackInt_M are used to pack scalar data into matrix data; UnPk_M, UnPkCx_M, UnPkFix_M, and UnPkInt_M unpack the data (back to scalar). Place the converters where needed in your design. (Otherwise, when a scalar pin is directly connected to a matrix pin (or vice versa), without a pack or unpack converter, an error message is generated.)
Privacy
Statement
|
Terms of Use
|
Legal |
Contact Us
|
© Agilent 2000-2008 ![]()




