REDIRECTING
Please  wait  FisadDi  is  on  the  way.

FisadDi

FisadDi.com
16. Addition using 2's complement

Download Notes

Computer Organization & Architecture

Addition using 2's complement

  FisadDi_Image
◼ Hamesha 2’s complement main convert karne se pehle hum usse 1’s complement main convert karnge fir usse 2’s complement main convert karnge.
  FisadDi_Image
◼ Computer Organization main plus(+) or minus(-) ko hum log Signed ya Magnitude boltey hai jaisa image main diya hai.
◼ Yha hum plus (+) ko 0 se denote and minus(-) ko 1 se denote kartey hai jaisa image main diya hua hai.
  FisadDi_Image
◼ Joh bit sabse left main hai woh signed bit hota hai jaisa image main diya hua hai ki yaha singed bit 1 hai matlab minus(-).
  FisadDi_Image
◼ Leftmost bit 0 hai joh ki plus hota hai and other bits 0101 hai joh ki 5 hota hai toh kya bena +5 jaisa image main diya hua hai.
◼ Jis bhi Binary number main leftmost bit 0 yani plus (+) sign hai woh kabhi bhi 1’s complement main convert ni hota hai to 2’s complement main bhi ni hoga.
◼ Jis Binary number main leftmost bit 1 yani Jiska minus(-) sign hai usko hum 1’s complement main convert karke fir 2’s complement main convert karnge.
  FisadDi_Image
◼ Hum jab 1’s complement main convert kartey hai toh joh signed bit hota hai usko hum convert nahi kartey hai usko jaisa hai waise likh dete hai uske baad jitney bhi bits hotey hai usko hum 1 main se minus karke convert karte hai jaisa image main diya hua hai.
  FisadDi_Image
◼ Ab jaise hi 1’s complement main convert ho jayega tab hum isko 2’s complement main convert karnge 1 ko add karke.
◼ Let’s take an example
◼ (40)10 + (9)10 = (?)2 by using 2’s complement ?
◼ Agar dono number positive hai toh kya karnge dekhtey hai.
  FisadDi_Image
◼ Phele +40 ko binary main likhenge toh plus ka 0 likha and 40 ka 101000 likha and jab +9 ko likhenge toh plus ka 0 likha and 9 ko 1001 likha but hum dekh rhe hai +9 ka Binary conversion main total bits hai woh +40 ke bits ke equal nahi hai toh hum isko equal karnge signed bit or bachhi hui bits ke beech main 2 zero’s (‘0’) add kar denge jaisa image main kiya hai.
  FisadDi_Image
◼ Ab dono ko add kar denge jaisa image main diya hua hai.
◼ Ab check karnge ki result joh aya hua hai true hai ki nahi uske liye dekha (+40 ) + (+9) = +49 hota hai or +49 ka Binary conversion yahi hota hai jo answer aaya jaisa image main diya hua hai.
◼ Final result (40)10 + (9)10 = (0110001)2 by using 2’s complement.
◼ Let’s take another example
◼ (40)10 + (-9)10 = (?)2 by using 2’s complement ?
◼ Agar humare pass ek positive number hai or ek negative number hai or positive bada hai negative se to kya hoga dekhtey hai.
◼ Phele (+40) ko binary main convert karnge.
  FisadDi_Image
◼ Phle +40 ko hum aise likh lenge jaisa image main likha hai plus ka 0 or 40 ka 101000 hoga.
  FisadDi_Image
◼ Ab (-9) ko minus ka 1 likha and 9 ka 1001 jaisa image main likha hua hai.
  FisadDi_Image
◼ Ab hum (-9) ko 2’s complement main convert karnge kyoki ye negative hai lekin hum dekh rahe hai ki (-9) joh hai woh (+40) ke bits ke equal ni hai phele usko equal karnge to hum two zero’s add karke signed bit ke baad jaisa image main kiya hai ab -9 ko 1’s complements main convert karnge or fir uske baad usse 2’s complement main convert karnge.
  FisadDi_Image
◼ Ab humne (-9) ko 1’s complement main convert kar diya to ab isse hum 2’s complement main convert karnge.
  FisadDi_Image
◼ Hum dekh rhe hai ki humne (-9) ko 2’s complement main convert kar liya hai jaisa image main diya hua hai.
  FisadDi_Image
◼ Jaise hume addition kiya toh dekh rhe hai ki sign bit k niche 2 bits aya hai toh hum isse kaise janege ki ye number positive hai ya negative jaisa image main diya hua hai.
  FisadDi_Image
◼ Hum dekh rhe hai ki addition karne par sign bit k niche 2 bits aa rha hai toh joh sabse left most bit hai usko hum discard kar denge jaisa image main diya hua hai.
  FisadDi_Image
◼ Ye hai humara finally result jaisa image main likha hai.
◼ Final result (40)10 + (-9)10 = (0011111)2 by using 2’s complement.
◼ Let’s take one more example
◼ (-40)10 + (9)10 = (?)2 by using 2’s complement ?
◼ Agar negative number bada ho or positive number smaller ho toh kya karnge.
◼ Phele (-40) ko binary main convert karnge.
  FisadDi_Image
◼ Phle (-40) ko hum aise likh lenge jaisa image main likha hai minus ka 1 or 40 ka 101000 hoga.
  FisadDi_Image
◼ Ab (+9) ko plus ka 0 likha and 9 ka 1001 jaisa image main likha hua hai.
  FisadDi_Image
◼ Ab hum (-40) ko 2’s complement main convert karne se pehle 1’s complement main convert karenge kyoki wo negative number hai jaisa image main diya hua hai.
  FisadDi_Image
◼ Humne ab (-40) ka 2’s complement nikal liya hai jaisa image main diya hua hai.
  FisadDi_Image
◼ Ab hum dono number ko add karnge lekin dono number ki bits equal karne ke baad jaise image main kiya hai .
  FisadDi_Image
◼ Ab add kar denge jaisa image main diya hua hai but abhi final result nahi aya.
◼ Ab joh result aya hai usme joh sign bit hai usse chhod kar baki sabhi bits ko 2’s complement main convert karnge.
  FisadDi_Image
◼ Jaise hi hum add kar lenge toh joh result aaya usska jo sabse left bit hai usse same likh kar baki bachi hui sabhi bits ko pehle 1’s complement main convert karnge jaisa image main diya hua hai.
◼ Jaise hi 1’s complement nikal leneg toh usse hum 2’s complement main convert karnge tab humara final result aajayega.
◼ Ye hai humara final result jaisa image main likha hai.
◼ Final result (-40)10 + (9)10 = (1011111)2 by using 2’s complement.
◼ Let’s take last example
◼ (-40)10 + (-9)10 = (?)2 by using 2’s complement ?
◼ Agar dono negative number ho to kaise karenge.
  FisadDi_Image
◼ Phle (-40) ko hum aise likh lenge jaisa image main likha hai minus ka 1 or 40 ka 101000 hoga.
  FisadDi_Image
◼ Ab (-9) ko minus ka 1 likha and 9 ka 1001 jaisa image main likha hua hai.
  FisadDi_Image
◼ Hum dekh rahe hai ki (-9) joh hai woh (-40) ke bits ke equal nahi hai phele usko equal karnge to hum usme two zero’s add karnge sign bit ke baad jaisa image main kiya hai.
◼ Ab hum (-9) ko 2’s complement main convert karnge kyoki ye negative hai lekin 2’s complement main convert karne se pehle (-9) ko 1’s complements main convert karnge.
  FisadDi_Image
◼ Humne (-9) ko 1’s complement main convert kar liya hai jaisa image main diya hua hai.
  FisadDi_Image
◼ Ab humne (-9) ko 2’s complement main bhi convert kar liya jaisa image main diya hai.
◼ Ab hum (-40) ko bhi 2’s complement main convert karnge kyoki ye bhi negative hai lekin 2’s complement main convert karne se pehle (-40) ko 1’s complements main convert karnge.
  FisadDi_Image
◼ Humne (-40) ko 1’s complement main convert kar liya hai jaisa image main diya hua hai.
  FisadDi_Image
◼ Ab humne (-40) ko 2’s complement main bhi convert kar liya jaisa image main diya hai.
  FisadDi_Image
◼ Jaise hi dono number 2’s complement main change ho jayenge phir hum dono ko add kar denge jaisa image main diya hua hai.
  FisadDi_Image
◼ Ab jaise hi add kar liya toh hum dekh rhe hai ki sign bit ke niche 2 bits ayi hai toh joh sabse leftmost bit hai usko hum discard kar denge jaisa image main diya hua hai.
  FisadDi_Image
◼ Jaise hi hum add kar lenge toh joh result aaya usska jo sabse left bit hai usse same likh kar baki bachi hui sabhi bits ko 2’s complement main convert karnge.
◼ Lekin 2’s complement main convert karne se pehle hum 1’s complement main convert karnge or fir 2’s complement main convert karnge jaisa image main diya hua hai.
◼ Jaise hi 2’s complement nikal lenge toh humara final result aajayega.
◼ Ye hai humara final result jaisa image main likha hai.
◼ Final result (-40)10 + (-9)10 = (1110001)2 by using 2’s complement.
◼ Important Note :- yaha 4 Cases hai.
◼ Case 1. Agar Negative number chhota hai Positive number se or Add karne par sign bits ke niche 2 bits aajaye to jo sabse leftmost bit hai usse hata kar result main add kardenge.
◼ Case 2. Agar Negative number bada hai Positive number se to Add karne par jo result aayega usse dobara se 2’s complement main change kar denge lekin sign bit ko 2’s main change nahi karenge.
◼ Case 3. Agar Negative number bada hai Positive number se or Add karne par sign bits ke niche 2 bits aaye to pehle sabse leftmost bit ko hata kar result main add kar denge or fir uske baad result ko 2’s complement main change kar denge lekin sign bit ko 2’s main change nahi karenge.
◼ Case 4. Agar dono number Negative hai to Add karne par sign bits ke niche hamesha 2 bits hi aayegi to isse bhi Case 3 ki jaise solve karenge.

<-------------------END------------------>

Agar aapko iss Topic m kuch bhi problem h to aap husme freely puche
Fisaddi.helpdesk@gmail.com

Thank You
Team FisadDi

Download Notes


About Us

Hello Friends, FisadDi is working to help students with their subjects. We provide videos as well as text notes in hindi language to make study easy. Our agenda is not only to help students to get good marks but also they will get the right knowledge and learn how the things work in a very easy way in their mother tongue. We are working hard to help in making your bright future.


Thank You
Team FisadDi


Contact Us

contact.fisaddi@gmail.com

Ghaziabad, India

8376873936


 
   
 
© www.fisaddi.com. All Rights Reserved.