230 likes | 349 Views
Fast Synthesis of Exact Minimal Reversible Circuit using Group Theory. Speaker: Min Lung Chuang Advisor: Chun-Yao Wang 2005/06/29. Outline. Introduction Background Minimal Length Algorithm Minimal Cost Algorithm Experimental result.
E N D
Fast Synthesis of Exact Minimal Reversible Circuit using Group Theory Speaker: Min Lung Chuang Advisor: Chun-Yao Wang 2005/06/29
Outline • Introduction • Background • Minimal Length Algorithm • Minimal Cost Algorithm • Experimental result
Reversible Circuit • Reversible circuits have applications in - low power design - quantum computer Landauer Principle If a computation process erases a single bit of information, the energy dissipated into the environment is at least E = k T ln2 , where k is the Boltzmann’s constant, • T is the temperature quantum computing is a reversible computing
Group Theory • There are some preliminary works on using group theory for reversible logic synthesis have been proposed. • GAP is a mathematical analysis package for group theory applications. • In this paper, we describe fast GAP-based algorithm to synthesize exact minimal reversible circuits for various type of gates with various gate costs.
Outline • Introduction • Background • Minimal Length Algorithm • Minimal Cost Algorithm • Experimental result
Must be optimal B A-B A-B Property of Optimal • If A is an optimal circuit with k gates, then the first k-1 gates that form a subcircuit B must also be optimal. It will Form a smaller circuit A’, so A is not an optimal circuit An optimal circuit A B’
Property of Optimal • Based on the property of optimal,we can build a library of small optimal circuits by dynamic programming. • There are two advantages of using dynamic programming approach • We may eliminate solutions and also save computations. • We can solve the problem stage by stage by systematically • We iterate through optimal m-gate circuits and add single gates at the end in all possible ways.
Outline • Introduction • Background • Minimal Length Algorithm • Minimal Cost Algorithm • Experimental result
Add gate at the end to generate some new functions Finding_Minimal_Length (FML) Input: A reversible gate library L Output: All the functions that can be implemented by L with minimal length. A A A L When set A stop grow, the algorithm is finished
j-1 is the maximum number of gates • in a function. • 2. A(j-1) is the total number of functions • 3. B(j-1) is the number of functions with • j-1gates. ( ) is the unity element in a permutation group A*B={a*b|a A and b B} A(j)={a|a T(L) and minl(a)<=j} If A(j)==A(j-1) then A(j+1)==A(j). Proof: A(j+1)=A(j)UA(j)*L=A(j-1)UA(j-1)*L Finding_Minimal_Length (FML) Algorithm Finding_Minimal_Length (FML): Input: Library L. Output: j-1, B(j-1),A(j-1) 1. A(0)={( )};j=0;n(j)=|A(0)|; 2. While n(j)≠0 do 3. j=j+1; 4. A(j)=A(j-1)UA(j-1)*L; 5.B(j)=A(j)-A(j-1); 6.n(j)=|B(j)|; 7.end while
L[ci]-1 L[ci] g k Minimum_Length_Representation Input: A reversible gate library L ; g. Output: Implementation of g with minimum length k. A(k-1) A(k) A(1) A(0) … L L
Group(L) is a set of all the functions that can be implemented by Library L In here B(k) is more suitable A(1) A(0) A(k-1) A(k) L[ci] a k … L L Minimum_Length_Representation Algorithm Minimum_Length_Representation Input: Library L;g. Output:Implementation of g with minimum length k. 1.G=Group(L);flag=0;a=g; 2. if g in G then 3. Flag=1; 4. Compute A(k) (k=0,1,…) as FML; 5. if g in A(k) then 6. For i=k downto 1 do 7. Find ci such that a*(L[ci])-1 A(i-1); 8. a=a*(L[ci])-1; 9. endfor; 10. endif 11. return flag, L[ck],…,L[c1], k;
Outline • Introduction • Background • Minimal Length Algorithm • Minimal Cost Algorithm • Experimental result
Gate Cost • In practice, the cost of NOT gates, Feynman gates and other well-known gates are different. • We assume cost(NOT)=0, cost (Feynman)=1, cost(Peres)=4,cost(Toffoli)=5 • Assume a library includes p+1 parts: L0={gates with cost 0),and Lri={gates with cost ri},where ri>0 are different integers,i=1,…,p.
L0 L0 L0 L0 L0 … L1N L1N L2N Lp-1N LpN Finding_Minimum_Cost (FMC) Input: A reversible gate library L Output: All the functions that can be implemented by L with minimal gate costs. … L0 L1 L2 Lp-1 Lp In every iteration, set A does not always grows up. A3 A1 A0
Finding_Minimum_Cost (FMC) • We can use function Group(L) in GAP to get all of the functions that can be implemented by library L. • When the size of set A is equal to the size of Group(L), the algorithm is finished.
j-1 is the maximum number of gate • cost in a function. • 2. A(j-1) is the total number of functions • 3. B(j-1) is the number of functions with • j-1gate cost. A to A’ A to A A to A’ B to B B to B’ B to B’ …etc in Group(L0) LriN is the real number of gates with gate cost i A(j)={a|a T(L) and Mine(a)<=j} We can not use n(j) to be a terminated condition Finding_Minimum_Cost (FMC) Algorithm Finding_Minimum_Cost(FMC) Input: L0, Lri ,…,Lrp Output: j-1, B(j-1),A(j-1) 1.G=Group(L);m=|G|; 2.A(0)=Group(L0);B(0)=A(0); 3.for 1≤ i ≤ p do LriN=Lri*A(0); 4.j=0;ma=|A(0)|; 5.while(ma<m) do 6. j=j+1;A(j)=A(j-1); 7. For 1 ≤ i ≤ p do 8. if(j-ri≥0) then A(j)=A(j)UA(j-ri)*LriN; 9. endfor 10. ma=|A(j)|;B(j)=A(j)-A(j-1);n(j)=|B(j)|; 11.endwhile
Lr1N[d] Lr1N[d]-1 k g Lrk-1N[d] Lrk-1N[d]-1 j Minimum_Cost_Representation Input: A reversible gate library L; g. Output: Implementation of g with minimum cost k. A(0) A(1) A(k-1) A(k) or … L L
In here B(k) is more suitable This is equal to the LriN[d]— the real number of gates with gate cost d a A(1) A(0) A(k-1) A(k) Lr1N[d] k … Lrk-1N[d] L L j Minimum_Cost_Representation Algorithm Minimum_Cost_Representation (MCR); Input:L0, Lri ,…,Lrp;g Output:Implementation of g with minimum cost k. 1.G=Group(L);flag=0;a=g; 2. if g in G then 3. Flag=1; 4. Compute A(k) (k=0,1,…) as FML; B(0)=A(0); 5. if g in A(k) then 6. h=0; 7. While( k>0) do 8. scan i=1 to p until find m,n such that 9. a*(Lri[m]*B(0)[n])-1 is in A(k-ri) then 10. h=h+1; c[h]=Lri[m]; b(h)=B(0)[n]; 11.a=a*(Lri[m]*B(0)[n])-1; k=k-ri; 12. endwhile; 12.endif; 12.return flag,h,b[1],c[1],…, b[h],c[h],a,k;
Outline • Introduction • Background • Minimal Length Algorithm • Minimal Cost Algorithm • Experimental result