[Libre-soc-isa] [Bug 560] big-endian little-endian SV regfile layout idea
bugzilla-daemon at libre-soc.org
bugzilla-daemon at libre-soc.org
Tue Jan 5 03:12:50 GMT 2021
https://bugs.libre-soc.org/show_bug.cgi?id=560
--- Comment #60 from Alexandre Oliva <oliva at libre-soc.org> ---
Ok, here we go. According to v3.0B p25, a doubleword 0x2122_2324_2526_2728 is
represented in memory like this:
endianness: { ([offset] = value,)* };
from most to least significant
BE: { [0] = 0x21, [1] = 0x22, [2] = 0x23, [3] = 0x24, [4] = 0x25, [5] = 0x26,
[6] = 0x27, [7] = 0x28, };
from most to least significant
LE: { [7] = 0x21, [6] = 0x22, [5] = 0x23, [4] = 0x24, [3] = 0x25, [2] = 0x26,
[1] = 0x27, [0] = 0x28, };
which could also be equivalently depicted like this:
from least to most significant
LE: { [0] = 0x28, [1] = 0x27, [2] = 0x26, [3] = 0x25, [4] = 0x24, [5] = 0x23,
[6] = 0x22, [7] = 0x21, };
just like the earlier one could be equivalently depicted like this:
from least to most significant:
BE: { [7] = 0x28, [6] = 0x27, [5] = 0x26, [4] = 0x25, [3] = 0x24, [2] = 0x23,
[1] = 0x22, [0] = 0x21, };
> * ld LE: ordering of the MEANING in regfile is in {insert order}
> * ld BE: ordering of the MEANING in regfile is in {insert order}
if you load from memory, with the CPU configured to assume memory is in the
same endianness as the representation you're reading from, what you get into
the register can be most trivially represented as 0x2122_2324_2526_2728. it
could also be represented as 0x21 * 2^{56} + 0x22 * 2^{48} + 0x23 * 2^{40} +
0x24 * 2^{32} + 0x25 * 2^{24} + 0x26 * 2^{16} + 0x27 * 2^8 + 0x28 * 2^0. or,
if you're looking for a bitwise representation, here's one:
0 * 2^{0} + 0 * 2^{1} + 0 * 2^{2} + 1 * 2^{3} + 0 * 2^{4} + 1 * 2^{5} + 0 *
2^{6} + 0 * 2^{7} + 1 * 2^{8} + 1 * 2^{9} + 1 * 2^{10} + 0 * 2^{11} + 0 *
2^{12} + 1 * 2^{13} + 0 * 2^{14} + 0 * 2^{15} + 0 * 2^{16} + 1 * 2^{17} + 1 *
2^{18} + 0 * 2^{19} + 0 * 2^{20} + 1 * 2^{21} + 0 * 2^{22} + 0 * 2^{23} + 1 *
2^{24} + 0 * 2^{25} + 1 * 2^{26} + 0 * 2^{27} + 0 * 2^{28} + 1 * 2^{29} + 0 *
2^{30} + 0 * 2^{31} + 0 * 2^{32} + 0 * 2^{33} + 1 * 2^{34} + 0 * 2^{35} + 0 *
2^{36} + 1 * 2^{37} + 0 * 2^{38} + 0 * 2^{39} + 1 * 2^{40} + 1 * 2^{41} + 0 *
2^{42} + 0 * 2^{43} + 0 * 2^{44} + 1 * 2^{45} + 0 * 2^{46} + 0 * 2^{47} + 0 *
2^{48} + 1 * 2^{49} + 0 * 2^{50} + 0 * 2^{51} + 0 * 2^{52} + 1 * 2^{53} + 0 *
2^{54} + 0 * 2^{55} + 1 * 2^{56} + 0 * 2^{57} + 0 * 2^{58} + 0 * 2^{59} + 0 *
2^{60} + 1 * 2^{61} + 0 * 2^{62} + 0 * 2^{63}
here's another:
0 * 2^{63} + 0 * 2^{62} + 1 * 2^{61} + 0 * 2^{60} + 0 * 2^{59} + 0 * 2^{58} + 0
* 2^{57} + 1 * 2^{56} + 0 * 2^{55} + 0 * 2^{54} + 1 * 2^{53} + 0 * 2^{52} + 0 *
2^{51} + 0 * 2^{50} + 1 * 2^{49} + 0 * 2^{48} + 0 * 2^{47} + 0 * 2^{46} + 1 *
2^{45} + 0 * 2^{44} + 0 * 2^{43} + 0 * 2^{42} + 1 * 2^{41} + 1 * 2^{40} + 0 *
2^{39} + 0 * 2^{38} + 1 * 2^{37} + 0 * 2^{36} + 0 * 2^{35} + 1 * 2^{34} + 0 *
2^{33} + 0 * 2^{32} + 0 * 2^{31} + 0 * 2^{30} + 1 * 2^{29} + 0 * 2^{28} + 0 *
2^{27} + 1 * 2^{26} + 0 * 2^{25} + 1 * 2^{24} + 0 * 2^{23} + 0 * 2^{22} + 1 *
2^{21} + 0 * 2^{20} + 0 * 2^{19} + 1 * 2^{18} + 1 * 2^{17} + 0 * 2^{16} + 0 *
2^{15} + 0 * 2^{14} + 1 * 2^{13} + 0 * 2^{12} + 0 * 2^{11} + 1 * 2^{10} + 1 *
2^{9} + 1 * 2^{8} + 0 * 2^{7} + 0 * 2^{6} + 1 * 2^{5} + 0 * 2^{4} + 1 * 2^{3} +
0 * 2^{2} + 0 * 2^{1} + 0 * 2^{0}
and here's yet another:
0 * 2^{7} + 0 * 2^{32} + 1 * 2^{24} + 0 * 2^{2} + 0 * 2^{33} + 0 * 2^{6} + 0 *
2^{25} + 0 * 2^{57} + 0 * 2^{62} + 0 * 2^{22} + 1 * 2^{53} + 0 * 2^{42} + 0 *
2^{60} + 0 * 2^{47} + 0 * 2^{1} + 1 * 2^{45} + 1 * 2^{18} + 1 * 2^{26} + 0 *
2^{44} + 0 * 2^{52} + 0 * 2^{58} + 0 * 2^{4} + 0 * 2^{16} + 0 * 2^{0} + 0 *
2^{23} + 1 * 2^{49} + 1 * 2^{3} + 0 * 2^{38} + 0 * 2^{35} + 0 * 2^{11} + 0 *
2^{46} + 0 * 2^{28} + 1 * 2^{13} + 0 * 2^{19} + 1 * 2^{8} + 0 * 2^{50} + 0 *
2^{30} + 0 * 2^{51} + 0 * 2^{43} + 0 * 2^{12} + 1 * 2^{21} + 1 * 2^{17} + 1 *
2^{10} + 0 * 2^{36} + 0 * 2^{39} + 1 * 2^{61} + 0 * 2^{48} + 1 * 2^{9} + 1 *
2^{41} + 1 * 2^{56} + 0 * 2^{59} + 0 * 2^{14} + 0 * 2^{55} + 0 * 2^{27} + 1 *
2^{34} + 1 * 2^{37} + 0 * 2^{20} + 0 * 2^{63} + 0 * 2^{31} + 1 * 2^{29} + 1 *
2^{5} + 0 * 2^{54} + 0 * 2^{15} + 1 * 2^{40}
they're all equivalent, of course. note how the order of presentation of the
bits doesn't change the significance of the bits (the exponent associated with
the bit), nor the aggregate value the bits represent together.
if loading a value from memory changed the aggregate value, it would be about
as bad as if loading a vector from memory changed the order of its elements.
How am I doing so far?
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Libre-SOC-ISA
mailing list