Lucky Resistor
Menu
  • Home
  • Learn
    • Learn C++
    • Product Photography for Electronics
      • Required Equipment and Software
    • Soldering for Show
  • Projects
  • Libraries
  • Applications
  • Shop
  • About
    • About Me
    • Contact
    • Stay Informed
  •  
Menu

Logic Gates Puzzle 1

Posted on 2021-04-292023-01-24 by Lucky Resistor

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 Puzzles

Logic Gates Puzzle 101

Logic Gates Puzzle 101

The message you got does not make any sense. Can you decypher it with the following logic puzzle? The circuit ...
Read More
Logic Gates Puzzle 100

Logic Gates Puzzle 100

Assume, while digging out an ancient site from 450 AD, you found a mysterious stone with a digital display. Your ...
Read More
Logic Gates Puzzle 11

Logic Gates Puzzle 11

The shown logic circuit performs a well-known function; can you discover what it is? The circuit was not optimised for ...
Read More
Logic Gates Puzzle 10

Logic Gates Puzzle 10

The shown logic circuit performs a handy function; can you discover what it is? The circuit was not optimised for ...
Read More
Logic Gates Puzzle 1

Logic Gates Puzzle 1

What kind of logic circuit do you see here? This logic circuit was optimised for symmetry and art. Can you ...
Read More

More Posts

Stronger 3D Printed Parts with Vertical Perimeter Linking

Stronger 3D Printed Parts with Vertical Perimeter Linking

One issue with fused filament fabrication is the weakness introduced into the parts at the layer boundaries. I had this simple idea of how especially straight sections of 3D prints could be improved on regular ...
Read More
Large Update to the Circle Pattern Generator

Large Update to the Circle Pattern Generator

Today I published a significant update to the circle pattern generator. Version 1.4.1 of the application is available for macOS and Windows for download. This new version adds various shapes, rotations, colours and a generator ...
Read More
Candlelight Emulation – Complexity with Layering

Candlelight Emulation – Complexity with Layering

In this blog post I explain the microcontroller firmware that emulates candlelight in more detail. You can apply the explained techniques in similar situations to get organic effects on CPU and RAM-limited platforms. I will ...
Read More
Better Bridging with Slicer Guides

Better Bridging with Slicer Guides

I got questions about a particular feature you find if some of my 3D models. In this short text, I will explain why I add it and why you should add features like this too ...
Read More
The 3D Printed Modular Lantern

The 3D Printed Modular Lantern

I designed a very modular 19th-century-style lantern. You can print it in its simplest form as a simple candlelight to put on a table or a shelf. By printing additional elements, you create a wonderful ...
Read More
Build a Sustainable Refillable Active Coal Filter

Build a Sustainable Refillable Active Coal Filter

If you ever used air filters to keep smells, fumes and dust at a low level in your workshop, you for sure came in contact with these expensive throwaway active coal filters. While throwing-away the ...
Read More

Leave a Reply Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Stay Updated

Join me on Mastodon!

Top Posts & Pages

  • Storage Boxes System for 3D Print
  • Event-based Firmware (Part 1/2)
  • Build a 3D Printer Enclosure
  • Yet Another Filament Filter
  • Circle Pattern Generator
  • Circle Pattern Generator
  • Real Time Counter and Integer Overflow
  • Projects
  • Logic Gates Puzzle 11
  • Units of Measurements for Safe C++ Variables

Latest Posts

  • Better Bridging with Slicer Guides2023-02-04
  • Stronger 3D Printed Parts with Vertical Perimeter Linking2023-02-02
  • Logic Gates Puzzle 1012023-02-02
  • Candlelight Emulation – Complexity with Layering2023-02-01
  • Three Ways to Integrate LED Light Into the Modular Lantern2023-01-29
  • The 3D Printed Modular Lantern2023-01-17
  • Rail Grid Alternatives and More Interesting Updates2022-12-09
  • Large Update to the Circle Pattern Generator2022-11-10

Categories

  • 3D Printing
  • Build
  • Common
  • Fail
  • Fun
  • Learn
  • Projects
  • Puzzle
  • Recommendations
  • Request for Comments
  • Review
  • Software
Copyright (c)2022 by Lucky Resistor. All rights reserved.
 

Loading Comments...