CS251 - Computer Organization and Design - Spring 2008
Lecture 15 - Single-Cycle Processor
Practical Details
- Read 5.1 to 5.4, C.2
Floating Point Numbers
Algorithms for Addition and Multiplication
Addition/Subtraction
- Equalize exponents
- Shift right significand of number with smaller exponent
- Add 1 to its exponent
- Until exponents are equal
- Add/subtract significands
- Put one bit bit 23
- Use sign bit top create TCIs
- Sign extend
- Add as TCIs: extra precision not needed
- Normalize result
- Shift significand left or right
- Add 1 to or subtract 1 from exponent
- Until significand is normalized
Note that subtraction is different
Multiplication (Division)
- Add (subtract) exponents
- Multiply significands
- Normalize result
Pathologies
Exponent can overflow or underflow.
Significand can underflow
NaN (Not a Number)
Possible values
- Too large to represent
- Too small to represent
- Infinity
- Underflow
Single-Cycle Processor
Datapath & control for a mini-MIPS (MIPS = Multiprocessor without
Interlocked Pipeline Stages). Operations
- load and store
- add, subtract, AND, OR, set on less than
- jump and conditional branch
which is enough to write just about any program.
Exercise: What is missing? (Answer. Shift)
MIPS Architecture
32 32-bit registers, numbered 0 to 31
Memory of 32-bit words
- byte addressable
- address of word is address of most significant byte
- data paths are 32-bit
All instructions are 32-bit
Instructions
Load & store
- addressing modes
- register, $s1
- base + displacement, 100($s1)
- immediate, 100
- load:
lw $s1, 100($s2) - load into register 1 whatever is
100 bytes from the value in register 2
- store:
sw $s1, 100($s2) - store the contents of register 1
into the memory at 100 bytes from the value in register 2
Add, subtract, AND, OR, set
- add:
add $s1, $s2, $s3 - add the values in regusters 2 and
3 and put the result in register 1
Conditional branch
- branch on equal:
beq $s0, $s1, 10 - is the value in
register 0 equals the value in register 1 set PC <= PC + 4 + 40
Unconditional branch
- jump:
j 1000 - PC <= 4000
MIPS Functional Units
- Program counter (PC) used to fetch instruction from instruction
memory
- Instruction used to fetch register operands from register file
- Instruction plus registers used to fetch memory operands from data
memory
- ALU computes result
- Result put into register file or data memory
Instruction Execution Components
The more you can keep them separate the more you can
Instruction Fetch
Sequence
- Signal to fetch
- Read cycle to instruction memory with PC as address
- Increment PC by 4 (combinational logic)
Often there is a FIFO
Datapaths
- PC to memory
- PC to adder
- Adder to PC
- Instruction to next stage
Decode Instruction and route the parts accordingly
Instruction Types
- Register instructions
- Memory instructions
- Branch instructions
Register (R-type) Instructions
- Argument parts of instruction select read and write registers
- ALU part of instruction selects operation of ALU
Sequence
- Read arguments of instruction put register values on path to ALU
input
- ALU part of instruction selects the combination logic function to be
applied
- Result appears on ALU output
- ALU output written to register selected by argument
Datapaths
- Instruction to register file
- Instruction to ALU
- Register file to ALU input
- ALU output to register file
Return to: