Complex Mixer (complex_mixer)
Multiplies complex IQ data input with a digital sine wave generated by a numerically-controlled oscillator (NCO).
complex_mixer is an asset in the ocpi.assets.dsp_comps component library. Implementations include the
complex_mixer HDL Worker (complex_mixer.hdl) and the complex_mixer RCC Worker (complex_mixer.rcc).
Tested platforms include
alst4, isim, matchstiq-z1 (PL), ml605, modelsim, xsim, and Zedboard(PL).
Design
The complex mixer consists of a numerically-controlled oscillator (NCO) and a complex multiplier. The component receives complex signed samples on its input port, performs a complex multiply with a digital sine wave generated by its NCO, and then places the resulting output, which is a frequency-shifted version of the input data, on its output port.
A block diagram representation of the implementation is given in Figure 1:
Figure 1: Complex Mixer Block Diagram
Interface
<!-- This is the spec file (OCS) for: complex_mixer
Add component spec attributes, like "protocol".
Add property elements for spec properties.
Add port elements for i/o ports -->
<ComponentSpec>
<Property Name="enable" Type="bool" Writable="true" Default="true"/>
<Property Name="phs_inc" Type="Short" Writable="true" Default="-4096"/>
<DataInterfaceSpec Name="in" Producer="false" Protocol="iqstream_protocol.xml" optional='true'/>
<DataInterfaceSpec Name="out" Producer="true" Protocol="iqstream_protocol.xml" optional='true'/>
</ComponentSpec>
Properties
enableType:
boolAccess:
Parameter:
FalseWritable:
TrueInitial:
FalseVolatile:
False
Default value:
true
phs_incType:
shortAccess:
Parameter:
FalseWritable:
TrueInitial:
FalseVolatile:
False
Default value:
-4096
Ports
Inputs:
in: Signed complex samples.Protocol:
iqstream_protocol.xmlOptional:
True
Outputs:
out: Signed complex samples.Protocol:
iqstream_protocol.xmlOptional:
True
Implementations
complex_mixer(HDL)Application worker HDL implementation with settable runtime configuration parameters and a numerically-controlled oscillator (NCO) that uses the coordinate rotation digital computer (CORDIC) algorithm to generate the digital sine wave for the complex multiply operation.
complex_mixer(RCC)Application worker RCC implementation with a numerically-controlled oscillator (NCO) that uses the
ncomodule from liquid-dsp to generate the digital sine wave for the complex multiply operation.
Example Application
<?xml version="1.0"?>
<application done="file_write">
<instance component="ocpi.core.file_read" connect="complex_mixer">
<property name="filename" value="input.bin"/>
</instance>
<instance component="ocpi.assets.dsp_comps.complex_mixer" connect="file_write">
</instance>
<instance component="ocpi.core.file_write">
<property name="filename" value="output.bin"/>
</instance>
</application>
Dependencies
The dependencies on other elements in OpenCPI are:
None.
Limitations
Limitations of complex_mixer are:
None.
Testing
Test cases for the complex mixer are derived from the number of
properties and their respective values as listed in
complex_mixer-test.xml. The following test cases
are implemented to validate the complex_mixer component:
Bypass mode, where the input data is forwarded to the output port. To verify this case, the test byte-wise compares the output file to the input file.
Normal mode, where the NCO is configured to tune the input signal to baseband. To verify this case, the test performs an FFT of the output data and checks the max value of the FFT to be at DC (0Hz).
For both of these cases, the input file contains a tone of 12.5Hz sampled at 100Hz and an amplitude of 32767.
Tested platforms: None
Component testing not completed.