split R = R7 R6 R5 R4 R3 R2 R1 R0 to produce W = W7 W6 W5 W4 W3 W2 W1 W0 0 0 0 0 0 R7 R6 R5 X = X7 X6 X5 X4 X3 X2 X1 X0 0 0 0 0 0 0 R4 R3 Y = Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 0 0 0 0 0 R2 R1 R0 In XCSB this would be written as:
e.g. R = 0xB6 W = (R >> 5) & (0xff >> 5) X = (R >> 3) & (0xff >> 6) Y = (R >> 0) & (0xff >> 5)Looking step by step at the computation we seeNOTE: some of the steps shown here are combined by the XCSB compiler into single step. The real code generated by the compiler is shorter than shown, the full sequence is shown here for completeness
W7 W6 W5 W4 W3 W2 W1 W0 X7 X6 X5 X4 X3 X2 X1 X0 Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 R7 R6 R5 R4 R3 R2 R1 R0 E7 E6 E5 E4 E3 E2 E1 E0 R = 0xB6 1 0 1 1 0 1 1 0 W = R >> 5 0 0 0 0 0 1 0 1 x x x E = 0xff 1 1 1 1 1 1 1 1 E = (E >> 5) 0 0 0 0 0 1 1 1 W = W & E 0 0 0 0 0 1 0 1 x x x X = R >> 3 0 0 0 1 0 1 1 0 x x x x x E = 0xff 1 1 1 1 1 1 1 1 E = (E >> 6) 0 0 0 0 0 0 1 1 X = X & E 0 0 0 0 0 0 1 0 x x Y = R >> 0 1 0 1 1 0 1 1 0 x x x x x x x x E = 0xff 1 1 1 1 1 1 1 1 E = (E >> 5) 0 0 0 0 0 1 1 1 Y = Y & E 0 0 0 0 0 1 1 0 x x x