Unit-1 of Computer Architecture
Unit-1 of Computer Architecture
Unit-1 of Computer Architecture
R1
ALU R2
R3
R4
I
1.CO NTROLUNIT
❖ The control unit is like that part of human brain that control all the operation perform by each
part of body.
❖ Controlling is achieved through wires that can be hot(on) or cold(off).
Functions of control unit-:
1. The control unit is the component of CPU that directs the operation of the processors.
2. Control unit is interact with ALU and main memory.
3. It tells the computer memory, ALU, input and output devices . How to respond to programs
instructions.
4.It directs the operation of other units by providing timing and control signals.
5.It directs the flow of computer between CPU and main memory.
6.It also interact with ALU, which type of operation should be perform on data .
WORKING OFCONTROLUNIT
Step:2 Decode the insruction into command step:3 Execute command
ALU
❖ More is the control signals required by CPU , more complex will be the design of control unit.
❖ Modifica tions in control signals are very difficult.
❖It is difficult to correct mistake in original design or adding new feature in existing design of control units.
Hardwired control unit consist of a:-
❖ Instruction register
❖ Number of control logic gates
❖ Two decoders
❖ 4- bit sequence counter
Architecture of hardwired controlunit
15 14 12 11 0 Other outputs
1 Address
3*8
DECODER
D7 D6 D5 D4 D3 D2 D1 D0
Control
CONTROL
LOGIC inputs
I GATES
Increment(INR)
4 BIT Clear(CLR)
SEQUENCE COUNTER Clock
1) An instruction read from memory is placed in the instruction registers (IR).
2) The instruction registers is divided into three parts: 1 bit , operation code and address part.
3) First 12 bits(0-11) to specify an address , next 3 bits the operation code(OP ) code field of the instruction
and last left most bit specify the addressing mode . I= 0 for direct addressing mode
T0
T1
T2
T3
T4
D3
CLR
SC
MICRO –PROGRAMMED CONTROLUNIT
❖ A micro programmed control unit is implemented by using programming approach.A sequence of micro
operations are carried out by executing a program consisting of micro operations.
❖ Micro program , consisting of micro instructions is stored in the control memory of the control unit.
❖ Execution of a micro operations is responsible for generation of a set of control signals.
❖ A micro instructions consist of :- - On or more micro operations to be executed
- Address of next micro instruction to be executed
✓ Micro operations -: The operation performed on the data stored inside the register are called micro
operations.
✓ Micro programs -: Micro programming is concept for generating control signals using programs . These
are called micro programs.
✓ Micro instructions -: The instructions that make micro programs are called micro instructions.
✓ Micro code -: Micro program is a group of micro instructions . The micro programs can also be termed as
micro code.
Advantages
❖ The design of micro program control unit is less complex because micro program are implemented using
software routines.
❖ The micro program control unit is more flexible because design modifications , correction and
enhancement is easily possible.
Disadvantages
❖ The micro program control unit slower than hardwired control unit.
❖ The micro program control unit is expensive than hardwired control unit.
First 12 bits(0-11) to specify an address , next 3 bits the operation code(OP ) code field of the instruction
and last left most bit specify the addressing mode . I=0 for direct addressing mode
Register-reference instructions
15 12 11 0 (OP-code = 111,I=0)
0 Op code
0111 Register operation
Input-output instructions
15 12 11 0 (OP-code = 111,I=1)
1 Op code
1111 I/O Operation
INSTRUCTIO NSCYCLE
START
1. FETCH -:
- To copy the next instructions into the instruction no
register in the CPU.
2. DECODE -:
- Decode the instructions. yes
3. EXECUTE -:
Fetch
- Execute the instructions
Decode
Execute
Stop
SC 0 START
T0
AR PC
IR M[AR],PC PC+1 T1
T2
D7
(I/O)=1 =0(register) (indirect)=1 =0(direct)
I I
T3 T3
Execute Execute register
input-output T3 T3
reference
instruction instruction AC M[AR] NOTHING
SC 0 SC 0 T4
REGISTERS
CONTROL UNIT
ALU
TYPESOF REGISTERS
1.MEMORY ADDRESS REGISTER
- Holds the memory address of data or instructions.
- Used to access data and instructions from memory during the execution phase of an instruction.
- It contains the copy of designated memory locations specified by the memory address register.
2.MEMORY DATA REGISTERS
- It contain the data to be stored in the computer storage.
- It acts like a buffer and holds anything that is copied from the memory ready for the processor to use.
- MDR holds the information before it goes to the decoder.
3. INDEX REGISTER
- It is used to modifying operand and addresses during the run of a program.
4. PROGRAM COUNTER
- Part of instruction sequencer in some computers.
- It is a 16 bit special function register in 8085 microprocessor.
- It holds the address of the memory location of the next instructions when the current instruction is
executed by the microprocessor.
5.ACCUMULATOR REGISTER
- It is used for storing the results those are produced by the system.
- When the CPU will generate some results after the processing then all the results will be stored into
the AC register.
6.MEMORY BUFFER REGISTER
- It holds the contents of data or instruction read from or written in memory.
7. DATA REGISTER
-A register used in microcomputer to temporarily store data being transmitted to or from a peripheral
devices.
ADDRESSING MODES
1.)Direct addressing mode
- In this mode , effective of operand is present in instruction itself.
……single memory reference to acce ss data.
…………..no additional calculations to find the effective address of the operand.
OP
code address memory
instruction
operand
2.)indirect addressing mode
- In this mode, the address field of instruction gives the address where the effective address is stored
in memory . This slows down the execution, as this includes multiple memory lookups to find the operand.
OP code
instruction Pointer to
operand
operand
MEMORY AND MEMORY FUNCTIONS
Memory vs. Storage
▪Memory refers to the location of short-term
data, while storage refers to the location of data
stored on a long-term basis.
▪Memory is most often referred to as the primary
storage on a computer, such as RAM. Memory is
also where information is processed. It enables
users to access data that is stored for a short
time.
STORAGE
The term storage refers to secondary
memory and is where data in a computer is
kept. An example of storage is a hard drive
or a hard disk drive (HDD). Storage is
nonvolatile, meaning the information is still
there after the computer is turned off and
then back on.
Why do we need a computer memory?
PROM
DRAM
EPROM
SRAM
EEPROM
2.Main memory
❖Main memories also called primary memory.
❖Main memory store program and data which are currently
needed by CPU . Example RAM/ROM.
❖Main memory is accessible directly by the processing unit.
❖It is volatile memory. MAIN
MEMORY
❖It is more expensive.
❖This is faster , therefore expensive.
RAM ROM
a.)RAM
✓RAM – Random Access memory.
✓A temporarily storage that can be read from or written into by the
users.
✓Random access memory loses its contents whenever powered is
switched off.
✓It is a volatile memory.
Dynamic RAM
✓Every location can be accessed independently.
✓Data can be changed.
✓Data storage is of temporarily in nature.
Static RAM
Dynamic RAM
✓DRAM stands for dynamic RAM.
✓Relatively slower and low cost memory.
✓Used for main memory.
✓Contents are constantly refreshed 1000times per second.
✓Access time 60-70 nano seconds.
Static RAM
✓SRAM stands for static RAM.
✓Characterised by high speed and high cost.
✓Use six transistors to store data.
✓Can accept one command and transfer one word of data per clock
cycle.
Difference between DRAM and SRAM
DRAM SRAM
It is dynamic random access memory. It is static random access memory
The information stored in DRAM has to The information stored in SRAM need to
be refreshed after every few million be refreshed but it remains stable as long
seconds, otherwise . It is read. as power supply is provided.
DRAM has higher storage capacity and is SRAM is costlier but has higher speed
cheaper than SRAM. than DRAM.
b.)ROM
✓ Read Only Memory retain the data even when the power is turned off.
✓ It is non-volatile memory.
✓ Data can’t be changed.
✓ Data storage is of permanent nature . That’s why is known as field stores , dead stores or
permanent stores.
Types of ROM
i. PROM- The information is stored by programmers after manufacturing . It also can’t be
altered or erased later on.
ii. EPROM- It is similar to PROM , but its information can be erased later on by ultra violet
light and it can be programmed.
iii. EEPROM- Electrically erasable programmable ROM. Its is similar to EPROM , but its
information can be erased by using on high voltage current.
iv. EAPROM- As compared to EPROM and EAPROM , the information stored in EAPROM can be
altered later.
3.Secondary memory
• Secondary memory is also called auxiliary memory.
• Much larger in capacity but lower than the main
memory(primary memory).
• Secondary memory is an additional memory that is
located outside the computer.
• Secondary memory is less expensive.
• Program or information which are not currently used by
CPU resides in secondary memory. Example: hard disk,
floppy disk.
• It is non-volatile memory.
• Permanent storage of data and instructions.
Types of Secondary Memory
• The following are the types of secondary memory
devices:
1. Hard Disk
A hard disk is a computer's permanent storage device. It is a non-volatile
disk that permanently stores data, programs, and files, and cannot lose
store data when the computer's power source is switched off. Typically,
it is located internally on computer's motherboard that stores and
retrieves data using one or more rigid fast rotating disk platters inside an
air-sealed casing.
2.Floppy Disk
• A floppy disk is a secondary storage system that
consisting of thin, flexible magnetic coating disks for
holding electronic data such as computer files. It is also
known as Floppy Diskette that comes in three sizes like
8 inches, 5.5 inches and 3.5 inches. The stored data of a
floppy disk can be accessed through the floppy disk
drive.
3. CD Drive:
CD stands for Compact Disk. CDs are circular
disks that use optical rays, usually lasers, to
read and write data. They are very cheap as
you can get 700 MB of storage space for less
than a dollar They are portable as you can
eject the drive, remove the CD and carry it
with you.
4. Memory Storage Devices:
A memory device contains trillions of interconnected
memory cells that store data. When switched on or off,
these cells hold millions of transistors representing 1s
and 0s in binary code, allowing a computer to read and
write information. It includes USB drives, flash memory
devices, SD and memory cards, which you'll recognize as
the storage medium used in digital cameras.
▪ Flash drive
▪ Memory card
Flash Drive:
A flash drive is a small, ultra-portable storage device. USB flash
drives were essential for easily moving files from one device to
another. Flash drives connect to computers and other devices
via a built-in USB Type-A or USB-C plug, making one a USB
device and cable combination.
Flash drives are often referred to as pen drives, thumb drives,
or jump drives. These days, a USB flash drive can hold up to 2
TB of storage. They're more expensive per gigabyte than an
external hard drive.
Memory card:
A memory cardor memory cartridge is an electronic data
storage device used for storing digital information, typically
using flash memory. These are commonly used in portable
electronic devices, such as digital cameras, mobile phones,
laptop computers, tablets, PDAs, portable media players, video
game consoles, synthesizers, electronic keyboards and digital
pianos, and allow adding memory to such devices without
compromising ergonomy, as the card is usually contained within
the device rather than protruding like USB flash drives.
Cache Memory
•Cache memory is a high-speed memory,
which is small in size but faster than the main
memory (RAM). The CPU can access it more
quickly than the primary memory. So, it is
used to synchronize with high-speed CPU and
to improve its performance.
•
Characteristics of Cache Memory
• Cache memory is an extremely fast memory type
that acts as a buffer between RAM and the CPU.
• Cache Memory holds frequently requested data
and instructions so that they are immediately
available to the CPU when needed.
• Cache memory is costlier than main memory or
disk memory but more economical than CPU
registers.
• Cache Memory is used to speed up and
synchronize with a high-speed CPU
Levels of Memory
• Level 1 or Register: It is a type of memory in which data is
stored and accepted that are immediately stored in the CPU.
The most commonly used register is Accumulator, Program
counter, Address Register, etc.
• Level 2 or Cache memory: It is the fastest memory that has
faster access time where data is temporarily stored for faster
access.
• Level 3 or Main Memory: It is the memory on which the
computer works currently. It is small in size and once power is
off data no longer stays in this memory.
• Level 4 or Secondary Memory: It is external memory that is not
as fast as the main memory but data stays permanently in this
memory.
How does cache memory work with CPU?
• When CPU needs the data, first of all, it looks inside the L1 cache. If it does
not find anything in L1, it looks inside the L2 cache. If again, it does not find
the data in L2 cache, it looks into the L3 cache. If data is found in the cache
memory, then it is known as a cache hit. On the contrary, if data is not
found inside the cache, it is called a cache miss.
• If data is not available in any of the cache memories, it looks inside the
Random Access Memory (RAM). If RAM also does not have the data, then it
will get that data from the Hard Disk Drive.
• So, when a computer is started for the first time, or an application is
opened for the first time, data is not available in cache memory or in RAM.
In this case, the CPU gets the data directly from the hard disk drive.
Thereafter, when you start your computer or open an application, CPU can
get that data from cache memory or RAM.
BUS STRUCTURE
❖
BUSAND TYPESOF BUS
The CPU must be able tocommunica te with all devices.
❖ The devices are connected together by a communication channel called a bus.
❖ A bus is composed of set of communication lines or wires.
❖ Communication pathway connecting multiple devices.
❖ It is shared transmission medium.
❖ Multiple devices connect to the bus and any signal transmitted by any 1 device is received by all
devices connected to the bus.
❖ Only a signal transmission is possible at a time.
❖A bus has multiple paths in it, each is ca lled a line.
10101
1 Multiple lines transmit their signals parallely
0 10101
1
SYSTEM BUS
❖ It is the bus that connect the three major components of the systems (CPU, I/O, MEMORY).
c ontrol lines
addresslines
CPU MEMORY
CONTROL BUS
ADDRESS BUS
DATA BUS
1.)Control bus
❖ The numbers of wires depends of control commands a computer needs.
❖ These lines are used to transfer control signals from one component to another.
❖ The control information is used for directing the activities of all units.
❖ It specifies the type of operation that is used to be performed.
❖ It also transmits the control signals like(acknowledgement signals).
❖ When a CPU gives command to the memory for writing data, than the memory send an
acknowledgement signal to the CPU after successful writing of data.
2.)Address bus
❖ The numbers of wires depends on the address space of memory.
❖ It is a part of system bus. It is used to carry address signal read and write data in the memory.
❖ An address bus is unidirectional. RAM address bus
❖ An address bus carries address information . It is a set of wires. Similar to the data bus but it only
connects CPU and memory.
❖ Whenever the processor needs data from the memory , it places the address of data on the address
bus.
❖ The address is carried to the memory where the data from the requested address is fetched and
placed on the data bus. The data bus carries to CPU.
❖ An address is unique ID of each component to the system bus.
❖It is called address of the component.
3.)Data bus
❖ The most common bus is the data bus. A data bus carries data.
❖ It is an electrical path that connects the CPU, memory, INPUT/OUTPUT devices and secondary storage
devices.
❖ The bus contain parallel group of lines.
❖ Data bus is used to transfer the data from one component to another.
❖ There are 32 or 64 parallel lines of data bus.
❖ Data bus is bidirectional.
DIFFERENCE BETWEEN ADRESSBUS,DATA BUSAND CONTROL BUS
▪Stack pointer
▪Base pointer
1.STACK POINTER
▪A stack pointer is a small register that stores
the memory address of the last
data element added to the stack or, in some
cases, the first available address in the stack.
▪It is used as a memory pointer. It points to a
memory location in read/write memory, called the
stack. It is always incremented/decremented by 2
during push and pop operation.
2. BASE POINTER
▪This is known as the Base pointer used to point
data in the stack segments. We can utilize BP to
access data in the other segments, unlike SP. It
has a 16-bit size. It mostly serves as a way to
access parameters given via the stack. The stack
segment is relative to its offset address.
Index registers: The 16-bit rightmost bits of
the 32-bit ESI and EDI index registers. SI
and DI are sometimes employed in addition
and sometimes in subtraction as well as for
indexed addressing.
▪Source Index
▪Destination Index
1. SOURCE INDEX
This source index register is used to identify
memory addresses in the data segment that
DS is addressing. Therefore, it is simple to
access successive memory locations when we
increment the contents of SI. It has a 16-bit
size. Relative to the data segment, it has an
offset.
2. DESTINATION INDEX
The function of this destination index register is
identical to that of SI. String operations are a
subclass of instructions that employ DI to access
the memory addresses specified by ES. It is
generally used as a Destination index for string
operations.
SPECIAL PURPOSE REGISTERS
The 8085 microprocessor has special-purpose
registers, namely, Program Counter (PC), Stack
Pointer (SP), Flags/Status Registers (SR),
Instruction Register (IR), Memory Address
Register (MAR), Temporary Register (TR), and
Memory Buffer Register (MBR).
Program Counter (PC) :
The program counter is a 16-bit special-purpose
register. This is used to hold the memory address of the
next instruction which will be executed. Actually, this
register keeps track of memory locations of the
instructions during execution of program. The
microprocessor uses this register to execute
instructions in sequence. For this, the microprocessor
increments the content of the program counter.
STACK POINTER
The stack pointer is a 16-bit register, which is used to point
the memory location called the stack. The stack is a
sequence of memory locations in the R/W memory. The
starting of the stack is defined by loading a 16-bit address
into the stack pointer. Generally, the programmers use this
register to store and retrieve the contents of the
accumulator, flags, program counter as well as general-
purpose registers during the execution of a program.
Flags/Status Registers (SR) :
The Arithmetic Logic Unit (ALU) includes five flip-flops, which are set or reset
after an ALU operation according to data conditions of the result in the
accumulator and other general-purpose registers. The status of each flip-flop is
known as a flag. Therefore, there are five flags, namely, Carry flag (CY), Parity
flag (P), Auxiliary Carry flag (AC), Zero flag (Z), and Sign (S) flags. The most
commonly used flags are Carry(CY), Zero(Z) and Sign(S). Generally, the
microprocessor uses these flags to test data conditions.
Instruction Register (IR) :
The instruction register holds the operation code (opcode) of
the current instruction of a program during an
arithmetic/logical operation. The instruction is fetched from
the memory prior to execution. The decoder takes the
instruction and decodes it. After that, the decoded
instruction is passed to the next stage for execution
Memory Address Register (MAR) :
The Memory Address Register holds the address of the
next program instruction. Then MAR feeds the address
bus with addresses of the memory location of the
program instruction which will be executed.
Temporary Register (TR) :
This is an 8-bit register, which is associated with ALU. This
register holds data during arithmetic and logical operation.
This register can be used by the microprocessor but is not
accessible to the programmer.
MICRO OPERATIONS
What is micro operation?
• A microoperation is an elementary operation performed on the information stored in
one or more. registers.
Types of Micro-operations:
1. Register Transfer Micro-operations: Transfer binary information from one register to
another.
1. SIMPLE TRANSFER
2. CONDITIONAL TRANSFER
3. SIMULTANEOUS OPERATIONS
1. Simple Transfer
• The content of R1 are copied into R2 without affecting the
content of R1. It is an unconditional type of transfer
operation.
R2 <- R1
2. CONDITIONAL TRANSFER
If the control function P=1, then load the content of R1 into R2 and
at the same clock load the content of R2 into R1.