Fundamentals of Digital Electronics
#1
Computers these days are so complex that a beginner could be excused for thinking that they could never begin to understand what makes them work. That was not true 55 years ago when I developed an interest in digital circuits. Previously, electronics had meant radio, and hobbyists had boxes of tubes stashed in their rooms and long antennas strung in their backyards. In 1966, few people had ever seen a computer or a calculator.

The central innovation of digital electronics was binary data. The function to be performed was expressed numerically, with numbers stored in binary form, meaning ones and zeros. Most computers used “core” memory to store digital information by polarizing ferrite magnets in one of two directions. Back then, the flip/flop was the next big thing. Using two transistors, which were newfangled semiconductor devices, you could build a circuit that had two stable states. The states were called set and reset, and a flip/flop required two inputs, one to set it and one to reset it. At any time, the flip/flop would be in one of those two states, set or reset, one or zero. Eight flip/flops could store an eight bit digital word, called a byte. If you knew that in 1966, you were definitely a nerd.

Back then, building a one byte memory was a big project. Just buying the 16 transistors required was a major investment for a student. We didn't see the microcomputer coming, but it was apparent that digital circuits could be put to many uses. Counters were cool, you could count up or down in binary. If you had an oscillator, you could count pulses and keep time. If you were going to put your flip/flops to work, a few additional fundamental logic elements would be needed. Those were the AND function, the OR function, and the NOT function. A NOT function is just an inversion. NOT turns a zero into a one and a one into a zero. It only takes one transistor to build the NOT function. You can make an OR circuit with two diodes (called a wire OR) or better, with two transistors. Actually with two transistors you would get a NOR function, that is to say NOT OR. A NOR gate with two inputs performs the logical function expressed in words as, if either input is a one, the output is a zero, otherwise, the output is a one. If you add a NOT after a NOR, that brings you back to OR, so you really need three transistors to make an OR function.

So, it was reasonable in the '60s to build AND, OR and NOT functions by hand, out of transistors. With just those building blocks, you could make a counter, or an adder, or a primitive calculator. It became a matter of scale. Now there are a billion transistors in an ordinary microprocessor that costs less than those 16 transistors cost in 1966. At that scale it is easy to forget that you can reinvent the whole universe of digital computing from AND, OR and NOT. To begin, here is a flip/flop built out of two transistors.

   

Both the stored value, usually called Q, and its inverse NOT Q, also called Q bar (shown as Q with a line over it), are available. Pressing the set button turns on transistor Q1 which pulls output Q bar to zero. With Q bar at zero, Q2 is turned off through R4. Output Q rises, due to the pull-up action of R1. Output Q then, through resistor R3, insures that Q1 stays on, which insures that Q bar stays at zero. So, the state of the flip/flop would stay set indefinitely. Pressing the set button again causes no change, but pressing reset reverses the process, causing Q to be stuck at zero and Q bar to be at 1. A flip/flop remembers one bit.

   

These days you can buy logic gates with one or two or four simple gates in a package, so next consider a flip/flop built out of two NOR gates. In a NOR flip/flop a logic one sets or resets the state. Logic zero at an input is ignored. Function is straight forward. Here are waveforms generated in LTSPICE.

   

If the last activity at the input was a set, the state of Q will be one. If the last input was a reset, the state of Q will be zero. The only ambiguity is if the flip/flop is set and reset at the same time the result will be indeterminate. In that situation, whichever input persists longer, set or reset, will determine the state that the flip/flop is left in. Additional logic can be added to cause deterministic behavior when set and reset act together. If you want set to override reset, you could gate the reset signal with an AND gate to block the reset signal when there is also a set signal. In words, resetout equals resetin AND NOT set. I hope you begin to get the picture.

There is one more ambiguity. When power is applied to a flip/flop circuit it may come up in either a set or reset condition. Good design always takes uncertain initial conditions into account. For example, the flip/flop might be reset by a reset signal OR by a power-on signal which is present only briefly. Then, resetout equals (resetin OR power-on) AND NOT set. The parenthesis indicate “do this first”. Maybe power-on should take precedence over set. Then, rearrange the order of the same elements to get resetout equals (resetin AND NOT set) OR power-on.

For completeness, you can also build a flop/flop built out of two NAND gates. In that case, a logic zero sets or resets. You might say that the NAND flip/flop inverts compared to a NOR flip/flop, but since both polarities, Q and Q bar, are available in both cases, it is a non-distinction.

Having explored the logic of set/reset flip/flops, a next step might be to explore how to add two binary numbers using flip/flops, AND, OR, and NOT, or it might be how to make a flip/flop that is edge-triggered, that is to say, it only updates its state when a clock signal transitions. A series of such small steps will get to latches and counters and encoders and decoders, and in fact, all logic functions, right up to the microprocessor.

Tom Lawson
June 2021
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)