Magnitude Squared (magnitude_squared_xs_ul)
Calculates the magnitude squared of a complex short input and outputs the result as an unsigned long.
Design
Sums the squares of the real and imaginary values of each input sample and outputs the result as an unsigned long value. This is useful for doing work with modulation schemes related to m-ary ASK signals. The reason that converting from magnitude squared to magnitude is unnecessary lies in the fact that the m-ary slicing levels can be scaled by squaring them to their appropriate values moving them into the magnitude squared domain. This saves on complexity and extra computations.
The unsigned long output width is chosen so the sum of the two squares never overflows, for every
input value including the most-negative one (-32768).
The mathematical representation of the implementation is given in (9).
In (9):
\(x_r[n]\) is the real part of the input values.
\(x_i[n]\) is the imaginary part of the input values.
\(y[n]\) is the output values.
Interface
<?xml version="1.0"?>
<componentspec>
<port name="input" producer="false" protocol="complex_short_timed_sample-prot"/>
<port name="output" producer="true" protocol="ulong_timed_sample-prot"/>
</componentspec>
Ports
Inputs:
input: Primary input samples port.Protocol:
complex_short_timed_sample-protOptional:
False
Outputs:
output: Primary output samples port.Protocol:
ulong_timed_sample-protOptional:
False
Opcode Handling
The magnitude squared calculation is only applied to values in sample opcode messages. All other opcode messages received are passed through this component without any effect.
Properties
None.
Implementations
Example Application
<?xml version="1.0"?>
<application done="file_write">
<instance component="ocpi.core.file_read" connect="magnitude_squared_xs_ul">
<property name="filename" value="input.bin"/>
</instance>
<instance component="ocpi.comp.sdr.math.magnitude_squared_xs_ul" connect="file_write">
</instance>
<instance component="ocpi.core.file_write">
<property name="filename" value="output.bin"/>
</instance>
</application>
Dependencies
The dependencies to other elements in OpenCPI are:
None
There is also a dependency on:
ieee.std_logic_1164
ieee.numeric_std
Limitations
Limitations of magnitude_squared_xs_ul are:
None.
Testing
Tested platforms: None
Component testing not completed.