go to previous page   go to home page   go to next page hear noise highlighting

Answer:

$0


Registers and the ALU

Registers and the ALU

The bit pattern 0x00000000 occurs so frequently in machine language that register $0 is wired to permanently hold it. That bit pattern represents the integer zero, a very common integer. It also represents a null, which is used to mark the end of character strings and often used in building data structures.

The arithmetic/logic unit (ALU) of a processor performs integer arithmetic and logical operations. For example, one of its operations is to add two 32-bit integers. An integer used as input to an operation is called an operand. One operand for the ALU is always contained in a register. The other operand may be in a register or may be part of the machine instruction itself. The result of the operation is put into a general purpose register.

Machine instructions that use the ALU specify four things:

  1. The operation to perform.
  2. The the first operand (contained in a register).
  3. The second operand (often contained in a register).
  4. The register that receives the result.

The picture shows a 32-bit addition operation. The operands come from register $8 and from register $9. The result is put in register $10. Here is how that instruction is written as assembly language:

addu    $10,$8,$9 

QUESTION 5:

Here is another instruction that involves the ALU:

subu    $25,$16,$17 

Identify the following:

  1. The operation:
  2. The location of one operand:
  3. The location of the other operand:
  4. The destination of the result:

go to previous page   go to home page   go to next page