Theory and Applications of The Double-Base Number System
Theory and Applications of The Double-Base Number System
AbstractÐIn this paper, we analyze some of the main properties of a double base number system, using bases 2 and 3; in particular,
we emphasize the sparseness of the representation. A simple geometric interpretation allows an efficient implementation of the basic
arithmetic operations and we introduce an index calculus for logarithmic-like arithmetic with considerable hardware reductions in look-
up table size. We discuss the application of this number system in the area of digital signal processing; we illustrate the discussion with
examples of finite impulse response filtering.
Index TermsÐDouble-base number system, index calculus, digital signal processing, FIR filters.
1 INTRODUCTION
TABLE 1
Column Reduction
To confirm the utility of the greedy algorithm, we Table 2 demonstrates the application of the identity,
generated NCDBNRs for 1,000 randomly chosen 215-bit 2i 3j 2i 3j1 2i2 3j , to remove consecutive active cells
lying in one row. This procedure is akin to the symbolic
integers. We predict (from Theorem 1) that the expected
substitution process used in optical computing.
number of nonzero digits is 27.75; the occurrence of the
number of 2-integers peaks at about 30, as shown in Fig. 1, 3.2 Generalized Reduction
which successfully demonstrates the efficacy of our algo- We can generalize the reduction problem using the purely
exponential Diophantine equation, (3), where l < k.
rithm. A variety of computational experiments shows that
the largest 2-integer, smaller than x, occurs in at least one of 2i1 3j1 2i2 3j2 . . . 2ik 3jk 2m1 3n1 2m2 3n2 . . . 2ml 3n1 :
the CDBNRs of x in about 80 percent of the cases. This
3
observation, along with Theorem 1, allows an estimate that The problem of solving such Diophantine equations has
the greedy algorithm returns a CDBNR with probability been a subject of investigation over the last two decades
log x
0:8log log x ; fortunately, this tends to zero very slowly. [10], although some interesting results were obtained in the
We also find that the greedy algorithm produces a 30s and 40s [11].
representation requiring on average O
logloglogx x 2-integers. We need only consider some special cases for k and l. For
This NCDBNR provides a sufficiently sparse representation example, using k 2, l 1, we can prove the following
of x to make it very useful. theorem:
Theorem 2. The Diophantine equation x y z, where
3 ARITHMETIC READY TRANSFORMATIONS GCD
x; y; z 1 and x, y, and z are 6-integers (that is x,
The mechanism of finding the NCDBNR plays a crucial role y, z have the form 2x1 3x2 5x3 7x4 11x5 13x6 , with x 0,
in performing basic arithmetic operations. Along with i 1; 2; 3; 4; 5; 6) has exactly 545 solutions.
sparseness, we also require that nonzero digits be non- Proof. See [12]. u
t
consecutive in our mapping representation; this allows
addition to be mapped to a simple boolean operation. Based In our case, x3 x4 x5 x6 0 and the only solutions
on this requirement, we provide the following definition: of x y z are
1; 2; 3,
1; 3; 4, and
1; 8; 9. Therefore,
Definition 3. A DBNR that has no consecutive nonzero digits is these represent the only three cases where we can replace
defined as an addition ready DBNR (ARDBNR). two active cells with one. For k 3, l 1, an interesting
possibility for reducing the active cells follows from the
solution of the Pillai equation [13]:
3.1 ARDBNR Reduction Rules
We can use a geometrical interpretation, with orthogonal 2a 3b 3c 3d :
4
dimensions for each of the bases, to represent numbers in
Pillai was able to solve all of the above four equations,
the DBNR. Nonzero DBNR digits are shown as black
excluding the equation 2a ÿ 2b 3c ÿ 3d on which he
squares (active cells). This interpretation allows us to
conjectured that the only solutions are
3; 1; 2; 1,
demonstrate simple identities on special combinations of
active cells that provide a transformation of a DBNR to an
5; 3; 3; 1, and
8; 4; 5; 1. The conjecture was proven by
ARDBNR. Stroeker and Tijdeman [22]. For our purposes, only (5) and
For example, Table 1 shows the representation of the (6) are relevant:
identity 2i 3j 2i1 3j 2i 3j1 to remove consecutive active
2a ÿ 2b 3c 3d
5
cells lying in one column.
Authorized licensed use limited to: the Leddy Library at the University of Windsor. Downloaded on March 22,2023 at 20:08:30 UTC from IEEE Xplore. Restrictions apply.
1100 IEEE TRANSACTIONS ON COMPUTERS, VOL. 48, NO. 10, OCTOBER 1999
Authorized licensed use limited to: the Leddy Library at the University of Windsor. Downloaded on March 22,2023 at 20:08:30 UTC from IEEE Xplore. Restrictions apply.
DIMITROV ET AL.: THEORY AND APPLICATIONS OF THE DOUBLE-BASE NUMBER SYSTEM 1101
TABLE 3
The Solutions of the Equation x y z t in 2-Integers
operations is considerably reduced based on the sparseness Iz
i; j 3 Iz
i 1; j AND Iz
i; j 2 AND Iz
i 4; j
Rule
8
of the representation.
Let us consider the multiplication of the numbers 79 and
The representation of the multiplication result is shown
107, represented via their DBNS maps as shown in Table 6. at the left side of Table 7 and the ARDBNR reduction, using
The final reduced forms of the product can be found by Rule (7) and Rule (8), at the right side of Table 7.
Efficient implementation of the NCDBNR (or ARDBNR)
using two specific solutions of the Pillai equation (4). reduction procedure is an ongoing project within our
Iz
i; j 4 Iz
i; j AND Iz
i 4; j AND Iz
i 6; j group. An interesting implementation using analog Cellular
Neural Networks has recently been presented [15] using
Rule
7
only the column and row reduction rules of Table 1 and
Table 2 to obtain ARDBNR forms.
TABLE 4
Example of the DBNS Addition Process 5 DBNS INDEX CALCULUS
The n-tuple, f2iz 3jz 2ix iy 3jx jy g, introduced in the pre-
vious section, immediately leads to an implementation of
multiplication using index addition, where the index
mapping of x, for example, is simply the n-tuple fix ; jx g.
For cases where we are approximating the reals by fixed
point numbers, it is possible to find a single index CDBNR
for any real number with arbitrary precision by using
diophantine approximation algorithms [12], [19]. This leads
us to a multiplication technique only involving a single 2D
shift, which corresponds to a pair of index additions. If only
one of the numbers to be multiplied is in the single index
form, multiplication will only require O
logloglogx x addition
pairs. The following theorem proves the single index
mapping property.
Theorem 3. Let n and m be integers. The set An;m f2n 3m g is
dense over the nonnegative reals; that is, in every interval
1 ; 2
1 0; 2 > 1 at least one number of the form 2n 3m
appears.
Proof. The proof follows from the well-known fact that the
set of numbers: fn m !g, n; m 2 Z, !-irrational is
dense over the reals. In our case, we have ! log2 3. t
u
Authorized licensed use limited to: the Leddy Library at the University of Windsor. Downloaded on March 22,2023 at 20:08:30 UTC from IEEE Xplore. Restrictions apply.
1102 IEEE TRANSACTIONS ON COMPUTERS, VOL. 48, NO. 10, OCTOBER 1999
TABLE 5 TABLE 7
Pillai Solution Final Map The Reduction Rules Applied Here Are Rule (7) and Rule (8)
2a 3b ÿ 2c 3d 2a 3b
1 ÿ 2cÿa 3dÿb
course, is the ability to use index calculus on the
10
2a 3b
c ÿ a; d ÿ b:
representation.
We will, of course, precompute and store the functions
5.1 Implementing the Index Calculus containing the approximation of:
We represent a number, x, as a triple
sx ; bx ; tx , where sx is
x; y 1 2x 3y 2 3
11
the sign bit, and bx and tx are integers such that sx 2bx 2tx is an
acceptable approximation to x. More precisely, if " is the
x; y 1 ÿ 2x 3y 2
3 :
12
error allowed, then jx ÿ sx 2bx 3tx j < ".
We have a low complexity implementation of multi- Addition (subtraction) of two numbers is now mapped
plication and division, namely, if: x
sx ; bx ; tx and into the following two steps:
y
sy ; by ; ty , then: 1. Find the corresponding element
; in the table;
2. Add (subtract)
a; b with
; .
x y
sx sy mod 2; bx by ; tx ty
7
5.2 Comparison with the Log Number System
x=y
sx sy mod 2; bx ÿ by ; tx ÿ ty :
8 It is clear that this index calculus shares some similarities
with the Logarithmic Number System (LNS) [16]. Both
The implementation of addition and subtraction within
allow the mapping of multiplication and division to
this index calculus can be performed using the identities: addition and subtraction, uses an identity requiring the
2a 3b 2c 3d 2a 3b
1 2cÿa 3dÿb look-up of a unary function (e.g., (11) is similar to the LNS
9 unary function log2
1 2
ÿ where the input to the table
2a 3b
c ÿ a; d ÿ b
is
ÿ , the logarithms of the numbers being added).
There is a fundamental difference in the mapping,
however, since the DBNS involves indices over two
TABLE 6 orthogonal dimensions, where the logarithmic number
Example of the DBNS Multiplication Process
system involves only one ªindex.º In the DBNS, if the error
of the computations is fixed to be ", then, in approximating
some real number, x, we can expect the size of the integers
used to be smaller than the corresponding fixed-point
number in the LNS [17]. Therefore, the multiplications
(divisions) can be performed by two parallel additions
(subtractions) of two small numbers.
A disadvantage of the DBNS is that there is no direct
way to quickly compare two numbers of the form 2a 3b and
2c 3d . The simplest way seems to be to compare the numbers
a b log2 3 and c d log2 3, which requires one fixed-
number multiplication, one addition, and one final subtrac-
tion to obtain the result.
To make a fair comparison between both number
systems, we have to evaluate the size of the integers used
Authorized licensed use limited to: the Leddy Library at the University of Windsor. Downloaded on March 22,2023 at 20:08:30 UTC from IEEE Xplore. Restrictions apply.
DIMITROV ET AL.: THEORY AND APPLICATIONS OF THE DOUBLE-BASE NUMBER SYSTEM 1103
TABLE 9
DBNS10-Bit Pairs for Filter Example
Authorized licensed use limited to: the Leddy Library at the University of Windsor. Downloaded on March 22,2023 at 20:08:30 UTC from IEEE Xplore. Restrictions apply.
1104 IEEE TRANSACTIONS ON COMPUTERS, VOL. 48, NO. 10, OCTOBER 1999
Authorized licensed use limited to: the Leddy Library at the University of Windsor. Downloaded on March 22,2023 at 20:08:30 UTC from IEEE Xplore. Restrictions apply.
DIMITROV ET AL.: THEORY AND APPLICATIONS OF THE DOUBLE-BASE NUMBER SYSTEM 1105
264
mod 32 8:
The shift input to the barrel shifter is ÿ4 and this value is
correctly obtained provided that it is contained within the
number of bits of the reduced binary adders.
7 CONCLUSIONS
In this paper, we have presented the theory of a double-
base number system as a technique for representing
numbers that allows potentially low complexity arithmetic
operations using a variety of implementation media.
We have explored an implementation procedure for
arithmetic operations using symbolic substitution. For
addition in the DBNS, we simply have to ensure that there
no consecutive active cells lying in any column on the
DBNS-map. For multiplication, using 2D shifts and addi-
tions, however, we seek representations with minimal
active cells located large 2D Hamming distances from each
other. Symbolic substitution provides the ability to seek
such representation, and our approach (presented as a set of
rules for the substitutions) produces near canonic forms for
Fig. 4. Screen dump of the IPSP simulator. the output representation.
An index calculus, which provides the same structure as
configuration. A screen dump of the essential elements of the Logarithmic Number System (LNS), is shown to
the simulator for a 5-tap filter test is shown in Fig. 3. considerably reduce the hardware required. An implemen-
The Data Conversion ROM tables were generated from a tation advantage over the LNS is that the index additions
custom integer programming package that selects binary and subtractions are reduced in complexity because the
and ternary exponents, a and b, based on minimizing the binary and ternary operations are completely independent.
error " jx ÿ 2a 3b j. The first 10 entries of this table for The use of this index calculus has been demonstrated using
an example of systolic FIR filtering.
integer values of x, with 10-bits of precision, is shown in
Table 10. These are the full values, not the modulo reduced
values. Note that only one data conversion ROM is required
for the entire IPSP filter chain. The top input to each IPSP is
Authorized licensed use limited to: the Leddy Library at the University of Windsor. Downloaded on March 22,2023 at 20:08:30 UTC from IEEE Xplore. Restrictions apply.
1106 IEEE TRANSACTIONS ON COMPUTERS, VOL. 48, NO. 10, OCTOBER 1999
Authorized licensed use limited to: the Leddy Library at the University of Windsor. Downloaded on March 22,2023 at 20:08:30 UTC from IEEE Xplore. Restrictions apply.