Computer Oragiantion Unit 1
Computer Oragiantion Unit 1
• PEO2-To apply current industry accepted computing practices and emerging technologies to analyze,
design, implement, test and verify high quality computing systems and computer based solutions to real
world problems (Design and development).
• PEO3- To enable the use of appropriate skill sets and its applications towards social impacts of computing
technologies in the career related activities (Skill Set) and to produce Efficient team leaders, effective
communicators and capable of working in multi-disciplinary environment following ethical
values(Communication).
• PEO4- To practice professionally and ethically in various positions of industry or government and/or succeed
in graduate (Professionalism) with lifelong learning and to make substantial contributions to the society
(Societal Contribution)
Course Outcome (CO)
CO1: Identify and analyze the basic structures of a computer hardware units, connectivity and software.
CO2: Design the basic structure of machine instruction and programs, memory location.
CO3: Analyze different memory in the hierarchy, their mapping and their performance.
CO4: Analyze internal details of a processor, how instructions are executed using different hardware units, and
how control unit controls all hardware components.
CO5: Study the design of ALU for arithmetic operations and use of registers.
CO6: Analyze the organization of secondary storage and how all the I/O devices communicate with CPU and
transfer data.
Course Syllabus
Reference Books
• “Computer Architecture and Parallel Processing”, Hwang and Briggs, Tata McGraw Hill
Publication, ISBN 13: 9780070315563.
• “Structured Computer Organization”, A. Tanenbaum, Prentice Hall Publication, ISBN 81–203–
1553–7, 4th Edition.
Website References
• https://nptel.ac.in/courses/106106092/
• https://www.tutorialspoint.com/computer_organization/index.asp
• https://www.geeksforgeeks.org/computer-organization-and-architecture-tutorials/
• https://www.javatpoint.com/computer-organization-and-architecture-tutorial
Instruction cycles
PCI Bus
Contents
• Organization and Architecture
• The computer architectural aspects needed for a machine language programmer is given below:
• Usually it includes the details of the hardware. Two computers with same
architecture can have different organization.
• Similarly, two computers having same organization may differ in their architecture.
• While designing a computer, its architecture is fixed first and then its organization is
decided.
Computer Organization and Functional Units
Input Unit
• Computers accept coded information through input units. The most common input
device is the keyboard.
• Whenever a key is pressed, the corresponding letter or digit is automatically translated
into its corresponding binary code and transmitted to the processor.
Output Unit
• The output unit is the counterpart of the input unit. Its function is to send processed
results to the outside world.
• Some units, such as graphic displays, provide both an output function, showing text and
graphics, and an input function, through touchscreen capability.
• The dual role of such units is the reason for using the single name input/output (I/O)
unit in many cases.
Computer Organization and Functional Units
An IN or OUT instruction is used for transfer of data between CPU and a device.
Data transfers from high speed devices such as hard disk and floppy disk is difficult to handle by programmed mode
or interrupt mode since transfer rate of these modes is slower than the rate at which data is coming from these
devices.
Slow speed devices can be handled by programmed mode or interrupt mode. Interrupt mode is ideal for very slow
speed devices so that CPU time is not wasted in waiting for device readiness between successive bytes transfer.
Computer Organization and Functional Units (contd..)
(ALU) and Control Unit :
• The ALU and control unit have usually some temporary storage units known as
registers.
• Each register can be considered as a fast memory with single location.
• Such registers temporarily store certain information such as instruction, data, address,
etc.
• Storing in registers is advantageous since these can be read quickly compared to
fetching them from external memory.
• The ALU and control unit are together known as Central Processing Unit (CPU) or
processor.
• The memory and CPU consist of electronic circuits and form the nucleus of the
computer.
• The input and output units are electromechanical units consisting of both electronic
circuits and mechanical assemblies.
• The input and output units are known as peripheral devices.
Computer Organization and Functional Units (contd..)
Arithmetic and Log Unit (ALU):
• Most computer operations are executed in the arithmetic and logic unit (ALU) of the
processor.
• Any arithmetic or logic operation, such as addition, subtraction, multiplication, division,
or comparison of numbers, is initiated by bringing the required operands into the
processor, where the operation is performed by the ALU.
• For example, if two numbers located in the memory are to be added, they are brought
into the processor, and the addition is carried out by the ALU.
• The sum may then be stored in the memory or retained in the processor for immediate
use.
• When operands are brought into the processor, they are stored in high-speed storage
elements called registers. Each register can store one word of data.
• Access times to registers are even shorter than access times to the cache unit on the
processor chip.
Computer Organization and Functional Units (contd..)
Control Unit :
• The memory, arithmetic and logic, and I/O units store and process information and perform input and
output operations. The operation of these units must be coordinated in some way.
• This is the responsibility of the control unit. The control unit is effectively the nerve center that sends
control signals to other units and senses their states.
• I/O transfers, consisting of input and output operations, are controlled by program instructions that
identify the devices involved and the information to be transferred. Control circuits are responsible for
generating the timing signals that govern the transfers and determine when a given action is to take
place. Data transfers between the processor and the memory are also managed by the control unit
through timing signals.
Computer Organization and Functional Units (contd..)
Control Unit :
• It is reasonable to think of a control unit as a well-defined, physically separate unit that
interacts with other parts of the computer. In practice, however, this is seldom the case.
Much of the control circuitry is physically distributed throughout the computer.
• A large set of control lines (wires) carries the signals used for timing and
synchronization of events in all units.
All modern computers use the stored program concept which was initially conceived by
the design team of ISA computer led by Von Neumann. Hence, it is commonly known as
Von Neumann concept. The essentials of stored program concept are as follows:
• The computer has five different types of units: memory, ALU, control unit, input unit
and output unit.
• The program and data are stored in a common memory.
• Once a program is in memory, the computer can execute it automatically without
manual intervention.
• The control unit fetches and executes the instructions in sequence one by one.
• This sequential execution can be modified by certain type of instructions.
• An instruction can modify the contents of any location in memory.
• Hence, a program can modify itself; instruction–execution sequence also can be
modified.
Computer Organization and Functional Units (contd..)
Auxiliary
Memory Pen Drive
Floppy (Flash
Disk Memory)
Hard Magnetic
Disk Type
Optical
Disk
These are connected to the computer as
DVD Input–Output (I/O) devices.
CD
Computer Organization and Functional Units (contd..)
Device Controller :
• A peripheral device is linked to the system nucleus (CPU and memory) by a device
controller, also known as I/O controller.
• The main function of a device controller is transfer of information (program and data) between the system nucleus and
the device. Physically, a device controller can exist in three different forms: as a separate unit, as integrated with the
device, as integrated with CPU.
The data signals may be sent either serially on one wire, bit-by-bit Serial interface
or in parallel, on eight wires, carrying all eight bits of a byte
simultaneously.
Parallel interface
Computer Organization and Functional Units (contd..)
I/O Drivers:
An I/O driver for a device consists of routines for performing various operations: read, write
etc. Each routine gives appropriate commands to the I/O controller and the device
controller issues necessary control signals to the device.
An I/O driver (device driver) is a collection of I/O routines for various operations for a specific
I/O device. It takes care of issuing commands to a device controller, verifying the status of the
device controller and device and handling input/output operations.
The operating system and other programs use the device driver routines for doing I/O
operations.
The I/O driver is a system program which can be asked by any other program to ‘serve’.
The I/O drivers of all the I/O devices are collectively known as BIOS.
Computer Organization and Functional Units (contd..)
Main Memory:
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 Two different memories with the same capacity
memory, is a fast memory that operates may have different organization as illustrated
at electronic speeds. Programs must be below. Both have same capacity of 4 kilo bytes but
stored in this memory while they are being they differ in their internal organizations.
executed.
• The memory stores instructions, data and results of
the current program being executed by the CPU.
• It is called program memory since the CPU fetches
instructions only from this memory. The main
memory is functionally organized as a number of
locations.
• Each location stores a fixed number of bits. The term
word length of a memory indicates the number of
bits in each location.
• The total capacity of a memory is the number of
locations multiplied by the word length. Memory capacity and organization
Computer Organization and Functional Units (contd..)
Random Access Memory (RAM):
• Instructions and data can be written into or read from the memory under the control of the
processor. It is essential to be able to access any word location in the memory as quickly as
possible.
• A memory in which any location can be accessed in a short and fixed amount time after
specifying its address is called a random-access memory (RAM).
• The time required to access one word is called the memory access time. This time is
independent of the location of the word being accessed.
• It typically ranges from a few nanoseconds (ns) to about 100 ns for current RAM units.
Read Only Memory (ROM):
• In a modern computer, usually a small part of the main memory is a Read Only Memory
(ROM).
• The CPU can read from the ROM but cannot write into it.
• Generally, some permanently required control programs and BIOS are stored in ROM by the
manufacturer.
Computer Organization and Functional Units (contd..)
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.
• All program instructions and any required data are stored in the main
memory.
• As execution proceeds, instructions are fetched into the processor chip, and
a copy of each is placed in the cache.
• Now, suppose a number of instructions are executed repeatedly as happens
in a program loop. If these instructions are available in the cache, they can
be fetched quickly during the period of repeated use.
• Similarly, if the same data locations are accessed repeatedly while copies of
their contents are available in the cache, they can be fetched quickly.
Bus Structure
Bus Concept :
• Connecting paths are necessary inside a computer for carrying following
types of information between the subsystems (CPU, memory, and I/O
controllers):
Bus concept
Bus Organization :
Bus Concept :
Bus concept
Bus Organization :
Bus Concept :
Address Bus
The address bus is used for two different
purposes as follows:
(a) To carry memory address, while reading
from or writing into memory.
(b) To carry I/O port address or device
address, while sending/reading data to/from
I/O port.
In early microprocessors, the address bus is
uni-directional since only the CPU can send
address and other units cannot address the
microprocessor. The advanced
microprocessors that have on-chip cache
memory have bi-directional address bus, for
cache memory invalidation.
In addition to processor, the DMA controller
can send memory address, during its bus
cycle, for data transfer between memory and Bus concept
an I/O controller.
Bus Organization :
Bus Concept :
Data Bus :
The data bus is a bi-directional bus and is used for the following tasks:
(a) To fetch instruction from memory.
(b) To fetch operand (of an instruction) from memory.
(c) To store the result (of an instruction) into memory.
(d) To send a command to an I/O device controller (or port).
(e) To read the status from an I/O device controller (or port).
(f) To read data from a device controller (or port).
(g) To issue data to a device controller (or port).
• During a bus cycle, if the CPU is the bus master, the CPU either places data on
data bus or takes data from data bus.
• Though the DMA controller also can become a bus master, it can neither supply
data to data bus nor receive data from data bus.
• It can only direct the memory and an I/O controller to supply/receive data.
However, during CPU's bus cycle, the DMA controller can interact with data bus, if
it is addressed by the CPU.
Bus Organization :
Bus Concept :
Control Bus :
The different control signals in a bus are shown in Figure and are briefly explained :
Control Bus :
The different control signals in a bus are shown in Figure and are briefly explained :
Control Bus :
The different control signals in a bus are shown in Figure and are briefly explained :
(e) Ready
The ready is an input signal to the CPU, generated in order
to synchronize the slow memory or I/O ports with the fast
CPU.
For instance, when the CPU is reading from a relatively slow
memory, the READY signal is used to “freeze” the CPU till
the memory completes the read operation as shown in Fig. Synchronization between a fast
In other words, delay is introduced in the bus cycle (in CPU and a slow memory
memory read sequence) by indicating that the
memory data is not yet ready.
(f) Other Signals
Various other signals such as Interrupt Requests and DMA Requests are also considered as control
signals
Bus Cycle :
• In a bus based computer, communication between the CPU and other subsystems take
place on the bus.
• A clearly defined protocol is followed on the bus so that there is no interference from
other subsystems when the CPU is communicating with any one subsystem.
• A sequence of events, performed on the bus, for transfer of one byte (or word), through
the data bus, is called a bus cycle. There are four major types of bus cycles:
Memory read bus cycle: CPU reads from a memory location;
Memory write bus cycle: CPU writes data into a memory location;
I/O Read bus cycle: CPU reads (accepts) data from an input port;
I/O Write bus cycle: CPU writes (sends) data to an output port.
Bus Cycle :
• An instruction cycle may involve multiple bus cycles of different types. Fetching of an
instruction involves memory read bus cycle. Storing a result in memory, needs memory
write bus cycle.
• Fetching operands involve memory read bus cycles. An IN or OUT instruction execution
involves I/O read bus cycle or I/O write bus cycle.
• The CPU starts a bus cycle by sending the address (of memory or port) on the address bus.
• All the subsystems connected to the bus decode this address. Only the addressed subsystem
will get logically connected to the bus and others do not interfere.
• The CPU indicates the type of bus cycle by sending the appropriate control signal (memory
read, memory write, I/O read, I/O write) on the control bus.
• In a given bus cycle, the CPU sends one control signal which distinctly identifies the type of
bus cycle. Memory responds to memory read or memory write whereas I/O ports respond
to I/O read or I/O write.
• During output bus cycles, CPU puts data on the data bus and the addressed subsystem
takes it. During input bus cycles, the addressed subsystem puts data on data bus and the
CPU takes (reads) it.
History of Computers
• The present day computer is the result of combined efforts of several scientists over
the past 60–70 years. Early developments in computers were achieved at Universities
working on Government funded projects.
• The
Early electronic computers are further grouped into different Computer Generations.
Calculators/Computers
Abacus
• The abacus is a mechanical device used for counting. The mathematical
operations such as addition, subtraction, division and multiplication can be
performed on a standard abacus.
• The abacus is nearly 2000 years old. It is still being used by Chinese merchants. It
is useful for teaching simple mathematics to children.
• The abacus has a wooden frame with vertical rods on which wooden beads slide.
Arithmetic problems are solved when these beads move around (with the fingers)
according to programming rules.
• Beads are considered counted, when moved towards the beam that separates the
two decks: upper deck and lower deck. Each bead in the upper deck has a value of
five; and each bead in the lower deck has a value of one.
History of Computers
Early Calculators/Computers
Mechanical Computers/Calculators
• Mechanical calculators were based on simple parts such as gears and levers. The French
philosopher Blaise Pascal built the first digital computer in 1642.
• It performed addition and subtraction of decimal numbers. In Germany, Gottfried Wilhelm von
Leibniz invented a computer that could add, subtract, multiply and divide. Leibniz designed a
stepped gear mechanism for introducing the addend digits.
• A sophisticated calculator was designed by Charles Xavier Thomas. It could add, subtract,
multiply, and divide. This was followed by models with a range of improved capabilities such as
accumulation of partial results, storage and automatic re-entry of previous results and printing of
the results.
Punched Cards
• The development of punched cards by Herman Hollerith and James Powers was a significant
contribution to development of computers.
• They introduced offline equipments to read punched information (holes) on the cards. This
facilitated faster input of the data and the program. Also, the decks of cards were used as offline
secondary storage. International Business Machines (IBM), Remington , Burroughs, and other
companies introduced punch card systems with electromechanical devices.
History of Computers
Computer Generations and Evolution
• The evolution of the computer over
the period of time has resulted in
development of various generations.
Different technologies have been
used for manufacturing the
computer hardware.
• Based on the component
technology, the computer is
classified into five generations.
Though, the main basis for the
classification is the component
technology, each new generation of
computers has a different
architectural structure as compared
to the earlier generation.
The EDVAC was a binary computer with 1-bit adder. It had a two tier memory hierarchy:
1. A fast main memory of 1 K words.
2. A slow secondary memory of 20 K words.
ENIAC supported the conditional branching instruction in which two way branching is specified by
the third and fourth addresses. It also had input–output instruction to perform data transfer. The
bit-by-bit processing was slow but it reduced the hardware cost.
History of Computers
(iii) IAS Computer (Von Neumann Machine)
The IAS computer was developed at the Princeton Institute for advanced studies. It is the basic
model for the stored-program concept which is followed in almost all subsequent computers.
The project team was led by Von Neumann.
In the IAS computer, the instruction has two fields, opcode and address, as shown in Fig below.
IAS instruction
• A memory word stores two such instructions. During instruction fetch, two instructions are
fetched from the memory in one access.
• The instruction set has five types of instructions: Arithmetic, Data transfer, Unconditional branch,
Conditional branch and Instruction address modify.
• The registers AC and MQ are directly addressable by instructions. The accumulator (AC) is a
general purpose register whereas the MQ is special purpose register.
• The AC is used in most of the arithmetic and data transfer instructions since the AC contents
plays a source, a destination or both in these instructions. The multiplier quotient (MQ) holds one
operand (multiplier) for a multiply instruction and the remainder for a divide instruction.
• The program counter (PC) is incremented by 1 after every instruction fetch. Since two consecutive instructions are
fetched simultaneously, the IR and IBR are used to store the current and next instructions, respectively.
History of Computers
(iii) IAS Computer (Von Neumann Machine)
2. During instruction fetch, simultaneously, two instructions are brought from the memory. Thus, one
instruction is always pre-fetched. This reduces access time for the second instruction, thus speeding
up the instruction cycle time.
3. The use of ‘address modify’ instruction results in changing the address field of another instruction
in the memory. Thus, a program can modify itself during runtime. This dynamic change is a powerful
feature, resulting in the efficient programming.
2. The IAS computer did not have ‘CALL’ and ‘RETURN’ type of instructions. Hence, subroutine
facility was not possible.
History of Computers
(iii) IAS Computer (Von Neumann Machine)
2. During instruction fetch, simultaneously, two instructions are brought from the memory. Thus, one
instruction is always pre-fetched. This reduces access time for the second instruction, thus speeding
up the instruction cycle time.
3. The use of ‘address modify’ instruction results in changing the address field of another instruction
in the memory. Thus, a program can modify itself during runtime. This dynamic change is a powerful
feature, resulting in the efficient programming.
2. The IAS computer did not have ‘CALL’ and ‘RETURN’ type of instructions. Hence, subroutine
facility was not possible.
History of Computers
(iii) Beyond IAS Computer
• Universal Automatic Computer (UNIVAC I) was developed by Eckert–Mauchy Corporation. It was suitable
for both scientific and commercial applications.
• This was soon followed by UNIVAC II which offered higher performance and had higher memory capacity.
• Subsequently, UNIVAC 1100 series of computers with compatibility between the various models was
released.
• International Business Machines (IBM) manufactured the IBM 701, its first electronic stored program
computer, in 1953. It was designed for scientific applications.
• Soon IBM 702, a system designed for commercial applications was introduced. UNIVAC series and IBM
series were two successful family of computers for a very long time.
History of Computers
econd Generation Computers
• The LSI technology simplified the design of Table lists various concepts and techniques used in fourth
generation computers.
digital systems. Single-IC chip based
computers came to market. The invention of
microprocessor by INTEL gave birth to
microcomputers.
• Several semiconductor companies such as
Motorola, Fairchild, Texas Instruments and
Zilog manufactured microprocessors that
offer a fantastic range of capabilities.
Several small companies also produce
innovative computer design.
• Powerful workstations meant for specialized
application such as CAD, production
stations, test and repair jigs etc. were
manufactured in addition to general purpose
computers.
• Microcomputers slowly captured the market
of minicomputers.
History of Computers
*Harvard architecture:-
Comparison of Von Neumann Architecture with
Harvard Architecture
CPU Architecture:
• The accumulator contains an operand. Hence, there is no operand address field (for one operand) in the instruction. This
results in short instructions and less memory space. Due to the absence of the address field, these are known as zero
address instructions. Such CPUs normally have two types of instructions: zero address and single address. The single
address instructions have one operand in main memory and the other in the accumulator.
• Instruction cycle takes less time due to the absence of operand fetch.
• Comparing with example 3.1, it is observed that the registers based CPU (GPR architecture)
results in shorter program size than the accumulator based CPU.
• Also, the program for the accumulator based CPU requires a memory location for storing partial
result.
• Hence, additional memory accesses are needed during program execution.
• Thus, increase in the number of registers, increases CPU efficiency. But care should be taken to
avoid
• unnecessary usage of registers.
• Hence, compilers need to be more efficient in this aspect.
CPU Architecture:
assification of Instruction Set Architectures
• It is present either inside1 the CPU or a portion of the memory can be used as a stack. A register (or memory
location) is used to point to the address of the top vacant location of the stack.
• This register is known as the Stack Pointer (SP). When nothing is stored in the stack, the stack is empty and
the stack pointer points to the bottom of the stack.
• When an item is stored in the stack, it is called PUSH operation; the stack pointer is decremented. When the
stack is full, the stack pointer points to the top of the stack.
• When any item is removed from the stack (POP operation), the stack pointer is incremented.
• The item which is pushed into the stack last (recently) comes out first in the next POP operation. In a stack
based CPU, all operations by the CPU are done on the contents of a stack.
• The stack is a push down list with a Last In First Out (LIFO) access mechanism. It
stores the operands.
• It is present either inside1 the CPU or a portion of the memory can be used as a
stack.
• A register (or memory location) is used to point to the address of the top vacant
location of the stack. This register is known as the Stack Pointer (SP). When nothing
is stored in the stack, the stack is empty and the stack pointer points to the bottom
of the stack.
• When an item is stored in the stack, it is called PUSH operation; the stack pointer is
decremented. When the stack is full, the stack pointer points to the top of the stack.
When any item is removed from the stack (POP operation), the stack pointer is
incremented.
• The item which is pushed into the stack last (recently) comes out first in the next
POP operation. In a stack based CPU, all operations by the CPU are done on the
contents of a stack.
• Similarly, the result of an operation is stored in stack. On executing an arithmetic
instruction such as ADD, the top operands are poped-off the stack. Burroughs B5000 Stack Concept
and HP 3000 are some examples of stack computers.
CPU Architecture:
assification of Instruction Set Architectures
Stack based CPU
Stack operation
CPU Architecture:
assification of Instruction Set Architectures
Stack based CPU
From the contents of stack, it is observed that the stack grows when some PUSH operation takes
place. When an arithmetic instruction is executed, the operands are removed from the stack and
the result occupies a position in the stack top.
Example 3.3 shows that the program size for the stack computer is more than for the registers
based CPU.
Instruction Format:
In computer organization, instruction formats refer to the way instructions are encoded and represented in machine
language. There are several types of instruction formats, including zero, one, two, and three-address instructions.
2. Result address : Instead of storing the result in a separate location, it is generally stored in the first or second operand
address. This saves space in instruction length. The only disadvantage is that the initial operand is replaced by the result. The
programmer should be careful in handling this problem. If the operand is needed by the program for future instructions, its
copy should be retained in some other location so that it is not lost.
3. Next instruction address : In majority of the cases, the next instruction required is physically the next one after the current
instruction. This implies that dedicating a field for the next instruction address is wastage of space and inefficient use of
instruction length. Hence, it is assumed that the next required instruction is the physically next instruction.
However, a branch (jump) instruction is used wherever necessary. The branch instruction specifies the
address of the next instruction.
Address instruction
Instruction Format:
The format of ADD instruction as shown in Fig. below. incorporates the stated variations.
Some computers store the result in the first operand location whereas the others in the
second location. The control unit is designed accordingly.
Example: The instruction length and operand address field is 36 bits and 14 bits,
respectively. If two-operand instructions of 240 numbers are used, then how many one operand
instructions are possible?
Instruction length = 36 bits
A two-operand instruction needs 28 bits for the operand addresses (2 × 14). Hence,
opcode size = 36 – 28 = 8 bits
Total number of instructions possible = 256
Number of one-address instructions = 256 – 240 = 16
Instruction Format
Ex:- ADD
Ex:- ADD B
Ex:- ADD R1, B
Ex:- ADD R1, A, B
Instruction Format:
Zero Address Instructions
These instructions do not specify any operands or addresses. Instead, they operate on data
stored in registers or memory locations implicitly defined by the instruction. For example, a zero-
address instruction might simply add the contents of two registers together without specifying
the register names.
A stack-based computer does not use the address field in the instruction. To evaluate an
expression first it is converted to reverse Polish Notation i.e. Postfix Notation.
Instruction Format:
One Address Instructions
These instructions specify one operand or address,
which typically refers to a memory location or register.
The instruction operates on the contents of that
operand, and the result may be stored in the same or
a different location. For example, a one-address
instruction might load the contents of a memory
location into a register.
This uses an implied ACCUMULATOR register for data
manipulation. One operand is in the accumulator and
the other is in the register or memory location.
Implied means that the CPU already knows that one
operand is in the accumulator so there is no need to
All operations
specify it. are done between the accumulator(AC) register and a memory operand.
M[ ] is any memory location.
M[T] addresses a temporary memory location for storing the intermediate result.
This instruction format has only one operand field. This address field uses two special instructions
to perform data transfer, namely:
•LOAD: This is used to transfer the data to the accumulator.
•STORE: This is used to move the data from the accumulator to the memory.
Instruction Format:
Location of Results :
There are multiple places for storing the result: main memory, CPU register, output port etc.
Some instructions such as HALT and NOOP do not have explicit results whereas, some
instructions just set or reset some flip–flops or clear registers.
Instruction Types :
The instructions are classified into different types on the basis of the following factors:
1. Opcode: Nature of operation done by the instruction.
2. Data: Type of data: binary, decimal etc.
3. Operand location: Memory, register etc.
4. Operand addressing: Method of specifying the operand location (address).
5. Instruction length: One byte, two byte etc.
6. Number of address fields: Zero address, single address, two address etc.
No two computers of different models have same instruction set. Almost every computer
has some unique instructions which attract the programmers. Computer architects give
considerable attention to the framing of the instruction set since it affects both the programmer
and the computer machine.
Instruction Types :
Taking into account the various operations, the instructions can be classified into following eight
types:
1. Data transfer instructions: These move the data from one register/memory location to another.
2. Arithmetic instructions: These perform arithmetical operations.
3. Logical instructions: These perform Boolean logical operations.
4. Control transfer instructions: These modify the program execution sequence
5. Input/output (I/O) instructions: These transfer information between external peripherals and
system nucleus (CPU/memory).
6. String manipulation instructions: These manipulate strings of byte, word, double word etc.
7. Translate instructions: These convert the data from one format to another.
8. Processor control instructions: These control processor operation.
Instruction Types :
Instruction Types :
Instruction Types :
Instruction Types :
Instruction Types :
Instruction Types :
Instruction Types :
Data Transfer Instructions:
Name Mnemonics
Load LD
Store ST
Move MOV
Exchange XCHG
Input IN
Output OUT
Push PUSH
Pop POP
Arithmetic Instructions:
Name Mnemonics
Increment INC
Decrement DEC
Add ADD
Subtract SUB
Multiply MUL
Add with carry ADDC
Subtract with borrow SUBB
Name Mnemonics
Clear CLR
Complement COM
AND AND
OR OR
Exclusive-OR XOR
Clear carry CLRC
Set carry SETC
Complement carry COMC
Enable Interrupt EI
Disable Interrupt DI
Shift Instructions:
Name Mnemonics
Logical shift right SHR
Logical shift left SHL
Arithmetic shift right SHRA
Arithmetic shift left SHLA
Rotate right ROR
Rotate left ROL
Rotate right through carry RORC
Input-Output instruction
Example:IN, OUT
Instruction Types:
Memory - reference instruction
Example: AND, ADD, LDA, STA
Memory reference instructions are those commands or instructions which are in the custom to
generate a reference to the memory and approval to a program to have an approach to the
commanded information and that states as to from where the data is cache continually. These
instructions are known as Memory Reference Instructions.
AND
The AND instruction implements the AND logic operation on the bit collection from the register and
the memory word that is determined by the effective address. The result of this operation is moved
back to the register.
ADD
The ADD instruction adds the content of the memory word that is denoted by the effective address to
the value of the register.
LDA
The LDA instruction shares the memory word denoted by the effective address to the register.
STA
STA saves the content of the register into the memory word that is defined by the effective address.
The output is next used to the common bus and the data input is linked to the bus. It needed only one
micro-operation.
Instruction Types:
Memory - reference instruction
Example: AND, ADD, LDA, STA
These instructions are mainly used to perform operations on registers. Operands are not
required here.
From bit 0 to bit 11 specifies register operation. Here opcode value always remains 111,
and the value of the indirect bit is always 0.
Input-Output instruction
Example:IN, OUT
These instructions are mainly used to perform operations on input and output related registers.
From bit 0 to bit 11 specifies input output operation. Here opcode value always remains 111
and value of indirect bit is always 1.
Addressing Modes
Implied / Implicit Addressing Mode
Immediate Addressing Mode
Direct Addressing Mode
Indirect Addressing Mode
Register Direct Addressing Mode
Register Indirect Addressing Mode
Relative Addressing Mode
Indexed Addressing Mode
Base Register Addressing Mode
Auto-Increment Addressing Mode
Auto-Decrement Addressing Mode
Contd…
Implied / Implicit Addressing Mode
Example: CMA (Complement Accumulator), zero address instructions
Immediate Addressing Mode
Auto increment
Mode
Contd…
Auto decrement
Mode
Flynn’s Classification of
Computers
Instruction Cycles
Flowchart for Instruction Cycle
RISC and CISC Processors
RISC (Reduced Instruction Set Computers)
CISC (Complex Instruction Set Computers)
Pipelining
Non-pipelined pipelined
Pipeline stages
5 stage pipeline
Advantages and disadvantages of
pipeline
Advantages
Disadvantages
3 types of hazards
Data Hazard: Occur when given instruction depends on data from an instruction
ahead of it in pipeline
WAR (Write
after Read)
[Anti-Data
dependency]
I: R2 <- R1 + R3
J: R3 <- R4 + R5
WAW (Write
after Write)
[Output data
Data Hazard
Example
Solutions for Data Hazard