Presentation is loading. Please wait.

Presentation is loading. Please wait.

C1 Number systems.

Similar presentations


Presentation on theme: "C1 Number systems."— Presentation transcript:

1 C1 Number systems

2 Negatives, Addition, Subtraction
Binary Negatives, Addition, Subtraction

3 C1 Number systems The use and interpretation of number systems used in computer systems, including: units of digital data (bit, byte, kilobyte and multiples of these) binary binary coded decimal (BCD). The use of binary arithmetic (including BCD) to perform calculations: addition, subtraction, multiplication and division. The use of binary to represent negative and floating point numbers.

4 All used for different purposes within a CPU
AQA CD-ROM Number Systems Binary Sign Magnitude Binary 2s Complement Binary All used for different purposes within a CPU

5 All computer processing is carried out digitally.
Binary All computer processing is carried out digitally. Processor handles instructions as binary codes – zeros and ones. All data on a device is 0’s and 1’s.

6 Converting binary into positive denary integers
Whole positive denary (base ten) numbers are converted into binary as follows: 135 from denary into binary = 135 MSB LSB 128 64 32 16 8 4 2 1 1 1 1 1

7 Binary Addition Binary Subtraction

8 Binary Addition Sums In binary addition there are 5 possible sums: 0 + 0 = 0 0 + 1 = 1 1 + 0 = 1 1 + 1 = 0, carry 1 = 1, carry 1

9 Binary Addition Example 1
= 89 128 64 32 16 8 4 2 1 75= 14= Carry 89 1 1 1 1 1 1 1

10 Binary Addition Example 2
= 136 128 64 32 16 8 4 2 1 79= 57= Carry 136 1 1 1 1 1 1 1 1 1

11 Binary Addition Example 3
= 150 128 64 32 16 8 4 2 1 75= Carry 150 1 1 1 1 1 1 1 1

12 Binary Addition Example 4
= 353 ( ) (exercise 3c Page 97) 128 64 32 16 8 4 2 1 215= 138= 353 1 1 1 Overflow 1 1 1 1 1

13 Binary Subtraction CPUs can’t subtract, they can only add! 75-14=61 The same as… 75+(-14)=61 Positive + Negative = Negative To do this we need 2s Complement -128 64 32 16 8 4 2 1

14 Storing Negative Integers
Another method is 2s Complement -75 64 32 16 8 4 2 1 128 -128 1 1 1 1 1 =-75

15 2s Complement Conversion
-117 Stage 1 : work out 117 in binary 128 64 32 16 8 4 2 1 Stage 2 : Reverse the 0’s and 1’s -128 64 32 16 8 4 2 1 1 Stage 3 : Plus 1

16 Storing Negative Integers
1 method is Sign/Magnitude 75 -75 MSB 64 32 16 8 4 2 1 +/- 128 1 1 1 1 1 1 is a Negative, 0 is a Positive

17 64 32 16 8 4 2 1 +/- 1 1 1 1 Sign Value or Magnitude Sign/Magnitude
This method has some limitations 2 types of data in the same value (MSB is a sign) Makes calculations difficult by losing 1 bit 127 maximum number 64 32 16 8 4 2 1 +/- 1 1 1 1 Sign Value or Magnitude

18 Binary Subtraction Example 1
75-14=61 75+(-14)=61 -128 64 32 16 8 4 2 1 75= -14= 61 1 1 1 1 1 1 1 1

19 Binary Subtraction Example 2
91-18=73 91+(-18)=73 -128 64 32 16 8 4 2 1 91= -18= 73 1 1 1 1 1 1 1 1 1 1

20 This is the same as an // operation in Python
Logical Shifts A left or right logical shift can be performed on a binary number as a method of multiplication or integer division. This is the same as an // operation in Python We can perform multiplications or integer divisions in powers of 2

21 Left Logical Shifts Example 1
128 64 32 16 8 4 2 1 Take this byte – 104 in denary Shift it left by 1 128 64 32 16 8 4 2 1 – 208 in denary (104x2) 2**1 is 2

22 Left Logical Shifts Example 2
128 64 32 16 8 4 2 1 Take this byte – 104 in denary Shift it left by 2 256 128 64 32 16 8 4 2 1 – 416 in denary (104x4) 2**2 is 4

23 Left Logical Shifts Example 3 (activity 5a page 102)
128 64 32 16 8 4 2 1 Take this byte – 58 in denary Shift it left by 3 - 2**3 (8) 256 128 64 32 16 8 4 2 1 – 464 in denary (58x8)

24 Right Logical Shifts Example 1
128 64 32 16 8 4 2 1 Take this byte – 185 in denary Shift it right by 1 128 64 32 16 8 4 2 1 – 92 in denary (185//2) Integer Division 2**1 is 2

25 Right Logical Shifts Example 3 Activity 5b Page 102
AQA CD-ROM Right Logical Shifts Example 3 Activity 5b Page 102 128 64 32 16 8 4 2 1 Take this byte – 157 in denary Shift it right by 4 128 64 32 16 8 4 2 1 – 9 in denary (157//16) Integer Division 2**4 is 16

26 Left arithmetic shift – The MSB remains untouched
Arithmetic Shifts A left or right arithmetic shift can be performed on a 2s complement binary number as a method of multiplication or integer division. Left arithmetic shift – The MSB remains untouched Right arithmetic shift – use a copy of the MSB as the replacement bits

27 Left Arithmetic Shifts Example 1 (page 102)
-128 64 32 16 8 4 2 1 Take this byte -36 in denary ( ) Shift it 1 place left arithmetic shift -128 64 32 16 8 4 2 1 – -72 (-36x2)

28 Right Arithmetic Shifts Example 1 (page 103)
-128 64 32 16 8 4 2 1 Take this byte -72 in denary ( ) Shift it 2 places right arithmetic shift -128 64 32 16 8 4 2 1 – -18 (-72//4) (2**2=4)

29 Representing characters
There are two main coding systems that provide conversions of keyboard characters into binary: ASCII UNICODE

30 ASCII ASCII stands for the American Standard Code for Information Interchange. It has been adopted as the industry standard way of representing English language keyboard characters as binary codes. Every keyboard character is given a corresponding binary code. ASCII uses an 7-bit code to provide 128 characters.

31 UNICODE UNICODE is the new standard to emerge that is replacing ASCII.
Uses 16 bits per character It is designed to cover more of the characters that are found in languages across the world. It has become important due to the increased use of the Internet, as more data is being passed around globally.


Download ppt "C1 Number systems."

Similar presentations


Ads by Google