-
Notifications
You must be signed in to change notification settings - Fork 6
Description
- 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-bitExtendedLength(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
Typefield is expanded to 3 bits and a new message typeBlobis allowed with the value 4. - Both
LengthandExtendedLengthare included, and interpreted as a single 24-bit value, allowing for a maximum message length of 16 MB. - A new
PayloadLengthfield is included afterExtendedLength, specifying the number of words in thePayloadfield. - A new
Blobfield is included afterPayloadwith size equal to the number of bytes remaining in the message excludingPayloadand 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
PayloadandBlob? - Should
Blobbe a flag or a type?