MicroBlaze V has the ability to address up to 16 EB of data controlled by the parameter C_ADDR_SIZE.
With the 32-bit implementation (RV32), this is limited to 4 GB when physical memory protection (PMP) is enabled, and to 16 GB when Supervisor mode is enabled. Otherwise extended addressing up to 16 EB is provided by load and store custom instructions.
With the 64-bit implementation (RV64), this is limited to 64 PB when physical memory protection or Supervisor mode is enabled.
| Addressable Size | Addressable Bytes | Address Bits | Configuration |
|---|---|---|---|
| 4 GB | 4 * 10243 bytes | 32 bits | RV32 and RV64 |
| 16 GB | 16 * 10243 bytes | 34 bits | RV32, only supervisor mode Sv32 physical address |
| 64 GB | 64 * 10243 bytes | 36 bits | RV64 |
| 1 TB | 10244 bytes | 40 bits | RV64 |
| 16 TB | 16 * 10244 bytes | 44 bits | RV64 |
| 256 TB | 256 * 10244 bytes | 48 bits | RV64 |
| 4 PB | 4 * 10245 bytes | 52 bits | RV64 |
| 64 PB | 64 * 10245 bytes | 56 bits | RV64, supervisor mode Sv39 physical address |
| 16 EB | 16 * 10246 bytes | 64 bits | RV64, not available with PMP |
There are a number of software limitations with extended addressing when using the 32-bit implementation:
- The GNU tools only generate ELF files with 32-bit addresses with RV32, which means that program instruction and data memory must be located in the first 4 GB of the address space. This is also the reason the instruction address space does not provide an extended address.
- Because all software drivers use address pointers that are 32-bit unsigned integers, it is not possible to access physical extended addresses above 4 GB without modifying the driver code, and consequently all AXI peripherals should be located in the first 4 GB of the address space.
- The extended address is only treated as a physical address, and is not available when enabling Supervisor Mode.
- The GNU compiler does not handle 64-bit address pointers, which means that the only way to access an extended address is using the custom extended addressing instructions, available as macros.
The following C code exemplifies how an extended address can be used to access data:
#include "xil_types.h"
#include "riscv_interface.h"
int main()
{
u64 Addr = 0x000000FF00000000LL; /* Extended address */
u32 Word;
u16 Halfword;
u8 Byte;
Word = lwea(Addr); /* Load word from extended address */
swea(Addr, Word); /* Store word to extended address */
Halfword = lhuea(Addr); /* Load unsigned byte from extended address */
shea(Addr, Halfword); /* Store byte to extended address */
Byte = lbuea(Addr); /* Load unsigned byte from extended address */
sbea(Addr, Byte); /* Store byte to extended address */
}