The shown logic circuit performs a well known function; can you discover what it is?

The circuit was not optimised for functionality, but to create a symmetric artwork.

If you need to know the meaning of the used logic gate symbols, have a look at this Wikipedia page. Also, there are great videos from Ben Eater on how to build real digital logic circuits.

If you get stuck, check the hints below.

## Hints

Hint 1

There are *three* input bits A_{0}, A_{1} and A_{2}, but *eight* output bits X_{0}-X_{7}.

Hint 2

Create a truth table with all input combinations and outputs. Do you see the pattern now?

Solution

This digital circuit is a **binary decoder**, more specific a **3-to-8 line decoder** or **one-hot binary decoder**. For each binary input number, it will set exactly one output to high, while all other outputs stay low.

See these Wikipedia pages for details: Binary Decoder, One-Hot.

It has many uses:

- As multiplexer: E.g. one of eight memory chips is enabled, based on the highest three bits.
- As display: The binary value is displayed by lighting up one LED in a bar or ring.
- As display multiplexing support: Eight 7-segment displays are controlled with just 10 lines from the microcontroller.

### About this Specific Design

Because only one output is high at a time, you can create a design like this by creating a set of boolean expressions:

# inputs a0 = ... a1 = ... a2 = ... # outputs x0 = ... x1 = ... x2 = ... ... x7 = ...

If you look at the table of input values, you see a simple pattern:

abc ab bc ca 000 00 00 00 ab = 0, bc = 0 100 10 00 01 bc = 0, a = 1 010 01 10 00 ca = 0, b = 1 110 11 10 01 ab = 1, c = 0 001 00 01 10 ab = 0, c = 1 101 10 01 11 ca = 1, b = 0 011 01 11 10 bc = 1, a = 0 111 11 11 11 ab = 1, bc = 1

So, you have this `ab`

, `bc`

and `ca`

combinations you want to check for `11`

or `00`

. This is easily done with a `NOR`

for `00`

and `AND`

for the `11`

state.

# inputs a0 = ... a1 = ... a2 = ... a01on = a0 and a1 a12on = a1 and a2 a02on = a0 and a2 a01off = not (a0 or a1) a12off = not (a1 or a2) a02off = not (a0 or a2) # outputs x0 = a01off and a12off x1 = a12off and a0 x2 = a02off and a1 x3 = a01on and not a2 x4 = a01off and a2 x5 = a02on and not a1 x6 = a12on and not a0 x7 = a01on and a12on

Now, if you compare this to the logic circuit, you can see why all the `AND`

gates line up with the outputs, and why there are three additional `AND`

and `NOR`

gates directly at the inputs.

More Challenges

- Rearrange the logic circuit: Use only
*three*`NOT`

and*eight*3-input`AND`

gates. - Reverse it: Create the logic circuit to encode a binary number from eight inputs.

## Conclusion

I hope you enjoyed this easy logic circuit puzzle. I already published it previously on Twitter, but without hints and solution. Let me know if you like to see more puzzle like this.

If you have any questions, missed information, or simply want to provide feedback, feel free to comment below. 😄

## More Posts

#### Logic Gates Puzzle 10

Read More

#### Adding a Light Barrier using Epoxy

Read More

#### Box in 500 Sizes with Smileys

Read More

#### Split Storage Boxes Update

Read More

#### Let’s Print a Cat/Pet Feeding Device (Part 4)

Read More

#### Logic Gates Puzzle 1

Read More