instruction set architecture in computer architecture
1.
Instruction Set Architecture(ISA)
• The Instruction Set Architecture (ISA) is the part of
the processor that is visible to the programmer or
compiler writer. The ISA serves as the boundary
between software and hardware.
• The 3 most common types of ISAs are:
• Stack - The operands are implicitly on top of the stack.
• Accumulator - One operand is implicitly the
accumulator.
• General Purpose Register (GPR) - All operands are
explicitly mentioned, they are either registers or
memory locations.
2.
General Purpose Register(GPR)
– Faster than accumulator architecture
– Efficient implementation for compilers.
– Results in longer instructions.
• Most systems today are GPR systems.
• There are three types:
– Memory-memory where two or three operands may be in
memory.
– Register-memory where at least one operand must be in a
register.
– Load-store where no operands may be in memory.
The number of operands and the number of available
registers has a direct affect on instruction length
3.
• Stack machinesuse one- and zero-
operand instructions.
• LOAD and STORE instructions require a
single memory address operand.
• Other instructions use operands from the
stack implicitly.
• PUSH and POP operations involve only the
stack’s top element.
• Binary instructions (e.g., ADD, MULT) use
the top two items on the stack.
4.
• Stack architecturesrequire us to think about arithmetic
expressions a little differently.
• We are accustomed to writing expressions using infix notation,
such as: Z = X + Y.
• Stack arithmetic requires that we use postfix notation: Z =
XY+.
– This is also called reverse Polish notation,
• The principal advantage of postfix notation is that parentheses
are not used.
• For example, the infix expression,
Z = (X Y) + (W U),
becomes:
Z = X Y W U +
in postfix notation.
• In astack ISA, the postfix expression,
Z = X Y W U +
might look like this:
PUSH X
PUSH Y
MULT
PUSH W
PUSH U
MULT
ADD
PUSH Z
Note: The result of a
binary operation is
implicitly stored on the
top of the stack!
7.
• In aone-address ISA, like MARIE, the
infix expression,
Z = X Y + W U
looks like this:
LOAD X
MULT Y
STORE TEMP
LOAD W
MULT U
ADD TEMP
STORE Z
8.
• In atwo-address ISA, (e.g.,Intel,
Motorola), the infix expression,
Z = X Y + W U
might look like this:
LOAD X, R1
MULT Y, R1
LOAD W, R2
MULT U, R2
ADD R2,R1
STORE R1,Z
9.
• With athree-address ISA, (e.g.,mainframes), the
infix expression,
Z = X Y + W U
might look like this:
MULT R1,X,Y
MULT R2,W,U
ADD Z,R1,R2
10.
stack
Advantages: Simple Modelof expression evaluation (reverse polish). Short
instructions.
Disadvantages: A stack can't be randomly accessed This makes it hard to
generate efficient code. The stack itself is accessed every operation and
becomes a bottleneck.
Accumulator
Advantages: Short instructions.
Disadvantages: The accumulator is only temporary storage so memory
traffic is the highest for this approach.
GPR
Advantages: Makes code generation easy. Data can be stored for long
periods in registers.
Disadvantages: All operands must be named leading to longer instructions.
11.
• The 2major reasons are that registers are
faster than memory,
• the more data that can be kept internally in
the CPU the faster the program will run.
• The other reason is that registers are easier
for a compiler to use.