Académique Documents
Professionnel Documents
Culture Documents
• It is the function of the control unit within the CPU to interpret each
instruction code and provide the necessary control functions needed to
process the instruction.
• The bits of the instruction are divided into groups called fields.
Copyright@ Amity University
INSTRUCTION FORMATS
• The common fields found in instruction formats are:
3. A mode field that specifies the way the operand or the effective address is determined.
• The operation code field of an instruction is a group of bits that define various processor
operations such as add, subtract etc.
• The number of address fields in the instruction format of a computer depends upon the
internal organization of its registers.
3. Stack organization.
• Stack Organization:
The stack-organized CPU would have PUSH and POP instruction which require an address field.
All operands are implied to be in the stack hence there is no need to specify operands with an
address field.
Based on the number of address fields present in the instruction the instructions can be
classified into:
• It is assumed that the computer has two processor registers R1 and R2. The symbol M [A]
denotes the operand at memory address symbolized A.
• Three address format gives short programs but requires larger space to specify three addresses.
• Generally stack organized computers use this type of addressing field. Mostly they will be using
PUSH and POP instructions.
• Example:
X=(A + B) + (C + D)
PUSH A ; TOS <- A top of the stack
PUSH B ; T0S <- B
ADD ; TOS <- A + B
PUSH C ; TOS <- C
PUSH D ; TOS <- D
ADD ; TOS <- C + D
ADD ; TOS <- (C + D) + (A + B)
POP X ; M [X] <- TOS
Copyright@ Amity University
ALLOCATION OF BITS
• Number of addressing modes
• Number of operands
• Address range
• Address granularity
1. Implied mode.
2. Immediate mode.
3. Register mode.
Example:
MVI A, 45.
e.g. ADD 5
– Add 5 to contents of accumulator
– 5 is operand
• Fast
• Limited range
Copyright@ Amity University
IMMEDIATE ADDRESSING DIAGRAM
OPCODE OPERAND
Instruction
• Example:
• MOV AX, BX
– Shorter instructions
REGISTER
OPCODE
ADDRESS R
Registers
Instruction
OPERAND
Memory
Instruction
Registers
This is similar to the register indirect mode except that the register is
incremented or decremented after or before its value is used to access
memory.
• The operand identifier used which is called a direct address is usually a CPU register
name or main memory address.
• In this mode the effective address is equal to the address part of the instruction.
OPCODE ADDRESS A
Memory
Instruction
OPERAND
• The instruction is obtained from memory and it uses its address part
to access memory again to read the effective address.
• The instructions will have the register which has the address. So to
fetch the data, the instruction must be decoded appropriate register
selected.
• The contents of the register will be treated as the address using this
address appropriate memory location is selected and data is
read/written.
Copyright@ Amity University
INDIRECT ADDRESSING
• Memory cell pointed to by address field contains the address of (pointer to)
the operand
EA = (A)
• Hence slower
Copyright@ Amity University
INDIRECT ADDRESSING DIAGRAM
Instruction
OPCODE ADDRESS A
Memory
PIONTER TO
OPERAND
OPERAND
• Let
Program counter contents = 2050
Address part of the instruction = 50
then the address of the operand = 2050 + 50
= 20A0 H or 2100 D.
Copyright@ Amity University
RELATIVE ADDRESSING
• Relative addressing is used with branch type instructions when the
branch address is in the area surrounding the instruction. This gives a
shorter address field.
• R = Program counter, PC
EA = A + (PC)
i.e. get operand from A cells from current location pointed to/by PC
• R = displacement
• EA = A + R
• EA = A + R
• R++
Copyright@ Amity University
BASE-REGISTER ADDRESS MODES
• In this mode the content of a base register is added to the address part of
the instruction to obtain the effective address.
• A base register holds a base address and the address field of the
instruction gives a displacement relative to this base address.
• A holds displacement
• Branch address
– Absolute
– Relative
– Indirect
• Arithmetic
– Operands in registers or part of instruction
– Floating point is register only
• It was argued that such functions would be better performed by sequences of simpler
instructions if this could yield implementations small enough to leave room for many
registers, reducing the number of slow memory accesses.
• In these simple designs, most instructions are of uniform length and similar structure,
arithmetic operations are restricted to CPU registers and only
separate load and store instructions access memory.
• Well known RISC families include DEC Alpha, AMD 29k, ARC, ARM, Atmel
AVR, MIPS, PA-RISC, PowerPC, SuperH, and SPARC.
• In fact, over the years, RISC instruction sets have grown in size, and
today many of them have a larger set of instructions than many CISC
CPUs.
– Identical general purpose registers, allowing any register to be used in any context,
simplifying compiler design (although normally there are separate floating
point registers);
– Few data types in hardware, some CISCs have byte string instructions, or
support complex numbers; this is so far unlikely to be found on a RISC.
• Most computers have just one CPU, but some models have several,
and multi-core processor chips are becoming the norm. There are
even computers with thousands of CPUs.
Copyright@ Amity University
PARALLEL PROCESSING
• With single-CPU, single-core computers, it is possible to perform
parallel processing by connecting the computers in a network.
However, this type of parallel processing requires very sophisticated
software called distributed processing software.
Instruction pipelines, such as the classic RISC pipeline, which are used in processors to
allow overlapping execution of multiple instructions with the same circuitry. The circuitry is
usually divided up into stages, including instruction decoding, arithmetic, and register fetching
stages, wherein each stage processes one instruction at a time.
Graphics pipelines, found in most graphics cards, which consist of multiple arithmetic units,
or complete CPUs, that implement the various stages of common rendering operations
(perspective projection, window clipping, color and light calculation, rendering, etc.).
Software pipelines, where commands can be written so that the output of one operation is
automatically used as the input to the next, following operation. The Unix command pipe is a
classic example of this concept; although other operating systems do support pipes as well.
Copyright@ Amity University
Pipelining Rules
• Forward travelling signals at each stage are latched
• High pipelining leads to increase of latency - the time required for a signal to
propagate through a full pipe.
A pipeline that is not fully pipelined has wait cycles that delay the progress of the
pipeline.
The cycle time of the processor is reduced, thus increasing instruction issue-rate in
most cases.
If pipelining is used instead, it can save circuitry vs. a more complex combinational
circuit.
• The fundamental idea is to split the processing of a computer instruction into a series of
independent steps, with storage at the end of each step.
• This allows the computer's control circuitry to issue instructions at the processing rate of
the slowest step, which is much faster than the time needed to perform all steps at
once.
• The term pipeline refers to the fact that each step is carrying data at once , and each
step is connected to the next (like the links of a pipe.)
F R X M W
F R X M W
Instruction
F R X M W
F R X M W
F R X M
F R X
• Control hazards
– the location of an instruction depends on a previous instruction
JMP LOOP
…
LOOP: ADD R1, R2, R3
• Structural hazards
– two instructions need access to the same resource
• e.g., single memory shared for instruction fetch and load/store
• collision in reservation table
Copyright@ Amity University
Vector Processor And Array
Processor
• A vector processor, or array processor, is a central processing unit (CPU) that
implements an instruction set containing instructions that operate on one-
dimensional arrays of data called vectors.
• Vector processors first appeared in the 1970s, and formed the basis of
most supercomputers through the 1980s and into the 1990s. Improvements in
scalar processors, particularly microprocessors, resulted in the decline of
traditional vector processors in supercomputers, and the appearance of vector
processing techniques in mass market CPUs around the early 1990s.
• Today, most commodity CPUs implement architectures that feature instructions for
some vector processing on multiple (vectorized) data sets, typically known
as SIMD (Single Instruction, Multiple Data). Common examples include MMX, SSE,
and AltiVec.
• Vector processing techniques are also found in video games console hardware
and graphics accelerators. In 2000, IBM, Toshiba and Sony collaborated to create
the Cell processor, consisting of one scalar processor and eight vector processors,
which found use in the Sony PlayStation 3among other applications.
• The data for A, B and C could be—in theory at least—encoded directly into the instruction.
However things are rarely that simple.
• In general the data is rarely sent in raw form, and is instead "pointed to" by passing in an
address to a memory location that holds the data. Decoding this address and getting the data
out of the memory takes some time.
• As CPU speeds have increased, this memory latency has historically become a large
impediment to performance
Copyright@ Amity University
Types of Vector Processing
• Today, most commodity CPUs implement architectures that
feature instructions for some vector processing on multiple
(vectorized) data sets, typically known as SIMD (Single
Instruction, Multiple Data). Common examples include MMX, SSE,
and AltiVec. Vector processing techniques are also found in video
game console hardware and graphics accelerators.