frame_merge4 HDL Worker

Round-robin, frame-atomic 4-to-1 merge of uchar_timed_sample decoded-frame streams.

Detail

The worker implements a two-state FSM (ST_ARB / ST_FWD) clocked on ctl_in.clk.

Arbitration (ST_ARB)

A combinational scan of pv(3:0) — where pv(k) = in<k>_in.ready AND in<k>_in.valid — selects the first available input starting at the round-robin pointer rr. The scan is unrolled as a for k in 0 to 3 loop with a found flag so only the first hit is latched. The selected index is stored in lp and the FSM moves to ST_FWD.

Forwarding (ST_FWD)

The locked input’s data, opcode, som, eom, and byte_enable signals are combinationally muxed onto the output port. A transfer (xfer) occurs when the locked input has a beat available (pv(lp) = '1') and the downstream asserts ready. On each transfer, in<lp>_out.take is asserted; all other inputs hold their take low.

The FSM leaves ST_FWD when xfer = '1' and the current beat is a sample-opcode EOM (se(lp) = '1'). se(k) is defined as:

se(k) <= '1' when in<k>_in.eom = '1' and
                  in<k>_in.opcode = uchar_timed_sample_sample_op_e
         else '0';

This condition fires on the last byte of the 134-byte sample message, which is always the second message in a frame unit. The metadata-message EOM does not satisfy se (wrong opcode), so the arbiter remains locked across the gap between the two messages.

On returning to ST_ARB the round-robin pointer advances: rr <= (lp + 1) mod 4.

EOF

output_out.eof is driven combinationally:

output_out.eof <= '1' when in0_in.eof = '1' and in1_in.eof = '1' and
                           in2_in.eof = '1' and in3_in.eof = '1' and
                           pv = "0000" and state = ST_ARB
                 else '0';

All four conditions must hold simultaneously to prevent premature EOF while any input still holds unforwarded frames.

Reset

Synchronous, active-high reset on ctl_in.reset. state, lp, and rr are all reset to zero.

Worker Properties

  • ocpi_buffer_size_output

    • Type: ushort

    • Access:

      • Parameter: False

      • Writable: False

      • Initial: True

      • Volatile: False

      • Read back: False

    • Default value: 0

  • ocpi_blocked_output

    • Type: ulong

    • Access:

      • Parameter: False

      • Writable: False

      • Initial: False

      • Volatile: True

      • Read back: False

    • Default value: None

  • ocpi_max_latency_output

    • Type: ushort

    • Access:

      • Parameter: True

      • Writable: False

      • Initial: False

      • Volatile: False

      • Read back: False

    • Default value: None

  • ocpi_latency_output

    • Type: ushort

    • Access:

      • Parameter: False

      • Writable: False

      • Initial: False

      • Volatile: True

      • Read back: False

    • Default value: None

  • ocpi_messages_output

    • Type: ulong

    • Access:

      • Parameter: False

      • Writable: False

      • Initial: False

      • Volatile: True

      • Read back: False

    • Default value: None

  • ocpi_bytes_output

    • Type: ulong

    • Access:

      • Parameter: False

      • Writable: False

      • Initial: False

      • Volatile: True

      • Read back: False

    • Default value: None

Worker Ports

    Inputs:

  • in0

    • Protocol: uchar_timed_sample

    • Optional: False

  • in1

    • Protocol: uchar_timed_sample

    • Optional: False

  • in2

    • Protocol: uchar_timed_sample

    • Optional: False

  • in3

    • Protocol: uchar_timed_sample

    • Optional: False

  • Outputs:

  • output

    • Protocol: uchar_timed_sample

    • Optional: False

Worker Ports

Inputs:

  • in0:

    • Type: StreamInterface

    • Protocol: uchar_timed_sample-prot

    • ClockDirection: in

    • Data width: 8

  • in1:

    • Type: StreamInterface

    • Protocol: uchar_timed_sample-prot

    • ClockDirection: in

    • Data width: 8

  • in2:

    • Type: StreamInterface

    • Protocol: uchar_timed_sample-prot

    • ClockDirection: in

    • Data width: 8

  • in3:

    • Type: StreamInterface

    • Protocol: uchar_timed_sample-prot

    • ClockDirection: in

    • Data width: 8

Outputs:

  • output:

    • Type: StreamInterface

    • Protocol: uchar_timed_sample-prot

    • Worker EOF: true

    • Clock: in0

    • Data width: 8

Utilisation

Utilization reporting is not currently implemented.