Time Demux (time_demux)

Design

The Time Demux component acts as a demultiplexer/router by parsing an iqstream_with_sync protocol and routing timestamps and data to separate output ports.

The incoming iqstream_with_sync supports three opcodes: iq, Sync, and Time. The output ports use the iqstream and iqstream_with_sync protocols, the former using a single opcode. Data within the iqstream_with_sync’s Time opcode (a single 64-bit value) is passed directly through, while data within the iq opcode is converted to iqstream’s iq opcode’s data (which, conveniently, is the same structure). The iqstream_with_sync’s Sync opcode is currently ignored.

Top-level Block Diagram

Figure 255: Top-Level Block Diagram

Interface

<?xml version="1.0"?>
<ComponentSpec>
  <!-- Add property and port elements here -->
    <Property name="Current_Second" type="ULong" volatile="true"></Property>
    <Property name="Messages_Read" type="ULongLong" volatile="true"></Property>
    <Property name="Bytes_Read" type="ULongLong" volatile="true"></Property>
    <Port name="Mux_In" protocol="iqstream_with_sync_protocol"></Port>
    <!-- Port order matters here - first port in the SPEC file -->
    <Port name="Time_Out" producer="true" protocol="iqstream_with_sync_protocol"></Port>
    <Port name="Data_Out" producer="true" protocol="iqstream_protocol"></Port>
</ComponentSpec>

Opcode Handling

None

Properties

  • Current_Second

    • Type: ulong

    • Access:

      • Parameter: False

      • Writable: False

      • Initial: False

      • Volatile: True

    • Default value: None

  • Messages_Read

    • Type: ulonglong

    • Access:

      • Parameter: False

      • Writable: False

      • Initial: False

      • Volatile: True

    • Default value: None

  • Bytes_Read

    • Type: ulonglong

    • Access:

      • Parameter: False

      • Writable: False

      • Initial: False

      • Volatile: True

    • Default value: None

Ports

Inputs:

  • Mux_In: multiplexed data stream iqstream_with_sync.

    • Protocol: iqstream_with_sync_protocol

    • Optional: False

Outputs:

  • Time_Out: timestamps.

    • Protocol: iqstream_with_sync_protocol

    • Optional: False

  • Data_Out: samples.

    • Protocol: iqstream_protocol

    • Optional: False

Implementations

Example Application

<?xml version="1.0"?>
  <instance component="ocpi.core.file_read" name="file_read">
    <property name="filename" value="input_samples.bin"/>
  </instance>
  <connection>
    <port instance="file_read" name="out"/>
    <port instance="time_demux" name="mux_in"/>
  </connection>
  <instance component="ocpi.tutorial.time_demux" connect="file_write"/>
  <connection>
    <port instance="time_demux" name="out"/>
    <port instance="file_write_time" name="in"/>
  </connection>
  <connection>
    <port instance="time_demux" name="out"/>
    <port instance="file_write_data" name="in"/>
  </connection>
  <instance component="ocpi.core.file_write" name="file_write_time">
    <property name="filename" value="time_output.bin"/>
  </instance>
  <instance component="ocpi.core.file_write" name="file_write_data">
    <property name="filename" value="time_output.bin"/>
  </instance>
</application>

Dependencies

There is also a dependency on:

  • ieee.std_logic_1164

  • ieee.numeric_std

  • ieee.math_real.all

Limitations

None.

Testing and Verification

Testing of the Time Demux component consists of a C++ program (test data generator.cxx ) used to generate input data and expected “golden” outputs Figure 256:. Fake timestamps and sample data are interleaved into an input file using the “message mode” format required to have ocpi.file read playback opcodes with data. The C++ generator takes input arguments of: input file name, starting timestamp, number of samples to push each “second,” filename for the interleaved file, filename for the golden timestamps, and filename for the golden output file. These parameters are all handled by the OpenCPI test XML, with the test application shown in Figure 257:. Output data is compared to the golden file(s) by the Makefile Figure 258:.

AGC Complex Test and Verification

Figure 256: Time Domain and Frequency Domain Plots

AGC Complex Test and Verification

Figure 257: Time Domain and Frequency Domain Plots

AGC Complex Test and Verification

Figure 258: Time Domain and Frequency Domain Plots

The default XML provides reasonable values for each of the data generator’s required parameters:

Table 128: XML Values

Test Property

Default

Notes

IFILE

(Running kernel image)

The input file is truncated to a 32-bit boundary to simulate two 16-bit data samples. This may cause verification issues if using random files.

START

0

Decimal only

SAMPLES

256

Should not exceed 2048

For test purposes, the “timestamp” is a one-up counter starting at START placed in the upper 32-bits and then incremented and placed into the lower 32-bits:

$ od −t x8 odata/output_time_golden.bin | head
0000000 0000000000000001 0000000100000002
0000020 0000000200000003 0000000300000004
0000040 0000000400000005 0000000500000006
0000060 0000000600000007 0000000700000008
0000100 0000000800000009 000000090000000a
0000120 0000000a0000000b 0000000b0000000c
0000140 0000000c0000000d 0000000d0000000e
0000160 0000000e0000000f 0000000f00000010
0000200 0000001000000011 0000001100000012
0000220 0000001200000013 0000001300000014

Testing

Tested platforms: None