2
\$\begingroup\$

I tried to solve this challenge by enhancing my skills in digital circuits, but could not solve it.

How can I design a digital circuit where the input is only 2 bits and the output equals 5 times the input.

\$\endgroup\$
0

2 Answers 2

10
\$\begingroup\$

If you draw out the truth table it becomes simple.

You have two inputs so there are only four possible output values.

In - Out
-----------
00 | 0000
01 | 0101
10 | 1010
11 | 1111

Now look down the columns and you'll see a pattern. You can implement that with no math at all.

\$\endgroup\$
2
  • \$\begingroup\$ Thanks for your solution , i solve it , But I want to make sure of the solution , the input(ab) output (cdef) then => c=a , d=b , e = a , f =b ? that correct (can not use any logic gate to solve it )? \$\endgroup\$
    – reem_moh
    Jul 5 at 5:55
  • \$\begingroup\$ That is correct. You could do it with logic gates, and for a different multiplier or number of bits you might need to, but for this particular problem it's just a matter of straight through connections. You might use some buffers for isolation, but that would be the most you'd need. If you want more practice try it with different conditions, multiple by a different number, or change the number of inputs. Write out a table and look into using Karnaugh maps and boolean math if you haven't learned those yet. \$\endgroup\$
    – GodJihyo
    Jul 5 at 6:16
4
\$\begingroup\$

If \$x\$ is your number, \$5x = (x + x + x + x + x) = 4x + x \$.

i.e., you have to multiply \$x\$ by \$4\$ and add \$x\$ to it.

Multiplying by \$4\$ (which is \$= 2^2\$) is nothing but shifting \$x\$ to left by two places.

\$x\$ is of two bits, therefore shifting \$x\$ to left by two places make the output \$4\$ bits, with LSbs \$'00'\$.

So what will happen if you add \$x\$ now, and how does MSbs and LSbs will look like after that? The pattern should be obvious. You should be able to come up with the 'circuit' now. In fact, you need only wires.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.