### V22.0436 - Prof. Grishman

### Lecture 9 - MIPS instruction set; binary arithmetic

#### MIPS architecture, cont'd (text, chapter 3)

Review basic MIPS instructions (text, Figure 4.6, p. 183)
- uniform 2-operand arithmetic and logical instructions
- use of register 0 as constant 0
- two-instruction sequence for branch on less than

Sharp contract with CISC (complex instruction set) architectures such
as the Intel 80x86

- historical requirements of upward compatibility with earlier machines
led to complex design (8080 -> 8086 -> 80286 -> 80386 etc.)
- almost every register has some special properties
- operands for instructions can come from memory or register; result
can be store to memory or register
- multiple operand sizes; multiple instruction lengths
- complex machine design

Will return to performance issues later in semester

#### Binary arithmetic

- negative numbers: 2's complement (text, chapter 4.2)
- binary adder: ripple carry; propagation delay (text, chapter 4.3)
- subtraction

#### MIPS ALU (text, section 4.5)

An ALU (arithmetic-logical unit) is a combinational circuit capable of
computing a variety of arithmetic and logical functions.

- operations needed for MIPS instructions discussed so far: add, subtract,
and, or, zero test, comparison [MIPS also has nor, xor; multiply and divide]
- general strategy: different circuits combined by multiplexer; multiplexer
select becomes function select for ALU
- inverting B input for subtraction
- feed output of high-order bit of adder to low-order bit for "set
on less" operation
- use OR gate on ALU output for "equal" test

#### Carry look-ahead: introduction

- simplest adder is "ripple carry": slow (delay time linear
in size of operands)
- add time is usually critical in determining overall cycle time of a
machine
- can speed up addition by introducing notion of "carry generate"
and "carry propagate"