From b081942da5c885e4a0a887fc2e2fb25ca519823e Mon Sep 17 00:00:00 2001 From: lkcl Date: Sun, 25 Sep 2022 00:46:25 +0100 Subject: [PATCH] --- openpower/sv/overview/discussion.mdwn | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/openpower/sv/overview/discussion.mdwn b/openpower/sv/overview/discussion.mdwn index fc84c0a85..51e0d8c6a 100644 --- a/openpower/sv/overview/discussion.mdwn +++ b/openpower/sv/overview/discussion.mdwn @@ -226,19 +226,32 @@ Further we may now also define half-words, words, and double-words, confirming the definition of registers (RA as the same example): H0 = B0||B1, H1 = B2||B3, H2 = B4||B5, H3 = B6||B7 + RA = H0||H1||H2||H3 W0 = H0||H1, W1 = H2||H3 D0 = W0||W1 + RA = H0||H1||H2||H3 + RA = W0||W1 RA = D0 -If we then perform the following **arithmetic** operations (assuming -starting all zeros): +If we then perform the following **arithmetic** operations: RA = 1 << 63 RB = 128 RT = 3 + 4 -The following bits are set (all others zero): +then the following bits are set (all others zero): RA.b0 = 1 RA.B0 = 0x80 RA.H0 = 0x8000 RA.W0 = 0x80000000 RB.b56 = 1 RB.B7 = 0x08 RB.H3 = 0x0008 RB.W1 = 0x00000008 RT.b61-3 = 1 RT.B7 = 0x07 RT.H3 = 0x0007 RT.W1 = 0x00000007 + +Now taking the c struct definition `elreg_t` above we may provide +a link between the two: + + elreg_t x; + x.actual_bytes[0] = RA.B7; // byte zero in LE is byte 7 in MSB0 + x.actual_bytes[1] = RA.B6; + ... + x.actual_bytes[7] = RA.B0; // byte 7 in LE is byte 0 in MSB0 + + -- 2.30.2