Comparator
Comparator
Comparator
org
Published in IET Computers & Digital Techniques
Received on 6th April 2013
Revised on 2nd October 2013
Accepted on 28th October 2013
doi: 10.1049/iet-cdt.2013.0066
ISSN 1751-8601
Abstract: Reversible logic has captured signicant attention in recent time as reducing power consumption is the main concern of
digital logic design. It consumes less power by recovering bit loss from its unique inputoutput mapping. In this study, the authors
propose a reversible low power n-bit binary comparator. An algorithm is presented for constructing a compact reversible n-bit
binary comparator circuit. The authors also propose two new reversible gates, namely, Babu-Jamal-Saleheen (BJS) and
Hasan-Lafa-Nazir (HLN) gates, to optimise the comparator. In addition, several theorems on the numbers of gates, garbage
outputs, quantum cost, ancilla input, power, delay and area of the reversible n-bit comparator have been presented. The
simulation results of the proposed comparator show that the circuit works correctly and gives signicantly better performance
than the existing ones. The comparative study shows that, as an example, for a 64-bit comparator, the proposed design
achieves the improvement of 24.4% in terms of number of gates, 19.9% in terms of garbage outputs, 7.7% in terms of
quantum cost, 25.77% in terms of area and 3.43% in terms of power over the existing best one. Area and power analysis also
show that the proposed design is the most compact as well as a low power circuit.
IET Comput. Digit. Tech., 2014, Vol. 8, Iss. 3, pp. 129139 129
doi: 10.1049/iet-cdt.2013.0066 & The Institution of Engineering and Technology 2014
www.ietdl.org
The simple reversible gate is a NOT gate and it is a 1 1 Here, K is the dielectric constant of metal, L is the maximum
gate. Controlled NOT (CNOT) is a 2 2 reversible gate. interconnect wire length, is the wire resistivity, is the
There are many 3 3 reversible gates such as Toffoli (TG), permitivity, is the least thickness value and n is the no. of
Peres (PG) and Fredkin gate. lines broke for calculation for long lines.
Unwanted or unused output of a reversible gate (or circuit) is The area of a logic circuit is the summation of individual area
known as garbage output, that is, the output(s) which is (are) of each gate of the circuit. Suppose, a reversible circuit
needed only to maintain the reversibility is (are) known as consists of n reversible gates and area of those n gates are
garbage output(s). Heavy price is paid off for each garbage a1, a2, , an. Then by using above denition, area (A) of
output [8]. that circuit is
n
2.3 Quantum cost A= ai
i=1
The quantum cost can be derived by substituting the
reversible gates of a circuit by a cascade of elementary Given the above denition the area of a circuit can be
quantum gates [9]. Elementary quantum gates realise calculated easily by obtaining area of each individual gate
quantum circuits that are inherently reversible and using CMOS 45 nm Open Cell Library [12] and Synopsis
manipulate qubits rather than pure logic values. The state of Design Compiler [16].
a qubit for two pure logic states can be expressed as |c =
|0 + |1, where |0 and |1 denote 0 and 1, respectively,
2.7 Power
and and are the complex numbers such that ||2 + ||2 =
1. The most used elementary quantum gates are the NOT The power of a logic circuit is the summation of individual
gate (a single qubit is inverted), the CNOT gate (the target power of each gate of the circuit. Suppose, a reversible
qubit is inverted if the single control qubit is 1), the circuit consists of n reversible gates and individual power of
controlled-V gate (also known as a square root of NOT, those gates are p1, p2, , pn, respectively. Then, the power
since two consecutive V operations are equivalent to an (P) of the circuit is
inversion), and the controlled-V + gate (which performs the
inverse operation of the V gate and thus is also a square
n
root of NOT) [9]. P= pi
i=1
130 IET Comput. Digit. Tech., 2014, Vol. 8, Iss. 3, pp. 129139
& The Institution of Engineering and Technology 2014 doi: 10.1049/iet-cdt.2013.0066
www.ietdl.org
been further illustrated with the design of 8-bit and 64-bit Table 1 Reversibility of the proposed BJS gate
reversible comparators. This work has not been generalised
A B C D P Q R S
for n-bit. Moreover, to improve the design of [20], another
improved prex grouping-based reversible binary 0 0 0 0 0 0 0 1
comparator is proposed in [21]. 0 0 0 1 0 0 0 0
Another existing approach [22] showed the reversible 0 0 1 0 0 0 1 0
design of 1-bit binary comparator. In this design, 1-bit 0 0 1 1 0 0 1 1
comparator has been designed with many popular reversible 0 1 0 0 0 1 0 0
0 1 0 1 0 1 0 1
gates, but here also, the design has not been generalised for 0 1 1 0 0 1 1 1
n-bit. A sequential and a tree-based comparator have been 0 1 1 1 0 1 1 0
shown in [23]. In this design, several new gates have been 1 0 0 0 1 1 0 0
proposed to design the comparator. However, the design 1 0 0 1 1 1 0 1
1 0 1 0 1 0 0 1
has not been generalised for n-bit. Moreover, the quantum 1 0 1 1 1 0 0 0
cost, delay and number of garbage outputs of this design 1 1 0 0 1 1 1 1
are not compact. Finally, different design paradigms have 1 1 0 1 1 1 1 0
different types of advantages and pitfalls. However, most of 1 1 1 0 1 0 1 0
them are not compact in terms of number of gates, garbage 1 1 1 1 1 0 1 1
outputs, quantum cost, delay, power and area. Some of
them are generalised while others are not.
In this paper, BJS gate is used to design the 1-bit
4 Proposed design of reversible n-bit comparator (shown in Section 4.3) and the MSB
comparator comparator (shown in Section 4.4). Fig. 1b shows the
equivalent quantum realisation of the BJS gate. Here, each
In this section, we propose a compact and improved version of dotted rectangle is equivalent to a 2 2 CNOT gate. Hence,
reversible n-bit comparator. A binary comparator compares the the quantum cost of the BJS gate is six.
magnitude of two binary numbers to determine whether they
are equal or one is greater/less than the other. To construct
4.2 Proposed HLN gate
the optimised n-bit comparator, we propose two new
reversible gates, namely BJS and HLN gate in Sections 4.1 A 3 3 reversible gate is proposed in this subsection which is
and 4.2, respectively. Section 4.3 shows the design of 1-bit named as HLN gate (shown in Fig. 2a). The corresponding
comparator circuit. In order to improve the design, we truth table of the gate is shown in Table 2. The truth table
propose an MSB comparator circuit for comparing the nth bit shows that the inputoutput combinations preserve the
(MSB) of two n-bit numbers described in Section 4.4. Then, one-to-one mapping between them.
a single-bit GE (greater or equal) comparator cell has been The HLN gate can implement all Boolean functions. When
designed to generate greater and equal signal for the C = 1 and C = 0, it implements EX-OR (Q = A B) and
remaining (n 1) bits of two numbers with the previous AND (Q = AB) functions, respectively. When B = 1, it
comparison result of MSB which is described in Section 4.5. implements OR function (R = A + B). When B = 0 and
Moreover, a single-bit LT (less than) comparator cell is C = 0, it depicts NOT function (Q = A). In this paper,
designed to determine the less than signal, which is HLN gate is used to design the single-bit greater or equal
described in Section 4.6. These three circuits are then comparator cell (shown in Section 4.5). Fig. 2b shows the
extensively used to design 2-bit and n-bit reversible binary equivalent quantum realisation of HLN gate. The quantum
comparators which are described in Sections 4.7 and 4.8, cost of the HLN gate is ve.
respectively.
0 0 0 0 1 0
0 0 1 0 0 1
0 1 0 0 0 0
0 1 1 0 1 1
1 0 0 1 0 0
Fig. 1 BJS gate 1 0 1 1 1 0
1 1 0 1 1 1
a Block diagram 1 1 1 1 0 1
b Quantum realisation of proposed BJS gate
IET Comput. Digit. Tech., 2014, Vol. 8, Iss. 3, pp. 129139 131
doi: 10.1049/iet-cdt.2013.0066 & The Institution of Engineering and Technology 2014
www.ietdl.org
Table 3 Truth table for 1-bit binary comparator
Inputs Outputs
0 0 0 1 0
0 1 1 0 0
1 0 0 0 1
1 1 0 1 0
132 IET Comput. Digit. Tech., 2014, Vol. 8, Iss. 3, pp. 129139
& The Institution of Engineering and Technology 2014 doi: 10.1049/iet-cdt.2013.0066
www.ietdl.org
IET Comput. Digit. Tech., 2014, Vol. 8, Iss. 3, pp. 129139 133
doi: 10.1049/iet-cdt.2013.0066 & The Institution of Engineering and Technology 2014
www.ietdl.org
An MSB comparator circuit requires one BJS gate. A Lemma 2: A reversible n-bit comparator requires (42.5n
single-bit GE comparator cell is constructed with one HLN 14.5) m2 area, where n is the number of data bits.
gate and two PGs. A single-bit LT comparator cell requires
two FGs. A 2-bit comparator circuit is constructed with one Proof: An n-bit comparator is constructed with one MSB
MSB comparator circuit, one single-bit GE comparator cell comparator circuit, (n 1) single bit GE comparator cells
and one single-bit LT comparator cell (shown in Fig. 6a). and one single bit LT comparator cell. An MSB comparator
Hence, the total number of gates required to construct 2-bit circuit requires one BJS gate. A single-bit GE comparator
binary comparator (NOG2-bit) is cell is constructed with one HLN gate and two PGs. A
single-bit LT comparator cell requires two FGs. Hence, the
NOG2-bit = NOGMSB + NOGSBGE + NOGSB-LT total number of gates is
= 1 + (1 + 2) + 2
NOG = NOGMSB + (n 1) NOGSB-GE + NOGSB-LT . . .
=6
= 1 BJS + (n 1)(HLN + 2 PG) + 2 FG
=32
(2)
Hence, the statement holds for the base case n = 2.
The areas of BJS gate, HLN gate, PG and FG are 20, 17.5,
Assume that, the statement holds for n = k. Hence, a
12.5 and 7 m2, respectively, (obtained using CMOS 45 nm
reversible k-bit binary comparator can be realised with 3k
Open Cell Library [12] and Algorithm 2 (see Fig. 8).
reversible gates.
Hence, the total area of an n-bit comparator can be
A (k + 1)-bit binary comparator requires one MSB
modelled as follows
comparator circuit, k single-bit GE comparator cell and one
single-bit LT comparator cell. Hence, the total number of
gates required to construct (k + 1)-bit binary comparator A = AMSB + (n 1) ASB-GE + ASB-LT
(NOG(k + 1)-bit) is = {20 + (n 1)(17.5 + 2 12.5) + 7} mm2
NOG(k+1)-bit = NOGMSB + k NOGSB-GE + NOGSB-LT = (42.5n 42.5 + 27) mm2
= 1 + k(1 + 2) + 2 = (42.5n 14.5) mm2
= 3k + 3
= 3(k + 1)
Lemma 3: A reversible n-bit comparator requires (117.76n
32.94) W power, where n is the number of data bits.
Thus, the statement holds for n = k + 1.
Therefore a reversible n-bit binary comparator can be Proof: One MSB comparator circuit, (n 1) single bit GE
realised with 3n reversible gates. comparator cells and one single bit LT comparator cell
are required to realise an n-bit comparator. Hence, the
Lemma 1: A reversible n-bit comparator requires (0.15n total required power can be measured by using following
0.03) ns timing delay, where n is the number of data bits. equation
Proof: The proposed n-bit comparator design has a serial Total power(P) = PMSB + (n 1) PSB-GE
architecture that has latency of O(n). An n-bit comparator
requires one MSB comparator circuit, (n 1) GE + PSB-LT . . . (3)
comparator cells and one single bit LT comparator cell.
Hence, the delay of the comparator circuit is
134 IET Comput. Digit. Tech., 2014, Vol. 8, Iss. 3, pp. 129139
& The Institution of Engineering and Technology 2014 doi: 10.1049/iet-cdt.2013.0066
www.ietdl.org
The single-bit GE comparator cell contains one HLN gate and Proof: A 2-bit comparator circuit consists of one MSB
two PGs. The power requirement of HLN gate and PG are comparator, one single-bit GE comparator cell and one
58.88 and 29.44 W, respectively, (obtained by DSCH 3.5 single-bit LT comparator cell. The MSB comparator circuit
[13] and CMOS 45 nm Open Cell Library [12]). Hence, the produces one garbage output and the single-bit GE
power requirement of a single-bit GE comparator cell, comparator cell produces four garbage outputs. The
PSB-GE, can be calculated as follows single-bit LT comparator cell does not produce any garbage
output. Hence, the total number of garbage outputs
PSB-GE = (58.88 + 2 29.44)mW = 117.76 mW produced by a 2-bit comparator is at least
Using DSCH 3.5 [13] and CMOS 45 nm Open Cell Library G2-bit = GMSB + GSB-GE + GSB-LT
[12], we have obtained the power requirement of MSB and
LT modules that are 37.72 and 47.1 W, respectively. =1+4+0
Hence, the total power of an n-bit comparator can be =5
modelled as below according to (3) =423
P = {37.72 + (n 1) 117.76 + 47.1} mW Hence, the statement holds for the base case n = 2.
= (117.76n 117.76 + 84.82) mW
Assume that, the statement holds for n = k. Hence, a
= (117.76n 32.94) mW reversible k-bit binary comparator produces at least 4k 3
garbage outputs.
A (k + 1)-bit binary comparator requires one MSB
Theorem 2: A reversible n-bit binary comparator (n 2) comparator circuit, k single-bit GE comparator cell and one
produces at least 4n 3 garbage outputs, where n is the single-bit LT comparator cell. So, the total number of
number of data bits. garbage outputs produced by the (k + 1)-bit binary
IET Comput. Digit. Tech., 2014, Vol. 8, Iss. 3, pp. 129139 135
doi: 10.1049/iet-cdt.2013.0066 & The Institution of Engineering and Technology 2014
www.ietdl.org
Table 4 Comparative results of the complexities of different Therefore a reversible n-bit binary comparator produces at
reversible n-bit comparators least 4n 3 garbage outputs.
Methods NOG GO QC
NOG, no. of gates; GO, garbage output; QC, quantum cost; , Proof: An MSB comparator circuit requires one BJS gate. A
not mentioned single-bit GE comparator cell is constructed with one HLN
gate and two PGs. A single-bit LT comparator cell requires
two FGs. A 2-bit comparator circuit is constructed with one
Table 5 Comparative results of the complexities of different MSB comparator circuit, one single-bit GE comparator cell
reversible n-bit comparators and one single-bit LT comparator cell. The quantum cost of
BJS gate, HLN gate, PG and FG are six, ve, four and one,
Methods Area, m2 Power, W Delay, ns respectively. Hence, the total quantum cost of the 2-bit
comparator circuit is
proposed circuit 42.5n 12.5 117.76n 0.15n 0.03
32.94
Rangaraju et al. 57.5n 35 182.53n + 0.2n 0.16
[18, 19] 76.55 QC2-bit = QCMSB + QCSB-GE + QCSB-LT
Thaplial et al. [20] 90n 77.5 268.23n 0.23*log2(n) + 0.1
239.2 = 6 + (5 + 4 2) + 2
Vudadha et al. [21] 57.5n 35 122.36n 0.09*log2(n) + 0.2
60.36 = 21
= 13 2 5
NI, no improvement; NOG, no. of gates; GO, garbage output; QC, quantum cost
NI, no improvement; NOG, no. of gates; GO, garbage output; QC, quantum cost
136 IET Comput. Digit. Tech., 2014, Vol. 8, Iss. 3, pp. 129139
& The Institution of Engineering and Technology 2014 doi: 10.1049/iet-cdt.2013.0066
www.ietdl.org
the (k + 1)-bit binary comparator is (QC(k + 1)-bit) is
Proposed
1659
3323
6651
203
411
827
21
47
99
QC(k+1)-bit = QCMSB + k QCSB-GE + QCSB-LT
= 6 + k(5 + 4 2) + 2
et al. [23]
Morrison
1076
2164
4340
8692
124
260
532
= 13k + 8
22
56
et al. [20]
= 13(k + 1) 5
Thapliyal
1143
2295
4599
9207
135
279
567
27
83
QC
1014
2038
4086
8182
118
246
502
of data bits.
= 2 + (n 1) 0 + 1
=3
et al. [20]
Thapliyal
1530
3066
186
378
762
18
42
90
6
GO
NOG, no. of gates; GO, garbage output; QC, quantum cost; , not mentioned
Vudadha
1276
2556
156
316
636
16
36
76
6
1536
192
384
768
12
24
48
96
1152
2304
4608
144
288
576
1022
2046
costs, area, power and delay for 8-bit and 64-bit comparator
126
254
510
14
30
62
6
circuits, respectively.
The performance and comparative study of 2, 4, 8, 16,
32, 64-bit binary comparator designs with respect to
bits
128
256
512
No.
16
32
64
of
IET Comput. Digit. Tech., 2014, Vol. 8, Iss. 3, pp. 129139 137
doi: 10.1049/iet-cdt.2013.0066 & The Institution of Engineering and Technology 2014
www.ietdl.org
delay, area and power are shown in Tables 8 and 9,
Proposed
202.58
909.14
1851.22
3735.38
15040.34
30113.62
60260.18
438.1
7503.7
respectively. Table 8 shows that for all of the cases, the
proposed circuit requires less numbers of gates, garbage
outputs and quantum costs than the existing designs
[1821, 23]. The calculation of area, delay and power has
1906.640
et al. [20]
Thapliyal
297.26
833.72
4052.48
8344.16
16927.52
34094.24
68427.68
137094.56
been done according to the process mentioned in Section
2. Although the proposed design has less delay than [17,
18], it produces much delay than [20, 21]. As [20, 21]
both are tree-based design, they require O(log2(n)) delay,
Power, W
6 Conclusions
This paper has presented the design methodologies of a
et al. [21]
Vudadha
184.36
429.08
918.52
3855.16
7770.68
15601.72
62587.96
31263.8
155.5
325.5
665.5
1345.5
2705.5
5425.5
70.5
10865.5
21745.5
102.5
282.5
642.5
1362.5
2802.5
5682.5
11442.5
22962.5
46002.5
195
425
885
1805
3645
7325
14 685
29 405
80
compared with 0.2n 0.16 [18, 19], 0.23 * log2(n) + 0.1 [20]
Vudadha
195
425
885
1805
3645
7325
14 685
29 405
80
7 References
Rangaraju et al.
12.64
25.44
51.04
102.24
0.24
0.64
1.44
3.04
6.24
application for designing reversible carry look ahead adder and other
0.29
0.38
0.47
0.56
0.65
0.74
0.83
0.92
1.01
reversible multiple valued logic gates. IEEE Proc. of the 34th Int. Symp.
bits
128
256
512
16
32
64
138 IET Comput. Digit. Tech., 2014, Vol. 8, Iss. 3, pp. 129139
& The Institution of Engineering and Technology 2014 doi: 10.1049/iet-cdt.2013.0066
www.ietdl.org
7 Babu, H.M.H., Islam, M.R., Chowdhury, A.R., Chowdhury, S.M.A.: 18 Rangaraju, H.G., Hegde, V., Raja, K.B., Muralidhara, K.N.: Design of
Synthesis of full-adder circuit using reversible logic. 17th Int. Conf. efcient reversible binary comparator. Int. Conf. on Communication
on VLSI Design, 2004, pp. 757760 Technology and System Design, 2012, vol. 30, pp. 897904
8 Biswas, A.K., Hasan, M.M., Chowdhury, A.R., Babu, H.M.H.: 19 Rangaraju, H.G., Hegde, V., Raja, K.B., Muralidhara, K.N.: Design of
Efcient approaches for designing reversible binary coded decimal low power reversible binary comparator. Proc. Engineering
adders, Microelectron. J., 2008, 39, (12), pp. 16931703 (ScienceDirect), 2011
9 Nielsen, M., Chuang, I.: Quantum computation and quantum 20 Thapliyal, H., Ranganathan, N., Ferreira, R.: Design of a comparator
information (Cambridge Univ. Press, 2000) tree based on reversible logic. Proc. Tenth IEEE Int. Conf. on
10 Feynman, R.P.: Quantum mechanical computers, Opt. News, 1985, 11, Nanotechnology Joint Symp. with Nano, August 2010, pp. 11131116
(2), pp. 1120 21 Vudadha, C., Phaneendra, P.S., Sreehari, V., Ahmed, S.E.,
11 Peres, A.: Reversible logic and quantum computers, Phys. Rev., 1985, Muthukrishnan, N.M., Srinivas, M.B.: Design of prex-based optimal
32, (6), pp. 32663276 reversible comparator. IEEE Computer Society Annual Symp. on
VLSI, 2012, pp. 201206
12 CMOS 45 nm Open Cell Library: URL http://www.si2.org/openeda.si2.
22 Nagamani, A.N., Jayashree, H.V., Bhagyalakshmi, H.R.: Novel low
org/projects/nangatelib
power comparator design using reversible logic gates, Indian
13 Microwind DSCH Schematic Editor and Digital Simulator, http://www.
J. Comput. Sci. Eng., 2011, 2, (4), pp. 566574
microwind.net/dsch.ph 23 Morrison, M., Lewandowski, M., Ranganathan, N.: Design of a
14 Mui, M.L., Banerjee, K., Mehrotra, A.: A global interconnect tree-based comparator and memory unit based on a novel reversible
optimization scheme for nanometer scale VLSI with implications for logic structure. IEEE Computer Society Annual Symp. on VLSI,
latency, bandwidth, and power dissipation, IEEE Trans. Electron 2012, pp. 331336
Devices, 2004, 51, (2), pp. 195203 24 Shamsujjoha, M., Babu, H.M.H.: A low power fault tolerant reversible
15 Saraswat, K.Prof.: Interconnect Scaling, Stanford University Lecture decoder using MOS transistor. Proc. 26th Int. Conf. on VLSI Design and
Slide, URL: http://www.stanford.edu/class/ee311/NOTES/Interconnect the 12th Int. Conf. on Embedded Systems, Pune, India, 2013, pp. 368373
ScalingSlides.pdf 25 Mehta, D.N., Sanghavi, P.N.: Intels 45 nm CMOS technology
16 Dadda, L.: Multioperand parallel decimal adder: a mixed binary and performance parameters in VLSI Design, Int. J. Electron. Commun.
BCD approach, IEEE Trans. Comput., 2007, 56, (10), pp. 13201328 Comput. Eng., REACT-2013, 4, (2), ISSN 2249071X
17 Al-Rabadi, A.N.: Closed system quantum logic network 26 Samanta, J., De, B.P., Bag, B., Maity, R.K.: Comparative study for
implementation of the viterbi algorithm, Facta Universitatis Elec. delay & power dissipation of CMOS Inverter in UDSM range,
Energ., 2009, 22, (1), pp. 133 Int. J. Soft Comput. Eng., ISSN: 22312307, 2012, 1, (6)
IET Comput. Digit. Tech., 2014, Vol. 8, Iss. 3, pp. 129139 139
doi: 10.1049/iet-cdt.2013.0066 & The Institution of Engineering and Technology 2014