Professional Documents
Culture Documents
Lecture 1 Instruction Set and Instruction Set Design
Lecture 1 Instruction Set and Instruction Set Design
LECTURE 1
INSTRUCTION SET AND DESIGN OF
INSTRUCTION SET ARCHITECTURE (ISA)
Dr. E. A. Kalinga|CSE|CoICT| 1
Introduction
• Computer architecture is the design of
computers, which include:
—Their instruction sets,
—Hardware components, and
—System organization
• The architecture of a computer consists of
two essential parts:
—The instruction set architecture (ISA), and
—The hardware-system architecture (HSA)
Computer architecture =
Instruction set architecture + Machine organisation
2
Introduction
• The instruction set architecture defines the
software/hardware interface that is visible
to the machine language level programmer.
• It includes:
i. The instruction set (i.e. the available operations)
ii. The instruction formats
iii.The available addressing techniques (Addressing
Modes)
iv.The format of the available data types
(representation of data)
v. Organization of storage: the operational register
set, memory (All programmer-accessible
registers in CPU)
3
Introduction
Instruction Set
• Programs written in High-Level languages (by a
programmer) must be translated (by a compiler)
to an appropriate sequence of assembly
instructions (assembly language).
• Later, assembly language will be translated into
executable binary codes.
• Assembly language provides mnemonics for
machine language instructions which must be
encoded as a series of binary digits.
10
11
12
Instruction Fetch
Address
Memory
Select next
Program Instruction
instruction
Counter
Increment PC
CPU to locate next
instruction.
Instruction
Register
13
14
15
Instruction
Instruction in Higher Level programming language:
a=b+c
Note:
Operation is “add”; source operands are “b” and “c”;
destination operand is “a”.
Instruction
Add b c a
Source Source Destination
Opcode Field Operand 1 Operand 2 Operand
(Operation Code)
18
19
20
TF DF IF OF SF ZF AF PF CF
21
Classification of ISA
• The type of internal storage in the CPU is the most basic
differentiator
• Computers can be classified according to the structure and
function of the registers in the CPU
• Operands may be named explicitly or implicitly
1. Accumulator Architecture
— Have a limited number of data accumulator often just one, in
addition to the address register within the CPU
— In an accumulator architecture one operand is implicitly the
accumulator
— Called accumulators because they serve both as the source of an
operand and as a destination for the arithmetic instructions:
thus, they serve to accumulate data
— Also known as 1-address machine, which makes the machine to
have the advantage of being cheap
— Having one or limited number of accumulator in the CPU, an
accumulator machine is quite limited when evaluating arithmetic
evaluations with many terms and factors
22
Classification of ISA
2. Stack Architecture
— The operands in a stack architecture are implicitly on top of
the stack
— LIFO (Last-In-First-Out) is used to describe the storage
mechanism
— Arithmetic operations use two operands from the top of the
stack, and the result is placed on the top of the stack
replacing the operand
— When the expression evaluation is complete, the result is
POPPED into a memory location to complete the process
— No-operand addresses need to be specified during an
arithmetic operation, the class is also known as a 0-address
machine
23
Classification of ISA
3. General-Purpose Register (GPR) Architecture
— Have only explicit operands – either registers or memory
locations
— The explicit operands may be accessed directly from memory
or may need to be first loaded into temporary storage
— They can be divided into two classes
a) Load-store or Register-register architecture:
– can access memory only with LOAD and STORE instruction
– LOAD moves data from memory to a processor register
– STORE moves data from processor to memory
– ALU and Branch operations in Load-Store machines can
accept only operands located in processor registers,
and they must store the result in the processor
registers.
– Hence also called Register-register Architecture.
24
Classification of ISA
b) Register-memory machine
– Locate operands and result in a combination of memory
and registers
– One operand or a result must be an accumulator or
general register (1½ address)
– Can access memory as part of any instruction
4. Memory-memory machine (2 or 3 address)
— They are 2 or 3 address machine depending upon whether one
of the operands location also serves as a result location
— Allows both the operand to reside in memory, i.e. keeps all the
operands in memory
— Not commonly used
• The explicit operand may be accessed directly from memory
or may need to be first loaded into temporary storage,
depending on the class of instruction and choice of specific
instruction
25
Classification of ISA
• Most early machines used stack or accumulator
style architecture
• Every machine designed after 1980 uses a
load-store register architecture due to the
following reasons:
—Registers are fast than memory
—Registers are easier for a compiler to use and can be
used more effectively than other forms of internal
memory
—Registers can be used to hold variables
26
Summary
• Stack architecture: Operands are implicitly on top
of the stack.
• Accumulator architecture: One operand is
implicitly in the accumulator (a register). Examples:
IBM 701, DEC PDP-8.
• General-purpose register (GPR) architecture:
Only explicit operands.
—Register-memory architecture (one operand in memory).
Examples: Motorola 68000, Intel 80386.
—Register-register (or load-store) architecture. Examples:
MIPS, DEC Alpha.
• Memory-memory architecture: All operands in
memory. Example: DEC VAX.
27
• Example: c = a + b
• It is assumed that a, b, and c all belong in
memory
28
ISA Characteristics
• Four main characteristics:
1. Register Organization
— # of registers & their sizes
2. Memory Organization
— Address space - # of memory locations
— Addressability - # of bits stored @ each location
– Byte addressable and provide access for byte (8 bits),
half word (16 bits), and word (32 bits)
– Conversions of ordering the bytes within a word (Little
Endian, Big Endian)
– Addressing modes – defines how operand values are
obtained
29
ISA Characteristics
3. Instruction Set
— List of opcodes (operations)– defines instructions
supported
— Instruction Formats (Encoding an instruction set)
– binary format for encoding instructions (R-format, I-
format, J-format)
– How the instructions are encoded into a binary
representation for execution by the CPU
— Type and size of operands: Integer, single/double precision
floating point, character
4. The role of the compiler
− From HLL to assembly language
30
Memory Organization
31
32
33
34
36
37
38
39
PC = PC[31-28]||(IR[25-0]<<2);
40
41
Data Sizes
A byte is composed of 8 bits. Two nibbles makes
up a byte.Words are composed of bytes as
shown: -
Bit 1 Bit length, Either ‘0’ or ‘1’
Nibble 4 bits length, or a half byte
Byte 8 bits length
Half word 16 bits length (2 bytes)
Word 32 bits length (4 bytes)
Double Word 64 bits length (8 bytes)
Quad words 128 bits length (16 bytes)
42
Memory Organization
• Instruction Set to be discussed are byte
addressed and provide access for byte,
half word, word or double word
43
44
45
Addressing Modes
47
48
49
50