Marek Perkowski Reversible Logic Synthesis with Garbage Bits Lecture 6.

Slides:



Advertisements
Similar presentations
Reversible Gates in various realization technologies
Advertisements

Logical Design.
Combinational Circuits
Functions and Functional Blocks
Boolean Algebra and Reduction Techniques
MVI Function Review Input X is p -valued variable. Each Input can have Value in Set {0, 1, 2,..., p i-1 } literal over X corresponds to subset of values.
ECE 331 – Digital System Design
Designing Oracles for Grover Algorithm
GF(4) Based Synthesis of Quaternary Reversible/Quantum Logic Circuits
A Transformation Based Algorithm for Reversible Logic Synthesis D. Michael Miller Dmitri Maslov Gerhard W. Dueck Design Automation Conference, 2003.
Calculating Spectral Coefficients for Walsh Transform using Butterflies Marek Perkowski September 21, 2005.
Regular Realization of Symmetric Binary and Ternary Reversible Logic Functions.
Marek Perkowski Reversible Logic Models: Billiard Ball and Optical Lecture 4.
Derivatives of Perkowski’s Gate k f2 g h t t De Vos gates  f1f1  A B P Q Feynman gates A B P f 2f 2  C Q R Toffoli gates Q P f 2 A C R B S D 0.
CS 151 Digital Systems Design Lecture 6 More Boolean Algebra A B.
This lecture is not mandatory for all students. It should be studied only by those students who selected the reversible logic as a topic of homework or.
Reversible Circuit Synthesis Vivek Shende & Aditya Prasad.
A Transformation Based Algorithm for Ternary Reversible Logic Synthesis using Universally Controlled Ternary Gates Erik Curtis, Marek Perkowski.
Ternary Deutsch’s, Deutsch-Jozsa and Affine functions Problems All those problems are not published yet.
April 25, A Constructive Group Theory based Algorithm for Reversible Logic Synthesis.
2002/10/08 SeonPil Kim Layout-Driven Synthesis For Submicron Technology : Mapping Expansions To Regular Lattices High Level Synthesis Homework #2.
Regular Structures. Levelized Structures Standard Lattice Diagrams for continuous, multiple-valued and binary logic.
Classical and Quantum Circuit Synthesis An Algorithmic Approach.
Boolean Matching in Logic Synthesis. Equivalence of Functions Equivalence of two functions defined under l Negation of input variables l Permutation of.
Taylor Expansion Diagrams (TED): Verification EC667: Synthesis and Verification of Digital Systems Spring 2011 Presented by: Sudhan.
Design of Regular Quantum Circuits
Minimization Techniques for Reversible Logic Synthesis.
 2000 M. CiesielskiPTL Synthesis1 Synthesis for Pass Transistor Logic Maciej Ciesielski Dept. of Electrical & Computer Engineering University of Massachusetts,
Grover’s Algorithm in Machine Learning and Optimization Applications
Lecture 3. Boolean Algebra, Logic Gates
New Approach to Quantum Calculation of Spectral Coefficients Marek Perkowski Department of Electrical Engineering, 2005.
Research Potential We should develop a set of unified standardized CAD tools for synthesizing, verifying, testing and simulating of quantum computers.
Chapter 5 Arithmetic Logic Functions. Page 2 This Chapter..  We will be looking at multi-valued arithmetic and logic functions  Bitwise AND, OR, EXOR,
Efficient Decomposition of Large Fuzzy Functions and Relations.
ROM-based computations: quantum versus classical B.C. Travaglione, M.A.Nielsen, H.M. Wiseman, and A. Ambainis.
Overview Part 1 – Design Procedure 3-1 Design Procedure
Overview Part 2 – Circuit Optimization 2-4 Two-Level Optimization
2.7 NAND and NOR logic networks
Chapter 2: Boolean Algebra and Logic Functions
BOOLEAN FUNCTION PROPERTIES
Combinational and Sequential Logic Circuits.
BOOLEAN ALGEBRA Saras M. Srivastava PGT (Computer Science)
Boolean Algebra and Digital Circuits
Department of Computer Engineering
REVERSIBLE LOGIC SYNTHESIS. Overview of the Presentation 1. Introduction 2. Design of a Reversible Full-adder Circuit.
Eng. Mohammed Timraz Electronics & Communication Engineer University of Palestine Faculty of Engineering and Urban planning Software Engineering Department.
Computer Organization 1 Logic Gates and Adders. Propositions –Venn Diagrams.
Chapter 10 (Part 2): Boolean Algebra  Logic Gates (10.3) (cont.)  Minimization of Circuits (10.4)
Charles Kime & Thomas Kaminski © 2008 Pearson Education, Inc. Circuit Optimization Logic and Computer Design Fundamentals.
Copyright © 2004 by Miguel A. Marin1 COMBINATIONAL CIRCUIT SYNTHESIS CLASSIC TWO-LEVEL CIRCUIT SYNTHESIS MULTILEVEL-CIRCUIT SYNTHESIS FACTORIZATION DECOMPOSITION.
Logic Gates Logic gates are electronic digital circuit perform logic functions. Commonly expected logic functions are already having the corresponding.
UM EECS 270 Spring 2011 – Taken from Dr.Karem Sakallah Logic Synthesis: From Specs to Circuits Implementation Styles –Random –Regular Optimization Criteria.
LOGIC GATES & BOOLEAN ALGEBRA
XOR Operator A short digression… … to introduce another Boolean operation: exclusive- OR (XOR) ABA + B XOR.
ENGIN112 L6: More Boolean Algebra September 15, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 6 More Boolean Algebra A B.
Boolean Algebra and Reduction Techniques
1 Chapter 4 Combinational Logic Logic circuits for digital systems may be combinational or sequential. A combinational circuit consists of input variables,
CLASSICAL LOGIC SRFPGA layout With I/O pins.
ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 4 Dr. Shi Dept. of Electrical and Computer Engineering.
Lecture 5 More Boolean Algebra A B. Overview °Expressing Boolean functions °Relationships between algebraic equations, symbols, and truth tables °Simplification.
Controlled- Controlled NOTControlled- Controlled NOT = Toffoli Gate.
BDD-based Synthesis of Reversible Logic for Large Functions Robert Wille Rolf Drechsler DAC’09 Presenter: Meng-yen Li.
Very good news for People who know Reed-Muller Logic 1.Quantum XOR 1.Quantum XOR is the most important gate in Quantum Logic 2.Synthesis of Quantum Circuits.
Kerntopf Gate and Regular Structures for Symmetric Functions
BASIC & COMBINATIONAL LOGIC CIRCUIT
CSE 370 – Winter Combinational Implementation - 1
ECE 352 Digital System Fundamentals
Design of new quantum primitives
ECE 352 Digital System Fundamentals
Circuit Simplification and
Presentation transcript:

Marek Perkowski Reversible Logic Synthesis with Garbage Bits Lecture 6

Logic Synthesis for Quantum Pseudo- Binary Logic (Permutation Logic)

Background Reviev of Reversible logic This approach is mostly for quantum logic realization For optical and CMOS realizations the k*k assumption is not necessarily used

Notation for Fredkin Gates A 0101 CB PQR A 01 P BC QR A circuit from two multiplexers Its schemata This is a reversible gate, one of many C AC’+B BC’+AC C A B

Margolus Gate A 0101 CB PQR A 01 C A B ReversibleConservative 3*3 gate There are many similar gates

The 3 * 3 Toffoli gate is described by these equations: P = A, Q = B, R = AB  C, Toffoli gate is an example of two-through gates, because two of its inputs are given to the output. Toffoli Gate PRQ * + ABC

* + + AB (b) PQ * + A B C PRQ * + ABC PRQ 0 1 Kerntopf Gate Feynman Toffoli Feynman, Toffoli and Fredkin gates are their own inverses

The Kerntopf gate is described by equations: P = 1  A  B  C  AB, Q = 1  AB  B  C  BC, R = 1  A  B  AC. When C=1 then P = A + B, Q = A * B, R =  B, so AND/OR gate is realized on outputs P and Q with C as the controlling input value. When C = 0 then P =  A *  B, Q = A +  B, R = A  B. 18 different cofactors! Kerntopf Gate Review cofactors if students forgot

As we see, the 3*3 Kerntopf gate is not a one-through nor a two-through gate. Despite theoretical advantages of Kerntopf gate over classical Fredkin and Toffoli gates, so far there are no published results on realization of this gate. Is it better for no-ancilla synthesis? Kerntopf Gate

Logic Synthesis for Reversible Logic

Toffoli Fredkin A B C F1 D F2 Feynman How to build garbage-less circuits GARBAGE BIT 1 GARBAGE BIT 2 We can decrease garbage at the cost of delay and number of gates We create inverse circuit and add spies for all outputs 2 outputs 2 garbages width = 4 delay = 4

Toffoli Fredki n A B C D Feyn man To ffo li Fred kin A B C D Feyn man copy How to build garbage-less circuits A,B,C,D are original inputs inputs reconstructed This process is informationally reversible It can be in addition thermodynamically reversible F1 from spy F2 from spy 2 outputs no garbage width = 4 delay = 9

Observations We reduced garbage at the cost of delay and number of gates We were not able to reduce the width of the scratchpad register

1. Minimize the garbage 2. Minimize the width of scratchpad register 3. Minimize the total number of gates 4. Minimize the delay Goals of reversible logic synthesis

Synthesis from (p)KFDDs Preprocessing

* + * + * + * + …... cici f1f1 f2f2 f3f3 f4f4 k1k1 k2k2 k3k3 k4k4 k5k5 k6k6 Previous levels next levels Other same level

* + * + * + * + …... f1f1 f2f2 f3f3 k1k1 k2k2 k3k3 k4k4 k5k5 k6k6 Previous levels next levels Other same level f4f4 cici

Example of converting a decision diagram to reversible circuit

Starting from Pseudo-Kronecker Functional Decision Diagram

fg pD nD S S S S S d a b c e 1 d d (a) * + (b) * + d f G1 G2 g G3 e b c a

Starting from function-driven Decision Diagram

S S S y1y1 y3y3 y2y (b) S S S x4x4 x3x3 x1x S x2x2 SS S (a) y1 =x2  x3  x1x3 y2 =x3  x1  x1x4 y3 =x1  x4  x3x4 y4 =x4 Converting fDDs to reversible circuits Standard BDD Corresponding fDD of Kerntopf Nonlinear preprocessor

y1 =x2  x3  x1x3 y2 =x3  x1  x1x4 y3 =x1  x4  x3x4 y4 =x4 * + * + * + x1x1  x1 x1 x3x3 x2x2 y1y1 y3y3 y2y2  x4 x4 x4x4  x3 x3 G2 + x3x G1 h G3 Reversible circuit corresponding to fDD together with preprocessor

Open Problems: Is our set of mapping rules sufficient? –(we have currently about 20 rules, but many more can be created). What is the practically best starting point for large functions? KFDD? PKFDD? fDD? How to transform the diagram or the circuit to improve the cost function? What to do in case of rule conflict? How to create rules to decrease garbage?

Use of Reversibility Observation: Every synthesis method can be executed forward and backwards Sometimes solution backwards can be simpler

A B C D X Y Z V Function F Function F -1 X Y Z V A B C D Forward Function Inverse Function Several methods exist to calculate inverse from forward function

X Toffoli Fredkin A B C Z Y D V Feynman Toffoli Fredkin A B C Z Y D V Feynman X Circuit for function F Circuit for function F -1 F*F -1 =I

Method of realization of F 1.1. Find function inverse F -1 of function F Synthesize F -1 using any method for reversible gates 3.3. Draw the schematics of F -1 from gates In the schematics replace every gate by its reverse and change the direction of signals The new schematics is the realization of F.

Fredkin A B C =Z  V  Y  Z Z Y D V Feynman X X=G1 Feynman G2=Z  V 0 X YZYZ YZYZ Y+  Z ZVZV YZYZ ZZ 0 Y Y Y Fan-out gate We were not able to find the best realization of F -1 shown earlier Another realization of F -1

Compositions and Decompositions

Composition Methods Composition methods with matching-based cell selection and complexity measures have been presented by: –Dietmeyer –Schneider –Wojcik –Michalski –Jozwiak, Chojnacki and Volf –DeMicheli library matching –Kravets and Sakallah

Uses library of 1*1,2*2 and 3*3 cells For every 3*3 function, a ready solution cascade is stored - see the results of Kerntopf and Storme-DeVos For every reversible gate, all cofactors can be stored (constants and garbage) and used in NPN matching. Gates with more cofactors (like Kerntopf) are better

Can be applied to both classical reversible and quantum logic All intermediate functions calculated in terms of input variables Uses equivalence mapping transformations based on NPN-equivalence Synthesis from inputs to outputs and from outputs to inputs, backtracking and look-ahead strategies

How to select the cell, its alignment and constants? Select the gate that provides smallest complexity evaluation of the remaining functions and intermediate functions. This works for both forward and backward transformations I proposed PPRM for matching because it is easy to implement. Other representations and measures can be used for matching - De Micheli, Dietmeyer, Jozwiak. Solve exor equations to find inverse functions and input values. Sometimes Kmaps are easier to use.

a + + a c b x y b c  ab c   ab a a Second stage Second stage of decomposition: Fredkin gate First stage First stage of decomposition: Feynman gate Decompositional synthesis of Toffoli Gate from Fredkin and Feynman Gates s t Third stage Third stage of decomposition: Feynman gate Using PPRM representation allows for NPN matching and good evaluation of the remaining function complexity Direction of synthesis

a + + a c b x y b c  ab c   ab a a Second stage Second stage of composition: Reversible Expansion for Fredkin gate Third stage Third stage of composition: Feynman gate Compositional synthesis of Toffoli Gate from Fredkin and Feynman Gates s t First stage First stage of composition: Feynman gate NPN matching takes care of permutations and inverters Direction of synthesis

Composition From inputs to outputs What to do if the initial function is not reversible?

A B C X Y Z h=A  B g=A*B G Toffoli Z=A*B Restrict to C=0 3. Toffoli gate assumed. 4. New functions X,Y,Z created. 5. C=0 restriction taken 6. Functions h and g of X,Y,Z can be now realizedComposition 1. These are inputs 2. These are outputs

Toffoli Feynman A B C X=A Y=B =0 Z=AB G =X=A g=Z=AB h=X  Y=A  B Created first Calculated in terms of new variables X,Y,Z and selected Feynman gate Compositional synthesis of non-reversible function of half-adder garbage IDEA: Look to outputs, modify near inputs, reduce the difference

Adder is composed from half-adders 2 garbage bits and one constant Compositional synthesis is here top-down, hierachical, like in classical CMOS

Toffoli Feynman A B C X=A Y=B =0 Z=AB G =X=A g=Z=AB h=X  Y=A  B Another variant assumes Kerntopf gate

Heuristics for finding simplest reversible function during composition CCN CN A B 0 A A  B (Sum) A and B (Carry) Toffoli Feynman A B AB  0 AB Mapping of a half-adder This is what we would like to have But this is not reversible, A B A  B A * B

CCN CN A B 0 A A  B (Sum) A and B (Carry) Toffoli Feynman A B AB  0 Mapping of a half-adder AB A B A  B A * B The simplest way to separate them is to add variable A Heuristics for finding simplest reversible function during composition

CCN CN A B 0 A A  B (Sum) A and B (Carry) Toffoli Feynman A B AB  0 AB Mapping of a half-adder This is what we would like to have But this is not reversible, because more outputs than inputs A * B A B A  B A Heuristics for finding simplest reversible function during composition

CCN CN A B 0 A A  B (Sum) A and B (Carry) Toffoli Feynman A B AB  0 AB C Mapping of a half-adder Positive Davio Gate Now function is reversible of A,B,C arguments. But we still need to decompose it to known gates A * B  C A B C A  B A Heuristics for finding simplest reversible function during composition

Search is defined by: –selecting function to be realized –selecting a gate type –selecting its forward or backwards matching –selecting other signals to match –selecting constant Garbage functions are becoming less and less undefined in the process of decomposition They can be used for synthesis We adopt classical AI search algorithms (depth-first, breadth-first, A*,best bound, etc) Search

Search cannot be avoided Trade-off between quality of solution and search time The only real improvement is possible through better selection heuristics and better implementation of cell library. Search

b 0101 a  c Q g1 = a  b + b  c a R P  c G2 =  b +  c + start forwardbackward H=  c+b forward + G3 *  c G4 Library matching cooperation of various methods Illustration of cooperation of various methods to design the Kerntopf gate from Fredkin, Toffoli, Feynman gates and inverters. One fan-out gate for input a, inverter for c and two fan-out gates for  c are not shown.

Adaptations of functional decomposition methods

G H... G H G H Ashenhurst-like parallel serial New Curtis Curtis-like

During graph coloring of an incompatibility graph for nodes with minterms of bound set, two conditions are satisfied: there must be 4 colors every color must be used exactly 2 times. G H... We sacrifice this wire for garbage These two signals should be encoded using 4 symbols Bound set Curtis Decomposition

Probability of finding such coloring is increased by having more don’t cares More don’t cares are created by repeating variables in bound and free sets. This principle is the base of all decompositions of reversible functions and relations. Curtis Decomposition

Levelized Structures

Two-Dimensional Lattice Diagrams for reversible logic

Three Types of General Expansions f 01 A f0f0 f1f1 f and A f 0 and f 1 Forward Shannon This is a classical Shannon that you know

Three Types of General Expansions g,h and A g 1 A+h 0 A’ g1g1 h A g 1 A+h 0 A’ Reverse Shannon (b) hoho g This is a reverse Shannon that you do not know Observe that this operator re-introduces the variable A in the middle, the variable that has been reduced in Shannon.

Three Types of General Expansions g 1 A+h 0 A’ A g h 10 g 0 A’+h 1 A g, h, and A g 0 A’+h 1 A and g 1 A+h 0 A’ Reversible Shannon This is a reversible Shannon that you do not know

f garbage g 1010 Z fg X garbage gf h i Y 1 garbage hfgfgh YZ X - - X YZ X X Shannon lattice uses only half of each gate

X Y Z X = =1=0=1= YZ This method is fully algorithmic Variable order selection problem Expansion type selection problem

Applications of levelized expansion method This method can be used to create arbitrary circuits, not only lattices Any constraint on layout size or shape can be imposed. last-resort approachThe expansion method can be used as the last-resort approach when other methods cannot find solution, in order to reduce the number of variables It introduces garbage and constants, but this is unavoidable when functions are not balanced When realizing multi-output functions start from those that are balanced or closest to balanced.

Conclusions New concepts: –(1) Reversible Shannon Expansion for k*k binary Fredkin Gates (k>2) and generalizations - reversible decision diagrams, –(2) Reversible Fredkin Lattice structures for logic based on binary Fredkin gates, –(3) Generalized Composition-Decomposition Methods –(4) Adaptations of Ashenhurst/Curtis decompositions. –(5) Levelized expansions for Shannon and Davio-like gates. –(6) adaptation of BDD-based, decomposition-based and technology mapping methods from standard binary logic

Research topics (1) Multiple-valued reversible gates (2) Multiple-valued quantum logic and synthesis methods (3) Fuzzy reversible logic and synthesis methods (4) Ashenhurst/Curtis-like decompositions of multi-valued reversible logic (5) Levelized expansions for multi-valued Shannon and Davio-like gates. (6) Decision Diagrams for binary and MV reversible logic (7) Genetic Algorithm combined with search for quantum logic (8) Regular structures for MV unate, symmetric, threshold and other functions (9) Visual Software End of Lecture 6