Professional Documents
Culture Documents
Unit 1
Unit 1
Unit 1
Architecture
SUBJECT CODE: 203105253
UNIT 1
Trilok Suthar
Asst. Prof. IT Dept
1
Basic of Computer
Computer Organization:
is about the study of the function and design of the various
units of computers that store and process information.
– Encompasses all physical aspects of computer systems.
– E.g., circuit design, control signals, memory types.
– How does a computer work?
Computer Architecture:
is a set of rules and methods that describe the functionality,
organization, and implementation of computer systems.
Some definitions of architecture define it as describing the
capabilities and programming model of a computer.
2
Why study computer organization and architecture?
3
UNIT 1
4
5
6
7
8
9
10
11
Instruction Set Architecture (ISA)
14
Instruction Codes
• Program
– A program is a set of instructions that specify the
operations, operands and the sequence by which
processing has to occur.
• Computer Instruction
– A computer instruction is a binary code that specifies a
sequence of microoperations for the computer.
– The computer reads each instruction from memory and
places it in a control register.
– The control then interprets the binary code of the
instruction and proceeds to execute it by issuing a
sequence of microoperations.
15
Instruction Codes
16
Stored Program Organization
17
Stored Program Organization
Memory
4096 x 16
1 12 11 0
5
Opcode Address
Instructions
(program)
Instruction Format
1 0 Operand
5 (data)
Binary Operand
Processor
Register
(accumulator or
AC)
18
Instruction format of basic computer
Instruction Format
1 14 12 11 0
5 Opcod
I Address
e
0 0 0 1 0 1 0 0 0 1 0 1 0 1 1 1
Add Instruction – ADD 457
19
Direct & Indirect Addressing of Memory
20
Direct & Indirect Addressing of Memory
Memory Memory
AD AD
2 0 457 3 1 300
D D
2 5
300 1350
457 Operand
1350 Operand
+ +
AC AC
21
Direct & Indirect Addressing of Memory
22
Direct & Indirect Addressing of Memory
15 14 12 11 0
22
0 ADD 457
23
Direct & Indirect Addressing of Memory
15 14 12 11 0
35 1 ADD 300
24
Direct & Indirect Addressing of Memory
25
Computer
Registers
26
Computer Registers
11 0
Program Counter(12)
PC Holds address of instruction
11 0
Address Register(12)
AR Holds address for memory
1 0
5 Instruction Register(16)
IR Holds instruction code
1 0
5 Temporary Register(16)
TR Holds temporary data
1 0
5 Data Register(16)
DR Holds memory operand
27
Computer Registers
1 0
5 Accumulator(16)
AC Processor Register
7 0
Output Register(8)
OUTR Holds output character
7 0
Input Register(8)
INPR Holds input character
Memory
4096 words
16 bits per word
28
29
Computer
Instructions
30
Types of Computer Instructions
31
Types of Computer Instructions
01 0
1 0
1 0
1 Address
0 1 1 1 1
0 1
0 1
0 1
0 1
0 1
0 1
0 0 0 0 0 0
0 1 1 1 0 0 0 0 0 0 0 1
0 0
1 1
0 1
0 1
0
34
Types of Computer Instructions
1 1 1 1 1
0 0
1 1
0 1
0 1
0 1
0 0 0 0 0 0 0
35
Instruction Set Completeness
36
37
Timing &
Control
38
39
Control Unit
40
Control Unit
41
Control Unit
42
Timing Cycle for D3T4: SC ← 0
𝑇0 𝑇1 𝑇2 𝑇3 𝑇4 𝑇5
Cloc
k
𝑇0
𝑇1
𝑇2
𝑇3
𝑇4
𝐷3
CL
R
43
SC
Control Unit
44
Control Organization
• Hardwired Control
– The control logic is implemented with gates, flips-flops, decoders and other
digital circuits.
– It can be optimized to produce a fast mode of operation.
– It requires changes in the wiring among the various components if the
design has to be modified or changed.
• Microprogrammed Control
– The control information is stored in a control memory.
– The control memory is programmed to initiate the required sequence of
microoperations.
– Any required changes or modifications can be done by updating the
microprogram in control memory.
45
Instruction
Cycle
46
A program residing in the memory unit of a computer
consists of a sequence of instructions. These
instructions are executed by the processor by going
through a cycle for each instruction.
47
Instruction Cycle
48
Instruction Cycle
49
50
The flowchart represents an initial configuration for
the instruction cycle and show how the control
determines the instruction type after decoding.
52
▪ When a memory reference instruction with I=0 is
encountered. It is not necessary to do anything since the
effective address is already in AR
• However the sequence counter SC must be incremented
when D’7|T3=1, so that the execution of the memory-
reference instruction can be continued with timing Variable
T4.
• A Reference register or input-output instruction can be
executed with the click associated with timing signal T3. after
the instruction is executed. Sc is cleared to 0 and control
returns to the fetch phase with T0=1. SC is either
incremented or cleared to 0 with every positive clock
transition 53
Addressing
Modes
54
Addressing Modes
55
Addressing Modes
1. Implied Mode
2. Immediate Mode
3. Register Mode
4. Register Indirect Mode
5. Autoincrement or Autodecrement Mode
6. Direct Address Mode
7. Indirect Address Mode
8. Relative Addressing Mode
9. Indexed Addressing Mode
10. Base Register Addressing Mode
56
1. Implied Mode
57
2. Immediate Mode
58
3. Register Mode
59
4. Register Indirect Mode
60
5. Autoincrement or Autodecrement Mode
• This is similar to the register indirect mode expect that the register is
incremented or decremented after (or before) its value is used to
access memory.
• When the address stored in the register refers to a table of data in
memory, it is necessary to increment or decrement the register after
every access to the table. This can be achieved by using the increment
or decrement instruction.
61
6. Direct Address Mode
• In this mode the effective address is equal to the address part of the
instruction.
• The operand resides in memory and its address is given directly by the
address field of the instruction.
• E.g. ADD 457
62
7. Indirect Address Mode
• In this mode the address field of the instruction gives the address
where the effective address is stored in memory.
• Control fetches the instruction from memory and uses its address part
to access memory again to read the effective address.
• The effective address in this mode is obtained from the following
computational:
Effective address = address part of instruction + content of CPU register
63
8. Relative Address Mode
64
9. Indexed Addressing Mode
65
10. Base Register Addressing Mode
• 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 is assumed to hold a base address and the address
field of the instruction gives a displacement relative to this base
address.
• The base register addressing mode is used in computers to facilitate
the relocation of programs in memory.
Effective address = address part of instruction + content of base register
66
INSTRUCTION
SET
67
Instruction sets are instruction codes to perform some task. It
is classified into five categories
4 Arithmetic Instructions
5 Data Transfer Instructions
68
Control Instructions
69
Logical instructions
Opcode Operand Meaning Explanation
The contents of the operand
R Compare the register or (register or memory) are M
CMP
M memory with the accumulator compared with the contents of the
accumulator.
72
Branching instructions
73
Opcode Operand Meaning Explanation
The program sequence
16-bit Jump is transferred to the
JMP
address unconditionally memory address given
in the operand.
74
Opcode Description Flag Status
JC Jump on Carry CY=1 16-bit Jump The program
JNC Jump on no CY=0 address conditionally sequence is
Carry transferred to the
JP Jump on S=0 memory address
positive given in the
JM Jump on minus S=1 operand based on
JZ Jump on zero Z=1 the specified flag of
the PSW.
JNZ Jump on no Z=0
zero
JPE Jump on parity P=1
even
JPO Jump on parity P=0
odd
75
Arithmetic Instructions
76
Opcode Operand Meaning Explanation
The contents of the register or memory are
R Add register or added to the contents of the accumulator
ADD memory, to the and the result is stored in the accumulator.
M accumulator
Example − ADD K.
The contents of the register or memory & M
Add register to the Carry flag are added to the contents of
R the
ADC the accumulator and the result is stored in
M accumulator the accumulator.
with carry
Example − ADC K
Example − SUB K
The contents of the register or the memory & M
R Subtract the source and the Borrow flag are subtracted from the contents
SBB borrow from the of the accumulator and the result is placed in the
M accumulator accumulator.
Example − SBB K
The 8-bit data is subtracted from the contents of
8-bit Subtract the immediate the accumulator & the result is stored in the
SUI accumulator.
data from the accumulator
Example − SUI 55K
The contents of register H are exchanged with the
Subtract the immediate contents of register D, and the contents of register
8-bit
SBI from the accumulator L are exchanged with the contents of register E.
data
with borrow
Example − XCHG
The contents of the designated register or the
R Increment the register or memory are incremented by 1 and their result is
INR stored at the same place.
M the memory by 1
Example − INR K 78
The contents of the designated register pair
Increment register pair are incremented by 1 and their result is stored
INX R at the same place.
by 1
Example − INX K
The contents of the designated register or
R Decrement the register memory are decremented by 1 and their result is
DCR stored at the same place.
M or the memory by 1
Example − DCR K
The contents of the designated register pair are
Decrement the register decremented by 1 and their result is stored at the
DCX R same place.
pair by 1
Example − DCX K
79
DATA TRANSFER INSTRUCTION
80
Opcode Operand Meaning Explanation
Rd, Sc Copy from This instruction copies the contents of the source register into
the source the destination register without any alteration.
MOV M, Sc (Sc) to the
Example − MOV K, L
destination(
Dt, M Dt)
Rd, data Move The 8-bit data is stored in the destination register or memory.
MVI immediate
M, data Example − MVI K, 55L
8-bit
The contents of a memory location, specified by a 16-bit
Load the address in the operand, are copied to the accumulator.
16-bit
LDA accumulato
address
r Example − LDA 2034K
81
The instruction loads 16-bit
Load the data in the register pair
Reg. pair, 16-bit designated in the register or
LXI register pair
data the memory.
immediate
Example − LXI K, 3225L
The contents of the
accumulator are copied into
the memory location
specified by the operand.
82
Output the The contents of the
data from accumulator are copied into
the the I/O port specified by the
accumulat operand.
OUT 8-bit port address
or to a
Example − OUT K9L
port with
8bit
address
83