previous
 next 
CS 3843 Computer Organization
Notes on Chapter 2

Today's News: January 24
UTSA is closed on January 24 at least until 10 AM.
There will not be class on January 24.
Hard copy of late assignment 0 may be turned in at the start of class on Monday.
Assignment 0 email must be sent by 9 AM, Friday, January 24.


Today's News: January 27
Hard copy of Late Assignment 0 is due today.

Section 2.3 - Introduction to computer arithmetic

Computer arithmetic does not necessarily follow the rules of normal arithmetic.
Can you find examples in which
  1. x < y is not the same as x - y < 0
  2. x + 1 < x
  3. x + y is not the same as y + x
  4. x + (y + z) is not the same as (x + y) + z

Addition of integers (unsigned or two's complement) are an abelian group.
An abelian group is a collection of objects, and a binary operation with the following properties:

Section 2.3.1 - Unsigned addition

Detect Unsigned Overflow

Figure 2.21 shows overflow in unsigned addition.
uadd-ovf.jpg
  1. What is the maximum (mathematical) sum of two w-bit unsigned integers?
  2. What are the min and max values on the right side of the figure?
  3. What does 2w -1 get mapped to?
  4. What does 2w get mapped to?
  5. What does the maximum (mathematical) sum get mapped to?
  6. Write an expression that sums two unsigned values and gives the largest possible result.
    Note: UINT_MAX + UINT_MAX does not work!

Unsigned subtraction

Section 2.3.2 - Two's complement addition


Figure 2.23 shows overflow in two's complement addition.
tadd-ocf.jpg
Twos Complement Addition Examples
  1. What is the maximum (mathematical) sum of two w-bit signed integers?
  2. What is the minimum (mathematical) sum of two w-bit signed integers?
  3. What are the min and max values on the right side of the figure?
  4. What does 2w-1 -1 get mapped to?
  5. What does -2w-1 get mapped to?
  6. What does the maximum (mathematical) sum get mapped to?

Section 2.3.3 - Two's complement negation


Today's News: January 29
No news yet.

Section 2.3.4 - Unsigned multiplication

Multiplication of two w-bit numbers might require up to 2w bits.
Unsigned multiplication is done modulo 2w:
    x *uw y = (x•y) mod 2w

Section 2.3.5 - Two's complement multiplication

Problem: What is the largest value you can obtain by multiplying two 32-bit two's complement integers, neither of which is 1?

Section 2.3.6 - Multiplying by constants

Multiply Examples

Section 2.3.7 - Dividing by powers of 2

Section 2.3.8 - Final Thoughts

Look at the practice problems in the book.
next