The Gateway to Computer Science Excellence

+40 votes

Consider an eight-bit ripple-carry adder for computing the sum of $A$ and $B$, where $A$ and $B$ are integers represented in $2$'s complement form. If the decimal value of $A$ is one, the decimal value of $B$ that leads to the longest latency for the sum to stabilize is ___________

+1

+46 votes

Best answer

+3

decimal value of A is 1..does it mean positive 1 or negative 1??but if it is a 8 bit representation,then positive 1 in binary is 00000001 conveeting to 2'complement,we will gt 11111111.which has sign bit as 1 and hence,considered as negative.so,dun we need 1 more bit to represent +1 in 2 'complemenmt for sign bit??

0

@Ankit and @Hemant you will write -1 as a 1111111 in 2's complement but 127 will be 01111111 show see these bits -1 has contain 1 more carry bit for caculation show it will take 1 bit more latency time for calculation.

+1

stabilize means sum should be 0.rt?

how 127 making sum stabilized in 2's complement form?

It is not signed or unsigned form ,right?

how 127 making sum stabilized in 2's complement form?

It is not signed or unsigned form ,right?

+1

@srestha question is asking for which input circuit take longest delay(latency) for calculation, It's not means to calculate zero . When all the bits are one then system will take longest delay to caculate carry and sum as well.

+10

@ Brij

here we are adding A and B

A =0000 0001 (in 2's complement form)

Now if B=127=0111 1111

127 means it is end point of positive number

Now if we add 1 with it will go to 0 (stabilize means go to all bits are 0 or all bits are 1)

Another one procedure could be add -1 with add with +1 to get 0

2's complement of -1 is 1000 0001

**It is also stabilize in 2's complement will be 0 **(As +0 and -0 is same for 2's complement)

Now if we add 1000 0001 with 0000 0001 we have to go upto 8th bit (while for 127 we have to calculate upto 7th bit)

which is 1 more bit than addition with 127

That is the cause of taking -1 as largest latency

0

But if we think about largest latency means generating carry in each bit and also generating sum in each bit then 127 will be right answer.

Because 127 adding with 1 generating carry in each bit, but in -1 adding with 1 will not generate carry in each bit.

rt?

0

What do you think if B=-127. Please let me know.

It will also give the correct result. In this case also carry will propagate throughout and sum will change.

It will also give the correct result. In this case also carry will propagate throughout and sum will change.

+15 votes

In ripple-carry adder, the carry "ripples" from one bit to the next. The longest path delay through * n-bit* ripple carry adder is

For this condition (longest latency) to arise, we must ensure that a carry that is generated at the least significant bit is propagated throughout till the last bit. This means we must have C_{in }= 1 for every stage of the ripple-carry adder.

Given A = +1 (in 2's complement form), we just need to find what should be B in 2's complement form to satisfy the given condition.

A= 0000 0001 (given)

B= 1111 1111 ( -1 in decimal)

On adding A+B we get C_{in} = 1 at every stage with the last C_{out} = 1. $\therefore$ Ans is -1.

+3 votes

why not 127????? worst cse occurs means longest time to stabilize when all generate a carry..so 127 satisfies this requirememnt

+1

in case of 127, the sum will settle in 2 stage delays. In case of -1, the sum will take 8 stage delays to settle.

0

@Praveen , if there are multiple answers then this will become marks to all ( Usually there are always few questions with marks to all in every paper!)

0

for sum there are 2 XOR,

for carry there is 1 XOR,1 AND and 1 OR.

i.e total 3 gate delays in case of carry and 2 gate delays in sum.

so in case of -1 the carry bit will change and thus it will take 1 extra gate delay.

for carry there is 1 XOR,1 AND and 1 OR.

i.e total 3 gate delays in case of carry and 2 gate delays in sum.

so in case of -1 the carry bit will change and thus it will take 1 extra gate delay.

+1

@abhishek you will write -1 as a 1111111 in 2's complement but 127 will be 01111111 show see these bits -1 has contain 1 more carry bit for caculation show it will take 1 bit more latency time for calculation.

0 votes

-1 and -127 both will give correct ans to this question.

-1 : 1111 1111

-1 : 1111 1111

+ : 1 1111 1110

-1 : 1111 1111

-127 : 1000 0001

+ : 1 1000 0000

In both cases carry is propagating throughout. In case of (-1,-1) sum is getting stabilized from 0000 0000 to 1111 11110

In case of (-1,-127) sum is getting stabilized from 0111 1110 to 1000 0000.

-1 : 1111 1111

-1 : 1111 1111

+ : 1 1111 1110

-1 : 1111 1111

-127 : 1000 0001

+ : 1 1000 0000

In both cases carry is propagating throughout. In case of (-1,-1) sum is getting stabilized from 0000 0000 to 1111 11110

In case of (-1,-127) sum is getting stabilized from 0111 1110 to 1000 0000.

0

In case of (-1,-127) sum is getting stabilized from 0111 1110 to 1000 0000. Carry moves from LSB to MSB and overflows in the end. So its the same case as (-1,-1).

+2

@ Ashish Sharma 3 1 in 2's complement is 1 only since its a positive number, and in all signed number representations all positive numbers are treated the same, so in place of -1 as A you should add

1: 00000001 (A)

-127:10000001 (B)

+: 10000010 Sum

If B=-1; then:

1: 00000001 (A)

-1: 11111111 (B)

+: 1 00000000 sum,so you can figure out which among -1 and -127 will take more latency for sum to be stabilized..

- All categories
- General Aptitude 1.9k
- Engineering Mathematics 7.5k
- Digital Logic 2.9k
- Programming and DS 4.9k
- Algorithms 4.4k
- Theory of Computation 6.2k
- Compiler Design 2.1k
- Databases 4.1k
- CO and Architecture 3.4k
- Computer Networks 4.2k
- Non GATE 1.4k
- Others 1.4k
- Admissions 595
- Exam Queries 573
- Tier 1 Placement Questions 23
- Job Queries 72
- Projects 18

50,737 questions

57,321 answers

198,399 comments

105,152 users