### Getting Started

Combinational Logic uses a combination of basic logic gates AND, OR and NOT to create complex functions. For each output, the design procedure is:

- Derive the truth table.
- Simplify the boolean expression using Karnaugh Map (K map).
- Draw a logic diagram that represents the simplified Boolean expression. Verify by analysing or simulating the circuit.

Your objective is increase your score in the 3 areas: Truth Table (TT), K Map (KM), and Logic Gates (LG) while designing different digital circuits. Start a design by selecting the project.

You can learn more about combinational logic design at https://electronics-course.com/combinational-logic-design

You need to sign in with your Google account to save your progress and earn a digital badge.

Breadboard the circuits at your home lab to put into practice what you have learnt. The home lab costs less than US$10 to equip (comprising test equipment and components that are easily available worldwide).

hide/show Getting Started Information.

hide/show Topical Help.

Use the discussion forum below to feedback suggestions or report problems.

## Select a project

### Bank Alarm System

A bank wants to install an alarm system with movement sensors. The bank have 3 sensors (A,B,C).

To prevent false alarms produced by a single sensor activation, the alarm will be triggered only when at least two sensors activate simultaneously.

### Odd Numbers

Design a circuit that has a 3-bit binary input B2,B1,B0 (where B2 is MSB and B0 is LSB) and a single output (Z) specified as follows:

- Z = 0, even numbers
- Z = 1, odd numbers 1, 3, 5, 7

### NAND Gate

A NAND gate (NOT-AND) is a logic gate which produces an output which is 0 only if all its inputs are 1; thus its output is complement to that of the AND gate.

The NAND gate is a universal gate since it can be used to construct all other logic gates.

For more info, see logic gates

### Car Safety Buzzer

Turn On the B(uzzer) whenever the D(oor) is Open OR when the K(ey) is in the Ignition AND the S(eat belt) is NOT Buckled.

- 0 : Seat Belt is NOT Buckled
- 1 : Seat Belt is Buckled
- 0 : Key is NOT in the Ignition
- 1 : Key is in the Ignition
- 0 : Door is NOT Open
- 1 : Door is Open
- 0 : Buzzer is OFF
- 1 : Buzzer is ON

### Classified Project 4

As this is a Classified Project, no description or purpose is provided - you are only given the blackbox.

Hint: You may want to skip the first part of the truth table.

### Prime Numbers

Design a circuit that has a 3-bit binary input B2,B1,B0 (where B2 is MSB and B0 is LSB) and a single output (Z) specified as follows:

- Z = 0, non prime number
- Z = 1, prime numbers 2, 3, 5, 7

### Alarm Circuit

If the circuit is Armed (A=1) and either B=1 or C=1 then Z=1, otherwise Z=0

- C : Door Open Sensor
- B : Motion Sensor
- A : Arm Alarm
- Z : Alarm

### Classified Project 7

As this is a Classified Project, no description or purpose is provided - you are only given the blackbox.

Hint: You may want to skip the first part of the truth table.

### 5 or more

Design a circuit that has a 3-bit binary input B2,B1,B0 (where B2 is MSB and B0 is LSB) and a single output (Z) specified as follows:

- Z = 1, when the input is 5, 6, 7
- Z = 0, otherwise

### Half Adder

The half adder adds two one-bit binary numbers A and B. The output is the (S)um of the two bits and the (C)arry.

- 0+0 -> C = 0, S = 0
- 0+1 -> C = 0, S = 1
- 1+0 -> C = 0, S = 1
- 1+1 -> C = 1, S = 0

For more info, see binary addition

### Full Adder

For a full adder, besides the 2 inputs bits A and B, the Carry in (C) bit is included. If the inputs are A, B and C, then

result = A + B + C

If the outputs are Sum (S) and Carry Out (CO), then

result | Carry (C) | Sum (S) |

0_{2} | 0 | 0 |

1_{2} | 0 | 1 |

10_{2} | 1 | 0 |

11_{2} | 1 | 1 |

For more info, see binary addition

### 2 to 1 Multiplexer

A 2 to 1 multiplexer uses 1 select line (S) to determine which one of the 2 inputs (A, B) is routed to the output (Z). Its operation can be described as follows:

S | Z |

0 | A |

1 | B |

### Digital Dice Decoder

A digital dice display can be made using 4 sets of LEDs - R(ed), Y(ellow), B(lue), G(reen)

When driven by a 3 bit input B2, B1, B0 (where B2 is the MSB and B0 is the LSB) from 1 to 6, the dice display appears as follows.

The LEDs light up as shown in the table.

Die Face | B2B1B0 | R | Y | B | G |

1 | 001 | ✔ | |||

2 | 010 | ✔ | |||

3 | 011 | ✔ | ✔ | ||

4 | 100 | ✔ | ✔ | ||

5 | 101 | ✔ | ✔ | ✔ | |

6 | 110 | ✔ | ✔ | ✔ |

### Dual-Function Gate

The Dual-Function Gate can perform 2 different logical operations on the data inputs, A and B, depending on the select input X.

- X=0 NAND
- X=1 NOR

For more info, see logic gates

### Comparator Circuit

Design a circuit that compares two 2-bits natural numbers A (A1,A0) and B (B1,B0) providing an output S such that

- S = 1, if A > B
- S = 0, otherwise

For more info, see number systems

Note: A1,B1 is MSB (most significant bit) and A0,B0 is LSB (least significant bit)

### BCD to 7 Segment Decoder

A seven-segment display is an electronic display device for displaying decimal numerals. The 7 segments are labelled a to g

A BCD to 7 segment decoder decodes the 4 bit input (D is MSB and A is LSB) so that the appropriate output segment is turned on. This decoder is for segments a, b, c, e.

For example, the **e** segment lights up only for the numerals 0, 2, 6, 8.

### 1 to 2 Demultiplexer

A 1 to 2 demultiplexer uses 1 select line (S) to determine how to route the input (D) to one of the 2 outputs (Y0, Y1).

- S=0 -> Y1=0, Y0=D
- S=1 -> Y1=D, Y0=0

For more info, see Demultiplexer

### 4 to 2 Priority Encoder

A 4-to-2 priority encoder takes 4 input bits and produces 2 output bits. In this truth table, for all the non-explicitly defined input combinations (i.e. inputs containing 2, 3, or 4 high bits) the lower priority bits are shown as don't cares (X). Similarly when the inputs are 0000, the outputs are not valid and therefore they are XX.

I3 | I2 | I1 | I0 | O1 | O0 |

0 | 0 | 0 | 0 | X | X |

0 | 0 | 0 | 1 | 0 | 0 |

0 | 0 | 1 | X | 0 | 1 |

0 | 1 | X | X | 1 | 0 |

1 | X | X | X | 1 | 1 |

For more info, see Priority Encoder

### 1 to 4 Demultiplexer

A 1 to 4 multiplexer uses 2 select lines (S0, S1) to determine which one of the 4 outputs (Y0 - Y3) is routed from the input (D). Its characteristics can be described in the following simplified truth table.

S1 | S0 | Y3 | Y2 | Y1 | Y0 |

0 | 0 | 0 | 0 | 0 | D |

0 | 1 | 0 | 0 | D | 0 |

1 | 0 | 0 | D | 0 | 0 |

1 | 1 | D | 0 | 0 | 0 |

For more info, see Demultiplexer

## Specification

## Black Box Continue

A black box shows the relationship between its inputs and outputs without knowing its implementation.

Click on the inputs and observe the output(s) to understand the specification.

- When the input, output or wire is grey, its value is 0 (false).
- When the input, output or wire is green, its value is 1 (true).

## Truth Table Check Skip

Your task is replace all the **?** in the output column by clicking on the cell. When you are done click **Check**.

Hints

- When you click on the inputs of the blackbox, the corresponding row is highlighted in the truth table.
- On the truth table, note the input variables and their values.
- Recall that when the input, output in the blackbox is grey, its value is 0. When it is green, its value is 1.
- Use the output color to determine if the output cell should be 0 (grey) or 1 (green).
- If the blackbox has more than one output, we will solve one output at a time.

The Truth Table shows the values of the circuit output for all input values. The number of rows is 2^{n} where n is the number of inputs. So for 2 inputs, there are 4 rows and for 3 inputs there are 8 rows and so on.

You can also fill up the truth table using the specification.

Your task is to select the minterm(s) that represent **?** in the Sum of Product. When you are done, click **Check**

Hints

- Hover or tap on
**?**to find the respective output cell. - Study the other minterms to understand how they are formed.

There are 2 steps to obtain the Sum of Products from its truth table.

- A Minterm is a product • (AND) term containing all input variables. A variable X appears in complemented form X if it is a 0 in the row of the truth-table, and as a true form X if it appears as a 1 in the row.
- The Sum of Products is obtained by taking the sum + (OR) of the minterm of the rows where a 1 appears in the output.

## K Map Check Skip

Your task is to replace all the **?** in the K Map by clicking on that cell. When you are done, click **Check**

Hints

- When you hover or tap on an output cell in the truth table, the corresponding cell in the K Map is highlighted.
- Understand the relationship by studying the variables in the headers of both the truth table and the K map.

The Karnaugh map (K map) provides a simple and straight-forward method of minimising boolean expressions.

A K map is a two-dimensional truth-table. Note that the squares are numbered so that any two adjacent cells differ by a change in only one variable.

Your task is to memorise and group adjacent cells containing 1's.

- When you hover or tap on the product terms in the Boolean expression, you will see groups of adjacent 1's. Memorise all of them and click
**Hide**. - Now click on the cells containing 1's to group them as memorised earlier. When you have selected a group, click
**Group**. - Repeat the previous step until the button changes to
**Check**.

Rules for Grouping together adjacent cells containing 1's

- Groups must contain 1, 2, 4, 8, 16 (2
^{n}) cells. - Groups must contain 1's only.
- Groups may be horizontal or vertical, but not diagonal.
- Groups should be as large as possible.
- Each cell containing a 1 must be in at least one group.
- Groups may overlap.
- Groups may wrap around the table. The leftmost cell in a row may be grouped with the rightmost cell and the top cell in a column may be grouped with the bottom cell.
- There should be as few groups as possible.

Your task is to select the product term(s) that represent **?** in the Boolean Expression. When you are done, click **Check**

Hint

- Hover or tap on
**?**to find the respective group. - Study the other product terms to understand how they are formed.

Obtaining Product Terms

- If X is a variable that has value 0 in all of the squares in the grouping, then the complemented form X is in the product term.
- If X is a variable that has value 1 in all of the squares in the grouping, then the true form X is in the product term.
- If X is a variable that has value 0 for some squares in the grouping and value 1 for others, then it is not in the product term.

## Logic Gates Check Skip

Your task is to connect up the logic gates to realise the Boolean Expression obtained from the K Map. When you are done, click **Check**

Hint

- Hover or tap on the gate to find the boolean expression.
- Study the connected gate to understand its function.
- To connect, click from the output of an element and drag to the input of the element that needs to be connected.
- If you are using a mobile device, select zoom/pan if you need to zoom or pan the logic diagram and select wire if you want connect the circuit.

Connecting the logic gates

- An AND gate performs the same function as product • operator in boolean algebra. It has only 1 output but can have 2 or more inputs.
- An OR gate performs the same function as sum + operator in boolean algebra. It has only 1 output but can have 2 or more inputs.
- A NOT gate inverts its input. It has only 1 output and only 1 input. If the input is X, then its output is X

## Design Complete Continue

### Truth Table

There are three ways to describe a Boolean function: logic circuit, truth table, and Boolean expression.

To convert a truth table to its circuit

- Convert the truth table to a Boolean expression using the sum of products technique.
- Minimise the Boolean expression using Karnaugh map (or Boolean algebra).
- Convert the minimised Boolean expression into a circuit.