Quatum Pla ad Carry Look-Ahead Adders Ka-We Cheg u8984@cc.kfust.edu.tw Che-Cheg Tseg tcc@ccms.kfust.edu.tw Deartmet of Comuter ad Commucato Egeerg, Natoal Kaohsug Frst Uversty of Scece ad Techology, Yechao, Kaohsug, Tawa, Reublc of Cha May, Abstract I ths aer, two quatum etworks for the addto oerato are reseted. Oe s the Modfed Quatum Pla(MQP)adder, ad the other s the Quatum Carry Look-Ahead(QCLA)adder. The MQP adder s obtaed by modfyg the Covetoal Quatum Pla(CQP)adder. The QCLA adder s a exteso of covetoal dgtal Carry Look-Ahead adder. Comared wth the CQP adder, two ma advatages are as follows: Frst, the roosed MQP ad QCLA adders have less umber of elemetary gates tha the CQP adder. Secodly, the umber of rocessg stages of the MQP ad QCLA adder are less tha oes of the CQP adder. As a result, the throughut tme for comutg the sum of two umbers o the quatum comuter ca be mroved. Keywords:Carry Look-Ahead Adder, Quatum Pla Adder, Quatum Arthmetc, arallel archtecture
. Itroducto I 994, Shor showed that rme factorzato ad dscrete logarthms ca be doe quckly o a quatum comuter [][]. Oe alcato of Shor s quatum rme factorzato algorthm s to break RSA crytosystems. To mlemet Shor's algorthm, a lot of researchers have devoted themselves to desg quatum arthmetc etworks. I 995, Vedral, Bareco ad Ekert rovded the quatum etwork for the modular exoetato, whch s oe of the ma arthmetc tasks of Shor s rme factorzato algorthm []. To comute modular exoetato, quatum etworks of the la adder, the adder modulo, ad the multler modulo also roosed []. Recetly, Draer also roosed a method for addto o the quatum comuter usg the Quatum Fourer Trasform [4]. Thus, to desg a effcet quatum etwork to erform addto s a mortat research toc for mlemetg Shor's algorthm. I ths aer, two quatum adder etworks are reseted to mrove the throughut tme for comutg the sum of two umbers o the quatum comuter. Oe s the Modfed Quatum Pla (MQP)adder, ad the other s the Quatum Carry Look-Ahead(QCLA)adder. The aer s orgazed as follows: I secto, the roblem statemet s made. I secto, the covetoal la adder (CQP) [] s brefly revewed ad the MQP adder wll be roosed. The umber of the elemetary gates ad the umber of rocessg stages are used to evaluate the erformace of CQP ad MQP adders. I secto 4, the QCLA adder s desged ad a comarso s made. The QCLA adder s a exteso of covetoal dgtal Carry Look-Ahead adder [5][6]. Fally, a cocluso s made.. Problem Statemet The addto s oe of the most mortat arthmetc oeratos, so t s useful to desg a quatum etwork to comute the sum of two umbers. Gve two -bt umbers a ad b are as follows: a = a a () Kaa b Kbb b = b () where s the th qubt of a ad b s the th qubt of b. The urose of ths aer s to desg a quatum etwork to comute the sum of a ad b. Ths sum has + qubts ad s deoted by a + b = C S S () KS S where the qubt C reresets the carry bt, ad the qubt S s the sum bt. Let otato be the Exclusve-OR oerato, the the carry bt C ca be comuted by the followg recursve relato [5][6]: ( a b ) C ad C = a b C = ad the relatosh amog, b ad S s gve by ( a b ) C = (4) S (5)
The quatum system block dagram to erform the addto s show Fgure. The ut cotas three comoets as a, b, ad oe(+)-bt zero umber. The outut of etwork cludes oe umber a, the sum S = S S -...S S ad(+)-bt carry C = C C -...C C. Clearly, the sum S aeared the same qubts rereseted the umber b. Note that oly the carry bt C s what to be cosdered, ad the other qubts of C are the byroduct of the addto arthmetc. Now, the roblem s how to desg a effcet addto quatum etwork Fgure such that the throughut tme of addto oerato ca be mroved. I ext secto, the CQP adder s frst revewed. The, the umber of elemetary gates ad rocessg stages are used to evaluate the erformace of the CQP adder. a b Quatum Network a S C Fgure The quatum system block dagram of addto for two umbers a ad b.. Quatum Pla Adder. Covetoal Quatum Pla Adder The Covetoal Quatum Pla (CQP) adder [] s mlemeted wth two utary comutatoal gates. Oe s a carry gate Fgure, ad the other s a sum gate Fgure. I ths aer, the carry gate wth a dark bar o the left sde s used to rereset the reverse order oerato of a carry gate wth a dark bar o the rght sde. From Fgure, we see that the fourth outut qubt of the carry gate s equal to (( b ) C ) (( a b ) C ) a (6) If the tal ut value of C s set to zero, the outut relato (6)s reduced to the oe (4). Thus, the formato of carry s laced the fourth qubt of the outut of the carry gate, ad the formato b s located the thrd qubt of the outut of the carry gate, whle the frst two qubts of the carry gate kee uchaged. I Fgure, the sum gate mlemets the relato (5). The formato of sum aears the thrd outut qubt of the sum gate. However, the frst two qubts of the sum gate are the same as ts ut. The CQP adder comosed of the revous utary gates for two 4-bt umbers a ad b s show Fgure 4. The Fgure 5 s obtaed from Fgure 4 by relacg the sum ad carry gates wth ther detals. The CQP adder used + qubts to add two -bt umbers. The reaso s that the CQP Adder eeds addtoal temorary qubts to rocess carry formato. Besdes, the tal states of each temorary carry qubt the ut are set to zero,.e. C =, for =,,,,4. Whe the comutato of the addto s comleted, the carry qubts are reset to zero excet C. The most sgfcat qubt of carry C s the last qubt of the quatum etwork Fgure 4. Furthermore, the ut qubt b s relaced wth sum bt S, for =,,,4. I ext subsecto, the erformace of ths CQP adder wll be
evaluated. C b C CARRY C a b (( a b ) C ) (( a b ) C ) Fgure Carry gate. C b SUM C ( a b ) C Fgure Sum gate. b C CARRY CARRY SUM ( a + b) C b C CARRY CARRY SUM ( a + b) C b CARRY CARRY SUM ( a + b) CARRY SUM Fgure 4 The Covetoal Quatum Pla adder for two 4-bt umbers. 4
b C ( a + b) C b C ( a + b) C b ( a + b) Fgure 5 The Covetoal Quatum Pla adder for two 4-bt umbers.. Performace Evaluato of the Covetoal Quatum Pla Adder I order to evaluate the erformace of CQP adder, we cosder the followg two factors. Oe s the umber of rocessg stages from ut to outut, ad the other s the umber of Cotrolled-Not (CNOT) gate ad Cotrolled-Cotrolled-Not (CCNOT) gate. Whe the umber of rocessg stages s small, t meas that the throughut tme s small. Besdes, the smaller umber of elemetary gates s, the smaller comlexty of adder has. For coutg the mmum umber of rocessg stages of CQP adder Fgure 5, the frst two elemetary gates CCNOT gate ad CNOT gate of each Carry gates Fgure 5 are moved toward the ut because deedet gates ca be groued together to rocess such that the throughut tme ca be reduced. Therefore, the quatum etwork Fgure 5 ca be rearraged to Fgure 6. Both etworks erform the same fucto. The oly dfferece betwee them s the order of rocessg. From the hel of auxlary vertcal dashed les Fgure 6, t s clear that the umber of rocessg stages of the CQP Adder for two 4-bt umbers s 4. The elemetary gates of CQP adder are the CNOT gate or the CCNOT gate used ether wth a carry gate ad a sum gate or outsde. Each elemetary gate s couted wth oe gate. Fgure 7 s exactly same as Fgure 5 excet auxlary vertcal dashed les are serted to hel us to cout the umber of gates. From Fgure 7, t s clear that the umber of gates of the CQP adder for two 4-bt umbers s. Moreover, the CQP adder s desged to comute exoetato modulo [], so the temorary bts of carry eed to be reset to zero. If we oly wat to erform addto oerato, the acto to reset carry bts ca be removed such that the CQP adder ca be smlfed. I the followg subsecto, a CQP adder wthout resettg the temorary bts of carry wll be reseted. 5
b C ( a + b) C b C ( a + b) C b ( a + b) rocessg stages: 4 5 6 7 8 9 4 5 6 7 8 9 4 Fgure 6 The umber of rocessg stages of a CQP adder for two 4-bt umbers. b C ( a + b) C b C ( a + b) C b ( a + b) elemetary gates: 4 5 6 7 8 9 4 5 6 7 8 9 4 5 6 7 8 9 Fgure 7 The umber of elemetary gates of a CQP adder for two 4-bt umbers.. Modfed quatum la adder wthout resettg temorary bts of carry to zero The CQP adder Fgure 5 ca be modfed to the quatum adder etwork Fgure 8. The verse Carry gates ad the frst CNOT gate of each Sum gate Fgure 4 ad 5 are removed. The Modfed Quatum Pla(MQP)adder does ot eed to reset temorary bts of carry to zero, so the umber of elemetary gates ca be reduced. Now, the erformace of the MQP adder s evaluated. For coutg the mmum umber of rocessg stages, the frst two elemetary gates CCNOT gate ad CNOT gate of each Carry gates Fgure 8 are moved toward the ut, ad the four CNOT gates outsde of the carry gates are gathered. Therefore, the quatum etwork Fgure 8 s rearraged to Fgure 9. Clearly, the 6
umber of rocessg stages of the MQP Adder for two 4-bt umbers s 7. I addto, from the Fgure, we see that the umber of elemetary gates of the MQP Adder for two four-bt umbers s 6. b C ( a + b) C b C ( a + b) C b ( a + b) Fgure 8 The Modfed Quatum Pla adder for two 4-bt umbers. b C ( a + b) C b C ( a + b) C b ( a + b) rocessg stages: 4 5 6 7 Fgure 9 The umber of rocessg stages of a MQP Adder for two 4-bt umbers. 7
b C ( a + b) C b C ( a + b) C b ( a + b) elemetary gates: 4 5 6 7 8 9 4 5 6 Fgure The umber of elemetary gates of a MQP Adder for two 4-bt umbers. 4. Quatum Carry Look-Ahead Adder 4. Quatum Carry Look-Ahead Adder Accordg to(4)ad(5), the recursve relatos of carry bt ad sum bt are rewrtte as follows: ( a b ) C = ab ( a b ) C = g C C = ab + (7) ( a b ) C = C S (8) = where g =b s used to geerate the carry bt C, ad = b s used to roagate the revous carry bt C - to the reset carry bt C or sum bt S. The Quatum Carry Look-Ahead (QCLA) adder s created by exadg(7)ad(8)to the followg form: C C C C M g C g C g C g C = g g g = C = g g C = g g g C = C g = C K L C = C (9) 8
b b b b b 4 C M C C C C 4 = g g = S = g C = = g g C = S g L C = S S = g g g C = S 4 g 4 4 K () I (9)ad (), the symbol reresets the trasform relatosh of state from ts left sde (ut)to ts rght sde(outut)o a secfc qubt. I (9), the carry bt C s located at the same qubt rereseted ts tal state ut. However, (), the qubt b s relaced wth the sum S. I the followg, the QCLA adder wll be costructed based o(9)ad(). Frst, let us defe the AND gate Fgure, ad the XOR gate Fgure. Moreover, based o (9), a C module s costructed Fgure, ad from (), a S module s bult Fgure 4. The AND gate s comosed of a CCNOT gate, ad t s rereseted the AND oerato of the th-bt of two umbers a ad b,.e. g = b. I Fgure, the thrd qubt of ut s set to zero, so that the corresodg outut s the AND oerato of the frst two qubts of ut. The XOR gate cossts of a CNOT gate, ad t stads for the Exclusve-OR oerato of the th-bt of two umbers a ad b,.e. = b. I Fgure, the secod qubt of outut s the Exclusve-OR oerato of two ut umbers. The C module Fgure ad the S module Fgure 4 are comosed of the CNOT gate, the CCNOT gate, ad some multle-cotrolled NOT gate [7]. What we cosdered s the MSB of Carry C, ad t s gve by C module wth =. The S module s the geeral form to get sum bt for =,,,. Usg basc gates ad modules from Fgure to Fgure 4, the QCLA adder for two -bt umbers s dected Fgure 5. Fgure 5(b) s obtaed from Fgure 5(a) by relacg AND gate, XOR gate, C module ad S module by ther detals. The QCLA adder s desged oly for the urose of addto, so that t s ot requred to reset the temorary bts of carry to zero. The QCLA adder s a arallel archtecture by sharg the oututs of the AND gate ad the XOR gate Fgure 5(a). I the followg subsecto, the erformace of the QCLA adder s evaluated. b C AND b b b C b b Fgure AND gate. b XOR a b b a b Fgure XOR gate. 9
g g g g g C g g g g g g g g C g C Fgure C module of the QCLA adder.
g g g g g S g g g g g S g g S Fgure 4 S module of the QCLA adder.
a a b b b b b C b C b C a b C a b C a b C AND AND AND AND AND AND XOR XOR XOR XOR XOR XOR C S S - S - S S S a ( a + b) C ( a + b) C ( a + b) C a + b ( a ) C a ( a b) + C a ( a + b) C a a + b Fgure 5(a) The QCLA adder for two -bt umbers wthout resettg temorary bts of carry. a a b C b C b a ( a + b) C ( a + b) C ( a + b) a b b b b C a b C a b C a b C C a + b ( a ) C a ( a + b) C a ( a + b) C a + b Fgure 5(b) The QCLA adder for two -bt umbers wthout resettg temorary bts of carry.
b AND XOR S ( a + b) C S C b AND XOR S ( a + b) C S 4 C b AND XOR ( a + b) AND XOR Fgure 6(a) The QCLA adder for two 4-bt umbers wthout resettg temorary bts of carry. b C ( a + b) C b C ( a + b) C b ( a + b) Fgure 6(b) The QCLA adder for two 4-bt umbers wthout resettg temorary bts of carry.
4. Performace Evaluato of the Quatum Carry Look-Ahead Adder For coveece of erformace evaluato, Fgure 5 wth =4 s show Fgure 6. The elemetary gates of CQP adder are the CNOT gate ad the CCNOT gate, however, the elemetary gates of QCLA adder cludes the -tmes Cotrolled-NOT gate,.e. the C NOT gate for =,,,. The umber of rocessg stages of the QCLA adder for two four-bt umbers s 6, as show fgure 7. From left sde to rght sde Fgure 7, the frst gate we ecoutered s the AND gate. Here, we have four AND gates. These four AND gate are couted as oe rocessg stage, because these gates ca be rocessed at the same tme. For the same reaso, the four XOR gates are couted as oe rocessg stage. The, we cosder the rocessg stages wth the C module for =4 because we oly care the logest throughut tme for the addto oerato. Therefore, the module s what we cosder. I Fgure 7, the module cossts of a CCNOT gate, a NOT gate, a NOT gate, ad a C 5 NOT gate. Each gate the module s couted as oe rocessg stage. So, the total rocessg stages s 6. From Fgure 8, we see that the umber of elemetary gates of the QCLA adder for two four-bt umbers s. The elemetary gates OCLA adder cludes the C NOT gate for =,,, used ether wth AND gate, XOR gate, C module, ad S module or outsde. Fally, for -bt addto, t ca be show that the umber of rocessg stages for a QCLA adder s +, ad the umber of elemetary gates for t s 4+Σ =~-(-). Moreover, the umber of rocessg stages for a CQP adder s 6, ad the umber of elemetary gates for a CQP adder of s 8-. Besdes, the umber of rocessg stages for a MQP adder s +, ad the umber of elemetary gates for t s 4. The comarso amog QCLA adder, CQP adder, ad MQP adder s summarzed Table. From Table, t s clear that the umber of rocessg stages for a QCLA adder s less tha the CQP adder ad MQP adder,.e. the throughut tme of a QCLA adder s mroved comared wth CQP adder ad MQP adder. However, the umber of elemetary gates of a QCLA adder s less tha the CQP adder but more tha the MQP adder. b C ( a + b) C b C ( a + b) C b ( a + b) rocessg stages: 4 5 6 4 5 6 4 5 4 Fgure 7 The umber of rocessg stages of a QCLA adder for two 4-bt umbers wthout resettg temorary bts of carry. 4
b C ( a + b) C b C ( a + b) C b ( a + b) elemetary gates:,,,4 5,6,7,8 9 4 5 6 7 8 9 Fgure 8 The umber of elemetary gates of a QCLA adder for two 4-bt umbers wthout resettg temorary bts of carry. 5. Cocluso I ths aer, two quatum etworks for the addto oerato have bee reseted. Oe s the MQP adder, ad the other s the QCLA adder. Comared wth the CQP adder, two ma advatages are as follows: Frst, the roosed MQP ad QCLA adders have less umber of elemetary gates tha the CQP adder. Secodly, the umber of rocessg stages of the MQP ad QCLA adder are less tha oes of the CQP adder. As a result, the throughut tme for comutg the sum of two umbers o the quatum comuter ca be mroved. Wth the throughut tme of the addto o a quatum comuter s mroved, the arthmetc quatum etworks ca be realzed faster. Oe of the alcatos s that we ca desg a faster quatum etwork system to factorg a comoste umber,.e. breakg the RSA crytosystems wth Shor s Quatum Factorg Algorthm o a quatum comuter [8][9][] ca be seeded u. 5
QCLA Adder CQP Adder MQP Adder Number of Number of Number of Number of Number of Number of Number of Processg Elemetary Processg Elemetary Processg Elemetary Stages Gates Stages Gates Stages Gates 4 6 6 4 4 4 9 4 5 8 5 5 8 6 4 6 4 7 6 M M M M M M M + 4+Σ=~-(-) 6 8- + 4 Table The Comarso amog the QCLA Adder, the CQP Adder, ad the MQP Adder. 6. Refereces [] Peter W. Shor, Algorthms for Quatum Comutato: Dscrete Logarthms ad Factorg, IEEE Comuter Socety Press, Nov. -, 994,.4-4. [] Peter W. Shor, Polyomal-Tme Algorthms for Prme Factorzato ad Dscrete Logarthms o a Quatum Comuter, quat-h/9587, Vol., 5 Ja. 997. [] V. Vedral, A. Bareco, ad A. Ekert, Quatum etworks for elemetary arthmetc oeratos, Phys. Rev. A 54, 47, 995. [4] Thomas G. Draer, Addto o a Quatum Comuter, quat-h/8, vol. 7, Aug.. [5] M. Morrs Mao, Dgtal Desg, d Edto, Pretce Hall, Chater 4, 99. [6] Douglas A. Puckell, ad Kamra Eshragha, Basc VLSI Desg, rd Edto, Pretce Hall, Chater 8, 994. [7] Gaero Cattaeo, Mara Lusa Dalla, Roberto Gut, ad Roberto Leor, A Ushar Logc From Quatum Comutato, quat-h/, v, 8 Ja. [8] D. Beckma, A. N. Char, S. Devabhaktu, ad J. Preskll, Effcet etworks for quatum factorg, Phys. Rev. A 54, 4. [9] C. Mquel, ad J. P. Paz, R. Perazzo, Factorg a dssatve quatum comuter, Phys. Rev. A 54, 65. [] C. Zalka, Fast Versos of Shor's quatum factorg algorthm, quath/98684. 6