Constant Generator (constant_generator)

Design

This component is based on constant_s component within OpenCPI SDR Components Library (ocpi.comp.sdr). It was modified to use complex_short_timed_sample protocol.

Generates a constant stream of samples whose values are set by the value property.

The component can be enabled or disabled during run time. When enabled values are produced whenever the output is ready. When the component is disabled no output values are generated.

The generated output values are settable during run time. There is an option to output a discontinuity message after a change in output value.

The size of the generated stream messages can be set during run time and must be between 1 and ocpi_max_bytes_output/sample_size_bytes.

Interface

<?xml version="1.0"?>
<componentspec>
  <property name="enable" type="bool" writable="true" default="true" description="Enables / disables the output."/>
  <property name="message_length" type="ushort" writable="false" initial="true" default="512" description="Output message length. Must not be 0."/>
  <property name="value" type="short" writable="true" default="0" description="Output value."/>
  <property name="discontinuity_on_value_change" type="bool" writable="true" default="false" description="Sets if a discontinuity opcode is generated when the value property is changed."/>
  <port name="output" producer="true" protocol="complex_short_timed_sample-prot"/>
</componentspec>

Ports

Inputs:

None.

Outputs:

  • output

    • Protocol: complex_short_timed_sample-prot

    • Optional: False

Opcode Handling

Will generate messages with sample opcode. Discontinuity opcode messages will only be generated if discontinuity_on_value_change is set.

Properties

  • enable: Enables / disables the output.

    • Type: bool

    • Access:

      • Parameter: False

      • Writable: True

      • Initial: False

      • Volatile: False

    • Default value: true

  • message_length: Output message length. Must not be 0.

    • Type: ushort

    • Access:

      • Parameter: False

      • Writable: False

      • Initial: True

      • Volatile: False

    • Default value: 512

  • value: Output value.

    • Type: short

    • Access:

      • Parameter: False

      • Writable: True

      • Initial: False

      • Volatile: False

    • Default value: 0

  • discontinuity_on_value_change: Sets if a discontinuity opcode is generated when the value property is changed.

    • Type: bool

    • Access:

      • Parameter: False

      • Writable: True

      • Initial: False

      • Volatile: False

    • Default value: false

Implementations

Example Application

<?xml version="1.0"?>
<application done="file_write">
  <instance component="ocpi.comp.sdr.generator.constant_generator" connect="file_write">
    <property name="enable" value="true"/>
    <property name="message_size" value="512"/>
    <property name="discontinuity_on_value_change" value="true"/>
    <property name="value" value="100"/>
  </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 constant_s are:

  • Setting message_length to 0 or greater than ocpi_max_bytes_output/sample_size_bytes results in unsupported behaviour.