UNIT-5 dlco
UNIT-5 dlco
Registers implement two important functions in the CPU operation are as follows
−
• It can support a temporary storage location for data. This supports the directly implementing
programs to have fast access to the data if required.
• It can save the status of the CPU and data about the directly implementing program.
The CPU bus system is managed by the control unit. The control unit explicit the data flow
through the ALU by choosing the function of the ALU and components of the system.
Consider R1 ← R2 + R3, the following are the functions implemented within the CPU −
ALU Operation Selector (OPR) − It can select the arithmetic addition (ADD).
Decoder Destination Selector (SELD) − It can transfers the result into R1.
The multiplexers of 3-state gates are performed with the buses. The state of 14 binary
selection inputs determines the control word. The 14-bit control word defines a micro-
operation.
Stack is also known as the Last In First Out (LIFO) list. It is the most important feature in
the CPU. It saves data such that the element stored last is retrieved first. A stack is a
memory unit with an address register. This register influence the address for the stack,
which is known as Stack Pointer (SP). The stack pointer continually influences the address
of the element that is located at the top of the stack.
It can insert an element into or delete an element from the stack. The insertion operation is
known as push operation and the deletion operation is known as pop operation. In a
computer stack, these operations are simulated by incrementing or decrementing the SP
register.
Register Stack
The stack can be arranged as a set of memory words or registers. Consider a 64-word
register stack arranged as displayed in the figure. The stack pointer register includes a
binary number, which is the address of the element present at the top of the stack. The
three-element A, B, and C are located in the stack.
The element C is at the top of the stack and the stack pointer holds the address of C that is
3. The top element is popped from the stack through reading memory word at address 3
and decrementing the stack pointer by 1. Then, B is at the top of the stack and the SP holds
the address of B that is 2. It can insert a new word, the stack is pushed by incrementing the
stack pointer by 1 and inserting a word in that incremented location.
The stack pointer includes 6 bits, because 2 6 = 64, and the SP cannot exceed 63 (111111 in
binary). After all, if 63 is incremented by 1, therefore the result is 0(111111 + 1 =
1000000). SP holds only the six least significant bits. If 000000 is decremented by 1 thus
the result is 111111.
Therefore, when the stack is full, the one-bit register ‘FULL’ is set to 1. If the stack is null,
then the one-bit register ‘EMTY’ is set to 1. The data register DR holds the binary
information which is composed into or readout of the stack.
First, the SP is set to 0, EMTY is set to 1, and FULL is set to 0. Now, as the stack is not full
(FULL = 0), a new element is inserted using the push operation.
The stack pointer is incremented by 1 and the address of the next higher word is saved in
the SP. The word from DR is inserted into the stack using the memory write operation. The
first element is saved at address 1 and the final element is saved at address 0. If the stack
pointer is at 0, then the stack is full and ‘FULL’ is set to 1. This is the condition when the SP
was in location 63 and after incrementing SP, the final element is saved at address 0.
During an element is saved at address 0, there are no more empty registers in the stack.
The stack is full and the ‘EMTY’ is set to 0.
A new element is deleted from the stack if the stack is not empty (if EMTY = 0). The pop
operation includes the following sequence of micro-operations −
The instruction format directly influences how the CPU fetches, decodes, and executes
instructions, making it a vital concept in computer organization.
1. Zero-Address Instructions
It operates without specifying any operands explicitly. Typically used in stack-based
architectures, these instructions rely on the stack to store operands. The operations are
performed on the top of the stack, and the results are also stored on the stack.
Example
In Postfix Notation, X = (A + B) * (C + D) would be written as AB+CD+*.
PUSH A TOP = A
PUSH B TOP = B
PUSH D TOP = D
2. One-Address Instructions
It specifies a single operand, typically held in an accumulator. The accumulator is an implicit
register used in the operation. The result can either be stored in the accumulator or another
location.
Example
The expression X = (A + B) * (C + D) can be computed using one-address instructions with the
accumulator (AC).
LOAD A AC = M[A]
ADD B AC = AC + M[B]
STORE T M[T] = AC
LOAD C AC = M[C]
ADD D AC = AC + M[D]
MUL T AC = AC * M[T]
STORE X M[X] = AC
3. Two-Address Instructions
It allows for two operands to be specified. These operands can be registers or memory
locations. The result can overwrite one of the source operands or can be stored in a separate
location
Example
The expression X = (A + B) * (C + D) can be calculated using two registers.
MUL R1, R2 R1 = R1 * R2
MOV X, R1 M[X] = R1
4. Three-Address Instructions
It specifies three operands contains two source operands and one destination operand. This
format allows for more complex operations and direct representation of expressions. It is most
commonly used in high-level language compilers and optimizers.
Source
opcode Destination address Source address mod
address
Example
The expression X = (A + B) * (C + D) can be computed with three addresses.
Addressing Modes are an instruction set used for communicating with the central processing unit (CPU)
for performing any specific task.
Generally the following addressing modes are used for executing the instruction in 8085
microcontroller:-
1. MOV A, #data
It is known as immediate because 8-bit data is send immediately to the accumulator (destination
operand).
Consider the following illustration describes the above set of instructions and their execution. The opcode
74H is saved at 0202 address. The data 4AH is saved at 0203 address inside a program memory. After
reading an opcode 74H, the data at the next memory address is copied to accumulator A (E0H is the
address of accumulator). Since an instruction is of 2-bytes and it is executed in single cycle, the program
counter will increment by 2 and will point to 0204 address of the program memory.
Indexed Addressing Mode
Let us consider two examples for understanding the concept of indexed addressing mode. Take a look at
the below instructions:
1. MOVC A, @A+DPTR
2. MOVC A, @A+PC
Here PC is the program counter and DPTR is the data pointer (both are 16-bit registers). Consider the
first example.
1. MOVC A, @A+DPTR
In this the source operand is @A+DPTR. It has a source data from that place. Here the contents of DPTR
are added with the current content of the accumulator. This addition provides a new address that is the
address of the source data. The data pointed by this address is further transferred to the accumulator.
Consider the opcode is 93H. The DPTR having the value of 01FE, here 01 is located in DPH side (higher
8 bits) and FE is located in DPL side (lower 8 bits). Consider Accumulator has the value 02H. After that a
16-bit addition is done and 01FE H+02H result in 0200 H. Data present at the location 0200H will become
transferred to the accumulator. The previous value of the accumulator (02H) will be replaced by the new
data from 0200H. The new data inside the accumulator is highlighted in the illustration.
1. MOV A, 07H
The register bank#0 (7th register) has the address 07H. When the MOV instruction is executed, the data
stored in register 07H is moved inside an accumulator. As the register 07H holding the data 1FH,
therefore 1FH is moved to the accumulator.
Note - we are not using '#' in direct addressing mode, as that used in immediate mode because If we had
used '#', the data value 07H is transferred to the accumulator instead of 1FH.
Now, consider the following illustration. It shows how the instruction is executed:-
The program counter will be incremented by 2 and will point to 0204 memory location. The opcode for an
instruction MOV A, address of operation is E5H. Whenever the instruction at 0202 is run (E5H), the
accumulator will become active and ready to receive data. Then the PC jumps to the next address at
0203 and look up the address of the location 04H where the source data (i.e. transferred to accumulator)
is located. At 04H, the controller finds the data 1FH and transfers this to the accumulator and hence the
execution of instruction is completed.
Advertisement
At one time, a single register bank is to be selected. Selection of a register bank is made possible by
using a Special Function Register (SFR) it named as Processor Status Word (PSW). PSW is an 8-bit
SFR where each bit can be programmed as required. Bits are assigned from PSW.0 to PSW.7.
Data (2F) movement is shown in bold. 2F is become transferred to the accumulator from data memory
location 0CH and it is shown by dotted line. 0CH is an address location of Register 4 of register bank #1.
The instruction shown above is of 1 byte and it requires 1 cycle for complete execution. It means that we
can save memory by using direct addressing mode.
Register Indirect Addressing Mode
In register indirect addressing mode, the address of data is stored inside the register as an operand.
1. MOV A, @R0
Here the value present inside R0 is to be considered as an address, it is used for holding the data to be
transferred inside an accumulator. Example: If register R0 has the value 20H, and data 2FH is stored at
the address location of 20H, then the value of 2FH will become transferred to the accumulator after
executing the above instruction.
Now, consider the following illustration. It shows how the instruction is executed:-
Consider the opcode for MOV A, @R0 is E6H. Program control moves to address location 20H where it
locates the data 2FH and then transfer 2FH inside an accumulator. It is a 1-byte instruction and the
program counter (PC) is increments by 1 and moves to 0203 location of the program memory.
Data Transfer And Manipulation:
Data transfer involves the movement of data between different components of a computer
system, such as from the processor to memory, between registers, or across network
interfaces. This movement is essential for fetching instructions, storing results, and
communicating between various parts of a system.
Data manipulation, on the other hand, refers to the processes that transform and operate on
data to produce desired outcomes. This includes arithmetic operations, logical operations, bit-
level manipulations, and data shifting. Each of these operations plays a vital role in how
computers process information and execute tasks.
Add with carry ADDC ADDC R11, Adds the value in register R12 and the carry
Name Mnemonic Example Explanation
Subtract with SUBB R13, Subtracts the value in R14 and the borrow
SUBB
borrow R14 flag from R13.
Clear carry CLRC CLRC Clears the carry flag (sets it to 0).
Shift Instructions
Shift instructions allow the bits of a memory byte or register to be shifted one-bit place to the
right or the Left.
There are basically two types of shift instructions — arithmetic and logical. Arithmetic shifts
consider the contents of the memory byte or register to be a signed number. So, when the shift
is made, the number is arithmetically divided by two (right shift) or multiplied by two (left shift).
Logical shifts consider the contents of the register or memory byte to be just a bit pattern when
the shift is made.
• OP is opcode field
• RL (It tells whether to shift it right or left).
• REG (It determines which register is to be shifted).
• COUNT (It tells the number of places to be shifted).
• TYPE( It tells the type of shifting from the list given below).
In right-shift operations, zeros are shifted into high-order vacated positions. And in the case of
the left-shift operation, shifts the zero into low-order vacated positions.
Name Mnemonic
Characteristics of RISC
Simpler instruction, hence simple instruction decoding.
Instruction comes undersize of one word.
Instruction takes a single clock cycle to get executed.
More general-purpose registers.
Simple Addressing Modes.
Fewer Data types.
A pipeline can be achieved.
Advantages of RISC
Simpler instructions: RISC processors use a smaller set of simple
instructions, which makes them easier to decode and execute quickly.
This results in faster processing times.
Faster execution: Because RISC processors have a simpler instruction
set, they can execute instructions faster than CISC processors.
Lower power consumption: RISC processors consume less power than
CISC processors, making them ideal for portable devices.
Disadvantages of RISC
More instructions required: RISC processors require more instructions to
perform complex tasks than CISC processors.
Increased memory usage: RISC processors require more memory to
store the additional instructions needed to perform complex tasks.
Higher cost: Developing and manufacturing RISC processors can be
more expensive than CISC processors.
Input-Output Organization
Peripheral devices:
A Peripheral Device is defined as a device that provides input/output functions for a computer
and serves as an auxiliary computer device without computing-intensive functionality.
A peripheral device is also called a peripheral, computer peripheral, input-output device, or I/O
device.
1. Input Devices:
The input device is defined as it converts incoming data and instructions into a pattern of
electrical signals in binary code that are comprehensible to a digital computer.
Example:.
Keyboard, mouse, scanner, microphone etc.
Example:
Monitors, headphones, printers etc.
Monitor: A monitor is an output device that displays
visual information from a computer system.
Hard Drive: A hard drive is a storage device that stores data and files on a computer system.
USB Drive: A USB drive is a small, portable storage device that connects to a computer system
to provide additional storage space.
Memory Card: A memory card is a small, portable storage device that is commonly used in
digital cameras and smartphones.
External Hard Drive: An external hard drive is a storage device that connects to a computer
system to provide additional storage space.
4. Communication Devices:
Communication devices are used to connect a computer system to other devices or networks.
Examples of communication devices include:
Modem: A modem is a communication device that allows a computer system to connect to the
internet.
Network Card: A network card is a communication device that allows a computer system to
connect to a network.
Router: A router is a communication device that allows multiple devices to connect to a network.
Input-Output Interface:
Input-output interface provides a method for transferring information between
internal storage and external I/0 devices. Peripherals connected to a
computer need special communication links for interfacing them with the
central processing unit. The purpose of the communication link is to resolve
the differences that exist between the central computer and each peripheral.
The major differences are:
1. Peripherals are electromechanical and electromagnetic devices and their
manner of operation is different from the operation of the CPU and
memory, which are electronic devices. Therefore, a conversion of signal
values may be required.
2. The data transfer rate of peripherals is usually slower than the transfer
rate of the CPU, and consequently, a synchronization mechariism may
be needed.
3. Data codes and formats in peripherals differ from the word format in
the CPU and memory.
4. The operating modes of peripherals are different from each other and
each must be controlled so as not to disturb the operation of other
peripherals connected to the CPU.
Strobe control involves sending data along with a different signal known
as the strobe signal. The strobe signal alerts the receiving device that the
data is valid and ready to be read. The receiving device waits for the
strobe signal before reading the data to ensure sure it is synchronized
with its clock.
The strobe signal is usually generated by the transmitting device and is
sent either before or after the data. If the strobe signal is sent before the
data, it is called a leading strobe. If it is sent after the data, it is called a
trailing strobe.
• Prοgrammеd I/Ο
• Intеrrupt- initiatеd I/Ο
• Dirеct mеmοry accеss( DMA)
Today in this post we will cover all three mode of data transfer in computer architecture
one by one with suitable diagram.
Mοdе οf Transfеr
• Thе binary infοrmatiοn that is rеcеivеd frοm an еxtеrnal dеvicе is usually stοrеd in
thе mеmοry unit.
• Thе infοrmatiοn that is transfеrrеd frοm thе CPU tο thе еxtеrnal dеvicе is οriginatеd
frοm thе mеmοry unit.
• CPU mеrеly prοcеssеs thе infοrmatiοn but thе sοurcе and targеt is always thе
mеmοry unit.
• Data transfеr bеtwееn CPU and thе I/Ο dеvicеs may bе dοnе in diffеrеnt mοdеs.
Data transfеr tο and frοm thе pеriphеrals may bе dοnе in any οf thе thrее pοssiblе ways
• Prοgrammеd I/Ο
• Intеrrupt- initiatеd I/Ο
• Dirеct mеmοry accеss( DMA)
Nοw lеt’s discuss еach mοdе οnе by οnе.
Prοgrammеd I/Ο
It is duе tο thе rеsult οf thе I/Ο instructiοns that arе writtеn in thе cοmputеr prοgram.
Еach data itеm transfеr is initiatеd by an instructiοn in thе prοgram. Usually thе transfеr
is frοm a CPU Rеgistеr and mеmοry.
In this casе it rеquirеs cοnstant mοnitοring by thе CPU οf thе pеriphеral dеvicеs.
Thus bοth thеsе fοrms οf I/Ο suffеr frοm twο inhеrеnt drawbacks.
• Thе I/Ο transfеr ratе is limitеd by thе spееd with which thе prοcеssοr can tеst and
sеrvicе a dеvicе.
• Thе prοcеssοr is tiеd up in managing an I/Ο transfеr; a numbеr οf instructiοns must bе
еxеcutеd fοr еach I/Ο transfеr.
Dirеct Mеmοry Accеss
• Thе data transfеr bеtwееn a fast stοragе mеdia such as magnеtic disk and mеmοry
unit is limitеd by thе spееd οf thе CPU.
• Thus wе can allοw thе pеriphеrals dirеctly cοmmunicatе with еach οthеr using thе
mеmοry busеs, rеmοving thе intеrvеntiοn οf thе CPU. This typе οf data transfеr
tеchniquе is knοwn as DMA οr dirеct mеmοry accеss.
• During DMA thе CPU is idlе and it has nο cοntrοl οvеr thе mеmοry busеs.
• Thе DMA cοntrοllеr takеs οvеr thе busеs tο managе thе transfеr dirеctly bеtwееn thе
I/Ο dеvicеs and thе mеmοry unit.
Bus Rеquеst : It is usеd by thе DMA cοntrοllеr tο rеquеst thе CPU tο rеlinquish thе
cοntrοl οf thе busеs.
Bus Grant : It is activatеd by thе CPU tο Infοrm thе еxtеrnal DMA cοntrοllеr that thе
busеs arе in high impеdancе statе and thе rеquеsting DMA can takе cοntrοl οf thе busеs.
Οncе thе DMA has takеn thе cοntrοl οf thе busеs it transfеrs thе data.
This transfеr can takе placе in many ways
Now a days we daily transfer data from mobile app. Sometime user asks a
question which app is best for data transfer ?
The answer of the question which app is best for data transfer depends on types of
data you want to transfer such as audio video etc.
Most of the app used for data transfer are google drive , SendAnywhere, Xender ,
Bluetooth File transfer ,Verizon Content Transfer App etc.
All these data transfer app are used on android mobile mobile phone.