quantum cost calculation of reversible circuit
DESCRIPTION
Quantum Cost Calculation of Reversible CircuitTRANSCRIPT
Quantum Cost Calculation of Reversible Circuit
Sajib MitraDepartment of Computer Science and EngineeringUniversity of [email protected]
OVERVIEW Reversible Logic Quantum Computing Quantum Gates Realization of Quantum NOT Quantum wire and Special Cases Quantum Cost Calculation of RC Conclusion Assignment References
Reversible Logic Equal number of input and output vectors Preserves an unique mapping between input and
output vectors of the particular circuit One or more operation can implement in a single unit
called Reversible Gate (N x N) Reversible Gate has N number of inputs and N
number of outputs where N= {1, 2, 3, …}
NOTA_A
(a) 1x1 Reversible Gate
Reversible Logic (cont…)
Advantage Recovers bit-loss as well as production of heat Adaptable for Quantum Computing Multiple operations in a single cycle Uses low power CMOS technology
A
BA B
3
2
1
0
1
0
INP
UT
VE
CT
OR
(A
, B)
OU
TP
UT
VE
CT
OR
(A
B
)
OU
TP
UT
VE
CT
OR
(P
, Q)
3
2
1
0
2
1
INP
UT
VE
CT
OR
(A
, B)
FGA
B Q=A B
P=A
0
3
(a) Irreversible EX-OR operation (b) Reversible EX-OR operation
Reversible Logic (cont…)
Limitation Feedback is strictly restricted Maximum and minimum Fan-out is always one
Reversible Logic (cont…)
Most Popular reversible gates are as follows:
Fig. 3x3 Dimensional Reversible gates
F2GA
BC
A
A C
A B
(d) Feynman Double Gate
PGA
BC
AA B
AB C
(b) Peres Gate
FRGA
BC
A
A’C AB
A’B AC
(f) Fredkin Gate
TGA
BC
A
AB C
B
(c) Toffoli Gate
NFTA
BC
AC’ B’CAC’ BC
A B
(e) New Fault Tolerant Gate
FGAA
B A B
(a) Feynman Gate
Reversible Logic (cont…)
Most Popular reversible gates are as follows:
Fig. 4x4 Dimensional Reversible gates
D
ABC
P = AQ = R = A B CS = (A B)C AB D
MTSG A B
D
ABC
P = AQ = A’C’ B’R = A’C’ B’ DS = ( A’C’ B’)D AB C
ABC
P = A
D
Q = A BR = AB CS = AB’ D
MIG TSG
(a) Modified IG Gate (b) TSG Gate
(c) Modified TSG Gate
Quantum Computing First proposed in the 1970s, quantum computing relies on
quantum physics by taking advantage of certain quantum physics properties of atoms or nuclei that allow them to work together as quantum bits, or qubits, to be the computer's processor and memory.
Qubits can perform certain calculations exponentially faster than conventional computers.
Quantum computers encode information as a series of quantum-mechanical states such as spin directions of electrons or polarization orientations of a photon that might represent as or might represent a superposition of the two values.
10 or
10 q
Quantum Computing (cont…)
Quantum Computation uses matrix multiplication rather than conventional Boolean operations and the information measurement is realized using qubits rather than bits The matrix operations over qubits are simply specifies by using quantum primitives as follows:
›|B A
|A
|B
|A
›(a) Quantum XOR operation (b) Acting representation
of Quantum XOR
UCN=
1 0 0 00 1 0 00 0 0 10 0 1 0
››
Quantum Computing (cont…)
›|B A
››
|A
|B
|A
›Quantum XOR operation
Input Output
A B P Q
0 0 0 0
0 1 0 1
1 0 1 1
1 1 1 0
Input/output
PatternSymbol
00 a
01 b
10 c
11 d
Quantum Computing (cont…)
›|B A
››
|A
|B
|A
›Quantum XOR operation
1 0 0 00 1 0 00 0 0 10 0 1 0
abcd
abdc
Quantum Computing (cont…)
›|B A
››
|A
|B
|A
›Quantum XOR operation
1 0 0 00 1 0 00 0 0 10 0 1 0
abcd
abdc
Input Output
A B P Q
0 0 0 0
0 1 0 1
1 0 1 1
1 1 1 0
Quantum Gates
A A
B VIF (A ) THEN V(B )
ELSE B
A A
B V+ IF (A ) THEN V+(B ) ELSE B
A A
B A B
(b) EXclusive-OR
A A’
(a) NOT
(c) Square Root of NOT (d) Hermitian of SRN
Fig: Quantum Gates are used for realizing Reversible Circuit
Quantum Gates (cont…)
What is SRN?
1 V 1 or 0
But
1 V V 0
Quantum Gates (cont…)
What is SRN?
1 V 1 or 0
But
1 V V 0NOT
But How?
Realization of Quantum NOT
NOT
(a) NOT Operator
CF
(b) Coin Flip Operator
QCF
(c) Quantum Coin Flip Operator
Basic operator for single input line:1. NOT 2. Coin Flip 3. Quantum Coin Flip
Realization of Quantum NOT (cont…)
0 1
1 0
NOT
NOT
0
1
NOT
NOT
NOT
NOT
0
1
1
0
CF00 or 1
CF11 or 0
CF
CF
1 or 0
0 or 1
CF0 0 or 1
CF1 1 or 0
0 0 or 1QCF
1 1 or 0QCF
1 or 00QCF1 QCF
1QCF00 or 1
QCF
Realization of Quantum NOT (cont…)
1
0 1
10 10
1/21/2
1/2 1/2 1/2 1/2
1/4 1/4 1/4 1/4
Probability of 0 or 1 based on Coin Flip:
Realization of Quantum NOT (cont…)
1
0 1
10 10
1/21/2
1/2 1/2 1/2 1/2
1/4 1/4 1/4 1/4
Probability of 0 or 1 based on Coin Flip:
So the Probability of P(0)=1/2 P(1)=1/2
Realization of Quantum NOT (cont…)
Probability of |0> or |1> based on Quantum Coin Flip:
|1>
21
21
21
21
21
21
|0>
|1>
|0>
|0>
|1>
|1>
21
21 2
12
1
Realization of Quantum NOT (cont…)
Probability of |0> or |1> based on Quantum Coin Flip:
|1>
21
21
21
21
21
21
|0>
|1>
|0>
|0>
|1>
|1>
21
21 2
12
1
So the Probability of P(|0>)=1 P(|1>)=0
Realization of Quantum NOT (cont…)
NOT operation can be divided into to SRN matrix production
1 V V 0
NOT
1 0
Quantum Cost (QC) of any reversible circuit is the total number of 2x2 quantum primitives which are used to form equivalent quantum circuit.
Quantum Wire and Special Cases (cont…)
A A
B A B
Quantum XOR gate, cost is 1
Quantum Wire and Special Cases (cont…)
A A
B B
Two Quantum XOR gates, but cost is 0
Quantum Wire and Special Cases (cont…)
A A
B B
Quantum Wire
Quantum Wire and Special Cases (cont…)
SRN and its Hermitian Matrix on same line.
VV+= Identity and the total cost = 0
V V+
Quantum Cost of V and V+ are same , equal to one.
Quantum Wire and Special Cases (cont…)
SRN and its Hermitian Matrix on same line.
VV+= Identity and the total cost = 0
V V+Y Y
XX
Quantum Wire and Special Cases (cont…)
The attachment of SRN (Hermitian Matrix of SRN) and EX-OR gate on the same line generates symmetric gate pattern has a
cost of 1. Here T= V or V+
T(a)
T(b)
Quantum Wire and Special Cases (cont…)
A A
B VIF (A ) THEN V(B )
ELSE B
A A
B V+ IF (A ) THEN V+(B ) ELSE B
A A
B A B
(b) EXclusive-OR
A A’
(a) NOT, Cost =0
(c) Square Root of NOT (d) Hermitian of SRN
The cost of all 4x4 Unitary Matrices (b, c, d) and the symmetric gate pattern (e, f, g, h) are unit.
Quantum Cost of F2G
F2Ga
bc
p= a
r= a c
q= a b
F2G, Cost = 2
a
a b
a
bc a c
Quantum Cost of Toffoli Gate
TG, Cost = 5
VV V+
b
aa
b
c ab cTG
ab
c
p= a
r= ab cq= b
But How?
VV V+
a b
aa
b
c ab cPG
ab
c
p= a
r= ab cq= a b
Quantum Cost of Toffoli Gate
TGab
c
p= aq= b
r= ab c
INPUT OUTPUT
a b r
0 0 c
0 1 c
1 0 c
1 1 c’
Quantum Cost of Toffoli Gate
V
1
1c V r= c’
INPUT OUTPUT
a b r
0 0 c
0 1 c
1 0 c
1 1 c’
Quantum Cost of Toffoli Gate
V
1
0c V r= cV+
INPUT OUTPUT
a b r
0 0 c
0 1 c
1 0 c
1 1 c’
V
0
1c V r= cV+
INPUT OUTPUT
a b r
0 0 c
0 1 c
1 0 c
1 1 c’
Now
Quantum Cost of Toffoli Gate
TGAB
C
P=A
R=AB C
Q=B
Input Output
A B R
0 0 C
0 1 C
1 0 C
1 1 C’
V
a
bc V V+ r=ab c
a
a b
(a)V
a
bc V V+ r= ab c
p= a
q= b
(b)
Have anything wrong?
Quantum Cost of Toffoli Gate
TGAB
C
P=A
R=AB C
Q=B
Input Output
A B R
0 0 C
0 1 C
1 0 C
1 1 C’
V
A
B
C V V+ R=AB C
P=A
Q=B
Ok
Quantum Cost of Toffoli Gate (cont…)
Alternate representation of Quantum circuit of TG…
b
aa
b
c ab c
TGab
c
p= a
r= ab cq= b
V
a
bc V V+ r= ab c
p= a
q= b
Quantum Cost of Fredkin Gate
V
a
b
c
a
V V+
a’b ac
a’c ab
a
bc
p= a
r=a’c ab
q= a’b acFRG
But How?
V
abc
a
V V+ a’c aba b c
a
bc
p= a
r=a’c ab
q= a b cMUX
Quantum Cost of Fredkin Gate (cont…)
A
BC
P=A
R=A’C AB
Q=A’B ACFRG
P=A
R=AC AB C
Q=AB AC BP=A
R=A(B C) C
Q=A(B C) B
Quantum Cost of Fredkin Gate (cont…)
A
BC
FRGP=A
R=A(B C) C
Q=A(B C) B
A
BC
A(B C)C
Quantum Cost of Fredkin Gate (cont…)
A
BC
FRGP=A
R=A(B C) C
Q=A(B C) B
A
BC
A
A(B C) C(B C)
Quantum Cost of Fredkin Gate (cont…)
a
bc
p= a
r=a’c ab
q= a’b acFRGa
bc
aa(b c) ba(b c) c
Quantum Cost of Fredkin Gate (cont…)
V
a
b
c
a
V V+
a’b ac
a’c ab
a
bc
a
a’b aca’c ab
Quantum Cost of Fredkin Gate (cont…)
V
a
b
c
a
V V+
a’b ac
a’c ab
V
a
b
c
a
V V+
a’b ac
a’c ab
Quantum Cost of Peres Gate
VV V+
A B
AA
B
C AB C
PG, Cost = 4
PGA
BC
P=AQ=A B
R=AB C
Quantum Cost of NFT Gate
NFT, Cost = 6
VV
A
B
C
V+ AC’ B’C
AC’ BC
A B
NFTA
BC
Q=AC’ B’CR=AC’ BC
P=A B
Quantum Cost of NFT Gate
a
b
c
a bac’ b’cac’ bc
a
bc
p= a b
r=ac’ bc
q= ac’ b’cNFT
V V+V
a
bc
a b
ac’ b’c
ac’ bc
Quantum Cost of MIG Gate
DMIG, Cost = 7
ABC
Peres Gate
A
AB CAB’ D
A B
ABC
P = A
D
Q = A BR = AB CS = AB’ D
MIG
Assignment
D
ABC
P = AQ = A’C’ B’R = A’C’ B’ DS = ( A’C’ B’)D AB C
TSG
Find out cost
D
ABC
P = AQ = R = A B CS = (A B)C AB D
MTSG A B
XAB
C
P=A
R=AB CQ=A’B’ C
About AuthorSajib Kumar Mitra is an MS student of Dept. of Computer Science and Engineering, University of Dhaka, Dhaka, Bangladesh. His research interests include Electronics, Digital Circuit Design, Logic Design, and Reversible Logic Synthesis.
THANKS TO ALL