Lecture4 - Lecture 4 Binary Arithmetic Unsigned Integers...

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

View Full Document Right Arrow Icon
Lecture 4 Binary Arithmetic Unsigned Integers Memory addresses are unsigned integers. If memory address (of a location) is 16 bit, then addresses would run from 0x0000 to 0xFFFF. There are no signed or negative addresses. Addition of Unsigned Integers Simply add the bits: 101 + 1001 = 1110 . The result may not fit in the allocated number of bits (in this case 4). The extra bit is carried over to a carry bit (if one is allocated). Signed Binary Integers Positive and negative integers. This is how a computer stores or represents integers in a memory word. There are 3 types of signed binary integers: A. Signed magnitude B. 1’s complement C. 2’s complement Processor must be able to add or subtract these numbers very easily.
Background image of page 1

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

View Full DocumentRight Arrow Icon
A. Signed Magnitude Leftmost bit in the word is the sign bit . ‘0’ for positive numbers, ‘1’ for negative numbers. Remaining bits hold the absolute value of the number ( e.g ., 8-bit word: 1 bit for sign, 7 bits for value). Example: 8-bit numbers. This includes 1 bit for the sign. 01001011 +75 10 10001111 -15 10 Addition: 7 10 + 12 10 = 19 10 0111 + 1100 = 1 0011 The 1 is an extra carry (note that the sign Subtraction: 9 10 6 10 = 3 10 1001 – 0110 = 0011 bit is not shown in these two examples) What happens if the result is < 0? How do we store negative numbers? Problems: There are two representations for zero: A ‘positive’ zero (0 000 0000) and a ‘negative’ zero (1 000 0000). Addition of 2 positive numbers is straightforward.
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 12/12/2010 for the course CSE 220 taught by Professor Staff during the Spring '08 term at SUNY Stony Brook.

Page1 / 6

Lecture4 - Lecture 4 Binary Arithmetic Unsigned Integers...

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