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).

(90)\[y[n] = b^{frac{x[n]}{2^N}}\]

In (90):

  • \(x[n]\) is the input values.

  • \(b\) is the base value, this is set by the base property.

  • \(N\) is the input scale power, this is set by the scale_input property.

  • \(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:.

Block diagram outlining exponentiation implementation.

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-prot

    • Optional: False

Outputs:

  • output: Primary output samples port.

    • Protocol: ushort_timed_sample-prot

    • Optional: 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: float

    • Access:

      • Parameter: True

      • Writable: False

      • Initial: False

      • Volatile: False

    • Default value: 10

  • scale_input: Input scale factor, where the input is divided by \(2^{scale_input}\).

    • Type: uchar

    • Access:

      • Parameter: False

      • Writable: True

      • Initial: False

      • Volatile: False

    • Default value: 0

Implementations

  • exp_us (HDL)

    Pipelined HDL implementation of exponentiation, allowing one input and one output every FPGA clock cycle, with a delay of 36 clock cycles through the pipeline.

  • exp_us (RCC)

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.