An Approach for Implementing State Machines with Online Testability

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.


Introduction
It is now widely accepted that transient errors are the major contributor of digital system failure [1][2][3][4][5][6].Several techniques have been proposed over the years for designing selfchecking combinational circuits and state machines to cope with transient errors [7][8][9][10][11][12][13][14].An architecture for designing online/offline testable state machines was proposed in [11] that has an advantage over the traditional approaches to selfchecking 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 selfchecking 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 2hot 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].

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 F and its complement F simultaneously.F 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.

Scan in Scan out
Scan clock Reset (low-to-high system clock)

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: 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." Figure 4: Example of encoding scheme and realization using transistors.Register Q's values are set by the Next State Logic, using reset/preset on the flip-flops.The implementation of Register Q 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 P 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 flipflops are preset.
The Next State Logic may be implemented with only ptype transistors, as seen in Figure 3.One possible present state is when the R 1 and R 4 outputs of Register R are 1.In the example in Figure 3, there are two inputs (X 0 and X 1 ).If X 0 = 0 and X 1 = 0, and both R 1 and R 4 are asserted, then a 1 is propagated to the outputs P 0 and P 1 , which denotes some particular state.This circuit may be repeated for all present states ({R 1 , R 2 }, {R 1 , R 3 }, etc.).

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 F and F . 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 F 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 (X 1 and X 0 ), and two outputs (F 1 and F 0 ).
The output logic circuit for generating F 1 and F 1 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 F 1 = 1.For example, the transition table in Table 1 At the same time, a 0 is propagated to not (F 1 ) in the bottom circuit through an equivalent path.
Notice that the right circuit is a replica of the left circuit, except (1) the p-type transistors are replaced by n-type transistors (2) all the input and state signals are inverted, and (3) the output has a pull-up mechanism instead of a pulldown mechanism.Because the circuits are alike, if a path is activated in the left circuit, then the same path must be 1 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 n-channel or 3 p-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.
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 R, Register Q, 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 (F) and its complement (F ) 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 p-type transistors, the fault will be propagated to F 0 and F 1 , but not to F 0 and F 1 , therefore the fault will be detected.Similarly, a fault that appears in a shared n-type transistor will be propagated only to F 0 and F 1 but not to F 0 or F 1 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 F 0 and F 1 can share the p-type transistors that identify the present state by transmitting a 1. Similarly in Figure 6, the circuits that generate (F 0 ) and (F 1 ) 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.

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 R and Q, 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 CMOSbased design; it uses transistors and buffers rather than fully complementary transistors.

Figure 1 :
Figure 1: Top view of the proposed architecture.

State 1 : 1 1 0 0 0 0 State 2 : 0 0 1 0 1 0
If two states have one 1 in common, they differ by two bits: have two 1's in common, they must be the same state.

Figure 5 :
Figure 5: Example of the path given by input combinations.

Figure 6 :Figure 7 :
Figure 6: Implementation of circuit to generate F 1 and F 1 .

Figure 8 :
Figure 8: Sharing of transistors in the Output Logic.

Table 1 :
Example FSM transition table and resulting output equations.

Table 2 :
Number of transistors and flip-flops needed for implementing MCNC benchmark circuits.