Module 4 Processor Orgainization
Module 4 Processor Orgainization
Topics to be covered
• Instruction Formats
• Instruction Sets
• Addressing Modes
• Assembly Language
• Processor Organization
• Register Organization
• Instruction Cycle – Pipelining
• RISC vs CISC
• Instruction Level Parallelism
Basic Computer Model
ENIAC
15 12 11 0
Opcode Address
Instructions
(program)
Instruction Format
15 0 Operand
Binary Operand (data)
Processor Register
(accumulator or AC)
Instruction Codes
Program:
– A sequence of (machine) instructions
(Machine) Instruction:
– A group of bits that tell the computer to perform a specific operation
(a sequence of micro-operation)
• The instructions of a program, along with any needed data are
stored in memory
• The CPU reads each instruction from memory
• It is placed in an Instruction Register (IR)
• Control circuitry in control unit then translates the instruction
into the sequence of micro operations necessary to implement
it.
Instruction Code
• Instruction Code
• An instruction code is a group of bits that instruct the computer to
perform a specific operation.
Unique Binary
• Example code is assigned
ADD1547 to every OpCode
Instruction Format
15 14 12 11 0
I Opcode Address
0 0 0 1 0 1 0 0 0 1 0 1 0 1 1 1
Add Instruction – ADD457
Direct & Indirect Addressing of Memory
300 1350
457 Operand
1350 Operand
+ +
AC AC
Direct &Indirect Addressing of Memory
Memory
4096 words
16 bits per word
Computer Instructions
0 0 0 0 Address
0 1 1 1 10 0 0 0 0 0 0 0 0 0 0 0
0 1 1 1 0 0 0 0 0 0 0 01 0 0 0 0
1 1 1 1 01 00 0 00 0 0 0 0 0 0 0 0
• These are special languages developed to reflect the procedures used in the
solution of a problem rather than be concerned with the computer
hardware behavior. E.g.Fortran, C++,Java,etc.
• The program is written in a sequence of statements in a form that people
prefer to think in when solving aproblem.
• However, each statement must be translated into a sequence of binary
instructions before the program canbe executed in acomputer.
• The program that translates a high level language program to binary is
called acompiler.
INTEGER A, B, C
DATA A, 83 B,-23
C= A +B
END
Assembly Language
• The user employs symbols (letters, numerals, or special characters) for the
operation part, the address part, and other parts of the instruction code.
• Each symbolic instruction can be translated into one binary coded instruction
by a special program called an assembler and language is referred to as an
assemblylanguage program.
Location Instruction Comment
000 LDA 004 Load first operand into AC
001 ADD 005 Add second operand to AC
002 STA 006 Store sum in location 006
003 HLT Halt computer
004 0053 First operand
005 FFE9 Second operand (negative)
006 0000 Store sum here
Assembly language program subtract Two number
Clock Input
R1
R2
R3
R4
R5
R6
R7
Load
(7 lines)
SELA { MUX MUX } SELB
3x8 A bus B bus
decoder
SELD
OPR ALU
Output
Control
ALU CONTROL
Encoding of ALU operations OPR
Select Operation Symbol
00000 Transfer A TSFA
00001 Increment A INCA
00010 ADD A + B ADD
00101 Subtract A - B SUB
00110 Decrement A DECA
01000 AND A and B AND
01010 OR A and B OR
01100 XOR A and B XOR
01110 Complement A COMA
10000 Shift right A SHRA
11000 Shift left A SHLA
Symbolic Designation
Microoperation SELA SELB SELD OPR Control Word
Examples of ALU
R1 R2 R3 R2 R3 R1 SUB 010 011 001 00101
Microoperations
R4 R4 R5 R4 R5 R4 OR 100 101 100 01010
R6 R6 + 1 R6 - R6 INCA 110 000 110 00001
R7 R1 R1 - R7 TSFA 001 000 111 00000
Output R2 R2 - None TSFA 010 000 000 00000
Output Input Input - None TSFA 000 000 000 00000
R4 shl R4 R4 - R4 SHLA 100 000 100 11000
R5 0 R5 R5 R5 XOR 101 101 101 01100
Exercise 1
PIPELINING
Time
30 40 20 30 40 20 30 40 20 30 40 20
T
a A
s
k
B
O
r C
d
e
r D
Time
30 40 40 40 40 20
T
a A
s • Pipelined laundry takes 3.5
k hours for 4 loads
B
O
r
C
d
e
r D
Instruction Pipeline
• Pipelining in Instruction Stream
• Reads consecutive instructions from memory
while previous instructions are being
executed in other segments.
• Instruction fetch and execute phases to
overlap and perform simultaneous
operations.
Instruction Pipeline
The design of an instruction pipeline will be most efficient if
the instruction cycle is divided into segments of equal
duration:
==> 4-Stage Pipeline
Conventional
i FI DA FO EX
i+1 FI DA FO EX
i+2 FI DA FO EX
Pipelined
i FI DA FO EX
i+1 FI DA FO EX
i+2 FI DA FO EX
RISC(Reduced Instruction Set
Computer)
• A computer with a large number of instructions
is classified as a complex instruction set
computer(CISC).
• In the early 1980s, a number of computer
designers recommended that computer use
fewer instruction with simple constructs so they
can be executed much faster within the CPU
without having to use memory as often.
• This type of computer is classified as a reduced
instruction set computer(RISC).
Characteristics of CISC
1. A large number of instructions – typically
100 to 250 instructions.
2. Some instructions that perform specialized
tasks and are used infrequently.
3. A large variety of addressing modes –
typically from 5 to 20 different modes.
4. Variable-length instruction formats
5. Instructions that manipulates operands in
memory.
Characteristics of RISC
1. Relatively few instructions.
2. Relatively few addressing modes.
3. Memory access limited to load and store
instructions.
4. All operations done within the registers of the
CPU.
5. Fixed-length, easily decoded instruction format.
6. Single-cycle instruction execution by using
Pipelining.
7. Hardwired rather than micro programmed control.
Exercise 3
• What are the two instructions needed in the
basic computer in order to set the E flip flop to
1?
Exercise 4
• Consider the instruction format of the basic computer
and the list of instructions. For each of the following
16-bit instruction, give the equivalent four-digit
hexadecimal code and explain in your own words what
it is that the instruction is going to perform:
a. 0001 0000 0010 0100 = 1024 H = Direct AND
Ans: AND operation between AC and operand at memory
location 024H
a. 1011 0001 0010 0100 = B124 H = Indirect STA
Ans: Store the AC value at the location specified by 124H
a. 0111 0000 0010 0000 = 7020H
Ans: Increment AC