COA Module 1
COA Module 1
2. Describe control unit design methods and conceptualize instruction level parallelism.
3. Apply fundamentals of digital logic design to solve problem & perform various
arithmetic operations using various algorithms.
4. Describe concept of memory organization and explain the function of each element of a
memory hierarchy.
Computer Organization
and Architecture
Computer: A computer is a combination of hardware and software resources which
integrate together and provides various functionalities to the user.
Computer Architecture
• It deals with the functional behavior of computer systems. It comes before the
computer organization while designing a computer.
1. Architecture describes what the computer does. The Organization describes how it does it.
In the above figure, it’s clear that it deals with In the above figure, it’s also clear that it deals with low-level
3.
high-level design issues. design issues.
Computer Architecture is also called Instruction Set Computer Organization is frequently called
7.
Architecture (ISA). microarchitecture.
Computer Architecture comprises logical functions
Computer Organization consists of physical units like
8. such as instruction sets, registers, data types, and
circuit designs, peripherals, and adders.
addressing modes.
10. It makes the computer’s hardware visible. It offers details on how well the computer performs.
Architecture coordinates the hardware and software Computer Organization handles the segments of the
11.
of the system. network in a system.
12. The software developer is aware of it. It escapes the software programmer’s detection.
Examples- Intel and AMD created the x86 Organizational qualities include hardware elements
processor. Sun Microsystems and others created the that are invisible to the programmer, such as interfacing
13.
SPARC processor. Apple, IBM, and Motorola created of computer and peripherals, memory technologies, and
the PowerPC. control signals.
Computer Architecture
Basic
Organization
of Computer
Block Level Description of the Functional Units
• Input unit
• Central Processing Unit(ALU and Control Unit),
• Storage (Memory) Unit
• Output Unit
The CPU is the brain of the computer. Controls the
operation of the computer and performs its data processing
functions; often simply referred to as processor. The CPU is
made up of these main parts:
1.Instruction register − It holds the instruction to be
executed.
2.Decoder − It decodes (converts to machine level
language) the instruction and sends to the ALU
(Arithmetic Logic Unit).
3.ALU − It has necessary circuits to perform
arithmetic,logical, memory, register and program
sequencing operations.
4.Register − It holds intermediate results obtained during
program processing.
● Registers are used for holding such results rather than
RAM because accessing registers is almost 10 times
faster than accessing RAM.
Memory
Microprocessor has two types of memory
RAM − Random Access Memory is volatile memory that gets
erased when power is switched off. All data and instructions are
stored in RAM.
RAM is used for storage of data while ROM is used for storage of
programs especially to the start-up program that runs when the
microprocessor is powered on.
Input/output (I/O) devices
• Input devices allow the user to enter data into the computer, such as a
keyboard, mouse, and scanner.
Memory: The memory holds both instructions and data that the CPU needs
to execute. The memory is organized as a linear sequence of addressable
cells, each containing a fixed number of bits.
System bus: The system bus is a collection of wires that connect the CPU,
memory, and I/O devices. It is used to transmit data, instructions, and
control signals between these components.
Bus
Connection lines used to connect the internal parts of the
microprocessor chip is called bus.
There are three types of buses
Data Bus − Lines that carry data to and from memory are called data
bus. It is a bidirectional bus with width equal to word length of the
microprocessor.
Address Bus − It is a unidirectional responsible for carrying address
of a memory location or I/O port from CPU to memory or I/O port.
Control Bus − Lines that carry control signals like clock signals,
interrupt signal or ready signal are called control bus. They are
bidirectional. Signal that denotes that a device is ready for processing
is called ready signal. Signal that indicates to a device to interrupt its
process is called an interrupt signal.
Advantages Of Von Neumann Architecture
• The Von Neumann architecture has several advantages,including
simplicity, flexibility, and efficiency.
• Because instructions and data are stored in the same memory
system, the CPU can easily access both of them without having
to switch between different memory systems. This makes it
easier to write programs and reduces the complexity of the system
as a whole.
Disadvantages Of Von Neumann Architecture
• One of the main limitations is that the shared bus can become a
bottleneck if too many devices are connected to it. This can lead
to slow performance and reduced scalability.
• Additionally, the CPU can only execute one instruction at a time,
which can limit the overall speed of the system.
Computer System
Evolution of Computers
Basic Terms Related to Computers
The basic terms related to generations of computers are listed below.
Vacuum Tube: Vacuum tubes have the functionality of controlling the flow of
electronics in a vacuum. Generally, it is used in switches, amplifiers, radios,
televisions, etc.
Transistor: A transistor helps in controlling the flow of electricity in devices, it works
as an amplifier or a switch.
Integrated Circuit (IC): Integrated circuits are silicon chips that contain their circuit
elements like transistors, resistors, etc.
During the third generation, technology envisaged a shift from huge transistors to integrated
circuits, also referred to as IC. Here a variety of transistors were placed on silicon chips,
called semiconductors. The most feature of this era’s computer was speed and reliability. IC
was made from silicon and also called silicon chips.
The computer programs was designed to make the machine work. Operating system was a
program designed to handle a machine completely. Because of the operating system machine
could execute multiple jobs simultaneously. Integrated circuits were used to replace many
transistors used in the second generation.
A single IC has many transistors, registers, and capacitors built on one thin slice of
silicon. The value size was reduced and memory space and dealing efficiency were increased
during this generation. Programming was now wiped out Higher level languages like BASIC
(Beginners All-purpose Symbolic Instruction Code). Minicomputers find their shape during
this era.
Fourth Generation Computers
In 1971 First microprocessors were used, the large-scale
of integration LSI circuits built on one chip called
microprocessors. The advantage of this technology
is that one microprocessor can contain all the circuits
required to perform arithmetic, logic, and control functions
on one chip. LSI placed thousands of transistors onto
a single chip.
The computers using microchips were called microcomputers. This generation provided even smaller
size of computers, with larger capacities. That’s not enough, then Very Large Scale Integrated
(VLSI) circuits replaced LSI circuits. T
The Intel 4004 chip, developed in 1971, located all the components of the pc from the central
processing unit and memory to input/ output controls on one chip and allowed the dimensions to reduce
drastically. VLSI placed several hundred thousand transistors on a single silicon chip. This silicon chip is
known as the micro processor.
Performance of a computer depends on the constituent subsystems of the system including software.
Each of the subsystems can be measured and tuned for performance. Thus performance can be
measured for:
● CPU performance for Scientific application, Vector processing, Business application, etc –
Throughput is the total amount of work done in a given time. Or the measure
of work done in a unit of time.
CPU execution time is the total time a CPU spends computing on a given
task.
Total time taken for execution of a program = CPU Time + I/O Time + Others
(like Queuing time etc.)
Therefore,
CPU Execution Time TCPU = N x CPI x Tclk
= 15000 x 12 x 0.3 x 10^-9 seconds
= 54000 x 10^-9 seconds
= 54 x 10^-6 seconds
= 54 micro seconds=54 μs
2
3
4
HW
There are several factors that can impact the performance of a
computer system, including:
It provides the interface of 8086 to external memory and I/O devices via the System Bus. It performs
various machine cycles such as memory read, I/O read, etc. to transfer data between memory and I/O
devices.
BIU performs the following functions are as follows:
● It generates the 20-bit physical address for memory access.
● It fetches instructions from the memory.
● It transfers data to and from the memory and I/O.
● Maintains the 6-byte pre-fetch instruction queue(supports pipelining).
BIU mainly contains the
1. 4 Segment registers,
2. the Instruction Pointer,
3. a pre-fetch queue,
4. and an Address Generation Circuit.
● The BIU sends out addresses, fetches instructions from memory, reads data from ports
and memory, and writes data to ports and memory. Or we can say it reads the operational
codes from memory and stores them in the instruction queue registers
● While the EU is decoding an instruction or executing an instruction, which does not
require use of the buses,the BIU fetches up to six instruction bytes.
● The BIU stores these pre-fetched bytes in a first-in-first-out register set called a queue.
● Except in the case of JMP and CALL instructions, where the queue must be dumped
and then reloaded Starting from a new address, this pre-fetch and queue scheme greatly
speeds up processing.
● Fetching the next instruction while the current instruction executes is called pipelining.
● BIU contains Instruction queue, Segment registers, Instruction pointer, and Address
adder.
● It provides a full 16 bit bidirectional data bus and 20 bit address bus. The bus interface
unit is responsible for performing all external bus operations.
● In simple words, the BIU handles all transfers of data and addresses on the buses for
the execution unit.
Segment Registers:
Most of the registers contain data/instruction offsets within 64 KB memory segment.
There are four different 64 KB segments for instructions, stack, data and extra
data. To specify where in 1 MB of processor memory these 4 segments are located
the processor uses four Segment registers.
There are 4 segment registers.
They are:
Code Segment Register(CS)
Data Segment Register(DS)
Extra Segment Register(ES)
Stack Segment Register(SS)
The 8086 architecture uses the concept of segmented memory. Since 8086 has 20
address lines A0 to A19 So maximum memory location are 220 i.e 1MB. This 1 Mb is
divided into 16 sections or segments each containing 64KB of memory . At one time we
can work with any 4 sections or segments each containing 64KB memory locations.
Physical address= segment address x 10H + offset address
The first is segment address, the segment registers contain 16-bit segment base addresses, related
to different segment.
The second part is the offset value in that segment.
Code segment register (CS): is used for addressing memory location in the code segment
of the memory, where the executable program is stored. Code segment (CS) is a 16- bit
register containing address of 64 KB segment with processor instructions. The
processor uses CS segment for all accesses to instructions referenced by instruction
pointer (IP) register.
Data segment register (DS): points to the data segment of the memory where the data is
stored. Data segment (DS) is a 16-bit register containing address of 64KB segment with
program data. By default, the processor assumes that all data referenced by general
registers (AX, BX, CX, DX) and index register (SI, DI) is located in the data segment. DS
register can be changed directly using POP and LDS instructions.
Extra Segment Register (ES) : also refers to a segment in the memory which is another
data segment in the memory. Extra segment (ES) used to hold the starting address of
Extra segment. Extra segment is provided for programs that need to access a second
data segment. Segment registers cannot be used in arithmetic operations.
Stack Segment Register (SS): is used for addressing stack segment of the memory. The
stack segment is that segment of memory which is used to store stack data. Stack
segment (SS) is a 16-bit register containing address of 64KB segment with program stack.
By default, the processor assumes that all data referenced by the stack pointer (SP)
and base pointer (BP) registers is located in the stack segment.
Instruction Pointer (IP):
● It is a 16-bit register. It holds offset of the next instructions in the Code
Segment.
● IP is incremented after every instruction byte is fetched.
● IP gets a new value whenever a branch instruction occurs.
● CS is multiplied by 10H to give the 20-bit physical address of the Code
Segment.
● The address of the next instruction is calculated by using the formula
Assume Cs=1000h
IP=2345h
● Control Circuitry
● Instruction decoder
● ALU
EXECUTION UNIT :
● The Execution unit is responsible for decoding and executing all
instructions.
● The EU extracts instructions from the top of the queue in the BIU, decodes
them, generates operands if necessary, passes them to the BIU and requests
it to perform the read or write cycles to memory or I/O and perform the
operation specified by the instruction on the operands.
● During the execution of the instruction, the EU tests the status and control
flags and updates them based on the results of executing the instruction.
● If the queue is empty, the EU waits for the next instruction byte to be
fetched and shifted to top of the queue.
● When the EU executes a branch or jump instruction, it transfers control to a
location corresponding to another set of sequential instructions. Whenever this
happens, the BIU automatically resets the queue and then begins to fetch
instructions from this new location to refill the queue.
EXECUTION UNIT :
● The execution unit of the 8086 tells the BIU where to fetch instructions or
data from, decodes instructions,and executes instructions.
● The EU contains control circuitry, which directs internal operations.
● The EU has a 16-bit arithmetic logic unit (ALU) which can add, subtract,
AND, OR, XOR, increment, decrement,complement or shift binary
numbers.
Steps
● EU extracts instructions from top of queue in BIU
● Decode the instructions
● Generates operands if necessary
● Passes operands to BIU & requests it to perform read or write bus cycles to
memory or I/O
● Perform the operation specified by the instruction on operands
Register Organization:
The 8086 microprocessor has a total of fourteen registers that are accessible to the
programmer. All of them are 16-bit registers. It is divided into two groups. They are:
● The registers AX, BX, CX and DX are the general purpose 16-bit registers.
● AX is used as 16-bit accumulator. The lower 8-bit is designated as AL and
higher 8-bit is designated as AH.
● AL can be used as an 8-bit accumulator for 8-bit operation.
● All data register can be used as either 16 bit or 8 bit. BX is a 16 bit register, but
BL indicates the lower 8-bit of BX and BH indicates the higher 8-bit of BX.
● The register BX is used as offset storage for forming physical address in
case of certain addressing modes.
● The register CX is used default counter in case of string and loop
instructions.
● DX register is a general purpose register which may be used as an implicit
operand or destination in case of a few instructions.
General Purpose Registers
Accumulator register consists of two 8-bit registers AL and AH, which can be combined
together and used as a 16-bit register AX. AL in this case contains the low order byte of the
word, and AH contains the high-order byte. Accumulator can be used for I/O operations
and string manipulation.
Base register consists of two 8-bit registers BL and BH, which can be combined together
and used as a 16-bit register BX. BL in this case contains the low-order byte of the word, and
BH contains the high-order byte. BX register usually contains a data pointer used for
based, based indexed or register indirect addressing.
Count register consists of two 8-bit registers CL and CH, which can be combined together
and used as a 16-bit register CX. When combined, CL register contains the low order byte of
the word, and CH contains the high-order byte. Count register can be used in Loop,
shift/rotate instructions and as a counter in string manipulation
Data register consists of two 8-bit registers DL and DH, which can be combined together
and used as a 16-bit register DX. When combined, DL register contains the low order byte of
the word, and DH contains the high-order byte. Data register can be used as a port number
in I/O operations.
AX= 1234H here 12 is the higher Byte 34 is the lower byte
MOV BL,CL
MOV BH,CH
MOV BX,CX
Program To ADD
MOV BL,04H
MOV CL,05H
ADD BL, CL
MOV BL,04H
ADD BL,05H
Pointers and Index Registers:
The index and pointer registers are given below:
IP—Instruction pointer-store memory location of next instruction to be executed
BP—Base pointer
SP—Stack pointer
SI—Source index
DI—Destination index
Stack Pointer (SP) is a 16-bit register pointing to program stack, i.e. it is used to hold the address of the top of
stack. The stack is maintained as a LIFO with its bottom at the start of the stack segment (specified by the
SS segment register).Unlike the SP register, the BP can be used to specify the offset of other program
segments.
Base Pointer (BP) is a 16-bit register pointing to data in stack segment. It is usually used by subroutines to
locate variables that were passed on the stack by a calling program. BP register is usually used for based,
based indexed or register indirect addressing.
Source Index (SI) is a 16-bit register. SI is used for indexed, based indexed and register indirect
addressing, as well as a source data address in string manipulation instructions. Used in conjunction with
the DS register to point to data locations in the data segment.
Destination Index (DI) is a 16-bit register. Used in conjunction with the ES register in string operations. DI is
used for indexed, based indexed and register indirect addressing, as well as a destination data address in
string manipulation instructions. In short, Destination Index and SI Source Index registers are used to hold
address.
OPERAND Registers
It is a temporary Register which is not available to the
programmer.
It is used by the processor to store temporary values
Every processor hs temporary register used by only processor
Example:
XCHG BX,CX
Flag Register
Flag Register contains a group of status bits called flags that indicate the status of the
CPU or the result of arithmetic operations. There are two types of flags:
1. The status flags which reflect the result of executing an instruction. The
programmer cannot set/reset these flags directly.
2. The control flags enable or disable certain CPU operations. The programmer can
set/reset these bits to control the CPU's operation.
Nine individual bits of the status register are used as control flags (3 of them) and
status flags (6 of them).The remaining 7 are not used.
A flag can only take on the values 0 and 1. We say a flag is set if it has the value 1.
The status flags are used to record specific characteristics of arithmetic and of
logical instructions.
Flag Register
Flag Register
Pin Diagram of 8086 Microprocessor
Extra
Instruction Set
Why study instruction set?
► The knowledge will help you write lines of code or program by which you
will be able to tell the processor, the sequence of operations to be
performed.
IN AX, DX
Process Control Instructions