Skip to content

Support for new blob message type #186

@glopesdev

Description

@glopesdev
  • Proposed
  • Prototype: Not Started
  • Implementation: Not Started
  • Specification: Not Started

Summary

This proposal introduces a new message type Blob to represent variable-length, register-specific binary payloads with a custom header, and describes additional constraints on the payload structure for implementing the request-reply pattern on this message type.

Motivation

Uploading firmware blobs or long stimulus waveforms to DAC devices present a challenging edge case to handle in the Harp protocol. Specifically:

  • Both cases typically require variable-length registers.
  • The size of these blobs often exceeds the maximum 8-bit Length (254 bytes) and even the 16-bit ExtendedLength (64 kB) allowed by standard Harp messages.
  • When using very large payloads in the request-reply pattern, the recommendation to echo the entire message in the reply body would place excessive pressure on transmission buffers.
  • Custom metadata headers and structure other than flat arrays are usually required.

This specification also indirectly provides a principled approach to nesting other data exchange protocols inside a Harp message.

Detailed Design

New message type: Blob

Below we detail the structure for this new message type:

  • The Type field is expanded to 3 bits and a new message type Blob is allowed with the value 4.
  • Both Length and ExtendedLength are included, and interpreted as a single 24-bit value, allowing for a maximum message length of 16 MB.
  • A new PayloadLength field is included after ExtendedLength, specifying the number of words in the Payload field.
  • A new Blob field is included after Payload with size equal to the number of bytes remaining in the message excluding Payload and other message headers.

In the request-reply pattern, the Device MUST reply with a Blob message containing only the Payload field.

With this approach, logging of reply messages could keep to a fixed-length contract containing blob metadata, and transmission bandwidth pressure would be removed by avoiding repetition of long data buffers.

Drawbacks

TBD

Alternatives

Avoid extra length field

An alternative was considered where Length would be used for Payload size and ExtendedLength for Blob size. This would make it less ambiguous to know where Blob begins but reduces maximum blob size, unless ExtendedLength is expanded to 24-bit.

The advantage of this alternative is not requiring any new header fields, e.g. no need for a PayloadLength field.

Add Blob as a separate flag rather than a separate type

The advantage here would be allowing Blob to be applied to all other types, possibly interesting to allow both Event blobs and Read blobs in addition to the request-reply pattern for uploading blobs.

Unresolved Questions

  • How best to separate between Payload and Blob?
  • Should Blob be a flag or a type?

Design Meetings

Metadata

Metadata

Assignees

No one assigned

    Labels

    proposalRequest for a new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions