Crossing The Synch Asynch
Crossing The Synch Asynch
The most difcult aspect of computer design has always been timing. Many early computers (e.g., the ILLIAC and the DEC PDP-6) were asynchronous; these systems designers felt that asynchronous machines were modular because timing issues could be localized to small parts of the machines. As late as the 1980s, asynchronous bus protocols were still common (such as DECs UNIBUS and the original SCSI protocol, which is still supported by modern SCSI devices). But the difculties of crossing from one clock domain to another spelled doom for asynchronous protocols, at least in small systems such as PCs, and today the standard approach is to provide the system designer with a hierarchy of clocks, all driven through gearboxes by a single central master. (The gearboxes are circuits that generate slave clocks, which are rational multiples of the master clock.) In larger systems, such as local-area networks, this is impossible, and such systems must cope with having several independent clock domains. The trend in VLSI is that the chips get larger, the clocks get faster, and everything gets more complicated. We can expect that tomorrows chips will look like todays local-area networks: the number of clock cycles required to get from one end of the die to the other will increase dramatically. This means that the gearbox approach will become more and more difcult to maintain, because a single wire might span several clock cycles, and the designer will nd it difcult to ensure that, for instance, setup and hold times are maintained. A way to deal with the increasing design complexity of VLSI systems is to bring back asynchrony. Several groups have had considerable success with entirely asynchronous systems [19, 4, 20, 5]; others have pursued the globally asynchronous, locally synchronous (GALS) paradigm, rst suggested by Chapiro in 1984 [3]. In either case, the issue of interfacing synchronous and asynchronous domains arises.
The authors are with the Computer Science Department of the California Institute of Technology, Pasadena, CA 91125, U.S.A.
"! #
Synchronous and asynchronous design methodologies are based on a simple principle: design composable subsystems in such a way that if the subsystems environments satisfy certain assumptions, then the subsystems themselves will present such environments to their neighbors. For synchronous systems, these assumptions take the form of the circuits having to maintain legal logic levels within certain setup and hold times. One might think that asynchronous circuits naturally make weaker demands on their environments since the clock has been removed. This is not necessarily so. In all asynchronous design methodologies, the synchronous level and timing requirements are replaced by certain handshaking requirementsrequirements on the ordering of signal transitions. This means that sampling a signal from a synchronous system within the asynchronous framework is fraught with difculty, much like the converse operation of sampling an asynchronous signal within the synchronous framework. With care, however, an asynchronous system can sample an unsynchronized signal with zero probability of synchronization failure. We shall review the main source of trouble: metastability; secondly, we shall investigate efcient solutions to a few typical problems: (1) the synchronizer problem, which is concerned with absorbing an arbitrarily varying signal into a four-phase signalling scheme; and (2) implementation of an asynchronous timer without introducing metastability.
In the late 1960s, designers of synchronous systems that engaged in high-speed communications between independent clock domains found a new class of problems related to accepting an unsynchronized signal into a clock domain. A device that can reliably and with bounded delay order two events in time cannot be constructed under the assumptions of classical physics. The basic reason for this is that such a device would have to make a discrete decisionwhich event happened rstbased on a continuous-valued inputthe time. Given an input that may change asynchronously, if we attempt to design a device that samples its value and returns it as a digital signal, we must accept that the device either may take unbounded time to make its decision or that it may sometimes produce values that are not legal ones or zeros but rather something in between. The failure of such a device to produce a legal logic value is called synchronization failure; Chaney and Molnar provided the rst convincing experimental demonstration of synchronization failure in 1973 [2]. Synchronous designers must accept a certain risk of system failure, which can be traded against performance, as discussed in the literature [21]. Synchronization failure may be avoided by making the sampling system completely asynchronous. In such a system, no clock demands that the system make its decision after a certain, xed amount of time and system operation can be suspended until the decision has been resolved. The device that determines whether a particular event happened before or after another is called an arbiter. A typical CMOS arbiter is shown in Figure 1. This is the familiar R-S latch with a ltering circuit on the output. In contrast to how this device is used in synchronous circuits, the arbiter is allowed to go into the metastable state if the two inputs arrive nearly simultaneously. The ltering circuit on the output (a pass-gate-transformed pair of NOR gate/inverter hybrids) ensures that the arbiter outputs and do not change until the internal-node voltages (on and ) are separated by at least a -transistor threshold voltagewhich means that the internal nodes have left the metastable state. At that time, the arbiter has made up its mind, and there is no possibility of an output glitch. If the rest of the system can wait until the arbiter asserts one of its outputs, which could take forever, then there is no possibility of synchronization failure. We stress that even though the arbiter could take forever, in practice, it rarely takes very long to exit the metastable state. In fact, this is 2
8 5 4 01 0 ' % 976632)(&$ A @ D
filter
s a
b t v
A rule means that the variable is set to when the condition is . Rules of the form correspond to pull-down chains, and correspond to pull-up chains. These production rules correspond to the circuit shown in Figure 1. The arbiter is specied by the following handshaking expansion (HSE)[18]:
T Q H SRG)G
qb dYa E y wu s xvtr
F E
q 7W qdb c 7W c db
Q IH P)G
2.5
2.1 The Synchronizer As we have seen, the arbiter can misbehave (have glitches) when an input is asserted and then withdrawn before being acknowledged. This means that we cannot use an arbiter to sample a completely unsynchronized external signal, something that is for instance required by the interrupt mechanism on a MIPS microprocessor [9]. A circuit that solves this more difcult problem is called a synchronizer. The synchronizer has two inputs: a control input and an input signal that is to be sampled. The specication of the synchronizer is, informally, that it waits for the control signal to be asserted and then samples the input. We are attempting to build the circuit so that it can be part of a QDI asynchronous system; therefore, the synchronizer produces a dual-rail output with the two rails or . representing the value of the sample input: either Using handshaking expansions, the program for the synchronizer is given by
where is the input being sampled, is the control input, and the pair is the dual-rail output. When the environment asserts , the synchronizer springs into action and samples , returning the observed value by asserting either or . What makes the implementation of this circuit challenging is that may change from true to false and vice versa at any time. If the input
uQ It o dpI s
y wu s xv7r
Q I
o I
k 6I
cg jd e c d2U
3 h qg a e !ih fe h !!vU 3 q a
1.5
0.5
has a stable value within a nite, bounded interval around the time the control input arrives, , the circuit asserts ; otherwise, the circuit asserts the circuit asserts ; if the input is a stable either or , but not both. In practice, the confusion interval will be a very short time indeed, approximately the delay of the single inverter used to invert the input. The confusion interval is analogous to the setup and hold times of a latch; however, as opposed to a latch, the synchronizer is required to operate correctly (albeit non-deterministically) even if the input changes in this interval. What makes the implementation of the synchronizer difcult is that it must work correctly when the input changes during the confusion interval. Implementing a synchronizer properly is so difcult that it is usually avoided: for instance, Marshall et al. avoid it by detecting the withdrawal of a request and resetting their entire system [13].
By keeping in mind the metastability argument of the previous section, we arrive at a correct synchronizer design through a top-down derivation. The synchronizer is given by the following handshaking expansion:
whose environment is described by Unfortunately, this specication of is not directly implementable. To see why, consider that the program has to do two things to advance from the wait for to : rst, it must lock out the second guard, so that cannot happen; secondly, it must actually perform the assignment . If should change after the second guard has been locked out but before the rst guard has proceeded, the program will deadlock. There is an inherent race condition that we have to remove; it is obvious that we shall have to remove it by introducing intermediate states before and . and that are used to hold the values and We introduce explicit signals respectively. We augment with assignments to and :
We introduce an explicit handshaking expansion to use the newly introduced signals and . The result is: produce outputs
and
G V k lI qQ 3I
Q U
qo ppI
o 2U
G h &6I V k
qo pI
o I
G V k &6I
Q U
o iU
y wu s xvtr
Q U
o iU
qQ I
p{
Q 3I
y Q I
Q {
o pI
qo ppI
to
(The bar means that both and cannot be high at the same time when is executing the and instead of between and selection statement.) We should like to arbitrate between , and not implement as written. Instead of , we use the following production rules that permit the different parts of to execute concurrently. Specifying the circuit behavior as a handshaking expansion is cumbersome, so we proceed directly to the production rules:
To make the rules CMOS-implementable, we introduce an inverter to generate in the rst production rule. Given that these rules all execute concurrently, we examine the behavior of in greater detail. Signals and are independent from each other, in the sense that they can be both true at the same time if is sampled during the confusion interval. Also, because can be sampled during and are not always completed, but we assume that at least a transition, the transitions one of them completes eventually. The essential fact about the signals and is that they are monotonically increasing as long as is true. In fact, can be thought of as the integral of : as long as holds, increases; should begin to hold instead, will increase instead. is similar to but not identical to an arbiter. In an arbiter, when both inputs are high, the arbiter selects both inputs one after the other in arbitrary order since a request is never withdrawn , on the other hand, when both inputs are high, only one should be selected. (see Section I). In Hence, we must check that both and are before resetting the output of . The new process is:
(Note that we have re-introduced the indicating that the selection between and is noncan be implemented directly as a bistable device, and the production rules deterministic.) are:
The circuit corresponding to the production rule set for the synchronizer is shown in Figure 3, where we have added the lter stage necessary to block the metastable state from reaching the digital outside world. 3.1 Summary Let us summarize what we have done. We started with an input, , which we assumed could change at any timein fact, need not even have a dened logic value. The problem we set out to solve was to sample this ; by this we mean that if holds a stable legal logic value, then our 6
G h 6I V k Q vU
o iU
Q U
Q U
o 2U
Q vU
p{ o 2U o iU
y wu s xv7r
Q vU
qQ U
Q vU k 6I
q pI o c pI o
q 3I Q c 3I Q
o iU
{ o 2U qo p2U G G
o 2U
a`vU h 2U h s i 3I h Y uQ V o Q Ya o U Q iV I
a`iiU h {U h s i pI h Y uo V Q o Ya Q U vV I o
cp2U o qo p2U
G h
Q vU
cU Q qQ U
Ya6I h k Ya G h w6I V k
a6I h Y k Ya G V k w6I
o iU
kI V lmG h
G V k &6I
r0_ x r1 a1
re a0
r0
r1_
Figure 3. Synchronizer
circuit returns that value; if does not hold a stable legal logic value, we do not care whether our circuit returns zero or one, as long as it returns one of the two rather than failing in some disastrous way. We accomplished this by integrating the signal into the two monotonic intermediaries and ; being monotonic, we could apply straightforward techniques to them. In a separate publication [23], we review different versions of this circuit (the one we have seen here is only the most basic) and also contrast the various versions to the earlier design by Rosenberger et al. [24]. Rosenberger et al.s design is a sense-amplier design, which draws static power and depends on transistor-ratioing assumptions that make it difcult to build a reliable circuit realization [10]. Ours, on the other hand, is a normal pseudo-static CMOS circuit that draws no static power and poses no especially difcult analog design problems. We should remember, however, that Rosenbergers design is the only prior work that actually solves the problem of synchronizing a completely asynchronous signal with zero probability of failure; other designers have simply given up and, like their synchronous friends, accepted a nonzero probability of failure [13]. As we have already discussed, the zero probability of failure is not a merely academic property; rather, it allows the designer to increase the performance of the design by taking advantage of averagecase performance rather than introducing extra latency to deal with once-in-a-lifetime metastability events. We have seen that what makes building a synchronizer different from building an arbiter is that the synchronizer has to contend with requests that are withdrawn before they are granted. In the special case where we know that the withdrawal will happen while another request is being serviced, the full functionality of the synchronizer is not necessary [11, 6]. A synchronizer similar to the one described here was used to sample the interrupt inputs in the MiniMIPS processor [20].
o 2U
Q vU
We shall study the specic case of interfacing a QDI asynchronous system with a synchronous environment. Specically, we shall develop and analyze a simple circuit that allows a QDI asynchronous system to sample an external clock signal. Why should we want a QDI asynchronous system to do such a thing? The main reason is so that we can build accurate timers; for instance, the Intel 8051 microcontroller is specied to have timers that count incoming clock ticks and raise an interrupt when the count reaches a certain value [1]. 4.1 Prior solutions We are studying the problem of sampling an external, free-running clock signal with an asynchronous circuit. This problem can be solved using a synchronizer: we simply set up the synchronizer to sample the input repeatedly and count the number of times that we see a 1 followed by a 0 or vice versa. Two problems are immediately evident: 1. The circuit can miss input transitions; if is not read often enough, it is possible for transition from, e.g., true to false and back to true again.
2. If we wish to mitigate the rst disappointment, we shall have to make our circuit read very often. If it then turns out that, contrary to our original fear of s changing too often, actually changes very infrequently, then we shall be wasting a great deal of energy by inspecting too frequently. (The sampling rate for the synchronizer must be higher than the maximum rate at which can change.) There is no completely satisfactory solution to the rst problem: if the asynchronous system that is interested in the value of cannot keep up with the changes on , then transitions on shall simply have to be missed. From before, we know that the synchronizer is a subtle circuit that among other things includes a metastable element. The presence of the metastable element is required because the specication requires the synchronizer to sequence two events whose occurrence times may be arbitrarily close to each other. The circuit that we shall discuss now borrows parts from our earlier synchronizer design while avoiding the metastability. 4.2 A Synchronous & Asynchronous Event Generator We shall consider designing a circuit that takes a synchronous clock signal and converts that into a stream of asynchronous events or handshakes. Using the Handshaking Expansion language (HSE), we write
where is the synchronous clock input, and denotes a handshake communication with the asynchronous environment. Obviously, if takes too long to complete (so that has time to go from false to true back to false), the circuit will miss a clock cycle, and it cannot proceed until the next cycle.
5 1 8 1 7)!"pm}mppp2&}
to
G G h vG {){
4.3 Input integrators The synchronizer we have already studied includes the following element as its rst stage:
waits for to become true and then completes a handshake. may make progress even if is not true long enough to re ; if is oscillating very rapidly, an may integrate until it has accumulated enough charge to re implementation of . As in the synchronizer, we further construct the following:
4.4 Control process and to implement and , then we only If we use need to add a control process to sequence the actions properly, and we say that . The obvious implementation of is the following:
Here we have replaced the communication with its implementation is a good candidate for reshufing: let us bring out and intertwine the and communications:
The prolog disturbs the symmetry of the program; by removing it, we shall only nd that we ignore the rst rising edge of the input clock. We hence get the following program:
communication:
m {){ vG h
In the synchronizer, is realized with an instance of inverter on its input (we shall see that we can even avoid that here).
qW 7
&
m E &y
E & icvvI !q!vxI h G h 3 V E &y 37I h !c F I7I !q F I I t q I V W !cvxd!7Wgv h ) !vxId!7IgvV h 3 q t cW W !7Wd" q I W m 37I h !c F I7I !q F I c I !gv h !qvxv I cW W !7Iv h !7WIv 3 q W m E &ym E W m E
qW 7 E G E G i7WvdI !7WvdI h G 3 c W q W V E
with an
Finally, it seems obvious that this program could have a particularly simple implementation if the signal senses are adjusted. The following works best:
In other words, is simply an inverting three-input C-element; with this implementation, , , and become three names for the same circuit node. 4.5 Transistor-level implementation
Similarly,
By inverting the sense of relative to , we avoid having to put an inverter on the input to ; furthermore, since all the production rules are and are inverting, the circuit is directly implementable in CMOS circuits. Since the nodes state-holding, we must add staticizers (bleeders) to them. is implemented as the following PRS:
It is more convenient to make inverted; we should normally call this is true, the circuit is enabled to produce an output). 4.6 Analog difculties
(for enablewhen
It is not immediately obvious that and will work correctly for any input waveform on . The PRS implementation guarantees that can only cause to decrease and can only cause to increase; but is this enough for the circuit to be correct? This question can only be answered relative to the destination of and . Unfortunately, this destination is a C-element: a noise-sensitive dynamic circuit. A very slowly decreasing hence, a slowly rising could, for instance, trigger the C-element well before reaches the rail. In this case, we should have to depend on a timing assumption to guarantee that gets to the
10
G E &
k lI
Now let us clarify the choice of signal senses. We implement production-rule set (PRS):
FI W I I m c F d!cxdt!c dI7IfV X) I t I W V W I t I !q F d!qdt!q Wgv"fI h V h W h 3 I V m E & E &y &y q h Ya c Ya c! I Ya c! I h G h Ya V E & qW 7 Ya h W cW 7 Ya W W q Ya I h W c Ya dfG W WI V E fI cFI qFI G aY`ffV ) I V W Ya I h V h ) h V W m W k 6I
c F d!cxdt!tdIgv"fIfV h ) I t I qW V W I t I cW !q F d!qdt!7dI7I h VW h 3 V m
qt_
ro, rt_, rf qt x
C
ri
qf_
qf
with Schmitt triggers. With this change, we are guaranteed that and switch quickly enough that neither node will be observed as both true and false. This is because of the following property of a Schmitt trigger: if the input changes monotonically from one legal logic value to the other, then the output will switch quickly between the logic values. However, a Schmitt trigger is not a magical device that can turn an arbitrary input waveform into a sequence of transitions between legal logic valuesthe property we are using only holds if the inputs are monotonic. This is why we have been careful to design and so that their outputs are monotonic, regardless of their inputs. The transistor diagram of the nal circuit is shown in Figure 4. We should note that the analog problem we describe here is unlikely to cause practical difcul-
11
&
q c q7 W cW 7
a h Y Ya W Ya h Ya W
2.5
2 voltage/[V]
ties; only a very unfortunate selection of transistor sizes could allow to linger in an intermediate voltage range for an appreciable length of time. However, once we have substituted the Schmitt triggers we can be sure that the circuit is correct without recourse to anything beyond a simple monotonicity argument for and and our well-tested QDI theory for the rest. (The synchronizer can also be improved, at least in theory, by similarly adding Schmitt triggers to it [23].) An example of how the circuit handles a particularly difcult input is shown in Figure 5. This is the SPICE output of a simulation of the circuit using 0.6- m parameters (for HPs CMOS14B process via MOSIS). A 1140 MHz input signal generated by a seven-stage ring oscillator is applied at node ; this is far faster than the maximum of about 400 MHz the circuit can handle in this technology (without any detailed transistor-size optimization). The nodes , , and are shown in the graph. We see how begins to rise (because is false); when has reached about halfway, becomes true and s rising stops; nally, becomes false again, and goes true. Since we have designed the circuit to generate a communication on every time it detects a downward edge on , it is s going true that eventually causes the upward transition on .
The curious reader will wonder whether one can devise a way for an asynchronous system to read a free-running counter (e.g., a time-of-day register driven by an accurate oscillator) (a) with zero probability of synchronization failure, (b) without interrupting the counter, and (c) with an absolute guarantee that the time that was read was indeed contained in the register in a bounded neighborhood of the time that the request was made. This particular problem can be solved with a synchronous Gray-code counter and either an array of synchronizers (one per bit of the counter) or a single synchronizer that is used once per bit of 12
G FI
FI
1.5
0.5
Clock input
sample signal
delay
13
In this paper, we have studied two similar problems that involve accepting signals that change at arbitrary times into an asynchronous handshaking framework. The rst design problem, the synchronizer, is one of the most difcult circuit-design problems in asynchronous design: a synchronizer is in some sense the most powerful circuit element imaginable since it allows the reliable reading of an input variable while placing no constraints on the timing behavior of that variable. The second design problem, the asynchronous clock circuit, is similar to the synchronizer in that the input can change at arbitrary times; however it is very different in the format of the output: instead of reading the input at a certain times, this circuit is reactive and produces an output when the input changes. This circuit solves the problem of building a timekeeper in the asynchronous framework very elegantly: it is simpler and easier to verify correct than the synchronous Gray-code counter, and it can be far more efcient than a synchronizer-based solution (whether synchronous or asynchronous) since its power consumption is proportional to the average rate of input transitions rather than to the maximum rate of input transitions.
The research described in this paper was supported in part by the Defense Advanced Research Projects Agency (DARPA) and monitored by the Air Force Ofce of Scientic Research. Rajit Manohar has contributed to the design of the synchronizer. The need for an asynchronous clock circuit was suggested by Karl Papadantonakis.
[10] A. M. Lines. Personal communication, 2001. [11] Rajit Manohar, Mika Nystr m, and Alain J. Martin. Precise Exceptions in Asynchronous o Processors. Erik Brunvand and Chris Myers, eds., Proceedings of the 2001 Conference on Advanced Research in VLSI: ARVLSI 2001, Salt Lake City, Utah, March 1416, 2001. Los Alamitos, Calif.: IEEE Computer Society Press, 2001. [12] Leonard R. Marino. General Theory of Metastable Operation, IEEE Transactions on Computers, C-30(2):107115, February 1981. [13] A. Marshall, B. Coates, and P. Siegel. Designing An Asynchronous Communications Chip, IEEE Design and Test of Computers, 11(2):821, 1994. [14] Alain J. Martin. Compiling Communicating Processes into Delay-insensitive VLSI circuits. Distributed Computing, 1(4), 1986. [15] A. J. Martin. Programming in VLSI: From communicating processes to self-timed VLSI circuits, in Concurrent Programming, (Proceedings of the 1987 UT Year of Programming Institute on Concurrent Programming), C. A. R. Hoare, ed., Reading, Mass.: Addison-Wesley, 1989. [16] A. J. Martin. The limitations to delay-insensitivity in asynchronous circuits, in Sixth MIT Conference on Advanced Research in VLSI, W. J. Dally, Ed. Cambridge, Mass.: MIT Press, 1990. [17] A. J. Martin. Synthesis of Asynchronous VLSI Circuits, in Formal Methods for VLSI Design, J. Staunstrup, Ed. North-Holland, 1990. [18] A. J. Martin. Synthesis of Asynchronous VLSI Circuits, Caltech CS Technical Report Caltech-CS-TR-93-28. California Institute of Technology, 1993. [19] Alain J. Martin, Steven M. Burns, Tak-Kwan Lee, Drazen Borkovic, and Pieter J. Hazewindus. The design of an asynchronous microprocessor. In Charles L. Seitz, ed., Advanced Research in VLSI: Proceedings of the Decennial Caltech Conference on VLSI, pp. 351373. Cambridge, Mass.: MIT Press, 1991. [20] A. J. Martin, A. Lines, R. Manohar, M. Nystr m, P. Penzes, R. Southworth, U. Cummings, and o T. K. Lee. The Design of an Asynchronous MIPS R3000 Processor. Proceedings of the 17th Conference on Advanced Research in VLSI. Los Alamitos, Calif.: IEEE Computer Society Press, 1997. [21] Carver Mead and Lynn Conway, Introduction to VLSI Systems. Reading, Mass.: AddisonWesley, 1980. [22] Chris J. Myers. Asynchronous Circuit Design. Wiley-Interscience, 2001. [23] Mika Nystr m, Rajit Manohar, and Alain J. Martin. A Failure-Free Synchronizer. In preparao tion, 2002. [24] Fred U. Rosenberger, Charles E. Molnar, Thomas J. Chaney, and Ting-Pien Fang. QModules: Internally Clocked Delay-Insensitive Modules, IEEE Transactions on Computers, 37(9):10051018, September 1988. [25] Charles L. Seitz. System timing, chapter 7 in [21].
15