# 1240893537 - ComputerOrganization CDA3103 Dr.HassanForoosh

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

Computer Organization CDA 3103 Dr. Hassan Foroosh  Dept. of Computer Science UCF © Copyright Hassan Foroosh 2004

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

View Full Document
Overview of Lecture Binary number representation and 2’s complement Addition in 2’s complement overflow ALU and adder full adder logical operations carry lookahead Multiplication
Computer System Organization Processor Computer Control Datapath Memory Devices Input Output Arithmetic is here Arithmetic is here

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

View Full Document
Binary Binary Decimal 0 0000 1 0001 2 0010 3 0011 Decimal 4 0100 5 0101 6 0110 7 0111 0 0 1 1 0 0 1 0 + 0 1 0 1 1 0 0 1 1 0 0 1 1 + 0 1 1 0 1 1 Introduction to Binary Numbers Value of digit i (LSB is digit 0) = digit x 2 i Addition examples:     3 + 2 = 5 3 + 3 = 6 Consider a 4-bit unsigned binary number
2’s Complement Binary Decimal 0 0000 1 0001 2 0010 3 0011 0000 1111 1110 1101 Decimal 0 -1 -2 -3 Bitwise Inverse 1111 1110 1101 1100 4 0100 5 0101 6 0110 7 0111 1100 1011 1010 1001 -4 -5 -6 -7 1011 1010 1001 1000 1000 -8 0111 8 1000 Not a Positive Number! Two’s Complement Representation 2’s complement representation of negative numbers Bitwise inverse and add 1 MSB is always “1” for negative number => sign bit Biggest 4-bit number : 7 (2 n–1  –1) Smallest 4-bit number: -8 (–2 n-1 )

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

View Full Document
Two’s Complement Value of number (assuming 32-bits = b 31 b 30 .…b 0 ): -b 31 x 2 31  + b 30  x 2 30  +. .. +b 1  x 2 1  + b 0  x 2 0 2’s complement to negate an n-bit number  x : 2 n  –  x invert all bits and add 1       x  + ~ x  = -1 (represented by 11…1) =>  x +  ~ x +  1 = 0  and therefore ~ x  + 1 = - x Alternative integer representations sign-magnitude: sign bit + absolute value 1’s complement: invert each bit Disadvantages of alternatives +0, –0 arithmetic not as simple Advantage of alternatives max positive = max negative Two’s complement is the standard
Two’s Complement Arithmetic Examples:       7 + (- 6)  =  1 3  +  (- 5)  =  -2 2’s Complement Binary Decimal 0 0000 1 0001 2 0010 3 0011 0000 1111 1110 1101 Decimal 0 -1 -2 -3 4 0100 5 0101 6 0110 7 0111 1100 1011 1010 1001 -4 -5 -6 -7 1000 -8 0 1 1 1 1 0 1 0 + 0 0 0 1 1 0 0 1 1 1 0 1 1 + 1 1 1 0 1 1 1 1

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

View Full Document
2’s Complement: Subtraction/Overflow Subtraction: add 2’s complement 5 – 7 = 5 +(–7) 7 – (–2) = 7 + (– – 2) = 7 + 2 Overflow => sum is too large to represent in precision Addition overflow sign of operands the same, and sign of result differs    Subtraction overflow: A – B sign of operands different, and A positive: sign of result negative, or A negative: sign of result positive Interesting case: 0 – max negative
Requirements for MIPS Integer ALU

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 08/22/2010 for the course CDA 3101 taught by Professor Staff during the Fall '07 term at University of Central Florida.

### Page1 / 44

1240893537 - ComputerOrganization CDA3103 Dr.HassanForoosh

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

View Full Document
Ask a homework question - tutors are online