#### Abstract

During the last two decades, significant amount of research has been performed to simplify the detection of transient or soft errors in VLSI-based digital systems. This paper proposes an approach for implementing state machines that uses 2-hot code for state encoding. State machines designed using this approach allow online detection of soft errors in registers and output logic. The 2-hot code considerably reduces the number of required flip-flops and leads to relatively straightforward implementation of next state and output logic. A new way of designing output logic for online fault detection has also been presented.

#### 1. Introduction

It is now widely accepted that transient errors are the major contributor of digital system failure [1β6]. Several techniques have been proposed over the years for designing self-checking combinational circuits and state machines to cope with transient errors [7β14]. An architecture for designing online/offline testable state machines was proposed in [11] that has an advantage over the traditional approaches to self-checking design. This method uses a 1-hot code to encode states, making the next state logic and output logic design straightforward. The disadvantage of the 1-hot code is that it requires *n *flip-flops to encode *n *states, which considerably increases the size of the circuit.

This paper proposes a technique for designing self-checking Mealy-type state machines whose registers and output logic are testable online. In a Mealy-type state machine the output is a function of the present state and current inputs [15]. The testable state machine uses a 2-hot code for state encoding instead of a 1-hot code used in [6]. The advantage of the 2-hot code over the 1-hot code is that it considerably reduces the number of flip-flops needed, while the next state and output logic are still relatively straightforward. Although it is possible to use an m-out-of-n code to encode the states of a state machine, an encoded state will have more 1βs than the 2-hot code in cases where a circuit has more than ten states. As a result the next state logic will require more circuitry, thereby increasing the unreliability of the circuitry. A new method for designing the output logic is also proposed in this paper. This proposed design generates the output and the complement of the output using only transistors and buffers; this approach makes the resulting circuitry more hardware efficient compared to using multiple input logic gates and incurs less overhead than a conventional approach, for example, duplicate and compare [1].

#### 2. Architecture for Online Testable State Machine

A top view of the architecture that can utilized to implement on-line testable state machines is shown in Figure 1; this is a modified version of that presented in [11]. The Output Logic takes in the present state and inputs, and generates the primary output and its complement simultaneously. and its complement can be compared externally to verify that they are the complement of each other. If they are not the complement of each other, there is a fault in the Output Logic.

As stated earlier in the proposed approach of state machine design, a 2-hot code is used to represent the states. A 2-hot code requires more flip-flops but simplifies the next state and output logic. Register represents the present state, and Register , which feeds back into Register , represents the next state. Register and Register have scan out features that allow them to be tested offline. The output of the next state logic is loaded into register . The outputs of Registers and are XORed and then compared by the Even Parity Checker. This determines if there is a transient error in the Next State Logic (details are discussed in the next section). The content of register can also be scanned out to check for permanent fault(s) in the next state logic; this can be done offline.

#### 3. Next State Logic Design

Using a 2-hot code, there are three possible relations between the present state and the next state. If two states have no 1βs in common, they differ by four bits:State 1:ββ β**1**β**1**β**0**β0β**0**β0State 2:ββ β**0**β**0**β**1**β0β**1**β0

If two states have one 1 in common, they differ by two bits:State 1:ββ β0β1β**1**β**0**β0β0State 2:ββ β0β1β**0**β**1**β0β0

If two states have two 1βs in common, they must be the same state.

Therefore, when using a 2-hot code, any two given states must have an even number of differing bits. In Figure 1, the XOR Module gives the number of differing bits between the present and next state, and the Even Parity Checker determines whether or not the XOR has an even number of 1βs. If there is an even number of 1βs in the XOR, then there should not be a single fault in either register nor in the Next State Logic. If there is a single fault in the Next State Logic or in one of the registers, the result may be a faulty 1 or a faulty 0 in the present state or next state. A faulty 1 or a faulty 0 in one of the registers would change the parity of the XOR function from even to odd. If there is an odd number of 1βs in the XOR, then there is a fault in either the Next State Logic or in one of the registers, and it can be observed in the output βNext State Check.β

Register βs values are set by the Next State Logic, using reset/preset on the flip-flops. The implementation of Register is shown in Figure 2. All the flip-flops are reset to 0 on the rising edge of the system clock. After some delay, the Next State Logic sets the appropriate two flip-flops to 1 using preset (denoted by in Figure 2). The Next State Logic should provide enough delay to ensure that the flip-flops have all been reset before the appropriate present state flip-flops are preset.

The Next State Logic may be implemented with only -type transistors, as seen in Figure 3. One possible present state is when the and outputs of Register are 1. In the example in Figure 3, there are two inputs ( and ). If and , and both and are asserted, then a 1 is propagated to the outputs and , which denotes some particular state. This circuit may be repeated for all present states (, , etc.).

#### 4. Output Logic Design

The Output Logic must take in the present state and the inputs, and must generate the output and the bitwise inverse of the output, as seen in Figure 1. The goal here is to minimize the overhead required to generate and . Figure 4 shows the encoding scheme for four possible numbers of states and the transistor design that selects the appropriate state. A shared transistor is used for states that have a 1 in common. Since only one state can be active at a time, only one path can be active at a time, and this path gives the present state.

A similar approach, as shown in Figure 5, is used to design the portion of the circuit that gives the correct combination of inputs that are active.

In Figure 5, every possible input combination points to the corresponding path that is activated. Note that with three inputs there are eight possible input combinations and eight possible paths to be activated, in which one and only one path must be active at any given time. When Figures 4 and 5 are put together, the result gives us all possible combinations of present state and input combinations. Since only one path can be active in Figure 4 and only one path can be active in Figure 5, one and only one path will be active at any time when the two are put together. However, a difficulty arises in trying to connect the present state transistors with the input transistors (or connect Figures 4 and 5). For example, if state 1 is directly connected to inputs 1 and 2, and state 2 is directly connected to inputs 2 and 3 then state 1 will be connected to input 3, thus giving an incorrect value for when state 1 and input 3 are activated. This can be avoided by using buffers to control flow of signals when multiple present state lines fan-in to a single input line. This technique will be illustrated using the following example.

Table 1 shows a transition table for a state machine and the resulting output equations. This state machine has six statesβusing all possible 2-hot combinations of the four state bits, two inputs ( and ), and two outputs ( and ).

The output logic circuit for generating and from the example in Table 1 is shown in Figure 6; the inverters necessary to generate the complements of the inputs are not shown. This design combines the techniques shown in Figures 4 and 5 to give a path for any possible present state/input combinations that make . For example, the transition table in Table 1 shows if , then . It can be seen in Figure 6, if , then a 1 is propagated to . At the same time, a 0 is propagated to not () in the bottom circuit through an equivalent path.

**(a)**

**(b)**

Notice that the right circuit is a replica of the left circuit, except (1) the -type transistors are replaced by -type transistors (2) all the input and state signals are inverted, and (3) the output has a pull-up mechanism instead of a pull-down mechanism. Because the circuits are alike, if a path is activated in the left circuit, then the same path must be activated in the right circuit. Since the left circuit propagates a 1 to the output or otherwise is pulled to 0, and the right circuit propagates a 0 to the output or otherwise is pulled to 1, the outputs will always be the complement of each other in the absence of a fault.

The buffers control the direction of signal flow in the circuit. They also act as amplifiers between multiple transistors connected in series. Since there is a resistance associated with all transistors, it is not desirable to have more than three transistors connected directly in series [16]. The more transistors in series the slower the circuit will be, although the transistors could be made larger than minimum to reduce the delay. In addition fewer transistors in series result in less resistance between the output and the power rails. A general rule of thumb as proposed in [17] is βNo more than 4 -channel or 3 -channel devices in series in any gate.β

It should be noted that the number of buffers in Figure 6 may be reduced by configuring them in a different form. The buffers used in the pull-up circuit (Figure 6(a)) and the buffers used in the pull-down circuit (Figure 6(b)) are different. Figure 7 shows an implementation of these buffers.

**(a)**

**(b)**

The proposed technique has been applied to design a subset of MCNC of circuits selected as suggested in [18]. The results are listed in Table 2. The first column lists the number of transistors in the next state logic (NSL) of the benchmark circuits; similarly the second, third, and the fourth columns show the number of transistors required in the output logic (OL), XOR module (XOR), and parity checker (PAR) in each circuit. The total number of transistors is shown in the fifth column. The number of flip-flops includes Registers, those in register , Register , and the Next State Checking logic of Figure 1.

It should be indicated that although different outputs in a multioutput circuit can share logic, sharing of logic between an output () and its complement () is not allowed in the proposed scheme so that a fault does not affect both output circuits at the same time thus preventing its detection. If there is a fault in one of these shared -type transistors, the fault will be propagated to and , but not to and , therefore the fault will be detected. Similarly, a fault that appears in a shared -type transistor will be propagated only to and but not to or and therefore will also be detected.

The transistor counts in the OL column in Table 2 were derived assuming no sharing of logic across different outputs. Thus the transistor counts may be reduced by possible sharing of logic. For example in Figure 5, output circuits and can share the -type transistors that identify the present state by transmitting a 1. Similarly in Figure 6, the circuits that generate () and () can share the n-type transistors that identify the present state by transmitting a 0. However sharing could increase fan-outs in the circuits thereby requiring more buffers. Figure 8 shows a general layout of shared of transistors in a testable state machine designed using the proposed scheme.

#### 5. Conclusion

This paper has proposed a method for designing state machines with online testability. The XOR Module and Parity Checker allow for online testing of Registers and , and the Next State Logic. This design will detect any single stuck-at fault in the Next State Logic or in the Registers. The proposed technique uses a design approach that is different from that used for designing conventional CMOS-based design; it uses transistors and buffers rather than fully complementary transistors.

#### Acknowledgment

The first author was supported in part by the National Science Foundation USA under Grant 0925080.