Threshold (threshold_ul_b)

Output a zero or one depending on if the signal is greater or lower than the set threshold.

Design

Determine if an input value is over a set threshold, returning a zero or one value as determined by invert_output.

The mathematical representation of the implementation is given in (45).

(45)\[\begin{split}y[n] = \begin{cases} 1-i & x[n] \ge T \\ i & \text{otherwise} \end{cases}\end{split}\]

In (45):

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

  • \(y[n]\) is the output values.

  • \(i\) is the invert_output property, considered as \(1\) for True and \(0\) for False.

  • \(T\) is the threshold value.

Interface

<?xml version="1.0"?>
<componentspec>
  <property name="threshold" type="ulong" writable="true" default="0" description="Threshold at which to quantise the data"/>
  <property name="invert_output" type="bool" writable="true" default="0" description="When true the output is inverted"/>
  <port name="input" producer="false" protocol="ulong_timed_sample-prot"/>
  <port name="output" producer="true" protocol="bool_timed_sample-prot"/>
</componentspec>

Ports

Inputs:

  • input: Primary input samples port.

    • Protocol: ulong_timed_sample-prot

    • Optional: False

Outputs:

  • output: Primary output samples port.

    • Protocol: bool_timed_sample-prot

    • Optional: False

Opcode Handling

The threshold function is only applied to values in a sample opcode message.

All other opcodes pass through this component without any effect.

Properties

  • threshold: Threshold at which to quantise the data.

    • Type: ulong

    • Access:

      • Parameter: False

      • Writable: True

      • Initial: False

      • Volatile: False

    • Default value: 0

  • invert_output: When true the output is inverted.

    • Type: bool

    • Access:

      • Parameter: False

      • Writable: True

      • Initial: False

      • Volatile: False

    • Default value: 0

Implementations

Example Application

<?xml version="1.0"?>
<application done="file_write">
  <instance component="ocpi.core.file_read" connect="threshold_ul_b">
    <property name="filename" value="input.bin"/>
  </instance>
  <instance component="ocpi.comp.sdr.dsp.threshold_ul_b" connect="file_write">
    <property name="threshold" value="10000"/>
    <property name="invert_output" value="false"/>
  </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 threshold_ul_b are:

  • None.

Testing

Tested platforms: None

Component testing not completed.