The Letter treats the case of converting a binary value, rep- resented in the form of n bytes, into a decimal value, rep- resented in the form of m BCD characters.
BINARY-TO-DECIMAL CONVERSION BASED O N THE DIVISIBILITY OF 2'- 1 BY 5
B. Arazi and D.
Naccache
S(i),, i = 0, 1, . . . , k - 1 is the ith character in the representation of N,,/(2' - 1). The proof of the validity of process2 succeeds the following two clarifying examples.
(3) Example: Note that all the capital letters between A and F Indexing term: Binary arithmetic
The Letter treats the case of converting a binary value, represented in the form of n bytes, into a decimal value, represented in the form of m BCD characters. The conversion, which is suitable for one-byte and two-byte processors, is based on the following observations: (a) 5 is a divisor of 2' - 1 and 216 - 1. (b) Modular binary arithmetic over 2' - 1 is easily performed. (c) Binary division by 2' - I , in the case where the remainder is known to be zero, is easily performed. (d) All the prime factors of 2' - 1 and 216 - I are of the form 2' + 1.
used in this and other examples refer to hexadecimal representation, whereas other letters refer to values which are explicitly defined in the text. For r = 4 and k = 6, let N,, = 7EDC4A. (F is a divisor of N,,)
S(0) = 1OOOOOO - 7EDC4A = 812386
+ S(0) div 2" + 812386 div 10 = 6 + 81238 = 81241 t = 2 : S(2) = S(1), + S(1) div 2" t = I: S(1) = S(O), =
6
=
1 + 81241 div 10 = 1
t = 3: S(3) = S(2),
Introduction :
=
Notation: N , denotes the radix-l representation of a positive integer N . (In particular, N,, denotes the radix-2' representation of N . ) N Z 8 consists of n bytes. NI, consists of m BCD characters. (A good estimate for m is 8n . log,, 2)
Treating the case of converting N Z e into NI,, for any n, consider the following standard radix-conversion procedure: for i t 0 t o m - 1
t
= 4:
t
=
S(4) = S(3),
5: S(5) = S(4),
+ 8124 = 8125
+ S(2) div 2" 5 + 8125 div 10 = 5
+ 812 = 817
+ S(3) div 2" = 7 + 817 div 10 = 7 + 81 = 88 + S(4) div 2" = 8 + 88 div 10 = 8 + 8 = 10
The values of S(i),,i = 0, 1, . .., k - 1, are 6, 1, 5, 7, 8, 0. These form the characters of 7EDC4AIF. (Check: 7EDC4A/ F = 087516.) In the following example the (k - 1)th character of N2,/ (2' - 1) is nonzero.
d(i) = NZamod 1010,
N l e = N Z s- d(i) N 2 * = N,./1010,
d(i), i = 0, 1, . .. , m - 1 form the coefficients of Nlo. The purpose of this Letter is to present methods for calculating N z s mod 1010, and N,,/1010, (where, in the latter operation, it is known in advance that 1010, divides N Z s with a zero remainder). The methods presented are suitable for execution by one-byte and two-byte processors. The methods are based on the following fundamental observations: (a) 5 is
a divisor of 2'
-
(4) ,Example: For r = 4 and k divisor of N,,) S(0) = 1OOOOOO - F6DC4A t
=
I : S(1) = S(O), =6
-
1 is easily performed.
-I:
( 1 ) Processl: Calculating N , . mod (2' - I ) : The operation N,. mod (2' - 1) is trivially performed by summing the (r-hit) characters which constitute N,,. The characters of the result are again summed, and so on, until a single r-bit character V is obtained. We then have: V = N,. mod (2' - I). The calculation of N2,/(2' - 1). for the case where it is known that 2' - 1 is a divisor of N,,, is considered next. Let k denote the number of (r-bit) characters in N,,. Note that the number of characters which constitute N,,/(2' - 1) can reach k (in which case the most significant character is 1). In the following process S(i - I), is the least significant (rbit) character of S(i - 1). and S(i - 1 ) div 2' is obtained by dropping S(i - I), from S(i - 1).
foritltok-1 S(i) = S(i - l),
+ S(i
~
1) div 2'
t = 4 : S(4) = S(3),
t = 5:
S(5) = S(4),
5
+ 925 div 10 = 5 + 92 = 97
+ S(3) div 2" = 7 + 97 div 10 = 7 + 9 = 10
+ S(4) div 2" =
0 + 10 div 10 = 0 + 1 = 1
F6DC4AIF = 107516. ( 5 ) Proving the validity ofprocess2: The proof relates to any radix p . Let 1) = ( a k - , P - l + a k - 2 b k - 2 + a k - a f - 3 + ... + alp + a,) N , = (B - 1 ) . ( a , - , f - ' + a,-,p"-' + ak-3pk--3 + . .. . + a l p + a,) = a , - , p k + ak-,bk-l + a k - 3 p k - 2+ _ _+ . alpZ
Z
= Ns/(p -
+ a 0 p - a*-,/?-'
- a,-,f-'
- ak-3bk-3
. .. - alp - a.
+ ( a k - *- ak-,)B*-' + + .. . + (a, - a,)B - a,. Expressing the coefficients a,_ ,,a,-,, a,_ =a,-$
-ak-,)~k-2
.. .,a,, a, of Z in terms of the coefficients of /Ik - N , completes the proof.
ELECTRONICS LETTERS 5th November 1992 Vol 28 No 23 -
+ 92386 div 10 = 6 + 9238 = 9241 = 1 + 9241 div 10 = 1 + 924 = 925 + S(2) div 2"
-
(2) Process2: Calculating N2,/(2' - I ) , f o r the case where it is known that 2' - I is a diuisor ofN,,: S(0)= - N , , . (That is, S(0) is the 2'-complement of N,,)
= 92386.
t = 3 : S(3) = S(2),
2'+ 1.
Modular arithmetic and zero-remainder division over 2'
F6DC4A. (F is a
+ S(0) div 2"
=
It appears that these observations are not used in conventional binary-to-decimal conversion methods [l, 21.
=
+ S(l) div 2"
(c) Binary division by 2' - 1, in the case where the remainder is known to be zero, is easily performed.
(d)All the prime factors of 2' - 1 and 216 - 1 are of the form
let N,,
t = 2 : S(2) = S(1),
1 and 216 - 1
(b) Modular binary arithmetic over 2'
= 6,
2151
Calculating Nzs mod 1010,: We consider the case where the binary-to-decimal conversion is to be performed by an available one-byte processor. Extensions to the two-byte case, which are rather obvious, will also be discussed. The calculation of d(i) = N2s mod 1010,, performed in the binary-to-decimal conversion process described in the introduction, is based next on calculating d’(i) = NZemod 101,. Converting this result to N2e mod 1010, is then based on direct parity considerations, where 101, is added to d’(i), yielding d(i), iff the parity of d’(i) contradicts that of N,.. (This consideration is actually an interpretation of the Chinese remainder theorem, solving the congruences x mod 5 and x mod 2.)
Divide the preceding result by 1 1 1 1 1 1 1 1 ,, using Process2. (This requires about n one-byte additions.)
(1) Process3: Calculating NZsmod 101,: V = NZ8mod (28 - 1); this operation is executed by processl. W = V mod 101,; this operation is executed by either executing a one-byte ‘mod’ instruction, or executing process4, described below. W is the final result. T o understand why W = N28mod 101, observe that if p is a divisor of q then
( 3 ) Two-byte representation: Observe (101,). ( 1 1 , ) . (1O001,) . (100000001,).
x mod p = (x mod q ) mod p
In our case 101, is a divisor of 2* - 1 and N,, mod 101, is calculated by first recovering N,, mod (28 - 1 ) and then reducing the result modulo 101,. Using the notation introduced previously, N,. consists of n bytes. The execution of the first step of process3 involves approximately n one-byte additions. The second step requires at most a single one-byte division operation. (2) Processl: Calculating V mod 101, for a one-byte V: Step 1 : Add the lower and upper halves of V and repeat the process until a 4-bit value W is obtained. Step 2: For a,, a , being the radix-4 coeflicients of W , calculate (ao - ai),. If the result is negative, add 11,. The final result is the desired V mod 11, ( = V mod 101,).
( 3 ) Proving the ualidity ofthe process: Since 101, is a divisor of I l l l , , step 1 first reduces the byte V modulo 1 1 1 1 , . Step 2 further reduces the result modulo lOl,, using radix-4
(2) Proving the validity of the process: Observe that 1 1 1 1 1 1 1 I , = (101,) . (11,) . (lO001,). That is N2,/1010, = [(II,). (1O001,). (N,,/2)]/(11111111,) After generating N,./2 at the first step of the process, this value is multiplied by (11,) . (1O001,) at the second step. Because 1010, is guaranteed to be a divisor of NZ8,11 11 1 1 1 1 is, a divisor of (11,) . (1O001,) . (N28/2).This division takes place at the third step.
,
that
2’‘‘
-
1
=
Process3 therefore applies also to the calculation of N,,,/1010,, with the following modifications: Further multiplication by (100000001,), executed by eight shifts and one addition, is performed at the second step. A division by 216 - 1 is performed at the third step, using process2. (4) Multiplying by (ll,), (10001,) and (100000001,): The second step in process5 requires multiplications by (1 1,) and (1O001,). Two-byte operations will also require a multiplication by (100000001,).Note that the multiplication by each of these values involves some shifts and a single addition. That is, the fact that all the prime factors of 28 - 1 and 216 - 1 are of the form 2’ 1, which has not been used until now, strongly acts in our favour.
+
2lst September 1992
B. Arazi (Department
of Electrical & Computer Engineering, Ben
Gurion University, Beer Sheva, Israel) D. Naccache (Philips T R T , Smart-Cards & Systems, 5 Avenue Reaumur, ZIPEC. Le Plessis Robinson Cedex, France)
References 1 BOYCE, P. H.: ‘Hexadecimal 10 BCD converter in two packages’, Electron. Eng., December 1977, p. 23
2
KNUTH, 0.:‘The
art of computer programming. Vol. 2: xminumerical algorithms’ (Addison-Wesley, Reading, Mass., 1981)
arithmetic. (4) Example:
v = 10011101,
BIT RATE PERFORMANCE OF MILLIMETRE-WAVE INDOOR RADIO SYSTEMS
1001+1101=10110.ooo1+0110=0111=W. (a, - a,),
=
V mod 11,
3,
=
-
1,
=
11,
=
2,
2,
P. F. M. Smulders and H. T. Muskens
This concludes the description of processes for calculating d ( i ) = NZsmod 101,. As was indicated before, the value of d(i) = NZsmod 1010, (needed in the binary-to-decimal conversion process described in the introduction) is trivially recovered from d’(i) using parity considerations. (5) Two-byte representation: Since 101, is also a divisor of 216 - 1, process3 and consequently process4, which referred to the operation NZsmod lOl,, are also valid when performing N,,, mod 101,. The same holds for the rest of the processes, yielding the final value N Z l emod 1010,. Since 101, is also a divisor of 2, - 1, the methods presented are suitable for hexadecimal operations as well, in the case where such an option could have a practical meaning. Calculating N,.~lOlO, for the case where 1010, is a divisor OJ NZe:The binary-to-decimal conversion process described in the introduction requires the calculation of N2,/1010,, where the steps that preceded this operation guarantee that 1010, is a divisor of N2*.
(1) ProcessS: Calculating N,./lOlO,, for the case where it ia known that 1010, is a divisor of NZ8: Shift NZaonce to the right. Multiply the preceding result by ( 1 1 , ) . (lO001,).
21 52
Indexing terms: Radiocommunication,Indoor radio systems
The performance of an ideal quaternary PSK (QPSK) modem operating on a 58GHz indoor radio channel is evaluated. In addition, the performance improvement achievable with antenna diversity is indicated. These evaluations are based on measured multipath profiles obtained in eight indoor environments. The results are presented in terms of maximum achievable bit rate for a specified bit error rate requirement. Introduction: Future developments of millimetre-wave indoor radio systems are expected to use the vast information transport capacity offered by the millimetre-wave frequency bands. Another key attraction for indoor radio applications is the promise of short frequency reuse distances due to the fact that millimetre waves are severely attenuated by most inner walls. T o examine the propagation characteristics of millimetrewave indoor radio channels, wideband measurements were carried out in eight indoor areas at the Eindhoven University of Technology [l-41. In this Letter we denote these areas A to H in compliance with previous publications. A detailed description of the areas is given in Reference 2. In each area the measurements were performed at about 20 randomly chosen positions of the remote. In the basic measurement
ELECTRONICS LETTERS
5rh November 1992
Vol. 28
N o . 23