230 likes | 538 Views
Fredkin/Toffoli Templates for Reversible Logic Synthesis. by. Dmitri Maslov. Dmitri Maslov. Gerhard Dueck. Michael Miller. ICCAD, November 11, 2003, San Jose, CA. Outline. Basic definitions Synthesis Procedure The Templates (definition, classification, application) Results.
E N D
Fredkin/Toffoli Templates for Reversible Logic Synthesis by Dmitri Maslov Dmitri Maslov Gerhard Dueck Michael Miller ICCAD, November 11, 2003, San Jose, CA
Outline • Basic definitions • Synthesis Procedure • The Templates(definition, classification, application) • Results page 1/20 ICCAD, San Jose, CA November 11, 2003
Basic Definitions Definition. Multiple output Boolean function is called reversible iff: 1. 2. - is a bijection. In reversible logic fan-outs and feed-back conventionally are not allowed, thus any network is a cascade. page 2/20 ICCAD, San Jose, CA November 11, 2003
Basic Definitions … NOT Toffoli CNOT (Feynman) Generalized Toffoli Toffoli type gates page 3/20 ICCAD, San Jose, CA November 11, 2003
Fredkin gates are the controlled SWAPs. Fredkin gates can be effectively simulated by a Toffoli gate and two CNOTs. Basic Definitions page 4/20 ICCAD, San Jose, CA November 11, 2003
Synthesis Procedure The Basic Algorithm Assume the function is given in a truth table as a reversible specification. Start creating the cascade from its end: transform the output to the form of the input. Transform the output pattern to the form of input in lexicographical order. While working with the pattern of higher order do not affect patterns with lower order. page 5/20 ICCAD, San Jose, CA November 11, 2003
1 10 1 Synthesis Procedure S2 000 001 010 011 100 101 111 110 S3 000 001 010 011 100 101 110 111 S1 000 010 001 011 100 110 111 101 in 000 001 010 011 100 101 110 111 out 100 110 101 111 000 010 011 001 Final circuit page 6/20 ICCAD, San Jose, CA November 11, 2003
Synthesis Procedure Further Improvements Bidirectional modification: while synthesizing a network the gates can be assigned at both sides. Output permutation. Control input reduction: there may be more than one possible assignment of controls. Apply templates. page 7/20 ICCAD, San Jose, CA November 11, 2003
Templates as a Simplification Tool As 3 gates can be rewritten by a sequence of 2, some s gates can be rewritten as a sequence of k gates (k<s). • Network simplification approach. • preprocessing: find as many rewriting rules as possible. • simplify by matching rewriting rules and rewriting the circuit. page 8/20 ICCAD, San Jose, CA November 11, 2003
Templates as a Simplification Tool • Problems in such naive approach. • The number of rewriting rules is very large: a. For s=3, k=2 and n=3 (number of lines) the number of rewriting rules is 180 (using Toffoli gates only). b. Many rewriting rules are redundant. c. The number of non-redundant rewriting rules only grows exponentially on n. 2. Very often a rewriting can be applied only when certain gates are moved. page 9/20 ICCAD, San Jose, CA November 11, 2003
Observation 1. If one has a rewriting rule then the gates in it satisfy equation Observation 2. If we have an identity then for any parameter p, is a valid rewriting rule. Observation 3. If , then The Templates: Definition page 10/20 ICCAD, San Jose, CA November 11, 2003
Given G0G1…Gm-1, a template of size m, its application for parameter p, is: for The Templates: Definition A size m template is a cascade of m gates which realizes the identity function. Any template of size m should be independent of smaller size templates, i.e. application of smaller templates does not decrease the number of gates in a size m template. page 11/20 ICCAD, San Jose, CA November 11, 2003
F E B A G F C D E G D A C B The Templates: Definition Example. Template ABCDEFG. p=4. Starting gate B. Direction: backward. F E G D A C B m2 How many rewriting rules are there in one template? Parameter p: m/2 choices. Starting gate i: m choices. Directions of application: 2 (forward, backward). page 12/20 ICCAD, San Jose, CA November 11, 2003
The Templates: Classification A class of Toffoli-Fredkin templates is defined as an identity with certain conditions on the form of gates in it. Box gate: - Line with the box is either NOT or SWAP. - All the boxes on the same line are of the same type. - If a line with a box has a NOT or a SWAP on it, the box is necessarily substituted with NOT. page 13/20 ICCAD, San Jose, CA November 11, 2003
Class 1: duplication deletion. Class 2: passing rule. The Templates: Classification page 14/20 ICCAD, San Jose, CA November 11, 2003
Group: link Group: Fredkin definition Group: semi-passing The Templates: Classification page 15/20 ICCAD, San Jose, CA November 11, 2003
Class 3: main template. Class 4: fttftt template. The Templates: Classification page 16/20 ICCAD, San Jose, CA November 11, 2003
The Templates: Application In a program realization: • use size 4 templates to move gates – moving rule. Semi-passing templates are used to pass the gate that does not change. • for other templates apply smaller templates first (in a sense, smaller template does a more general transformation). - given a template, match it by trying both directions, starting with any gate and trying to move other gates by the moving rule. page 17/20 ICCAD, San Jose, CA November 11, 2003
The Templates: Application page 18/20 ICCAD, San Jose, CA November 11, 2003
semi-passing passing The Templates: Application page 18/20 ICCAD, San Jose, CA November 11, 2003
Results Number of reversible functions of size 3 using a specified number of Toffoli-Fredkin gates. More than 77% of synthesized functions are optimal. Average gate count of the synthesized Toffoli-Fredkin circuit is less than optimal gate count for Toffoli network. page 19/20 ICCAD, San Jose, CA November 11, 2003
Results Benchmark synthesis results * - when the function is not reversible, it was synthesized in its minimal reversible specification. page 20/20 ICCAD, San Jose, CA November 11, 2003
Fredkin/Toffoli Templates for Reversible Logic Synthesis END Thanks for Your attention!