1 / 31

Number Systems

Number Systems. Revision of conversations What is a register Addition Complementation. Revision of conversions. Answers. Home Work. Convert the following. What is a Register?. A small amount of very fast computer memory Speed up computer programs. Store most commonly used values,

haroun
Download Presentation

Number Systems

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. Number Systems Revision of conversations What is a register Addition Complementation

  2. Revision of conversions

  3. Answers

  4. Home Work • Convert the following

  5. What is a Register? • A small amount of very fast computer memory • Speed up computer programs. • Store most commonly used values, • Computers load information into the registers, and then load it back to the main memory (load-store architecture)

  6. Registers • If we have a 5 bit register the maximum number of bits it can store is 5 • Since it can hold 5bits we could have 25 combinations (32) • The range of the register would be 0 – 25-1 = 0 - 31

  7. Working with Registers • If we had a 12 bit register how many bits could it hold? • How many combinations would the register be able to hold? • What would the range of the register be?

  8. Home Work • Find the following for registers A, B and C • How many bits would each one hold? • How many combinations could be made in each register? • What would the range of numbers be for each one? • 10 • 8 • 14

  9. Addition • We could perform addition on binary numbers • Here are some examples;

  10. REMEMBER • If we remember the following rules we will have no problems when performing additions

  11. Trying out additions

  12. Answers

  13. Home work

  14. Complementation • Complementation is a used to represent positive and negative numbers. In binary • This system requires numbers to be represented by a fixed number of bits. • There are two forms of complementation, one’s complement and two’s complement.

  15. Ones Complement • One’s complement is used to represent negative numbers • Lets say we have 4510 • When using 8 bits 4510 = 001011012 • If we change 4510 to -4510 The binary representation changes by converting 0s to 1s and 1s to 0s; 001011012 110100102. after ones complement

  16. Examples • Change the following to negative binary numbers using one’s complement

  17. Answers

  18. Two’s Complement • Two’s complement allows us to perform subtractions with binary numbers • With two’s complement we start converting 1s to 0s and 0s to 1s after the first 1 • Lets take the previous example of -4510,

  19. Another example • Lets say we had the number 1710 and we want to change it to a -17 in two’s complement • First we convert 1710 to binary using an 8 bit register = 000100012 • Starting after the first 1 we convert the bits = 111011112

  20. Examples • Change the following negative numbers to binary using two’s complement and an 8 bit register ;

  21. Answers

  22. Home Work • Convert the following negative numbers into binary using one’s and twos complement;

  23. Numerical Overflow • An overflow is when something doesn’t fit in a certain space • Numeric overflow is when the storage for a calculation is too small to hold the result • For example we have an 8 bits register, if we add two binary numbers and the result turns out to be 9 bits it would not fit in the register

  24. Example • Let’s say we have an 8 bit register • Add the following; • Do we have an overflow?

  25. Numerical Overflow • When we have a numeric overflow we will have an error in our calculation • When we have an overflow we would need to remove the extra bit at the start of the number • Lets say we had a 7 bit register and the result of a calculation is 11001100 the actual answer would be 1001100

  26. Example • Let’s say we have a 7 bit register • Add the following; • Do we have an overflow? • Actual answer =

  27. What is Bit Shifting? • Bit shifting is the process of moving all the bits in a binary number • We have two shifts • A right shift • A left shift • The right shift would divide the number while the left would multiply it

  28. Right Shift • The right shift is used for • If we shift the byte 001101112 left once, we get 011011102. If we shift 101100112, right by three places, we get 000101102. Notice in the right-shift example that bits that are shifted out of the byte are lost. This also occurs with left-shifting: if any bits are shifted outside of the "boundaries" of the type in use (eight bits, for a byte), they are lost.

  29. Left Shift

  30. Right Shift

  31. Ranges

More Related