Exponentiation (exp_us)
Calculates a base value raised to the power of the input sample opcode message values.
Design
Input values are first scaled by an factor of \(2^N\), where \(N\) is the scale_input property. A base value is then raised to the power of this scaled input value.
The mathematical representation of the implementation is given in (90).
In (90):
\(x[n]\) is the input values.
\(b\) is the base value, this is set by the
baseproperty.\(N\) is the input scale power, this is set by the
scale_inputproperty.\(y[n]\) is the output values, before rounding. Values that are returned by the component are first rounded using a half up rounder.
A block diagram representation of the implementation is given in Figure 138:.
Figure 138: Exponentiation implementation.
To avoid undefined implementation behaviour the input scaling factor must be set high enough to ensure the output never exceeds 65535.
Interface
<?xml version="1.0"?>
<componentspec>
<property name="base" type="float" parameter="true" writable="false" default="10" description="Base of the exponentiation."/>
<property name="scale_input" type="uchar" writable="true" default="0"
description="Input scale factor, where the input is divided by :math:`2^{scale_input}`."/>
<port name="input" producer="false" protocol="ushort_timed_sample-prot"/>
<port name="output" producer="true" protocol="ushort_timed_sample-prot"/>
</componentspec>
Ports
Inputs:
input: Primary input samples port.Protocol:
ushort_timed_sample-protOptional:
False
Outputs:
output: Primary output samples port.Protocol:
ushort_timed_sample-protOptional:
False
Opcode Handling
The exponentiation operation is only applied to values in a sample opcode message. All other opcodes messages received are passed through this component without any effect.
Properties
base: Base of the exponentiation.Type:
floatAccess:
Parameter:
TrueWritable:
FalseInitial:
FalseVolatile:
False
Default value:
10
scale_input: Input scale factor, where the input is divided by \(2^{scale_input}\).Type:
ucharAccess:
Parameter:
FalseWritable:
TrueInitial:
FalseVolatile:
False
Default value:
0
Implementations
Example Application
<?xml version="1.0"?>
<application done="file_write">
<instance component="ocpi.core.file_read" connect="exp_us">
<property name="filename" value="input.bin"/>
</instance>
<instance component="ocpi.comp.sdr.math.exp_us" connect="file_write">
<property name="base" value="10.0"/>
<property name="scale_input" value="14"/>
</instance>
<instance component="ocpi.core.file_write">
<property name="filename" value="output.bin"/>
</instance>
</application>
Dependencies
The dependencies to other elements in OpenCPI are:
There is also a dependency on:
ieee.std_logic_1164
ieee.numeric_std
ieee.math_real
Limitations
Limitations of exp_us are:
Base values less than or equal to one are not supported.
Input values that result in output values greater than 65535 give undefined behaviour.
Testing
Tested platforms: None
Component testing not completed.