l12 - 6.111 Lecture # 12 Binary arithmetic: most operations...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
6.111 Lecture # 12 Binary arithmetic: most operations are familiar Each place in a binary number has value 2 n 5 = 00000101 = 1 + 4 19 = 00010011 = 1+2+16 5 + 00000101 19 00010011 = 00011000 24 = 16+8 19 - 00010011 5 = 00000101 00001110 14 = 8+4+2 What happens if we do this operation: 5 00000101 -19 00010011 = 11110010 Note two things about this operation: Addition often requires a ‘carry’ Subtraction may require a ‘borrow’ 1. We had to invent a ‘borrow’ bit from the left 2. What is left is the two’s complement representation of -14: 14 = 00001110 -14 = 11110001 +1 = 11110010 Representation of negative numbers: there are a number of ways we might do this: 1. Use of a ‘sign bit’ (this is just like having a sign for the number) -5 = 10000101 Note that addition and subtraction are somewhat complex (and multiplication and division). Generally must strip the sign bit, do the operation, then figure out the sign of the result. 2. ‘One’s Complement’: invert each bit. We won’t have much to say about this. 3. ‘Two’s Complement’: invert each bit and add one. 1 Two’s complement is consistent and reversible: 5 = 00000101± -5 = 11111010 +1 = 11111011± 5 = 00000100 +1 = 00000101± Addition and Subtraction between two’s complement numbers works: -5 11111011± +(-19) 11101101± = 11101000 (which is -24)± 00010111+1 = 00011000 = 16+8 3 4 2
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
5.5 = 00000101.1 5.0 = 00000101.0 -5.0 = 11111010.1 + 1 = 11111101.0 In many cases we want to extend a number: to employ more ‘binary places’ to represent a number. How do we do this extension? To extend a number (represent with more places) without changing
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 07/20/2009 for the course ELECTRICAL 6.111 taught by Professor Prof.dontroxel during the Fall '02 term at MIT.

Page1 / 6

l12 - 6.111 Lecture # 12 Binary arithmetic: most operations...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online