Unit 1
Introduction to Computer Architecture
(06 Hours)
Unit 1 Introduction to Computer Architecture (06 Hours)
● Functional Blocks of a Computer
● Instruction Set Architecture
● Register Transfer Language (RTL) interpretation of instructions
● Addressing Modes -1
● Addressing Modes -2
● Instruction Execution Cycle
● Instruction Set
● Functional blocks of a computer: CPU
● The basic architecture of computer was developed by John Von Neumann in
1945.
● Later we call it as Von Neuman Architecture which consists of Control Unit,
Arithmetic and logic unit, Memory Unit, Registers and Inputs/Outputs.
● His architecture based on the stored-program computer concept, where instruction
data and program data are stored in the same memory
● Functional blocks of a computer: CPU
Computer Architecture : It is a set of rules and methods that describe the functionality, organization
and implementation of computer systems.
Functional units : A computer consists of the following five independent units which has its own
functionality.
Input unit
Output unit
Arithmetic and Logic unit
Memory unit
Control unit
● Functional blocks of a computer: CPU
● The input unit accepts coded information from human operators using devices such as
keyboards, or from other computers over digital communication lines.
● The information received is stored in the computer’s memory, either for later use or to
be processed immediately by the arithmetic and logic unit.
● The processing steps are specified by a program that is also stored in the memory.
● Finally, the results are sent back to the outside world through the output unit.
● All of these actions are coordinated by the control unit.
● An interconnection network provides the means for the functional units to exchange
information and coordinate their actions.
● The arithmetic and logic circuits, in conjunction with the main control circuits, is the
processor.
● Input and output equipment is often collectively referred to as the input-output (I/O)
unit.
● Input Unit
• Input units are used by the computer to read the data.
• e.g keyboards, mouse, joysticks, trackballs, microphones,
etc.
● Memory Unit
● The function of the memory unit is to store programs and data. There are two classes of
storage, called primary and secondary.
Primary memory:
● Also called main memory, is a fast memory that operates at electronic speeds.
● Programs must be stored in this memory while they are being executed.
● The memory consists of a large number of semiconductor storage cells, each capable of
storing one bit of information.
● These cells are rarely read or written individually. Instead, they are handled in groups
of fixed size called words.
● The number of bits in each word is referred to as the word length of the computer,
typically 16, 32, or 64 bits.
● To provide easy access to any word in the memory, a distinct address is associated with
each word location.
Cache Memory
● As an adjunct to the main memory, a smaller, faster RAM unit, called a cache, is used to hold
sections of a program that are currently being executed, along with any associated data.
● The cache is tightly coupled with the processor and is usually contained on the same integrated-
circuit chip.
● The purpose of the cache is to facilitate high instruction execution rates.
● At the start of program execution, the cache is empty.
● As execution proceeds, instructions are fetched into the processor chip, and a copy of each is
placed in the cache.
● When the execution of an instruction requires data, located in the main memory, the data are
fetched and copies are also placed in the cache.
● If these instructions are available in the cache, they can be fetched quickly during the period of
repeated use.
Secondary Storage
● Although primary memory is essential, it tends to be expensive and does not retain
information when power is turned off.
● Thus additional, less expensive, permanent secondary storage is used when large
amounts of data and many programs have to be stored, particularly for information that
is accessed infrequently.
● Access times for secondary storage are longer than for primary memory.
● The devices available are including magnetic disks, optical disks (DVD and CD), and
flash memory devices.
Arithmetic and Logic Unit
It performs arithmetic operations like addition, subtraction, multiplication, division and also
the logical operations like AND, OR, NOT operations.
Output Unit
• The primary function of the output unit is to send the processed
results to the user.
• e.g monitor, printer, etc.
Control Unit
• It coordinates the operation of the processor.
• It directs the other functional units to respond to a program's instructions.
• It is the nerve center of a computer system.
The operation of a computer can be summarized as follows:
● The computer accepts information in the form of programs and data through an input
unit and stores it in the memory.
● Information stored in the memory is fetched under program control into an arithmetic
and logic unit, where it is processed.
● Processed information leaves the computer through an output unit.
● All activities in the computer are directed by the control unit.
Instruction set architecture
● Instruction set architecture is basically the interface between your hardware and the
software
● The Instruction Set Architecture (ISA) defines the way in which a microprocessor is
programmed at the machine level.
● i.e an ISA is defined as the design of a computer from the Programmer’s Perspective.
Instruction set architecture
Different features considered when designing the instruction set architecture are:
1. Types of instructions (Operations in the Instruction set)
2. Types and sizes of operands
3. Addressing Modes
4. Addressing Memory
5. Encoding and Instruction Formats
6. Compiler related issues
Instruction set architecture
1 Types of instructions:
A computer must have the following types of instructions:
a) Data transfer instructions, e.g. MOV A, B
b) Data manipulation instructions, e.g. ADD A, B
c) Program sequencing and control instructions, e.g. JMP 2000H
d) Input and output instructions, e.g. IN 80H i.e. Takes input from port 80H and stores it in the
accumulator.
● An accumulator is a special-purpose register in the CPU used to store intermediate arithmetic and logic
results during instruction execution.
Instruction set architecture
a) Data transfer instructions
– perform data transfer between the various storage places in the computer
system, viz. registers, memory and I/O
– two basic operations are, Load (or Read or Fetch) and Store (or Write)
b) Data manipulation instructions
– perform operations on data and indicate the computational capabilities for the
processor.
– E.g arithmetic operations, logical operations or shift operations
– Add,sub,mul, and div
Instruction set architecture
c) Program sequencing and control instructions
– It changes the flow of the program.
– E.g1 Looping : adding a list of n numbers.
– E.g 2 branch instructions: It loads a new value into the program counter.
conditional branch & unconditional branch
Instruction set architecture
d) Input and output instructions
– It transferring information between the registers, memory and the input / output
devices.
– Either use special instructions that exclusively perform I/O transfers, or use
memory related instructions itself to do I/O transfers.
Instruction set architecture
Types and sizes of operands
Various data types supported by the processor and their lengths are
• Common operand size
– Character (8 bits),
– Half word (16 bits),
– Word (32 bits),
– Single Precision Floating Point (1 Word),
– Double Precision Floating Point (2 Words),
• Operand data types
– two’s complement binary numbers,
– Characters usually in ASCII
– Floating point numbers following the IEEE Standard
– Packed and unpacked decimal numbers.
Types and sizes of operands
Operands of Computer Hardware
– Registers operands, ADD R1, R2
– Memory operands,MOV R1, [1000H]
– Constant or immediate operands,MOV R1, #10 i.e Load the constant value 10 into
Register R1
10 is an immediate operand
Instruction Set Architecture
– The way the operands are chosen during program execution
Instruction Set Architecture
– Instruction Format
● Defines the layout of an instruction.
● Includes an opcode and zero or more operands.
Opcode : It defines an operation to be performed like Add, Subtract,
Multiply, Shift, Complement ,etc.
○
Operands / Address : It is a field which contain the operand or
location of operand, i.e., register or memory location.
e.g ADD A,B
Instruction Set Architecture
Types of instruction format
Instruction Set Architecture
Three Address Instruction
General Format :
Operation Destination, Source1, Source2
Advantage :
Reduced number of instruction
Disadvantage :
Need more space for Lengthy Instruction.
Example: Evaluate X=(A+B) (C+D)
1. ADD R1,A,B R1 ← M[A] + M[B]
2. ADD R2,C,D R2 ← M[C] + M[D]
3. MUL X,R1,R2 M[X] ← R1 R2
Instruction Set Architecture
Two Address Instruction
Instruction Set Architecture
Instruction Set Architecture
Eg..
Register and its functions listed with size in the below table
Accumulator (AC): It is a special register to hold temporarily operands
and results of ALU operations
Instruction Set Architecture
Zero Address Instruction
• Stack Organization
• Operands and result are always in the stack
• It is possible to use the instruction in which the locations are of all operands
are
defined implicitly.
• Such instruction are found in machine that stores operands in a
structure called pushdown stack.
Instruction Set Architecture
Addressing of Memory
Instruction Set Architecture
Addressing of Memory
Register Transfer Language (RTL)
Register Transfer Language (RTL) or Register Transfer Notation
• The symbolic notation used to describe the micro operation transfer among
register is called Register Transfer Language (RTL)
• E.g R1 ← R2 + R3 // Add R1,R2,R3 , R1=R2+R3
• The operations performed on the data stored in registers are called Micro-
operations.
• The Register Transfer Language is the symbolic representation of notations
used to specify the sequence of micro-operations.
Register Transfer Language (RTL)
Register Transfer Notations
• In a computer system, data transfer takes place between processor registers and
memory and between processor registers and input-output systems.
• These data transfer can be represented by standard notations given below:
– Processor registers - Notations R0, R1, R2…,MAR,MDR
– Addresses of memory locations - LOC, PLACE, MEM, A,B etc.
– Input-output registers - DATA IN, DATA OUT and so on.
Register Transfer Language (RTL)
• REGISTERS
• It is a collection of Flip flops.
• Each flip flop can store 1 bit of information.
• Computer registers are represented by Capital letters.
• Ex : MAR, MDR, PC, IR, R1, R2…
• MICRO OPERATION
• Operation executed on data stored in a register.
Register Transfer Language (RTL)
Register Transfer Language (RTL)
Register Transfer Language (RTL)
Register Transfer Language (RTL)
• A memory word is designated by the letter M.
• We must specify the address of memory word while writing the memory transfer
operations.
• The address register is designated by MAR and the data register by MDR.
• Thus, a read operation can be stated as:
• Read: MDR ← M [MAR]
• The Read statement causes a transfer of information into the data register (MDR)
from the memory word (M) selected by the address register (MAR).
• And the corresponding write operation can be stated as:
• Write: M [MAR] ← R1
Register Transfer Language (RTL)
Register Transfer Language (RTL)
Example: Evaluate X=(A+B) * (C+D)
Three-Address
1. ADD R1,A,B ; R1 ← M[A] + M[B]
2. ADD R2,C,D ; R2 ← M[C] + M[D]
3. MUL X,R1,R2 ; M[X] ← R1 * R2
Two-Address
4. MOV R1,A ; R1← M[A]
5. ADD R1,B ; R1 ← M[B] +R1
6. MOV R2,C ; R2 ← M[C]
7. ADD R2,D ; R2 ← R2 + M[D]
8. MUL R1,R2 ; R1 ← R1 * R2
9. MOV X,R1 ; M[X] ← R1
Register Transfer Language (RTL)
Addressing Modes
Addressing Modes
Addressing Modes
Addressing Modes
Addressing Modes
Addressing Modes
Addressing Modes
Addressing Modes
Addressing Modes
Addressing Modes
Addressing Modes
Addressing Modes
Addressing Modes
Addressing Modes
Addressing Modes
Addressing Modes
Addressing Modes
Addressing Modes
Examine the following sequence and identify the addressing modes used, operation done in every instruction and find the
effective address by considering R1=3000, R2=5000, R5=1000.
LOAD 10(R1),R5 SUB (R1)+, R5 ADD –(R2),R5 MOVI 2000,R5
Ans:
Instruction Addressing Mode Operation Effective Address
LOAD 10(R1), R5 Indexed R5 ← M[3000 + 10] 3010
SUB (R1)+, R5 Auto-increment Indirect R5 ← R5 - M[M[3000]], R1+=1 M[3000] → then use value
ADD –(R2), R5 Auto-decrement Indirect R5 ← R5 + M[M[4999]], R2-=1 M[4999] → then use value
MOVI 2000, R5 Immediate R5 ← 2000 N/A
Instruction Execution Cycle
Instruction Execution Cycle
Instruction Execution Cycle
Instruction Execution Cycle
Instruction Execution Cycle
Instruction Execution Cycle
Instruction Execution Cycle
Instruction Execution Cycle
Instruction Execution Cycle
Branch Instructions
• Unconditional branch instruction: JUMP X
• Replaces the PC contents with branch target address
Control sequence
Step Action Pc=3000
1. PCout, MARin, Read, Select4, Add, Zin Jump x ///3500
offset 500
2. Zout, PCin, Yin, WMFC Pc+offset=
3000+500=3500
3. MDRout, IRin
4. Offset –field –of-IRout, Add, Zin
5. Zout, PCin, End
Instruction Execution Cycle
Instruction Set
Instruction Set
Instruction Set
Instruction Set
Characteristic of RISC
• Simpler instruction, hence simple instruction decoding.
• Instruction come under size of one word.
• Instruction take single clock cycle to get executed.
• More number of general purpose register.
• Simple Addressing Modes.
• Less Data types.
• Pipeling can be achieved.
Instruction Set
Characteristic of CISC
• Complex instruction, hence complex instruction decoding.
• Instruction are larger than one word size.
• Instruction may take more than single clock cycle to get executed.
• Less number of general purpose register as operation get performed in
memory itself.
• Complex Addressing Modes.
• More Data types.
Instruction Set
References
[Link], Dean, Computing Cluster Sri Krishna College of Technology,
Coimbatore