Learning about Digital Design: Part 1Follow article
Truth Tables, K-Maps, Boolean Expressions and 7400 Series Logic.
Over the past year in my HND course one of the units which I completed was Combinational and Sequential logic. In this subject we covered quite a wide area of topics, including the design, build and test of logic circuits.
Logic gates are used for many different purposes and in their simplest form a single gate can be used to describe the operation of a digital circuit. The type of gate used is dependant on what the gate is required to do and the relationship between the inputs and outputs.
If you look at the circuit below we can use an OR gate to describe the operation. With the two switches in parallel the current can flow through either switch A OR switch B OR even both to illuminate the lamp.
Image Source: BBC Bitesize
A truth table can be used to describe the relationship between the inputs and outputs. For an OR gate the truth table would look like the one above, with A and B representing the inputs and Q representing the output.
Get the gist? Here are the Truth tables and gate symbols for the other logic gates.
Image Source: finallyunderstand.com
Each gate has its own truth table, however, we can use truth tables to decide what gates are needed in a circuit based on what the required operation is. The most common Boolean operators are AND, OR and NOT. In Diary of a Trainee Electronics Engineer: March 2016 I included the truth table for a 555 timer traffic light circuit and the K-map for one of the six outputs. Let's take a look at a new Truth table.
Instead of using boolean algebra it is usually preferred to use Karnaugh maps as long as there are no more than four inputs. Using a 'K-map' instead of boolean algebra can greatly simply the design of the logic circuit by reducing the number of gates required, not only simplifying but also proving cost effective. Although the benefits of K-maps may not be immediately visible, especially when designing simpler small circuits, this greatly reduces complexity and cost when it comes to designing a multi-layer PCB with thousands of gates.
Designing K-maps is quite simple once you get your head around it and to start with we'll look at a small, simple truth table and the K-map which is derived from this.
The outputs of the K-map below have been marked with W, X, Y and Z, as this is not a specific gate, usually the columns would be marked with 0's and 1's.
It's quite easy to see on this K-map as there are only two inputs. Let's have a look at what the K-map would be for the new truth table that we had a look at earlier.
*Take note of the ordering along the X and Y axis.
Once the K-map is filled in we can group the outputs. The outputs can be grouped in 2's, 4's, 8's, 16's or even individually, however, the larger the group usually the simpler the circuit as it will require less gates. A very simple and quick check against the truth table and K-map is that the number of 1s and 0s in the output column of the truth table, should be the same number which is in the K-map.
The Boolean expression for the above K-map and truth table would be: Q3', Q1' + Q3, Q2', Q1, Q0'
Therefore the logic circuit would look like the circuit below with K1 as the output.
A K-map and boolean expression would be produced for each output stated in the truth table, here we only have one output therefore there is only a single K-map and boolean expression.
Once you have your boolean expression(s) it is possible to begin designing the logic circuit. When I designed the traffic light system as part of an assignment in Combinational and Sequential logic for the first year of my HND in Electrical and Electronic Engineering, I used the 74LS series of transistor-transistor logic.
7400 Transistor Transistor Logic
The 7400 series are the most popular family of TTL IC and there are hundreds of devices, from basic logic gates, flip-flops and counters, to special purpose bus transceivers and arithmetic logic units. The through hole dual in line package (DIL/DIP) version of this series is generally used for rapid prototyping or hobbyist projects, while the surface-mount ICs are typically the lowest voltage and fastest. There are several variations of the 7400 series:
74 – Standard TTL, released 1966.
74L – Low-power, introduced in 1971. Now this series is obsolete and has been replaced by either the 74LS series or CMOS technology.
74H – High-speed, introduced in 1971 and was used 1970s era supercomputers. Although these are still produced they are generally superseded by the 74S series.
74S – High-speed Schottky. Also released in 1971 the 74S series has faster operation than the 74 and 74H series but at the cost of increased power consumption and cost.
74LS – Low-power Schottky.
74AS – Advanced Schottky, this series has greater speed and fan-out despite lower power consumption.
74ALS – Advanced low-power Schottky. Same technology as 74AS but with the speed/power trade off of the 74LS.
74F – Fast. Introduced in 1978 this is Fairchild's version of Texas Instruments 74AS.
Once the logic circuit has been designed and the boolean expression derived, the next important step is to decide which physical ICs the design will be implemented in. One thing to bear in mind is that each IC will usually have multiple logic gates on a single chip – by ensuring that you use all the possible gates on these before introducing additional ICs this will keep the cost of the design to a minimum.
Take the 74LS08 for example, this IC has four 2-input AND gates on it. So if your design needed 6 AND gates this could be done using two of these chips, using either three on each IC or four on one and two on the other.
For people who are new to building logic designs, the preferred method seems to be to use a through hole IC and build the circuit on breadboard initially. I myself did this when I built the traffic light circuit as part of my HND course and the finished breadboard circuit can be seen below.
Once you move on to starting to design more complex circuits it can prove beneficial to use simulation. This can be done using a Hardware Description Language such as Verilog together with a software tool such as Icarus Verilog. In Part 2 I plan to have a go at basic circuit simulation with Verilog and a test bench program.