Skip to content

Accelerator Interfaces

Serena Curzel edited this page Sep 15, 2023 · 5 revisions

Minimal Memory Interface Protocol

The Minimal Memory Interface Protocol is a hardware memory interface designed to act as an on-chip bus, and it is used by Bambu as the default accelerator interface. This protocol is specifically designed to offer a compact and straightforward interface while maintaining efficient data transfer for both read and write operations. The protocol utilizes a set of seven signals, each serving a specific purpose in the data transfer process.

Interface Signals

The Minimal Memory Interface Protocol is composed of the following seven signals:

Signal Direction Bitsize Description
oe Output 1 bit Output Enable: Asserted by the master to indicate a read request.
we Output 1 bit Write Enable: Asserted by the master to indicate a write request.
addr Output 32/64 bits Address Bus: Carries the memory address of the data to be read from or written to.
data_size Output ceil(log2(Wdata)) Data Size Bus: Specifies the requested write bitsize as a binary number from 0 to the size of the Wdata bus.
Wdata Output Variable Write Data Bus: Carries the data to be written into the memory module during write requests.
Rdata Input Variable Read Data Bus: Carries the requested data from the memory module during read requests.
DataRdy Input 1 bit Data Ready: Asserted by the memory module to indicate the completion of a read or write request.

oe (Read Enable): This signal is asserted by the master to indicate a read request. When asserted, the slave memory module is expected to provide data back to the master.

we (Write Enable): This signal is asserted by the master to indicate a write request. When asserted, the slave memory module is ready to accept data from the master for storage.

addr (Address Bus): The address bus is a bus of 32 or 64 bits, depending on the implementation. It carries the memory address of the data to be read from or written to.

data_size (Data Size Bus): The data_size bus is used to specify the requested write bitsize as a binary number ranging from 0 to Wdata bus bitsize. This feature allows the master to indicate how many bits of the Wdata bus carry valid data during a write request.

Wdata (Write Data Bus): Wdata is an output bus of variable size. During write requests, it carries the data to be written into the memory module by the master. The number of valid bits carried on this bus is determined by the data_size signal.

Rdata (Read Data Bus): Rdata is an input bus of variable size. During read requests, the memory module places the requested data on this bus for the master to read.

DataRdy (Data Ready): This signal is asserted by the memory module to indicate the completion of a read or write request. When this signal is asserted, it signifies that valid data is available on the Rdata bus for read requests, or the data provided on the Wdata bus has been successfully stored for write requests.

Operation

The Minimal Memory Interface Protocol operates as follows:

  1. Read Operation:

    • The memory address is placed on the addr bus by the master.
    • The master asserts the oe signal to indicate a read request.
    • The memory module responds by placing the requested data on the Rdata bus.
    • Once the data is available on the Rdata bus, the memory module asserts the DataRdy signal.
    • The master reads the data from the Rdata bus upon observing the DataRdy signal.
  2. Write Operation:

    • The memory address is placed on the addr bus by the master.
    • The master asserts the we signal to indicate a write request.
    • The master specifies the number of valid bits in the data being written by setting the data_size signal.
    • The data to be written is placed on the Wdata bus by the master.
    • The memory module stores the data from the Wdata bus based on the value indicated by the data_size signal.
    • Once the write operation is complete, the memory module asserts the DataRdy signal.

The Minimal Memory Interface Protocol offers several advantages, including its simplicity, flexibility, efficiency, and low overhead. To enable multiple outstanding requests, it is possible to implement a pipelined version of the minimal interface protocol.

Inferred interfaces

When the --generate-interface=INFER option is specified, Bambu evaluates the following factors, in order of precedence, to set the correct interface protocol for each argument of the top function:

  1. Presence of a user-specified XML file (--interface-xml-filename=<filename>)
  2. Presence of HLS_interface pragmas in the code
  3. Default assignment according to the argument type

In cases 1. and 2. the user selects the desired interfaces for one or more function arguments through the options described here. For all arguments without a specification, and in case 3., the following table applies:

C argument type Direction Interface protocol
Scalar (pass by value) in none
Array in/out array
Pointer or reference in none
Pointer or reference out valid
Pointer or reference in/out o_valid