Unit-1 of Computer Architecture

Download as pdf or txt
Download as pdf or txt
You are on page 1of 91

UNIT-I

Basic computer organization and design, Instructions and instruction


codes, Timing and control/ instruction cycle, Register/ Types of
register/ general purpose & special purpose registers/ index registers,
Register transfer and micro operations/ register transfer instructions,
Memory and memory function, Bus/ Data transfer instructions,
Arithmetic logic micro-operations/ shift microoperations, Input/
Output and interrupts, Memory reference instructions, Memory
interfacing memory/ Cache memory.
BASIC COMPUTER ORGANISATION AND DESIGN
CPU –Central processing unit
A unit or component that is used for data process and converting it into meaningful
information.
CPU is known as the brain of the computer.
Representation of CPU-:

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

Step:1 Fetch instruction the memory Step:4 Store instruction


in memory

1. Fetch instruction from the memory.


2.Decode the instruction into command.
3. Execute the command.
4. Store the instruction in the memory.
DESIGN OFCONTROLUNIT
Control unit is designed by two methods-:
1. Hardwired control unit
2. Micro-programmed control unit
HARDWIRED CONTROL UNIT
❖ It is implemented with the help of physical components which is hardwired(gates , flip-flops ,decoders)in
the hardware.
❖ The input to control unit at the instruction registers , flags , timing control signals).
❖ The designed is modified or changed, all the combinational circuits should be modified which is very
difficult task.
The sequence of the operations is carried out by this machine is determined by this machine is determined
by wiring of the logic elements so it is known as “hardwired”.
Advantages
❖ Hardwired control unit is fast because control signals are generated by combinational circuits.
❖The delay in generation of control signals depend up on the number of gates.
Disadvantages

❖ 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

T15 T14 T13 T12 T11 T10 T9 T8 T7 T6 T5 T4 T3 T2 T1 T0


4*16
DECODER

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

I=0 for indirect addressing mode.


4) First 12 bits are applied to the control logic gates .
5) The operation code bits (12-14) are decoded with 3*8 decoder.
6) The eight outputs (D0-D7) from a decoder goes to the control logic gates to perform specific operation.
7) last bit 15 is transferred to a 1 flip flop designated by symbol I.
8) The 4 bit sequence counter SC can count in binary from 0 through 15.
9) The counter output is decoded into 16 timing pulses T0 through T15.
10) The sequence counter can be incremented by INR input or clear by CLR input synchronously.
HARDWARE CONTROL UNIT-EXAMPLE
………Generation of timing signals for T0 to T4
Consider the case wherw SC is incremented to provide timing signals T0,T1,T2,T3and T4 in sequence.
………..condition … … … … …
…………….
- At the time T4 , SC is cleared to 0[zero]if decoder output D3 is active.This is expressed symbolically by the
statement:
D3 T4:SC<-0
TIM ING SIGNALS
- Generated by 4-bit sequence counter and 4*16 decoder.
- The SC ca n be incremented or cleared.
- Example :T0,T1,T2,T3,T4,T0,T1,… … … … … … …
Assume :At the time T4,SC is cleared to 0 if decoder output D3 is active.
D3 T4:SC<-0
T0 T1 T2 T3 T4 T0

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.

Architecture of micro program control unit

External Next Control Control


Control
Inputs address address data
memory
generator register register

next address information


❖ The address of micro instructions that is to be executed stored in control address register (CAR).
❖ Micro instructions corresponding to the address stored in CAR is fetched from control memory and is
stored in the control data register (CDR).
❖ The micron instructions contains control word to execute.
❖ After the execution of all micro operations of micro instructions the address of next micro instructions is
located.
DIFFERENCEBETWEENHardwired and Micro program
BASIS HARDWIRED MICRO PROGRAMME

Control signal generated by Hardware Software

Structure Complex Simple

Cost High Low

Speed Fast Slow

Update Difficult to modified Easy to modified

Decoding Complex decoding Easily decoding

Used in RISC CISC


INSTRUCTIONSAND INSTRUCTIONSCODES
INSTRUCTIONS
❖ A group of bits tell the computer to perform a specific operations (a sequence of micro operations).
❖ The instructions of program , along with any needed data are stored in memory.
❖ The CPU reads the next instruction from memory.
❖It is placed in an instruction register(IR).
INSTRUCTION FORMAT

A computer instruction is often divided into two parts-:


• An opcode(operation code) that specifies for that instructions.
• An address that specifies the registers and locations in memory to use for that operation.
1 opcode address
15 14 12 11 0

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

I=0 for indirect addressing mode


INSTRUCTION CODE
❖ MEMORY-REFRENCE INSTRUCTIONS
A memory-reference instructions uses 12 bits to specify an address and 1 bit to specify the addressing
mode I.I is equal to zero for direct address and to 1 for indirect address.
❖ REGISTER-REFERENCE INSTRUCTIONS
A register reference instructions specifies an operation on or a test of the AC registers. An operand
from the memory is not needed therefore the other 12 bits are used to specify the operation to be
executed.
❖ INPUT-OUTPUT INSTRUCTIONS
An input-output instructions does not need a reference to memory and is recognized by operational
code 11 with a 1 in the left most bit of the instructions the remaining 12 bits are used to specify the type of
input output operation performed.
Memory-reference instructions
15 14 12 11 0 (OP-code =000~110)
1 opcode address

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

DECODE Op code in IR(12-14),


AR IR(0-11), I IR(15)
(Register or I/O)=1 =0 (Memory reference)=>opcode=111

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

Execute memory reference


instruction
SC 0
REGISTERS,TYPESOF REGISTERSAND REGISTERTRANSFER
REGISTERS
A registers is one of a small set of data holding places that are part of a computer processor. A registers may
hold-
❖ A computer instructions
❖ A storage address
❖ Or any kind of data (such as a bit sequence or individual characters)
❖ Rarely more than 64 registers in number
❖ Small in size
❖Typically a registers is less than 64 bits in size.
REGISTERSLOCATION

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?

In the computer system, we need computer


memory to store various types of data like
text, images, video, audio, documents, etc.
We can retrieve it when the data is required.
Features of Memory
Following are the different features of the memory
system that includes:
1. Location
2. Capacity
3. Unit of transfer
4. Performance
5. Physical characteristics
Classification of Memory
MEMORY

PRIMAFRY SECONDARY CACHE REGISTER

RAM ROM HARD DISK, CD,


DVD, MAGNETIC
TAPE etc.

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

SYSTEM data 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

S.no ADDRESS BUS DATA BUS CONTROL BUS


1. A computer bus that A computer bus The control bus
is used to specify a that is used to carries control
physical address in transmit data information from
the memory. among the control unit to
components. the other units.
2. Uni -direction. Bi-directional. Uni-directional or
bi-directional.
3. Helps to transfer Help to send and Help to control the
memory addresses of receive data. functioning of
data and I/O. control and other
units.
4. With determines the With determines
amount of memory a the data
system can address. transferring rate.
GENERAL PURPOSE REGISTERS
✓General purpose registers are used to store temporary data
within the microprocessor.There are 8 general purpose registers
in 8086 microprocessor.
✓General Purpose Registers are a kind of registers which can
store both data and addresses. All general registers of the Intel
8086 microprocessor can be used for arithmetic and logic
operations and data movement.
✓ There are 4 general-purpose registers of 16-bit length each.
✓ Each of them is further divided into two subparts of 8-bit
length each: one high, which stores the higher-order bits and
another low which stores the lower order bits.
1.AX –
• This is the accumulator. It is of 16 bits and is divided
into two 8-bit registers AH and AL to also perform 8-bit
instructions.It is generally used for arithmetical and
logical instructions but in 8086microprocessor it is not
mandatory to have accumulator as the
destinationoperand.
Example:
ADD AX, AX (AX = AX + AX)
2. BX–
• This is the base register. It is of 16 bits and is
divided into two 8-bit registersBH and BL to
also perform 8-bit instructions.It is used to
store the value of the offset.
Example:
MOV BL, [500] (BL = 500H)
3. CX –
• This is the counter register. It is of 16 bits and is divided
into two 8-bitregisters CH and CL to also perform 8-bit
instructions.It is used in looping and rotation.
Example:
MOV CX, 0005LOOP
4. DX:
This is known as the Data register. Its 16 bits are
split into two 8-bit registers, DH and DL so that
it can execute 8-bit instructions as well. In I/O
operations, the data register can be used as a
port number. It is also applied to division and
multiplication.
Pointer registers: The pointer registers
consist of 16-bit left sections (SP, and BP) and
32-bit ESP and EBP registers.

▪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.

2. Arithmetic Micro-operations: Perform arithmetic operation on numeric data stored in


registers.

3. Logical Micro-operations: Perform bit manipulation operations on data stored in


registers.

4. Shift Micro-operations: Perform shift operations on data stored in registers.


Arithmetic Micro-operations
In general, the Arithmetic Micro-operations deals with the operations
performed on numeric data stored in the registers.
▪ The basic Arithmetic Micro-operations are classified in the following
categories:
i. Addition
ii. Subtraction
iii. Increment
iv. Decrement
v. Shift
Some additional Arithmetic Micro-operations
are classified as:
1.Add with carry
2.Subtract with borrow
3.Transfer/Load, etc.
Symbolic Representation Description

R3 ← R1 + R2 The contents of R1 plus R2 are transferred to R3.

R3 ← R1 - R2 The contents of R1 minus R2 are transferred to R3.

R2 ← R2' Complement the contents of R2 (1's complement)

R2 ← R2' + 1 2's complement the contents of R2 (negate)

R3 ← R1 + R2' + 1 R1 plus the 2's complement of R2 (subtraction)

R1 ← R1 + 1 Increment the contents of R1 by one

R1 ← R1 - 1 Decrement the contents of R1 by one


Note: The increment and decrement micro-
operations are symbolized by '+ 1' and ‘- 1'
respectively. Arithmetic operations like multiply and
divide are not included in the basic set of micro-
operations.
BINARY ADDER
▪The Add micro-operation requires registers that can
hold the data and the digital components that can
perform the arithmetic addition.
▪A Binary Adder is a digital circuit that performs the
arithmetic sum of two binary numbers provided with
any length.
▪A Binary Adder is constructed using full-adder circuits
connected in series, with the output carry from one
full-adder connected to the input carry of the next
full-adder.
4-BIT BINARY ADDER
➢The augends bits of A and the addend bits of B are
designated by subscript numbers from right to left, with
subscript 0 denoting the low-order bit.
➢ The carries are connected in a chain through the full-
adders. The input carry to the binary adder is Co and the
output carry is C4. The S outputs of the full-adders generate
the required sum bits.
➢An n-bit binary adder requires n full-adders.
Binary Adder-Subtractor
• The Subtraction micro-operation can be done easily by taking the
2's compliment of addend bits and adding it to the augend bits.

Note: The 2's compliment can be obtained by taking the


1's compliment and adding one to the least significant
pair of bits. The 1's compliment can be implemented
with inverters, and one can be added to the sum through
the input carry.
The block diagram for a 4-bit adder-subtractor circuit can be
represented as:
REGISTER TRANSFER OPERATIONS
REGISTER TRANSFER OPERATION
• The operation performed on the data stored in the registers are
referred to as register transfer operations.
• There are different types of register transfer operations:

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

It indicates that if P=1, then the content of R1 is transferred to R2.


It is a unidirectional operation.
3. SIMULTANEOUS OPERATIONS
If 2 or more operations are to occur simultaneously then they are
separated with comma (,).

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.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy