quantum cost calculation of reversible circuit

53
Quantum Cost Calculation of Reversible Circuit Sajib Mitra Department of Computer Science and Engineering University of Dhaka [email protected]

Upload: sajib-mitra

Post on 05-Dec-2014

2.957 views

Category:

Technology


3 download

DESCRIPTION

Quantum Cost Calculation of Reversible Circuit

TRANSCRIPT

Page 1: Quantum Cost Calculation of Reversible Circuit

Quantum Cost Calculation of Reversible Circuit

Sajib MitraDepartment of Computer Science and EngineeringUniversity of [email protected]

Page 2: Quantum Cost Calculation of Reversible Circuit

OVERVIEW Reversible Logic Quantum Computing Quantum Gates Realization of Quantum NOT Quantum wire and Special Cases Quantum Cost Calculation of RC Conclusion Assignment References

Page 3: Quantum Cost Calculation of Reversible Circuit

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

Page 4: Quantum Cost Calculation of Reversible Circuit

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

Page 5: Quantum Cost Calculation of Reversible Circuit

Reversible Logic (cont…)

Limitation Feedback is strictly restricted Maximum and minimum Fan-out is always one

Page 6: Quantum Cost Calculation of Reversible Circuit

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

Page 7: Quantum Cost Calculation of Reversible Circuit

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

Page 8: Quantum Cost Calculation of Reversible Circuit

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

Page 9: Quantum Cost Calculation of Reversible Circuit

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

››

Page 10: Quantum Cost Calculation of Reversible Circuit

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

Page 11: Quantum Cost Calculation of Reversible Circuit

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

Page 12: Quantum Cost Calculation of Reversible Circuit

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

Page 13: Quantum Cost Calculation of Reversible Circuit

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

Page 14: Quantum Cost Calculation of Reversible Circuit

Quantum Gates (cont…)

What is SRN?

1 V 1 or 0

But

1 V V 0

Page 15: Quantum Cost Calculation of Reversible Circuit

Quantum Gates (cont…)

What is SRN?

1 V 1 or 0

But

1 V V 0NOT

But How?

Page 16: Quantum Cost Calculation of Reversible Circuit

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

Page 17: Quantum Cost Calculation of Reversible Circuit

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

Page 18: Quantum Cost Calculation of Reversible Circuit

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:

Page 19: Quantum Cost Calculation of Reversible Circuit

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

Page 20: Quantum Cost Calculation of Reversible Circuit

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

Page 21: Quantum Cost Calculation of Reversible Circuit

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

Page 22: Quantum Cost Calculation of Reversible Circuit

Realization of Quantum NOT (cont…)

NOT operation can be divided into to SRN matrix production

1 V V 0

NOT

1 0

Page 23: Quantum Cost Calculation of Reversible Circuit

Quantum Cost (QC) of any reversible circuit is the total number of 2x2 quantum primitives which are used to form equivalent quantum circuit.

Page 24: Quantum Cost Calculation of Reversible Circuit

Quantum Wire and Special Cases (cont…)

A A

B A B

Quantum XOR gate, cost is 1

Page 25: Quantum Cost Calculation of Reversible Circuit

Quantum Wire and Special Cases (cont…)

A A

B B

Two Quantum XOR gates, but cost is 0

Page 26: Quantum Cost Calculation of Reversible Circuit

Quantum Wire and Special Cases (cont…)

A A

B B

Quantum Wire

Page 27: Quantum Cost Calculation of Reversible Circuit

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.

Page 28: Quantum Cost Calculation of Reversible Circuit

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

Page 29: Quantum Cost Calculation of Reversible Circuit

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)

Page 30: Quantum Cost Calculation of Reversible Circuit

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.

Page 31: Quantum Cost Calculation of Reversible Circuit

Quantum Cost of F2G

F2Ga

bc

p= a

r= a c

q= a b

F2G, Cost = 2

a

a b

a

bc a c

Page 32: Quantum Cost Calculation of Reversible Circuit

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

Page 33: Quantum Cost Calculation of Reversible Circuit

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’

Page 34: Quantum Cost Calculation of Reversible Circuit

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’

Page 35: Quantum Cost Calculation of Reversible Circuit

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’

Page 36: Quantum Cost Calculation of Reversible Circuit

Now

Page 37: Quantum Cost Calculation of Reversible Circuit

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?

Page 38: Quantum Cost Calculation of Reversible Circuit

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

Page 39: Quantum Cost Calculation of Reversible Circuit

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

Page 40: Quantum Cost Calculation of Reversible Circuit

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

Page 41: Quantum Cost Calculation of Reversible Circuit

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

Page 42: Quantum Cost Calculation of Reversible Circuit

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

Page 43: Quantum Cost Calculation of Reversible Circuit

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)

Page 44: Quantum Cost Calculation of Reversible Circuit

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

Page 45: Quantum Cost Calculation of Reversible Circuit

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

Page 46: Quantum Cost Calculation of Reversible Circuit

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

Page 47: Quantum Cost Calculation of Reversible Circuit

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

Page 48: Quantum Cost Calculation of Reversible Circuit

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

Page 49: Quantum Cost Calculation of Reversible Circuit

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

Page 50: Quantum Cost Calculation of Reversible Circuit

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

Page 51: Quantum Cost Calculation of Reversible Circuit

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

Page 52: Quantum Cost Calculation of Reversible Circuit

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.

Page 53: Quantum Cost Calculation of Reversible Circuit

THANKS TO ALL