1 / 12

COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE

COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE. By Engineer Bilal Ahmad September 13, 2013. Binary math. In this lecture we will focus on Binary Math and than we will jump to Signed Representation in the next class hopefully. So till now you know the Number Systems.

mills
Télécharger la présentation

COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE By Engineer Bilal Ahmad September 13, 2013

  2. Binary math • In this lecture we will focus on Binary Math and than we will jump to Signed Representation in the next class hopefully. • So till now you know the Number Systems. • Representing numbers with bits is one thing but doing something with them is entirely a different stuff. • Today we will learn how to perform some basic mathematical operations that computers perform on binary numbers along with the binary representation that supports those operations.

  3. Need to understand binary Math • Put yourself in the shoes of a CS and IT Expert, I am sure you all will have successful positions in your live and I wish you good luck for that as well. • Okay so now imagine why you need to understand binary math? • All mathematical operations are performed by processors and they have limitations. You can handle problems if you know the upper and lower limits of the variables and you can handle overflow effectively.

  4. Binary Addition • Regardless of number systems, it is a rule of thumb that if you want to add two numbers what you do? • Assume that you add 3 with 5 using the decimal number system and than assume that you are adding 6 with 5 again in a decimal system. What is the result? What is the difference now? How have you tackled it? • While adding 6 with 5 if I say that we get 11 that is too large to fit in decimal digit therefore 10 is subtracted from the result giving 1 with a carry of 1.

  5. Binary addition Continued • If I say that the addition of two numbers can never be greater that number 18. therefore the carry to the next column will never be greater than 1. what do you say am I right in saying that or no? • Now let’s consider the example of binary digits as our machines operates on binary number systems. • For simplicity we can say that three of the addition operations always result in one digit and we don’t need to carry. Can your write those three addition operations

  6. Results of adding two bits • The only combination if we add 1 to 1 in binary will give us a result of 2 in Decimal. It doesn’t exist in binary so therefore we need to convert decimal 2 in binary that is 10. so a carry of 1 has to be introduced. • Please do write the four possible results of Adding Two Bits

  7. Binary addition • In binary system, accounting for one carry adds four new scenarios. Just like decimal it is adding three values together.

  8. Binary addition continued • In the previous slide the second and third cases are similar to previous examples, the only new case is when 3’s 1 are added together. Just think what is the result of decimal 3 in binary, you will get the answer. If you want to understand in other way if you subtract 2 from 3 what will you get? • Now lets try another example add 10010110 with 00101011 and tell me the answer.

  9. Binary subtraction • Just as addition now we are going to use decimal numbering system to illustrate the process used in binary no system. • There are four possible cases of a single bit binary number is you want to perform an operation. • 0-0, 0-1, 1-0 and 1-1 • Can you identify what is minuend and subtrahend in the above four possible cases? • Subtract 001010101 from 100111011 (in binary)

  10. Binary complements • If it is said that in arithmetic, every number has an additive complement what would you say? • Can you tell what is an additive complement of +7 • There are two ways to calculate the complements of a binary value. • You must know that not necessarily all operations are same for decimal and binary. So rules has been developed to overcome these sort of issues.

  11. One’s complement • What you need to do if you want to add two binary numbers and you want to achieve 0 as a result? • Most people say that just flip the value. • Take a value in Binary 10010111, What will be the 1’s Complement? After getting the 1’s Complement add the original value with its 1’s complement and have a look what is the result. • Means that it is not useful for additive complements.

  12. Two’s complement • You have seen that the result of the additive complement should be 0 but it didn’t happen. • There is another method and it is called 2’s complement. • In the previous example if you add 1 after taking the 1’s complement or inverting each and every value and add 1 you will get the appropriate additive inverse. That is the value will be equal to zero.

More Related