register indirect and absolute are easily represented
– Byte addressable 64-bit address •
Big or littleendian
– Load/store architecture
I-type instructions •
I-Type instruction: 6 bits
5 bits
Op code
•
rs
5 bits rt
16 bits immediate
Encodes: Loads and stores of bytes, half words, words, dwords – All immediate (rt ç rs op immediate) – Ex: Add base register rs to 16 bit offset
R-type instructions • R-Type instruction: 6 bits Op code
5 bits rs
Source registers
5 bits
5 bits
11 bits
rt
rd
func
Destination register
Op code variant
• Register-Register ALU operations: rd ç rs func rt – Function encodes data path operation: add, sub, slt, and, or – Read/write special registers and moves
1
J-type instructions • J-Type instruction: 6 bits
26 bits
Op code
immediate
• Encodes: – Jump and jump & link – Trap and return from exception
In summary… • Pitfalls – Designing “high-level” language instructions – Not considering compiler design when targeting code size
• Fallacies – There are “typical” programs – An architecture with flaws cannot be successful – You can design a flawless architecture
ALU components Data Path and Control Review
op Carry_in a b
Kirk W. Cameron, Ph.D. Assistant Professor Department of Computer Science and Engineering University of South Carolina
0 1
a b
+
sum
3/2 adder
1-bit logical unit for AND and OR Carry_out
2
1-bit Simplified ALU w/ subtraction
1-bit Simplified ALU Carry_in
Binvert
op
a b
Carry_in
a b
0 1
op
0 1
result
result
2
2
0
+
+
1 Carry_out
Carry_out
a + b + 1 = a + (b + 1) = a + ( −b) = a − b
32 bit ALU (ripple carry)
Edge-triggered Design
Carry_in Binvert
a0 b0
op
ALU0
ALU1
Clocks: necessary to update logic that holds state
• • • •
Frequency = inverse of cycle time Clock period = high clock followed by a low clock Edge-triggered clocking: all state changes occur on clock edge Active clock edge = edge of clock that causes state to change
– Free running signal with a fixed cycle time (clock period) result0
Carry_out
a1 b1
•
result1
Carry_out
Rising edge a32 b32
ALU32
Falling edge
Clock period
result32
Carry_out
Why use edge-triggering? State of input element
Setup time
Combinational Logic
State of output element
Hold time High Low High Low Clock period
*input values must be stable when active clock edge returns
3
6 bit register using D flip flops
Register Files • Set of registers that can be read and written by supplying a register number to be accessed – One set of registers operated on by a port
• Multiple-read ports: not too difficult • Multiple- write ports: problems arise