It’s time to do a series on logic including things such as programmable logic, state machines, and the lesser known demons such as switching hazards. It is best to start at the beginning — but even experts will enjoy this refresher and might even learn a trick or two. I’ll start with logic symbols, alternate symbols, small Boolean truth tables and some oddball things that we can do with basic logic. The narrative version is found in the video, with a full reference laid out in the rest of this post.
The most simple piece of logic is inversion; making a high change to low or a low change to high. Shown are a couple of ways to write an inversion including the ubiquitous “bubble” that we can apply almost anywhere to imply an inversion or a “True Low”. If it was a one it is now a zero, where it was a low it is now a high, and where it was true it is now untrue.
Moving on to the AND gate we see a simple truth table, also known as a Boolean Table, where it describes the function of “A AND B”. This is also our first opportunity to see the application of an alternate symbol. In this case a “low OR a low yields a low”
Most if not all of the standard logic blocks come in an inverted form also such as the NAND gate shown here. The ability to invert logic functions is so useful in real life that I probably used at least three times the number of NAND gates as regular AND gates when doing medium or larger system design. The useful inversion can occur as spares or in line with the logic.
Likewise the OR gate is simple, straightforward, and can be drawn as an alternate symbol. With the OR gate, the output with be high if one OR the other is high (including if both are high). The NOR has the same behavior, however, it inverts the output. Compare the truth tables for both the OR and the NOR gates shown here.
I also recommend learning to think about logic as not just highs and low, or ones and zeros’ but also about the logic of true and not true. Particularly in higher integration situations we save the actual polarity of a true signal until the last moment when it actually gets assigned a pin and polarity as it leaves the chip.
Another logic function is the “exclusive or” function written as XOR. It has the function that the output is true if, and only if, one input is true. An example of a cool use of this is as a programmable signal inventor that can be made as shown above.
High Impedance or “Hi-Z”
In addition to highs and lows we also have a third state of high impedance or “Hi-Z” state. This is the state that a tri-state enabled device (referring to the three states: high, low and hi-z) when the output is disabled. This is how multiple devices can access a common resource such as memory, basically jumping on and off the common bus.
Another way to combine outputs is to use open collector outputs which drive the line in the low direction only, they are either off or low. Multiple outputs may be combined without fear of them shorting to each other as they can only drive low while no one drives high (high is passive). As a result we end up with an AND logic function where the output is high only if all outputs are in a Hi-z state.
Not just digital devices use open collector outputs, shown on the right is a very common quad analog comparator that uses an open collector output which makes it a good match for converting an analog signal to a digital. We can combine two pieces of analog information due to the ability to connect two open collector outputs. Here in this window comparator a signal has to been “approved” by both comparators, when both are true the resistor is free to pull the output high.
Finally there are standard logic chips that may be used as general purpose functions such as the 74×139, two to four decoder with enable. Looking at its logic table we can find an unusual function by selecting which of the outputs we choose.
Before I end I wanted to put it together and show some simple logic combined with the equation nomenclature. This nomenclature can extend to huge projects or high level languages while staying pretty straightforward. Above is a simple circuit that demonstrates using parenthesis to indicate order of operation.
To the right is another circuit, can you spot the risk of a glitch?
In the next installment I will talk about the electrical properties of common logic families and also introduce Programmable Logic Devices and the software that allows us to describe hardware using a text editor.