Presentation is loading. Please wait.

Presentation is loading. Please wait.

IT Systems Number Operations EN230-1 Justin Champion C208 – 3273 www.staffs.ac.uk/personel/engineering_and_technology/jjc1.

Similar presentations


Presentation on theme: "IT Systems Number Operations EN230-1 Justin Champion C208 – 3273 www.staffs.ac.uk/personel/engineering_and_technology/jjc1."— Presentation transcript:

1 IT Systems Number Operations EN230-1 Justin Champion C208 – 3273 www.staffs.ac.uk/personel/engineering_and_technology/jjc1

2 IT Systems Contents Maths Addition Subtraction Multiply Division Negative numbers How it actually works Half adder Full Adder

3 IT Systems Different numbers systems Last week we looked at different common number systems Hexadecimal Binary Decimal These number systems unless we could do something with them Computers are good calculations we will look methods of doing the maths First job is to convert the numbers into a common format Methods of this were discussed last week in lecture 4

4 IT Systems Binary Addition This works in the same way as the decimal system Add The issue becomes when we have This sum is done in the same way decimal, the value is written in the column and a carry bit is then added to the next column 1 +0 1 +1 ?? 1 +1 10 = Decimal 2

5 IT Systems Binary Addition (continued) More examples As discussed last week ensure that both lines have the same number of values so Becomes Workings 010 +0111011 0000010 +0111011 Carries 1 0000010 +0111011 0111101

6 IT Systems Computer Architecture 6811 Has a special register which stores the carry bit if the number is bigger than the register you are working upon Register A, B are both 8 Bits All processors have this register

7 IT Systems Binary Subtraction The same technique is used as decimal Try If you are having problems with this concept there is nothing wrong with converting to decimal carrying out the maths then converting back to binary 1 - 0 1 111 - 100 011 11000 - 10111 00001

8 IT Systems Binary Multiplication & Division Special case where multiplication or division are by a divisor of 2 This could be done by the same method as used for decimal Faster method is to use Binary Bit Shifting 111Dec 7 * 10Dec 2 1110

9 IT Systems Binary Bit Shifting This is moving all of the bits Move them towards the big endian for multiplication Move them towards the little endian for division One movement would equal a change by 2 If you were multiplying by 8 You would move towards the big endian 4 times

10 IT Systems Multiplication Try this or If the numbers are NOT multiples of 2 You have to do the work the same as the decimal method For the remainders we will ignore as this will end up complicated 101 * 100 1000 / 100

11 IT Systems Negative numbers Obviously it is possible to end up with negative numbers These number are represented by different methods Signed Magnitude One’s Complement Two’s Complement Excess

12 IT Systems Signed Magnitude The big endian is used to indicate if the value is positive or negative 00001100 == +12 10001100==-12 One’s Complement Positive numbers do not change Negative numbers flip the bits The big endian as with signed magnitude indicates a positive or negative value Flipping the bits All 1’s become 0 and all 0’s become 1’s So 0001001 becomes 1110110

13 IT Systems Two’s Complement First of all this is the same as 1’s complement The value of 1 is added to the result Excess 2 (m-1) = 8 bits = 2 7 The maximum value is added to the binary number +7 = 10000111 -7 = 01111001

14 IT Systems Whichever system is used it must be check on the architecture. If your maths are based upon 2’s complement and you use 1’s the answers will be very different 2’s complement is the common used method The ease of maths is the reason for this

15 IT Systems Maths with the 2’s complement 12 + -7 12 = 1100 -7 = 1001 The fifth bit is thrown away and will be stored by the overflow bit 1100 Dec 12 +1001Dec -7 0101 Dec 5

16 IT Systems Maths on Hexadecimal numbers As with Binary the same method as decimal is used 7 Dec 7 +2Dec 2 9 Dec 9 +2Dec 2 B Dec 11

17 IT Systems How it works ? So after all of this how does the computer actually add the numbers A series of logic gates Sum = A. B Carry = A + B exclusive OR This will add 2 binary numbers together And is commonly referred to as a half adder

18 IT Systems How it works ? Half adder adds 2 binary values together and stores one bit in the carry bit A full adder accepts the carry bit as a input and also has a carry bit as a output. These full adders are then put into sequence connecting to each other So for a 8 bit adder we would have 8 of them in a row

19 IT Systems Summary of what we have discussed Maths Addition Subtraction Multiply Division Negative numbers How it actually works Half adder Full Adder


Download ppt "IT Systems Number Operations EN230-1 Justin Champion C208 – 3273 www.staffs.ac.uk/personel/engineering_and_technology/jjc1."

Similar presentations


Ads by Google