Escolar Documentos
Profissional Documentos
Cultura Documentos
ISA specifies the set of opcodes (machine language), and native commands
implemented by a particular processor.
Instruction set
The CPU must be able to extract the data from the various instruction fields
to perform the required operation.
Operation code (Op code) Do this…
Opcode field which stands for operation code and it specifies the particular operation that is to be performed.
The operation may involve one or more source operands, that is, operands that are inputs for the operation.
Operands fields which specify where to get the source and destination operands for the operation specified by the opcode.
It tells the CPU where to fetch the next instruction after the execution of this instruction is complete.
Different Instruction Formats
Expression: X = (A+B)*(C+D)
One Address Instruction
Expression: X = (A+B)*(C+D)
Two Address Instruction
Expression: X = (A+B)*(C+D)
Three Address Instruction
Expression: X = (A+B)*(C+D)
16 Different types of ISAs
A stack
An accumulator
A set of registers
17 ISA Architectures
Stack architecture:
Operands are implicitly on top of the stack
Accumulator architecture:
One operand is in accumulator (register) and the others are in
memory
(Essentially this is a 1 register machine)
(Found in earlier machines…)
Simple expression
evaluation
Short instruction yields good
code density ALU
bottleneck
MBR
19 Stack Architecture
A=B+C
A, B & C are memory addresses
push B
push C
add
pop A
Accumulator Architecture
20
instructions
Arithmetic instructions
require memory access
Short instruction ALU
MBR
21 Accumulator/Single Register
Architecture
A=B+C
A, B & C are memory addresses
load B
add C
store A
load regA, memoryX not allowed
Complex operations too slow
September 6, 2017
General-Purpose Architecture
22
MBR
23 General-Purpose Architecture
A=B+C
A, B & C are memory addresses
load R 1, B load R1, B
load R 2, C add R1, C
add R 1, R 2 store A, R1
store A , R1
Memory Choices
Stack Architecture:
Accumulator Architecture
General Purpose Register Architecture
Register – memory
Register – Register (load/store)
Memory – Memory Architecture (Obsolete)
Taxonomy of Instruction Set ….. Cont’d
25
PUSH A
PUSH B ALU
ADD
POP C
Accumulator Architecture
28 An accumulator is a special register Processor
within the CPU that serves both as
the implicit source of one operand
and as the result destination for
arithmetic and logic operations.
Load A
ADD B
Store C
.
.
General Purpose Register Architecture
30
Many general purpose registers are available within CPU
Generally, CPU registers do not have dedicated functions and can
be used for a variety of purposes – address, data and control
A relatively small number of bits in the instruction is needed to
identify the register
In addition to the GPRs, there are many dedicated or special-
purpose registers as well, but many of them are not “visible” to the
programmer
GPR architecture has explicit operands either in register or memory
thus there may exist:
- Register – memory architecture
- Register – Register (Load/Store) Architecture
- Memory – Memory Architecture
General Purpose Register Architecture
Register – Memory Architecture
One explicit operand is in a register
and one in memory and the result ....
goes into the register R3
The operand in memory is R2
accessed directly R1
To execute: C=A+B
Processor ....
ADD instruction has explicit
operand A loaded in a register and
the operand B is in memory and ALU
the result is in register
Load R1, A
ADD R3, R1, B ....
Memory
Store R3, C
....
31
General Purpose Register Architecture
32 The explicit operands in memory are Register – Register (Load/store)
first loaded into registers temporarily Architecture
and
....
Are transferred to memory by Store R3
instruction R2
To execute: C=A+B R1
ADD instruction has implicit operands A
Processor ....
and B loaded in registers
Load R1, A
ALU
Load R2, B
ADD R3, R1, R2
Store R3, C
....
Both the explicit operands are not Memory
accessed from memory directly, i.e.,
Memory – Memory Architecture is
obsolete
....
33 Comparison of three GPR Architectures
Register-Register
Advantages
Simple, fixed-length instruction decoding
Simple code generation
Similar number of clock cycles / instruction
Disadvantages
Higher Instruction count than memory reference
Lower instruction density leads to larger programs
34 Comparison of three GPR Architectures
Register- Memory
Advantages
Data can be accessed without separate Load first
Instruction format is easy to encode
Disadvantages
Encoding a register number and memory address in each instruction may
restrict the number of registers
CPI vary by operand location
35 Comparison of three GPR Architectures
Memory- Memory
Advantages
Most compact
Doesn’t waste registers for temporary storages
Disadvantages
Large variation in instruction size
Large variation in work per instruction
Memory bottleneck by memory access
Pros and cons for each ISA type
Machine Advantages Disadvantages
Type
Stack Short instructions Lack of random access
Good code density Efficient code hard to get
Simple to decode
instruction
Register Lots of code generation Longerinstructions
option Complex instructions
Efficient code (compiler
options)
36