What kind of logic circuit do you see here?

This logic circuit was optimised for symmetry and art. Can you see which function is implemented in this circuit?

You find more about logic gates and how they work on this Wikipedia page.

Check the hints below, if you get stuck.

Hint 1

There are two inputs `A`

and `B`

, each with *two* bits (bit `0`

and `1`

).

Also there is an output `X`

with *four* bits (`0`

, `1`

, `2`

, `3`

).

Hint 2

The input `A`

and `B`

is somehow combined into output `X`

.

`X = A ??? B`

Hint 3

Create a truth table with all possible inputs and the resulting outputs, write all inputs and outputs also as decimal numbers. Do you see the pattern now?

Truth table: A B X A B X 00 00 ???? 0 0 ?? 01 00 ???? 1 0 ?? ....

Solution

The circuit shows a **two bit multiplication circuit**.

If you create a truth table for the circuit you see it easily.

A B X 00 00 0000 0 x 0 = 0 01 00 0000 1 x 0 = 0 10 00 0000 2 x 0 = 0 11 00 0000 3 x 0 = 0 00 01 0000 0 x 1 = 0 01 01 0001 1 x 1 = 1 10 01 0010 2 x 1 = 2 11 01 0011 3 x 1 = 3 00 10 0000 0 x 2 = 0 01 10 0010 1 x 2 = 2 10 10 0100 2 x 2 = 4 11 10 0110 3 x 2 = 6 00 11 0000 0 x 3 = 0 01 11 0011 1 x 3 = 3 10 11 0110 2 x 3 = 6 11 11 1001 3 x 3 = 9

You can separate the circuit into four parts.

1. Pass the A value to the output if B0 is one

2. Pass the A value, **shifted one bit** (x2) to the output, if B1 is one.

3. Detect an “overflow”, if A = 11 and B = 11.

4. “Add” the results of part 1, 2 and 3.

In a programming language, e.g. Python, you could write the four parts like this:

a = 3 b = 2 # Part 1 ab0 = (a if (b & 0b1) else 0) # Part 2 ab1 = ((a << 1) if (b & 0b10) else 0) # Part 3 ab_overflow = (0b1100 if (a == 0b11 and b == 0b11) else 0) # Part 4 x = ab0 ^ ab1 ^ ab_overflow

It is no exact logic representation of the circuit, because the input and output bits are kept combined in the variables.

## Additional Challenges

- The logic circuit is optimised for symmetry and art, can you optimise it to reduce the number of used gates?
- Design the same digital circuit, but with three bits input for
`A`

and`B`

.

## Conclusion

I hope you enjoyed this simple logic circuit puzzle. Please 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

#### Storage Boxes System Survey

Read More

#### New Storage Boxes

Read More

#### Adafruit PowerBoost 1000C Enclosure (LR2165)

Read More

#### Round Corner Template Set for Woodworking

Read More

#### Huge Storage Boxes Update

Read More

#### How to Create a Large 3D Printed Artwork

Read More