|
|
|
|
|
|
|
relatively straightforward to determine: |
|
|
|
 |
|
|
|
|
(Address mod 2n) mod (2k + 1). |
|
|
|
|
|
|
|
|
This allows distribution of addresses across an odd number of modules (and in the case of k = 2 and 4, a prime number, 5 and 17). |
|
|
|
|
|
|
|
|
This translation consists of initially decomposing the mod 2n address into p digits, each of k bits. Thus, |
|
|
|
 |
|
|
|
|
Xn-1 X0 mod 2n = Yp-12(p-1)k + + Y222k + Y12k + Y0, |
|
|
|
|
|
|
|
|
where each Yi is a k-bit grouping of binary bits X. |
|
|
|
|
|
|
|
|
Now observe that Y0 = Xk-1 X0, and |
|
|
|
 |
|
|
|
|
2k mod (2k + 1) = -1 mod (2k + 1) |
|
|
|
 |
|
|
|
|
22k mod (2k + 1) = +1 mos (2k + 1), |
|
|
|
|
|
|
|
|
since 22k = 2k..2k, or 22k mod (2k+1) = 2k mod (2k+1)..2k mod (2k+1) = (-1)(-1) = +1. |
|
|
|
 |
|
|
|
|
Yi2ik mod (2k = Yi(±1) (-1 if i is odd, +1 if i is zero or even). |
|
|
|
|
| | | | | |
|
|
|
|
( + Y4 - Y3 + Y2 - Y1 + Y0) mod (2k + 1). |
|
|
|
|
|
|
|
|
|
|
The pairwise differences can be computed using mod 2k arithmetic with sign extension. The results are summed mod 2k with end-around borrow, since if (Xi + Yj) < 2k + 1: |
|
|
|
 |
|
|
|
|
(Xi mod 2k + Yj mod 2k + 1) = (Xi + Yj) mod (2k + 1). |
|
|
|
|
|
|
|
|
If Xi + Yj = 2k, then Xi + Yj = -1 mod (2k + 1), since 10000 with end-around borrow is 0000 - 1 = -1. |
|
|
|
|
|
|
|
|
If Xi + Yj = 2k +1, then Xi + Yj = 0, since 10001 with end-around borrow becomes 0001 - 1 = 0. |
|
|
|
 |
|
|
|
|
k = 4, 2k + 1 = 17. |
|
|
|
|
|
|
|
|
Consider a 24-bit mod 224 address: |
|
|
|
|
|