Shift right (shift_right_xs)
Right shift all input sample values.
Design
Separately right shifts the bit values of the real and imaginary values of a complex value. Upper bit positions are padded with the most significant bit to preserve the sign of the number. Equivalent to a division by a power of 2.
The mathematical representation of the implementation is given in (79).
In (79):
\(x[n]\) is the input values.
\(y[n]\) is the output values.
\(N\) is the number of bits the input is right shifted by.
A block diagram representation of the implementation is given in Figure 67:.
Figure 67: Shift right implementation.
The real and imaginary inputs are treated as separate value streams (i.e. (79) / Fig. 67 will be implemented twice within the component, once for the real values and a second time for the imaginary values).
Interface
<?xml version="1.0"?>
<componentspec>
<property name="shift" type="uchar" parameter="true" default="1" writable="false" description="Number of bit positions the input values will be right shifted by."/>
<port name="input" producer="false" protocol="complex_short_timed_sample-prot"/>
<port name="output" producer="true" protocol="complex_short_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:
complex_short_timed_sample-protOptional:
False
Opcode handling
Only values in a sample opcode message are right shifted. All other opcodes messages received are passed through this component without any effect.
Properties
shift: Number of bit positions the input values will be right shifted by.Type:
ucharAccess:
Parameter:
TrueWritable:
FalseInitial:
FalseVolatile:
False
Default value:
1
Parameters
Example application
<?xml version="1.0"?>
<application done="file_write">
<instance component="ocpi.core.file_read" connect="shift_right_xs">
<property name="filename" value="input.bin"/>
</instance>
<instance component="ocpi.comp.sdr.math.shift_right_xs" connect="file_write">
<property name="shift" value="3"/>
</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 shift_right_xs are:
None.
Testing
Component testing not completed.