4

If a program running on a little endian processor writes the value 0xaabbccdd uncached to address 0, and the processor uses a 32-bit wide AXI4 bus, are bits 31-24 of WDATA 0xaa or 0xdd?

AXI does not expose byte addressable memory--it can only read or write a full data bus width (32 bits in this case). The question is how it maps addresses of byte values to data bus bits.

Section A3.4.3 of the AXI spec (rev E) discusses "byte invariant" endianness, but doesn't seem to explain the order of bytes on the data bus.

JeffB
  • 407
  • 3
  • 13

1 Answers1

2

If a little endian processor writes the value 0xaabbccdd uncached to address 0 via a 32-bit wide AXI4 bus, are bits 31-24 of WDATA 0xaa or 0xdd?

31-24 bits of WDATA are 0xAA independent of processor endianness. But the order of bytes in memory is determined by the endianness. See this answer for explanation of byte-invariant endianness.

Juglans
  • 31
  • 3
  • From the linked answer, what you've described sounds more like data invariance: specifically, "The datum is a 32-bit word which always has the value 0xddccbbaa, independent of endianness." For address invariance, that answer implies byte addressable memory, which is not the case here. It seems like both mappings (31-24 or 7-0) would be compatible with this definition given there. – JeffB Aug 14 '18 at 05:53
  • Well, linked answer may be a little bit misleading as examples are considered from perspective of memory, while we are on the AXI bus side. AXI does support narrow transfers, you can overwrite two bytes at address 0 (AXI address space) with value 0x1122 by masked transfer 0xXXXX1122, and get 0xAABB1122 (Addr 0,1,2,3 in memory, big-endian) or 0x2211BBAA (little-endian). Reading byte at address 3 (AXI address space) will always return 0xAA (0xAAXXXXXX). – Juglans Aug 15 '18 at 07:42
  • I write 0xaabbccdd at 0 and read byte address 3 on a big endian machine, it should be 0xdd. On a little endian machine, it should be 0xaa. In that case, your first answer that 31-24 are alway 0xaa for a 32-bit write and the second comment that reading a byte address 3 will always return 0xaa seem incompatible: it would be broken for big endian machines. – JeffB Aug 15 '18 at 14:14