{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Lecture4

# Lecture4 - Lecture 4 Binary Arithmetic Unsigned Integers...

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

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.

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

View Full Document
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.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### 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
Ask a homework question - tutors are online