Skip to content

Logic Quest

VLSI Interview Questions

  • Wave Diagram Analysis
  • Design Questions
  • Gate Level Questions
  • Some Coding
  • Contact us
  • Toggle search form

Addition of two numbers with a twist

Design a system that gets two 4-bit numbers X3X2X1X0 , Y3Y2Y1Y0 in the range of 0-9 and the output of the system is the addition result between these two numbers (Z4Z3Z2Z1Z0) while the MSB, Z4 is the tens and Z3Z2Z1Z0 are the units digits.

For example: X3X2X1X0 = 8 (1000) , Y3Y2Y1Y0 = 5 (0101) , Z4Z3Z2Z1Z0  = 13 (1-0011)

                         X3X2X1X0 = 9 (1001) , Y3Y2Y1Y0 = 1 (0001) , Z4Z3Z2Z1Z0  = 10 (1-0000)

                         X3X2X1X0 = 4 (0100) , Y3Y2Y1Y0 = 3 (0011) , Z4Z3Z2Z1Z0  = 7   (0-0111)

In order to design the system you have two 4-bit adders, OR and AND gates as many as you like and constants (‘0’ and ‘1’).

Answer

We need to implement logic that detects when the result of the first addition between the two inputs is greater, or equal to ten. The Carry (Cout bit) will be ‘1’ in case that the result is more than 15 and S3 will be ‘1’ in case of a result greater than 8. Let’s write down some numbers

Cout S3 S2 S1 S0
10 0 1 0 1 0
11 0 1 0 1 1
12 0 1 1 0 0
13 0 1 1 0 1
14 0 1 1 1 0
15 0 1 1 1 1
16 1 0 0 0 0

From this table we can define the function F = Cout + S3(S2+S1) and it’s output will be connected directly to Z4.
If the result is greater than 9 then we need to convert it to the new representation. Let’s say that the result is 10 (1010), the new representation in such case is 10000 (16), so we need to use the second adder and to add 6 in order to get the correct Units digit representation.

Next Question>>>

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Copyright © 2023 Logic Quest.

Powered by PressBook Blog WordPress theme