Visible to Intel only — GUID: GUID-95DD304D-6DC7-4E1F-AD1D-963F5CC7146B
Visible to Intel only — GUID: GUID-95DD304D-6DC7-4E1F-AD1D-963F5CC7146B
Memory-Mapped Host Interfaces
Each external memory interface is uniquely identified by a “buffer location” identifier. Buffer location identifiers can be applied to arguments annotated with the annotated_arg<> property and accessors. A pointer-type kernel argument with a specified buffer location is sometimes referred to as an annotated pointer argument. An unannotated pointer argument can be any of the of the following items:
- Accessor arguments without a specified buffer location
- Kernel arguments not specified as annotated_arg type with a buffer_location property
For each unique buffer location among the annotated pointer arguments of your kernels, the compiler infers one memory-mapped host interface. If there is no annotated pointer argument defined in all kernels, one global memory-mapped interface with default configuration is inferred (with buffer location 0).
You can attribute a buffer location to a kernel argument in the following ways:
- Memory-Mapped Host Interfaces Using Unified Shared Memory Pointers and the annotated_arg Class
A kernel can interface with an external memory over an Avalon® Memory-mapped (MM) Host interface. You can specify the Avalon® MM host interface with the annotated_arg class.
For full details about the annotated_arg class, refer to The annotated_arg Template Class.
- Memory-Mapped Host Interfaces Using Accessors
Using accessors allows the runtime and BSP to manage the copying of the memory between the host and device.
Accessor kernel arguments result in four arguments for each accessor argument.
In most cases, the compiler encodes the virtual address space information automatically. However, in some cases, you might need to encode it yourself. For details, refer to Addresses in Memory-Mapped Host Interfaces.
Addresses in Memory-Mapped Host Interfaces
Memory-mapped (MM) host interfaces issue byte addresses, not word addresses.
For example, if you dereference a pointer to a 4-byte wide data type, the address issued by the MM host interface is base address of the pointer plus the array index multiplied by 4.
Assuming a base address of 0x0000 for mm_a, the following code example results in 0x0018 on the interface because 0x0018 = 0x0006 x 4:
uint32_t value = mm_a[0x0006];
If mm_a has a base address of 0x1000, the resulting address is 0x1018 instead of 0x0018.
If you dereference a pointer to a 1-byte wide data type, the address issued by the MM Host interface is the base address of the pointer plus the array index multiplied by 1.
Assuming a base address of 0x0000 for mm_a, the following code example results in 0x0006 on the interface because 0x0006 = 0x0006 x 1:
uint8_t value = mm_a[0x0006];
If mm_a has a base address of 0x1000, the resulting address is 0x1006 instead of 0x0006.