PowerPC, Number Representation

Tom Kelliher, CS 240

Feb. 8, 1999

Administrivia

Announcements

Assignment

From Last Time

80x86 architecture.

Outline

  1. PowerPC architecture.

  2. Number representation: unsigned and signed representations.

Coming Up

ALU design.

Other Instruction Sets

PowerPC: Another RISC

Basics similar to MIPS:

  1. 32 registers.

  2. 32-bit instructions.

  3. Load-Store architecture.

Additional features:

  1. Indexed addressing: address is sum of two registers.

    General applicability?

  2. Update addressing: similar to base/offset addressing with the additional wrinkle of automatically incrementing the base register by sizeof(operandType) after access.

    Other strides? ALU conflicts?

  3. Load/store multiple: load/store upto 32 registers in a single instruction. Useful for: register save/restore, block memory copying.

    Complexity? Can it be done with hardwired control?

  4. A special loop control register, distinct from the 32 registers and accessed by a special conditional branch instruction which decrements it and then tests it ( =0, !=0).

    Useful for:

    for (i = n; i != 0; --i)
       /* code block */;
    
    Not generally useful. What it can lead to.

Number Representation

  1. Weighted, positional number systems:
    1. Digit weights.

    2. Digit positions within a number.

  2. Conventionally, a base x system uses x numerals (symbols).

    Consider decimal. This really isn't the case. Why? How can we make it so.

  3. Consider a four bit binary number: . What does contribute to the value of the number?

  4. Hexadecimal: For the sake of brevity, binary numbers are often written in hexadecimal form, because of a direct conversion between the two:

    Examples: convert 110101 to hex and AE to binary.

  5. MIPS registers are 32-bits. How do you store 4 in a register?

    What is the range of unsigned values representable in the MIPS? In general, with i-bits, how many unsigned values can we represent?

  6. What do we do about numbers that are too big? Fractions? The reals?

  7. What about negative values? How do we represent them?

    How do we solve this in the decimal system.

    The sign bit. Location within a word.

Sign-Magnitude Representation

Msb is sign, remaining bits are magnitude.

Problems with sign-magnitude representation:

  1. Multiple zero representations.

  2. Consider the algorithm for a + b:
    if a and b are of the same sign
    {
       sign of sum = sign of a;
       magnitude of sum = magnitude of a + magnitude of b;
    }
    else if magnitude of a > magnitude of b
    {
       sign of sum = sign of a;
       magnitude of sum = magnitude of a - magnitude of b;
    }
    else
    {
       sign of sum = sign of b;
       magnitude of sum = magnitude of b - magnitude of a;
    }
    

Two 0 representations.

Symmetric range.

One's Complement Representation

Msb is sign bit.

  1. Positive values have same representation as for unsigned case.

  2. To compute the inverse, complement all the bits.

  3. Two 0s.

  4. Symmetric range.

  5. Addition may cause wraparound carries.

Two's Complement Representation

Again, msb is sign bit.

  1. Positive values have same representation as for unsigned case.

  2. To compute the inverse, complement all the bits and add 1.

  3. One 0.

  4. Asymmetric range: one more negative value.

To be continued.



Thomas P. Kelliher
Sun Feb 7 16:05:34 EST 1999
Tom Kelliher