#### Abstract

Synthesis of reversible sequential circuits is a very new research area. It has been shown that such circuits can be implemented using quantum dot cellular automata. Other work has used traditional designs for sequential circuits and replaced the flip-flops and the gates with their reversible counterparts. Our earlier work uses a direct feedback method without any flip-flops, improving upon the replacement technique in both quantum cost and ancilla inputs. We present here a further improved version of the direct feedback method. Design examples show that the proposed method produces better results than our earlier method in terms of both quantum cost and ancilla inputs. We also propose the first technique for online testing of single line faults in sequential reversible circuits.

#### 1. Introduction

Moore’s law [1] predicted a continuous rise in the number of transistors per chip due to the continuous reduction in feature size. The popular thought is that Moore’s law will no longer hold true in about a decade when the feature size will approach the atomic level. DeBenedictis [2] showed that in CMOS technology feature size is no longer the primary challenge; rather energy dissipation is the new limiting factor. Current CMOS circuits implement Boolean logic networks, where the main contributor to heat generation is the energy in the 0 and 1 signals stored on wires. Each time a signal changes from one state to another and back again, joules of energy are turned into heat, where is the capacitance between the wire and the ground and is the power supply voltage. The most common number cited is , where is Boltzmann’s constant and is the ambient temperature in kelvin [2]. DeBenedictis [2] also stated that adiabatic and reversible logic essentially recycle joules of signal energy many times before dissipating as heat. Consequently, the energy drawn from the power supply could be reduced by as much as 100 times. However, signal energy recycling cannot take place in traditional Boolean networks. Therefore reversible logic may be the next promise for CMOS technology.

In a theoretical study, Landauer [3] stated that irreversible logic operations dissipate of heat energy when a bit of information is lost, where again is Boltzmann’s constant and is the operating temperature in kelvin. In another theoretical study, Bennett [4] showed that, from a thermodynamic point of view, if a circuit is both logically and physically reversible, then heat will not be dissipated. Experiments have shown that dissipation of no heat is not achievable; however, it has been experimentally demonstrated that reversible logic dissipates less heat than the thermodynamic limit of in physically irreversible low-power CMOS logic [5] and physically reversible superconductor flux logic (SFL) [6]. Thus, reversible logic is a favorable choice for low-power emerging computing technologies.

Reversible logic has become realizable in many emerging computing technologies such as superconductor flux logic (SFL) technology [6, 7], optical technology [8, 9], quantum dot cellular automata technology [10, 11], and nanotechnology [12]. In addition, quantum circuits are inherently reversible [13]. This is another reason why reversible logic has become a promising choice for low-power emerging computing technologies.

Reversible logic synthesis attempts have mostly focused on reversible combinational logic synthesis. Some of the most important but nonexhaustive work in this area is [14–23]. However, very few works have investigated reversible* sequential* logic synthesis. The major problem behind this lack of work is the prevailing thought that feedback is not possible in reversible logic and therefore reversible sequential circuits are not possible. However, in 1980, Toffoli [24] argued that if the feedback is provided through a delay element, then the feedback information will be available as the input to the reversible combinational circuit in the next clock cycle and thus a reversible sequential circuit is possible. Moreover, Thapliyal et al. [25] showed that reversible sequential circuits can be implemented using quantum dot cellular automata (QCA) technology by providing appropriate feedback timing by managing the clock of the QCA wire providing the feedback.

This paper presents a further improvement of our earlier work in designing a sequential circuit using direct feedback instead of flip-flops [26]. In addition, to our knowledge no other work has offered any technique for online testing of sequential circuits. Thus we also propose the first method of testing for single line faults in sequential circuits.

The rest of the paper is organized as follows. In Section 2, we discuss background for our proposed design method and related topics. We discuss related work on design of sequential circuits and online testing methods for combinational circuits in Section 3. In Section 4, we present our proposed method of designing sequential circuits. We show design examples in Section 5. In Section 6, we introduce our proposed method of online testing for single line faults in sequential circuits. We also present results for several benchmark circuits. Finally, in Section 8, we conclude the paper.

#### 2. Background

##### 2.1. Reversible Logic

A reversible function is a bijective mapping , where is the number of input variables. A reversible gate (or a circuit) implements a reversible function; that is, it maps the input combination to the output combination in a bijective manner. Thus a reversible gate (or a circuit) has the same number of inputs and outputs. In addition every input combination produces a unique output combination in a reversible circuit, and therefore for every output combination, the corresponding input combination can be uniquely determined.

A reversible circuit is constructed using reversible gates. The commonly used reversible gates are shown in Figure 1. Figure 1(a) shows the symbol of a NOT gate. It complements the input at the output; that is, . Figure 1(b) shows the symbol of a controlled-NOT (CNOT) or Feynman gate. The input is called the control input and its value is passed unchanged to the output; that is, . The input is called the target input. The target output has the value . Figure 1(c) shows the symbol of a three-input Toffoli gate (sometimes referred to as a controlled-controlled-NOT gate or CCNOT gate). The inputs and are called the control inputs and their values are passed unchanged to the outputs; that is, and . The input is called the target input and the target output has the value . Toffoli gates may have more than three inputs, in which case they may be referred to as multiple-controlled Toffoli gates. In an -input Toffoli gate, the first inputs (say ) are the control inputs and the last input (say ) is the target input. The value of the target output is . Figure 1(d) shows the symbol of a controlled swap gate, or Fredkin gate. Input is the control input and inputs and are targets. When the control input value is , then the target inputs and are passed unchanged to the outputs; that is, and . When the control input value is , then the target inputs are swapped at the outputs; that is, and . The outputs and can be expressed as and . When , then and . When , then and .

**(a)**

**(b)**

**(c)**

**(d)**

*Quantum cost* and the number of* ancilla inputs* are widely used as metrics for comparing reversible circuits. Quantum cost refers to the number of primitive quantum gates required to realize the circuit, while ancilla inputs are the constant-initialized working inputs, in addition to the function inputs, that are required for the functionality of the circuit.

NOT and CNOT gates are technology realizable primitive gates, and their quantum costs are assumed to be one. Toffoli and controlled swap gates are macro-level gates and must be realized through a combination of primitive quantum gates. The three-input Toffoli gate and the controlled swap gate can be realized using five primitive quantum gates [27, 28] and thus their quantum cost is five each.

Realization of multiple-controlled Toffoli gates from primitive quantum gates is presented in [29], where quantum costs for up to 16-input Toffoli gates are reported. The quantum costs for 4-input, 5-input, and 6-input Toffoli gates are 14, 20, and 32, respectively.

In [30], extended Toffoli gates (ETG) are proposed, which have two target outputs. ETGs are very useful in online testing of reversible combinational circuits. In Figure 2(a), the extended Feynman gate (EFG) and its logic level implementation are shown. The quantum cost of the EFG is 2. In Figure 2(b), a 2-control ETG and its logic level implementation are shown. The quantum cost of an ETG is 2 plus the quantum cost of the corresponding Toffoli gate. The quantum cost of the ETG in Figure 2(b) is 5 + 2 = 7.

**(a)**

**(b)**

##### 2.2. Reversible Logic Synthesis Using ESOP Expressions

An exclusive-OR sum of products (ESOP) expression is similar to a conventional sum of products (SOP) expression, except that product terms are combined with exclusive-OR (EXOR) operators rather than OR operators [31]. A common technique in reversible logic synthesis is to express the logic function as an ESOP expression and then realize the ESOP expression as a cascade of NOT, CNOT, and Toffoli gates [32]. An example ESOP expression is given in (1) and its reversible realization as a cascade of NOT, CNOT, and Toffoli gates is shown in Figure 3.

##### 2.3. Sequential Circuits

The classical model of a sequential circuit is shown in Figure 4. A sequential circuit has a memory whose content during the present clock cycle is called the present state. The combinational circuit produces the output as a function of the present state and the input. The combinational circuit also produces the next state as a function of the present state and the input; this computed next state becomes the present state during the next clock cycle. The behavior of a sequential circuit is described using a state transition diagram. In describing a sequential circuit the present state is represented by and the next state is represented by . An example sequential circuit is shown in the state transition diagram in Figure 4. It has 1-bit input (), 1-bit output (), and 2-bit state (). The reset state is 00.

**(a)**

**(b)**

##### 2.4. Testing of Reversible Circuits

Testing is very important to ensure quality, availability, and reliability of a circuit. There are two approaches to circuit testing: offline testing and online testing [33]. In offline testing, a circuit is tested when it is not in normal operation. In online testing, however, the circuit must be able to continue normal operations while testing is carried out. For online testing additional circuitry is generally added to the original circuit to determine whether the circuit is faulty or not. There are three fault models: line faults (or bit faults) [33], missing control faults, which is one instance of crosspoint faults [34], and missing gate faults [35]. In a line fault, the logic value of a line is flipped and produces faulty output. In a missing control fault, the control point of a gate either is not working or disappears from the gate, resulting in an incorrect value for the target output. In a missing gate fault, the entire gate does not work or the gate disappears from the circuit causing faulty output.

#### 3. Related Work

In this section, we discuss related work on reversible sequential circuit design and on online testing of reversible combinational circuits.

##### 3.1. Related Work on Reversible Sequential Circuit Design

There are many attempts at designing reversible latches, flip-flops, and sequential circuits. Some important but nonexhaustive work on reversible sequential logic design includes [25, 26, 36–42]. References [36–39] present reversible designs for latches and flip-flops using reversible gates and suggest that sequential circuits be synthesized by replacing the latches, flip-flops, and gates of the combinational part of the traditional irreversible designs with their reversible counterparts. Following this replacement approach, the work in [40] presents a design for a four-bit falling-edge-triggered universal register and the work in [41] presents a design for a four-bit level-triggered up counter with asynchronous parallel load. The work in [25] again uses the replacement technique and demonstrates that reversible circuits can be implemented using QCA technology with offline testing of the QCA-based sequential circuit. The work in [42] offers the first attempt to synthesize a sequential circuit using direct feedback of the state output and without using any flip-flops. Reference [42] also presents a design for a level-triggered up counter using positive polarity Reed-Muller expressions for representing the next states. The up counter design is more efficient than the replacement design in [41] in terms of both quantum cost and garbage outputs (outputs that are not used for the intended circuit realization). The next step to this work is presented in [26], which details the direct design of arbitrary sequential circuits using pseudo-Reed-Muller expressions for representing the next states. This work also introduces modifications making the circuit falling-edge triggered and asynchronous loadable. The up/down counter in [26] is better than that in [41] in terms of both quantum cost and garbage outputs, and the universal register in [26] improves upon the design in [40] again for both quantum cost and garbage output.

A further improvement of the work in [26] is presented in [43]. In [43], a new technique for representing the next states using exclusive-OR sum-of-product (ESOP) expressions is presented. Using this technique, designs for a four-bit falling-edge triggered up/down counter with asynchronous loading and a four-bit falling-edge triggered universal register are presented. Both designs in [43] offer improvements over those from [26] in terms of both quantum cost and ancilla input. This work is an extended version of [43].

##### 3.2. Related Work on Testing of Reversible Combinational Circuits

Several works offer techniques for online testing of reversible combinational circuits. Some propose new testable gates which are then used to construct online testable reversible circuits. In [17] three new reversible gates are proposed, two of which are used to design an online testable block and the other is used to create a checker circuit. The checker circuit compares the two parity bits produced by the online testable blocks in order to test a single bit fault. In [23] an improved approach to single bit fault testing is proposed that does not require a checker circuit.

The most generalized approaches offer online testing of reversible circuits synthesized using NOT, CNOT, and Toffoli gates. In [44], all of the Toffoli gates are replaced by extended Toffoli gates, and two sets of CNOT gates and one additional parity line are added to the original circuit to achieve online testability for single line faults. In [45], a DFT- (design for testability-) based offline approach is proposed for detecting single missing gate faults. In [46], an online fault detection approach is proposed for detecting single missing gate faults. In [47], each of the Toffoli gates is accompanied by a duplicate Toffoli gate of the same size with the same control lines, but the target is placed on an additional parity line to make the Toffoli gate a testable Toffoli block. Two sets of CNOT gates are also used, for which the targets are the parity line. This approach detects all three types of faults.

To the best of our knowledge, no work has been reported in the literature on offline or online testing of reversible sequential circuits.

#### 4. Synthesis of Sequential Reversible Circuits

In this section, we present our proposed method for synthesis of sequential reversible circuits.

##### 4.1. Representing the Next State

Let and be the present state and the next state of a sequential circuit, respectively. can be expressed as a function of and as follows: where

We call the modified next state. In our proposed technique, the modified next state is determined using (3) and is expressed as a minimized ESOP expression of a function of the inputs and the present state. The next state is then expressed using (2).

##### 4.2. Synthesis Model

Our model for the reversible synthesis of sequential circuits is shown in Figure 5. First the modified next state is generated, as a function of the inputs and present state, in the Modified Next State Logic section. The next state is generated using (2) in the Next State Logic section. The generated next state is loaded to the state output as the present state at the falling-edge of the clock in the Falling-Edge Trigger section. The asynchronous reset or load is carried out in the Asynchronous Load section. The feedback of the present state is generated in the Feedback section and the present state is fed back to the Modified Next State Logic section. Finally, in the Output Logic section, the output is generated as a function of the input and the present state. The following examples explain the use of this model.

#### 5. Design Examples

In this section, we use three examples to illustrate the design model discussed in Section 4.2.

##### 5.1. Example 1: Sequential Circuit from Figure 4(b)

The truth table representing the next states , the modified next states , and the output of the sequential circuit in Figure 4(b) is shown in Table 1. The modified next states and the output are minimized as ESOP expressions as follows: Equations (4), (5), and (6) are then used to implement the state machine from Figure 4(b), resulting in the circuit shown in Figure 6. Each section of this circuit is explained below.

*(1) Modified Next State Logic*. The modified next states and (see (4) and (5)) are realized as functions of the input and the fed-back present states and as a cascade of NOT, CNOT, and Toffoli gates. The quantum cost of this section is 28 and 2 ancilla inputs are required.

*(2) Next State Logic*. The next states are realized as and using the generated modified next states and and fed-back present states and . This requires two CNOT gates, and thus the quantum cost of this section is exactly equal to the number of bits in the state of the sequential circuit, since for each bit a CNOT gate is required and the quantum cost of the CNOT gate is 1. No ancilla inputs are required.

*(3) Falling-Edge Trigger*. The falling-edge triggering is achieved using two controlled swap gates controlled by the clock . When the clock and reset , the fed-back states are passed to the state outputs, maintaining the state outputs unchanged. When the clock is set to and is maintained, then the generated next states are transmitted to the state outputs. Just after the next states arrive at the state output and the feedback of the present states arrives at the Falling-Edge Trigger section, the clock must be set to in order to maintain the new present state at the output. Thus, the changes of the present states occur at the falling-edge of the clock and the duration of the period of has to be very carefully determined to avoid malfunction of the circuit. The quantum cost of this section is 5 times the number of bits required for the state of the sequential circuit, since for each bit a controlled swap gate is required and the quantum cost of the controlled swap gate is 5. Thus the quantum cost of this section is 10, and no ancilla inputs are required.

*(4) Reset*. The reset is achieved using two controlled swap gates controlled by the reset input . In the sequential circuit represented by Figure 4, the reset state is 00. During synchronous operation, the clock must be set to and the reset must be cleared to to maintain the present state unchanged. For the falling-edge triggering action, the clock and the reset must both be cleared to . The reset action takes place asynchronously when the clock and the reset are both set to . In this case, the constant inputs 00 are transmitted to the state outputs. At this point, the reset must be set to in order to maintain the state outputs unchanged. Again, the duration of the reset value must be carefully determined to avoid malfunction of the sequential circuit. The quantum cost of this section is also 5 times the number of bits in the state of the sequential circuit, since for each bit a controlled swap gate is required and the quantum cost of the controlled swap gate is 5. This section requires ancilla inputs exactly equal to the number of bits in the state. Thus the quantum cost of this section is 10 and 2 ancilla inputs are required.

*(5) Feedback*. The feedback of the present state is generated using two CNOT gates used as copying gates and is achieved by setting the target input to be 0. The quantum cost of this section is exactly equal to the number of the bits in the state of the sequential circuit, since one CNOT gate is required for each bit of the state and the quantum cost of the CNOT gate is 1. This section requires ancilla inputs exactly equal to the number of bits in the state of the sequential circuit, since for each bit of the state one constant-initialized input is required. The quantum cost of this section is 2 and 2 ancilla inputs are required.

*(6) Output Logic*. The output is realized as a function of the input and the present state using (6).

The total quantum cost of the circuit in Figure 6 is 53 and 6 ancilla inputs are required. These values are compared with those of the replacement design approach in [26] and the direct design in [26] in Table 2. The % improvement over previous designs is calculated using the formula From Table 2, we see that our new present design technique saves significantly on quantum cost and ancilla inputs as compared to both previous replacement design technique and the direct design technique presented in [26].

##### 5.2. Example 2: 4-Bit Up/Down Counter

In this section, we illustrate the application of our technique to the design of a four-bit falling-edge trigged up/down counter with asynchronous load. The truth table representing the next states and the modified next states of the counter is shown in Table 3. The modified next states of the four-bit up counter from Table 3 are minimized as ESOP expressions as follows: Similarly, the modified next states of the four-bit down counter are minimized as ESOP expressions as follows: The complete counter is implemented using the ESOP expressions (8) to (15) and the resulting reversible circuit is shown in Figure 7 where is the clock input; the input performs the asynchronous load with for normal operation and for asynchronous load; and the input determines the count direction with for up and for down. The design is similar to that of the previous example (Example ). The operation of the circuit is discussed below.

*(1) C = 1 and L = 1: Asynchronous Load*. The data inputs , , , and are loaded to the present state outputs , , , and (respectively) through the controlled swap gates that make up the Asynchronous Load section of the circuit. After loading the input data, we set to maintain the present state output.

*(2) M = 0: Modified Next State Generation for Up Count*. The six -controlled CNOT gates of the Modified Next State Logic section will not modify the logic values of their targets and the fed-back state values , , , and remain unchanged. These fed-back state values are used in the Modified Next State Logic section to generate modified next states , , , and (see (8) to (11)).

*(3) M = 1: Modified Next State Generation for Down Count*. The first three CNOT gates controlled by complement the fed-back present states , , , and . These complemented values are used in the Modified Next State Logic section to generate modified next states , , , and (see (12) to (15)). The last three CNOT gates of the Modified Next State Logic section restore the fed-back present states for use in the Next State Logic section of the circuit.

The circuit in Figure 7 has a quantum cost of 74 and requires 8 ancilla inputs. The complexity of our design is compared with that in [26] as shown in Table 4. From the table, we see that the present design saves quantum cost with no increase of ancilla inputs.

##### 5.3. Example 3: 4-Bit Universal Register

In this section, we illustrate the synthesis process for a four-bit falling-edge triggered universal register. The truth table representing the next states and the modified next states is shown in Table 5, where is the serial data input. The modified next states , , , and are minimized as ESOP expressions as follows: Using (2), the next states corresponding to (16) to (19) can be determined as follows: Similarly, the next states of a four-bit serial-in serial-out left-shift register can be determined as follows, where is the serial data input: Equations (20) to (27) are implemented with reversible gates to build the circuit shown in Figure 8. Multiplexing is needed for implementing right-shift and left-shift: between and for , between and for , between and for , and between and for . This is implemented using four controlled swap gates controlled by the shift direction control input in the Next State Logic section of the circuit. Implementations of the other sections are similar to those in Figure 7. The different modes of operations are explained below.

*(1) C = 1 and L = 0: Serial-In Serial-Out Register*. If , expressions (20) to (23) are implemented by the Next State Logic section and data is shifted right. If , expressions (24) to (27) are implemented and data is shifted left. When is changed to 0, the next states are passed to the present state outputs through the Asynchronous Load section of the circuit.

*(2) Serial-In Parallel-Out Register*. The operation is similar to step and the present state outputs are taken in parallel.

*(3) C = 1 and L = 1: Parallel-In Parallel-Out Register*. The parallel input values , , , and are loaded to the present state outputs through the Asynchronous Load section by setting and then changing to . Outputs are taken in parallel.

*(4) Parallel-In Serial-Out Register*. The asynchronous load operation is similar to step . After setting , if is changed to 0, the states will be shifted to either right or left based on the value of .

The quantum cost of the circuit in Figure 8 is 74 and 14 ancilla inputs are required. The circuit complexity is compared with that of previous work in Table 6. From the table, we see that the present design saves both quantum cost and ancilla inputs as compared to the replacement design in [40]. It is to be noted that in [40] the number of ancilla inputs is not mentioned. We count only the 0-initialized working inputs as ancilla inputs and do not include a large number of control inputs as ancilla inputs. The present design also saves on quantum cost as compared to the direct design in [26], but requires slightly more ancilla inputs.

#### 6. Online Testable Design of Sequential Circuits

In this section, we introduce our proposed technique for online testing of single line faults in sequential circuit. We focus only on single line faults because some of the missing control fault and missing gate fault situations can be treated as single line faults. For example, if a missing control fault inverts the original target output of the gate, then that fault can be treated as a single line fault at the target output of the gate. Similarly, if a gate produces an inverted output at the target, then the missing gate will not produce that inversion and this condition can be treated as a single line fault at that position. Thus online detection of single line faults also detects some missing control and missing gate faults.

##### 6.1. Online Testing of Single Line Fault in Toffoli Circuits

A Toffoli circuit is a cascade of NOT, CNOT, and Toffoli gates. In [44], a method for online detection of single line fault in Toffoli circuits is presented. The method in [44] is as follows:(1)A 0-initialized parity line is added to the given circuit.(2)Assume that the given circuit has inputs/outputs. At the beginning of the circuit, CNOT gates are added, where the controls of the CNOT gates are the input lines and the target of all the CNOT gates is the parity line .(3)All CNOT and Toffoli gates of the given circuit are replaced by their corresponding extended versions (EFGs and ETGs, respectively). The second target of all gates is the parity line .(4)The NOT gates in the given circuit are retained. If the number of NOT gates in the given circuit is odd, then an extra NOT gate is added at the end of the parity line .(5)At the end of the circuit, CNOT gates are added, where the controls of the CNOT gates are the input lines and the target of all the CNOT gates is the parity line .(6)If the circuit is fault free then the parity output will be 0, otherwise it will be 1.

##### 6.2. Online Testing of Single Line Faults in Fredkin Circuits

A Fredkin circuit is a cascade consisting of only Fredkin (controlled swap) gates. To our knowledge, there is no existing work on offline or online testing of Fredkin circuits. We propose here a technique for online testing of single line faults in Fredkin circuits. The procedure is as follows:(1)A 0-initialized parity line is added to the given circuit.(2)Assume that the given circuit has inputs/outputs. At the beginning of the circuit, CNOT gates are added, where the controls of the CNOT gates are the input lines and the target of all the CNOT gates is the parity line .(3)At the end of the circuit, CNOT gates are added, where the controls of the CNOT gates are the input lines and the target of all the CNOT gates is the parity line .(4)If the circuit is fault free then the parity output will be 0, otherwise it will be 1.

A simple example of the above technique is shown in Figure 9. In a controlled swap gate the target inputs are either swapped or not swapped depending on the control value. Thus the outputs of a controlled swap gate are a permutation of the inputs. Similarly, the outputs of a Fredkin circuit are a permutation of the inputs. In Figure 9, the parity output is computed as If there is no single line fault in the circuit, then the parity output of (28) will be 0, since each pair (input, output) will be canceled. If any single line fault occurs anywhere in the circuit, then any of where will be inverted at the output. Thus, the parity output will be 1, since . If a single line fault occurs at any point in the parity line the parity output will also be 1, since if any subexpression in (28) is inverted, then will be 1.

##### 6.3. Online Testing of Single Line Faults in Sequential Circuits

In our proposed method for online testing of single line faults in sequential circuits, we use the technique in [44] for testing the Toffoli circuits in the (i) Modified Next State Logic and Next State Logic sections together and test the (ii) Feedback section and (iii) Output Logic section separately. We then use our proposed technique for online testing of single line faults in Fredkin circuits in the Falling-Edge Trigger and Reset/Asynchronous Load sections together.

The online testable version of the reversible sequential circuit in Figure 6 is shown in Figure 10. The design of the testable circuit is described below:(1)The Modified Next State Logic and Next State Logic sections together are a Toffoli circuit. We make this circuit testable by adding 0-initialized parity input . This portion of the circuit has five active inputs: , two 1-initialized inputs, , and . Five CNOT gates are added at the beginning of this portion and another five CNOT gates are added at the end of this portion. One CNOT gate and three Toffoli gates in the original circuit are replaced by their corresponding extended versions. There are three NOT gates in the original circuit, so an extra NOT gate is added along the parity line. If any single line fault occurs in this section, then the parity output will be 1, otherwise it will be 0. The overhead quantum cost of this section is 20.(2)The Falling-Edge Trigger and Asynchronous Reset sections together are a Fredkin circuit. We make this circuit testable by adding 0-initialized parity input . This portion of the circuit has eight active inputs: , , , , , , and two 0-initialized inputs. Eight CNOT gates are added at the beginning of this portion and another eight CNOT gates are added at the end of this portion. If any single line fault occurs in this section then the parity output will be 1, otherwise it will be 0. The overhead quantum cost of this section is 16.(3)The Feedback section of the circuit is a Toffoli circuit. We make this circuit testable by adding 0-initialized parity input . This portion of the circuit has four active inputs: , , and two 0-initialized inputs. This portion of the circuit is made testable using the technique described in Section 6.1. If any single line fault occurs in this section then the parity output will be 1, otherwise it will be 0. The overhead quantum cost of this section is 10.(4)The Output Logic section of the circuit is a Toffoli circuit. We make this circuit testable by adding 0-initialized parity input . This portion of the circuit has two active inputs: and . This portion of the circuit is made testable using the technique described in Section 6.1. If any single line fault occurs in this section then the parity output will be 1, otherwise it will be 0. The overhead quantum cost of this section is 5.(5)Multiple line faults in different sections can be detected simultaneously. Therefore, from the parity outputs, fault sections can be located.

The total overhead quantum cost of the circuit in Figure 10 is 20 + 16 + 10 + 5 = 51. The quantum cost of the original circuit in Figure 6 is 53. Therefore, the quantum cost overhead of the testable circuit is only 96.23%.

#### 7. Experimental Results

The process for designing the sequential reversible circuit and adding the gates for testability was applied to several sequential benchmarks from the MCNC suite of benchmarks [48]. As shown in Table 7, the additional circuitry required for making the sequential reversible circuit testable adds an average of 30% overhead, in terms of quantum cost. The highest percentage overhead occurs for the smallest circuits; this is a result of needing to copy the input and output lines several times. In larger circuits, the percentage overhead is significantly lower.

#### 8. Conclusion

In this work, an improved synthesis approach for sequential reversible circuits is presented. Three design examples are demonstrated, including an arbitrary sequential circuit with 2-bit states, 1-bit input, and 1-bit output (Figure 4); a four-bit falling-edge triggered up/down counter with asynchronous load and a four-bit falling-edge triggered universal register are shown. We compare the quantum cost and the ancilla inputs of the three designs with both the replacement design technique and the direct design technique reported in [26]. The new design of the sequential circuit in Figure 4 saves 44.79% and 39.77% in quantum cost and 66.67% and 33.33% in ancilla inputs as compared to the replacement design and direct design in [26], respectively. The new counter design saves 21.28% in quantum cost with the same number of ancilla inputs as compared to the design in [26]. The new register design saves 66.36% in quantum cost and 22.22% in ancilla inputs as compared to the replacement design in [40]. The register design also saves 33.93% in quantum cost with a 16.67% increase in ancilla inputs over that in [26].

We also present an online testable design for sequential reversible circuits for detecting single line faults. The technique presented in [44] is used for testing Toffoli-cascade portions of the circuit. For testing sections of the circuit built from controlled swap gates we propose a new testing technique. The testable design can simultaneously detect multiple single line faults in different sections of the circuit. As shown in Figure 10 the online testable version of Figure 6 requires only 96.23% quantum cost overhead. Furthermore, tests of several benchmarks indicate that as the circuit complexity grows the percentage overhead required for testability decreases.

Future work includes automation of the mapping process and consideration of online testability for all three fault models.

#### Disclosure

The first author did most of his work at the University of Lethbridge while on sabbatical from East West University, Dhaka, Bangladesh.

#### Conflicts of Interest

The authors declare that there are no conflicts of interest regarding the publication of this paper.

#### Acknowledgments

The second author was supported by a grant from Canada’s National Science and Engineering Research Council (NSERC) while pursuing this research.