# Sequential Circuits

I'm learning about sequential circuits, and it's driving me crazy. How can you use an output as input, what was it's value at time 0? It can't go on forever...

Generally, its input at time 0 is arbitrary unless a reset circuit of some kind forces it. You either have to have such a reset circuit, or your design has to work regardless of the input at time 0.

• What do you mean arbitrary? Doesn't that mean that a random value will be output? I'm looking at a SR Flip-Flop and trying to go through the values in my head. What will the first input be, in practice?
– David
Jan 23, 2012 at 20:31
• It doesn't mean a random value will be output. It means we don't force the value to be any particular thing and don't care what it actually is. It may always be 0, always be 1, it may be random. We don't know, and we don't care. In the design phase, we treat "arbitrary" as its own state. (Sometimes the term "indeterminate" is used.) If an output is indeterminate, it is imperative that the design not rely on it having any particular value. Jan 23, 2012 at 20:39
• Assuming we care about the output, how can we not care what the input is? If we don't care about the output, what's the point of doing anything?
– David
Jan 23, 2012 at 20:45
• The design doesn't rely on the output having any particular value when the output is indeterminate. It is the job of the designer to ensure that all output states that matter are determinate. For example, when you first turn your computer on, the contents of RAM are indeterminate. But the BIOS and the OS are carefully designed such that this doesn't matter because they make sure to set the RAM to a determinate state before relying on the outputs having a particular value. The designer ensures that all outputs he cares about are determinate. That's his job. Jan 23, 2012 at 21:00
• That's one way to do it. The other way is to do it is by a sequence of operations that produces the same final result regardless of some of the initial conditions. For example, if you multiply a number by zero, the result is zero, regardless of what number you started with. Both techniques are used. (The bypass/reset method is usually used where there's no other choice, just to get the system in an initially sane enough state where more normal methods can put the rest of the system into a known state.) Jan 24, 2012 at 0:05

When designing a circuit it is your job to bring all elements into a valid state after startup.

In most cases you will just keep the Reset signal active for a certain time ( say 5-10 clock cycles) on all devices. Typically the Reset signal takes precedence over other signals and you will end up with all your circuits / devices in a valid state.

One point not yet mentioned is that in many cases one might not care about the "absolute" state of an output, provided that changes to the output state take place sensibly. For example, consider a circuit with a one-hot decade counter (e.g. a 74HC4017) driven by an 10.00Hz oscillator, and wired to ten LEDs. Such a circuit will cause all ten LEDs to light up in a sequence that will repeat once per second. The light which is lit at some particular time (e.g. precisely one hour after the unit is powered on) will depend upon which light was lit when the unit is powered on. If one doesn't make any effort to control which light is lit at power-on, it's possible that any one of the lights might be lit an hour later. On the other hand, it's also entirely possible (even likely) that one won't care which light is lit at any given time provided that 100ms later the next light will be lit, then the next, etc.

When latches, counters, and other such devices are used in such a way that their output is indeterminate, there is often a risk that they may in fact enter what's called a "metastable" state, where they can't quite "decide" what their value is. When a device is in a metastable state, its behavior may be essentially arbitrary until it falls out of the metastable state. To use an analogy, think of flipping a coin; it may quickly come up heads, or it may quickly come up tails, or it may spin about on its edge in such a way that it can't very well be resolved as either heads or tails. If the floor is vibrating somewhat, it might not be possible for the coin to sit stably on its edge, but it would be theoretically possible that every time the coin starts to fall the floor vibrates in just the right manner to prevent it from doing so. Were it not for the limits of quantum physics, it would be impossible to absolutely guarantee that a device would fall out of any possible metastable state within any particular amount of time, but the probability of a device staying in a metastable state for a particular length of time can often be made vanishingly small.