Professional Documents
Culture Documents
software
instruction set
hardware
ISA Design
Instructions:
Machine Language
Single ISA
Leverage common compilers, operating systems,
etc.
BUT fairly easy to retarget these for different ISAs
(e.g. Linux, gcc)
Multiple ISAs
Specialized instructions for specialized
applications
Different tradeoffs in resources used
(e.g. functionality, memory demands, complexity,
power consumption, etc.)
Competition and innovation is good, especially in
emerging environments (e.g. mobile devices)
CA: MIPS ISA
ISA Design
calculators
Harvard Mark I , 1944; Zuses Z1, WW2
ENIAC
ENIAC
EDVAC
EDSAC
1946
1948
1947 (concept )
1950 Maurice Wilkes
Instruction
Fetch
Instruction
Decode
Result
Store
Next
Instruction
how is it decoded?
Operand
Fetch
Execute
ISA Design
Successor instruction
x
x
AC M[x]
M[x] (AC)
ADD
SUB
x
x
AC (AC) + M[x]
MUL
DIV
x
x
Single accumulator
AC 2 (AC)
SHIFT LEFT
SHIFT RIGHT
JUMP
JGE
x
x
PC x
if (AC) 0 then PC x
LOAD ADR
STORE ADR
x
x
Ci
LOOP
F1
F2
F3
DONE
Ai + Bi, 1 i n
LOAD
JGE
ADD
STORE
LOAD
ADD
STORE
JUMP
HLT
N
DONE
ONE
N
A
B
C
LOOP
Single accumulator
N
ONE
-n
1
code
LOOP
F1
F2
F3
DONE
modify the
program
for the next
iteration
DONE
LOAD
JGE
ADD
STORE
LOAD
ADD
STORE
JUMP ADR
LOAD
HLT
ADD
STORE ADR
LOAD ADR
ADD
STORE ADR
LOAD ADR
ADD
STORE ADR
JUMP
HLT
N
DONE
ONE
N
A
B
C
LOOP
F1
ONE
F1
F2
ONE
F2
F3
ONE
F3
LOOP
Ci
Ai + Bi, 1 i n
Single accumulator
Self-Modifying Code
10
stores
10
x, IX
x, IX
Index registers
Index Registers
AC M[x + (IX)]
AC (AC) + M[x + (IX)]
x, IX
LOADi
...
x, IX
if (IX)=0 then PC x
else IX (IX) + 1
IX M[x] (truncated to fit IX)
11
Index registers
DONE
LOADi
JZi
LOAD
ADD
STORE
JUMP
HALT
-n, IX
DONE, IX
LASTA, IX
LASTB, IX
LASTC, IX
LOOP
LASTA
1in
Costs:
12
new instruction
Index registers
new instruction
k, IX
IX (IX) + k
x, IX
13
x, IX
LOAD
(x)
Addressing modes
3. Indirection
4. Multiple accumulators, index registers, indirection
or
LOAD
LOAD
R, IX, x
R, IX, (x) the meaning?
R M[M[x] + (IX)]
or R M[M[x + (IX)]]
RI, (RJ)
14
Instruction formats
RI (RI) + (RJ)
RI (RI) + M[x]
RI (RJ) + (RK)
RI (RJ) + M[x]
CA: ISA Design
15
Operands on a stack
add
load
Stack architecture
Register
A
B
C
SP
16
Stack architecture
expression evaluation;
2. subroutine calls, recursion, nested
interrupts;
3. accessing variables in block-structured
languages.
1.
tagged data
virtual memory
multiple processors and memories
CA: ISA Design
17
Stack architecture
Evaluation of Expressions
(a + b * c) / (a + d * c - e)
/
+
a
*
c
*
d
Reverse Polish
abc*+adc*+e-/
push a push b
multiply
push c
c
bb
*c
a
Evaluation Stack
18
Stack architecture
Evaluation of Expressions
(a + b * c) / (a + d * c - e)
/
+
a
*
c
*
d
Reverse Polish
abc*+adc*+e-/
add
CA: ISA Design
b*c
a+a
b*c
Evaluation Stack
19
Stack architecture
20
Stack architecture
1 memory reference
1 memory reference
No Good!
21
abc*+adc*+e-/
a and c are
loaded twice
not the best
use of registers!
program
push a
push b
push c
*
+
push a
push d
push c
*
+
push e
/
stack (size = 4)
R0
R0 R1
R0 R1 R2
R0 R1
R0
R0 R1
R0 R1 R2
R0 R1 R2 R3
R0 R1 R2
R0 R1
R0 R1 R2
R0 R1
R0
Stack architecture
22
(a + b * c) / (a + d * c - e)
Reuse
R2
Reuse
R3
Reuse
R0
Load
Load
Load
Mul
Add
Load
Mul
Add
Load
Sub
Div
R0
R1
R2
R2
R2
R3
R3
R3
R0
R3
R2
a
c
b
R1
R0
d
R1
R0
e
R0
R3
GPR machine
Ri m
Ri (Rj)
Ri (Rj) (Rk)
- eliminates unnecessary
Loads and Stores
- fewer Registers
but instructions may be longer!
CA: ISA Design
23
Stack architecture
In addition to push,
pop, + etc., the
instruction set must
provide the capability
to
machinery to
carry out
+, -, etc.
stack
SP
DP
PC
push
push
push
*
+
push
/
a
b
c
e
a
b
c
.
.
.
data
code
CA: ISA Design
24
Stack architecture
25
Forth machines
Stack architecture
Stacks post-1980
26
7094
7074
7080
7010
Instruction set
I/O system and Secondary Storage:
magnetic tapes, drums and disks
assemblers, compilers, libraries,...
market niche
business, scientific, real time, ...
IBM 360
CA: ISA Design
27
28
Processor State
Data Formats
29
Model 30
...
Storage
8K - 64 KB
Datapath
8-bit
Circuit Delay 30 nsec/level
Local Store
Main Store
Control Store Read only 1sec
Model 70
256K - 512 KB
64-bit
5 nsec/level
Transistor Registers
Conventional circuits
30
IBM z11
Quad-core design
Three-issue out-of-order superscalar pipeline
Out-of-order memory accesses
Redundant datapaths
31
ISA Design
Data Types
Bit: 0, 1
Bit String: sequence of bits of a particular length
4 bits is a nibble
8 bits is a byte
16 bits is a half-word
32 bits is a word
64 bits is a double-word
128 bits is a quad-word
Character:
ASCII 7 bit code
UNICODE 16 bit code
Decimal:
digits 0-9 encoded as 0000b thru 1001b
two decimal digits packed per 8 bit byte
Integers:
2's Complement
Floating Point:
Single Precision
Double Precision
Extended Precision
E
MxR
mantissa
exponent
base
32
Rank instruction
load
22%
conditional branch
20%
compare
16%
store
12%
add
8%
and
6%
sub
5%
move register-register
4%
call
1%
10
return
1%
Total
96%
ISA Design
33
ISA Design
Operation Summary
load,
store,
add,
subtract,
move register-register,
and,
shift,
compare equal, compare not equal,
branch,
jump,
call,
return;
CA: ISA Design
34
Condition Codes
Processor status bits are set as a side-effect
of arithmetic instructions (possibly on Moves)
or explicitly by compare or test instructions.
ex: add r1, r2, r3
bz label
Condition Register
Ex: cmp r1, r2, r3
bgt r1, label
Compare and Branch
Ex: bgt r1, r2, label
ISA Design
35
Processor
ISA Design
Memory Addressing
Memory:
Continuous Linear
Address Space
36
ISA Design
0
lsb
msb
0
Aligned
Aligned
37
Addressing mode
Example
Meaning
Register
Add R4,R3
R4 R4+R3
Immediate
Add R4,#3
R4 R4+3
Displacement
Register indirect
Add R4,(R1)
Indexed / Base
Direct or absolute
Add R1,(1001)
R1 R1+Mem[1001]
Memory indirect
Add R1,@(R3)
R1 R1+Mem[Mem[R3]]
Post-increment
Add R1,(R2)+
R1 R1+Mem[R2]; R2 R2+d
Pre-decrement
Add R1,(R2)
R2 R2d; R1 R1+Mem[R2]
Scaled
Add R1,100(R2)[R3]
ISA Design
Addressing Modes
R4 R4+Mem[R1]
R1 R1+Mem[100+R2+R3*d]
38
Addressing Modes
w += i
w += 3
w += a[100 + i]
w += a[i]
w += a[i + j]
w += a[1001]
w += a[*p]
a[i++]
a[i--]
w += a[100 + i + d*j]
39
--- Immediate:
ISA Design
7% avg, 0% to 16%
3% avg, 1% to 6%
--- Misc:
2% avg, 0% to 3%
40
ISA Design
41
Register Set
Load/Store
Computational
Integer/Floating point
Memory Management
Special
3 Instruction Formats: all 32 bits wide
OP
rs
rt
OP
rs
rt
OP
Registers
R0 - R31
PC
HI
LO
rd
sa
funct
immediate
jump target
CA: ISA Design
42
Acknowledgements
43