0% found this document useful (0 votes)
20 views

Unit I

Uploaded by

Sakile Chinnu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Unit I

Uploaded by

Sakile Chinnu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 45

Unit-I

Introduction
Functional Units
• A computer organization describes the functions and design of the various
units of a digital system.
• A general-purpose computer system is the best-known example of a digital
system. Other examples include telephone switching exchanges, digital
voltmeters, digital counters, electronic calculators and digital displays.
• Computer architecture deals with the specification of the instruction set and
the hardware units that implement the instructions.
• Computer hardware consists of electronic circuits, displays, magnetic and
optic storage media and also the communication facilities.
• Functional units are a part of a CPU that performs the operations and
calculations called for by the computer program.
• Functional units of a computer system are parts of the CPU (Central
Processing Unit) that performs the operations and calculations called for by
the computer program. A computer consists of five main components
namely, Input unit, Central Processing Unit, Memory unit Arithmetic &
logical unit, Control unit and an Output unit.
Input unit
• Input units are used by the computer to read the data. The most
commonly used input devices are keyboards, mouse, joysticks,
trackballs, microphones, etc.

• However, the most well-known input device is a keyboard. Whenever


a key is pressed, the corresponding letter or digit is automatically
translated into its corresponding binary code and transmitted over a
cable to either the memory or the processor.
Central Processing Unit (CPU):
Central processing unit commonly known as CPU can be referred as an
electronic circuitry within a computer that carries out the instructions
given by a computer program by performing the basic arithmetic,
logical, control and input/output (I/O) operations specified by the
instructions.
Memory unit
• The Memory unit can be referred to as the storage area in which programs are kept which are running,
and that contains data needed by the running programs.
• The Memory unit can be categorized in two ways namely, primary memory and secondary memory.
• It enables a processor to access running execution applications and services that are temporarily stored in
a specific memory location.
• Primary storage is the fastest memory that operates at electronic speeds. Primary memory contains a
large number of semiconductor storage cells, capable of storing a bit of information. The word length of
a computer is between 16-64 bits.
• It is also known as the volatile form of memory, means when the computer is shut down, anything
contained in RAM is lost.
• Cache memory is also a kind of memory which is used to fetch the data very soon. They are highly
coupled with the processor.
• The most common examples of primary memory are RAM and ROM.
• Secondary memory is used when a large amount of data and programs have to be stored for a long-term
basis.
• It is also known as the Non-volatile memory form of memory, means the data is stored permanently
irrespective of shut down.
• The most common examples of secondary memory are magnetic disks, magnetic tapes, and optical disks.
Arithmetic & Logical Unit (ALU):
Most of all the arithmetic and logical operations of a computer are
executed in the ALU (Arithmetic and Logical Unit) of the processor. It
performs arithmetic operations like addition, subtraction, multiplication,
division and also the logical operations like AND, OR, NOT operations.
Control unit
• The control unit is a component of a computer's central processing
unit that coordinates the operation of the processor. It tells the
computer's memory, arithmetic/logic unit and input and output devices
how to respond to a program's instructions.
• The control unit is also known as the nerve center of a computer
system.
• Let's us consider an example of addition of two operands by the
instruction given as Add LOCA, RO. This instruction adds the
memory location LOCA to the operand in the register RO and places
the sum in the register RO. This instruction internally performs several
steps.
Output Unit
• The primary function of the output unit is to send the processed results
to the user. Output devices display information in a way that the user
can understand.
• Output devices are pieces of equipment that are used to generate
information or any other response processed by the computer. These
devices display information that has been held or generated within a
computer.
• The most common example of an output device is a monitor.
Basic Operational Concepts
• The primary function of a computer system is to execute a program,
sequence of instructions. These instructions are stored in computer memory.
• These instructions are executed to process data which are already loaded in
the computer memory through some input devices.
• After processing the data, the result is either stored in the memory for
further reference, or it is sent to the outside world through some output port.
• To perform the execution of an instruction, in addition to the arithmetic
logic unit, and control unit, the processor contains a number of registers
used for temporary storage of data and some special function registers.
• The special function registers include program counters (PC), instruction
registers (IR), memory address registers (MAR) and memory and memory
data registers (MDR).
• The Program counter is one of the most critical registers in CPU.
• The Program counter monitors the execution of instructions. It keeps
track on which instruction is being executed and what the next
instruction will be.
• The instruction register IR is used to hold the instruction that is
currently being executed.
• The contents of IR are available to the control unit, which generate the
timing signals that control, the various processing elements involved
in executing the instruction.
• The two registers MAR and MDR are used to handle the data transfer
between the main memory and the processor.
• The MAR holds the address of the main memory to or from which
data is to be transferred.
• The MDR contains the data to be written into or read from the
addressed word of the main memory.
• Whenever the processor is asked to communicate with devices, we say
that the processor is servicing the devices. The processor can service
these devices in one of the two ways.
• One way is to use the polling routine, and the other way is to use an
interrupt.
• Polling enables the processor software to check each of the input and
output devices frequently. During this check, the processor tests to see
if any devices need servicing or not.
• Interrupt method provides an external asynchronous input that informs
the processor that it should complete whatever instruction that is
currently being executed and fetch a new routine that will service the
requesting device.
Bus Structure
• A bus structure is a set of conductors that carry data, address, and
control signals within a computer system. It acts as a communication
highway connecting the central processing unit (CPU), memory,
input/output devices, and other peripherals.
A system bus usually consists of a range of distinct lines, typically
numbering from fifty to hundreds. Each line is designated for a specific
function, and these lines can be divided into three main functional
categories: data lines, address lines, and control lines.

Early computer buses were literally parallel electrical wires with


multiple connections, but modern computer buses can use both parallel
and bit serial connections.

Some types of bus structures include:


• Single bus structure
• Double bus structure
• Multiple bus structure
1. Address Bus:
• Address bus carry the memory address while reading from writing into
memory.
• Address bus caary I/O post address or device address from I/O port.
• In uni-directional address bu only the CPU could send address and
other units could not address the microprocessor.
• Now a days computers are haing bi-directional address bus.
2. Data Bus:
• Data bus carry the data.
• Data bus is a bidirectional bus.
• Data bus fetch the instructions from memory.
• Data bus used to store the result of an instruction into memory.
• Data bus carry commands to an I/O device controller or port.
• Data bus carry data from a device controller or port.
• Data bus issue data to a device controller or port.
3. Control Bus:
• Different types of control signals are used in a bus:
• Memory Read: This signal, is issued by the CPU or DMA controller
when performing a read operation with the memory.
• MemoryWrite: This signal isissued by the CPU or DMAcontroller
when performing a write operation with the memory.
• I/O Read: This signal isissued by the CPU when it is reading from an
input port.
• I/O Write: This signal is issued by the CPU when writing into an
output port.
• Ready: The ready is an input signal to the CPU generated in order to
synchronize the show memory or I/O ports with the fast CPU.
A system bus is a single computer bus that connects the major
components of a computer system, combining the functions of a data
bus to carry information, an address bus to determine where it should be
sent, and a control bus to determine its operation.
Instruction Sequencing and Addressing Modes
Instructions and Instruction Sequencing
The tasks carried out by a computer program consist of a sequence of small steps,
such as adding two numbers, testing for a particular condition, reading a character
from the keyboard, or sending a character to be displayed on a display screen.
A computer must have instructions capable of performing 4 types of operations:

1) Data transfers between the memory and the registers (MOV, PUSH, POP,
XCHG).

2) Arithmetic and logic operations on data (ADD, SUB, MUL, DIV, AND, OR, NOT).

3) Program sequencing and control(CALL,RET, LOOP, INT).

4) I/0 transfers (IN, OUT).


REGISTER TRANSFER NOTATION (RTN)

Here we describe the transfer of information from one location in a


computer to another. Possible locations that may be involved in such
transfers are memory locations, processor registers, or registers in the
I/O subsystem. Most of the time, we identify such locations
symbolically with convenient names.

• The possible locations in which transfer of information occurs are:

1) Memory-location
2) Processor register &
3) Registers in I/O device.
ASSEMBLY LANGUAGE NOTATION
To represent machine instructions and programs, assembly
language format is used.
BASIC INSTRUCTION TYPES
Addressing Modes
Addressing modes are techniques used in computer architecture to specify
the method by which the CPU accesses operands from memory. They define
how the CPU calculates the effective address of an operand before
performing operations like reading from or writing to memory.

Addressing modes for 8086 instructions are divided into two categories:

1) Addressing modes for data


2) Addressing modes for branch
• The 8086 memory addressing modes provide flexible access to
memory, allowing you to easily access variables, arrays, records,
pointers, and other complex data types. The key to good assembly
language programming is the proper use of memory addressing
modes.
• An assembly language program instruction consists of two parts
The memory address of an operand consists of two components:
IMPORTANT TERMS
• Starting address of memory segment.
• Effective address or Offset: An offset is determined by adding any
combination of three address elements: displacement, base and index.
• Displacement: It is an 8 bit or 16 bit immediate value given in the instruction.
• Base: Contents of base register, BX or BP.
• Index: Content of index register SI or DI.
• According to different ways of specifying an operand by 8086
microprocessor, different addressing modes are used by 8086.
• Addressing modes used by 8086 microprocessor are discussed below:
Implied mode:
• In implied addressing the operand is specified in the instruction itself.
• In this mode the data is 8 bits or 16 bits long and data is the part of
instruction.
• Zero address instruction are designed with implied addressing mode.

Example: CLC (used to reset Carry flag to 0)


Immediate addressing mode (symbol #):
In this mode data is present in address field of instruction.
Designed like one address instruction format.

Note: Limitation in the immediate mode is that the range of constants


are restricted by size of address field.

Example: MOV AL, 35H (move the data 35H into AL register)
Register mode:
In register addressing the operand is placed in one of 8 bit or 16 bit general
purpose registers.
The data is in the register that is specified by the instruction.
Here one register reference is required to access the data.

Example: MOV AX,CX (move the contents of CX register to AX


register)
Register Indirect mode: I
n this addressing the operand’s offset is placed in any one of the registers
BX,BP,SI,DI as specified in the instruction.
The effective address of the data is in the base register or an index register that
is specified by the instruction.
Here two register reference is required to access the data.

MOV AX, [BX](move the contents of memory location s


addressed by the register BX to the register AX)
Auto Indexed (increment mode):
Effective address of the operand is the contents of a register specified in the
instruction.
After accessing the operand, the contents of this register are automatically
incremented to point to the next consecutive memory location.(R1)+.

Here one register reference, one memory reference and one ALU operation is
required to access the data.

Add R1, (R2)+ // OR


R1 = R1 +M[R2]
R2 = R2 + d
Auto indexed ( decrement mode):
Effective address of the operand is the contents of a register specified in the
instruction.
Before accessing the operand, the contents of this register are automatically
decremented to point to the previous consecutive memory location. –(R1)
Here one register reference, one memory reference and one ALU operation is
required to access the data.

Add R1,-(R2) //OR


R2 = R2-d
R1 = R1 + M[R2]

Auto decrement mode is same as auto increment mode. Both can also be used to implement a
stack as push and pop . Auto increment and Auto decrement modes are useful for implementing
“Last-In-First-Out” data structures.
Direct addressing/ Absolute addressing Mode (symbol [ ]):
The operand’s offset is given in the instruction as an 8 bit or 16 bit displacement
element.
In this addressing mode the 16 bit effective address of the data is the part of the
instruction.

Here only one memory reference operation is required to access the data.

Example:ADD AL,[0301] //add the contents of offset address 0301 to AL


• Indirect addressing Mode (symbol @ or () ):
• In this mode address field of instruction contains the address of effective
address. Here two references are required.
1st reference to get effective address.
2nd reference to access the data.
Based on the availability of Effective address, Indirect mode is of two kind:
• Register Indirect: In this mode effective address is in the register, and
corresponding register name will be maintained in the address field of an
instruction.
Here one register reference, one memory reference is required to access the data.
• Memory Indirect: In this mode effective address is in the memory, and
corresponding memory address will be maintained in the address field of an
instruction.
Here two memory reference is required to access the data.
Indexed addressing mode:
The operand’s offset is the sum of the content of an index register SI or DI and
an 8 bit or 16 bit displacement.
Example: MOV AX, [SI +05]

Based Indexed Addressing:


The operand’s offset is sum of the content of a base register BX or BP and an
index register SI or DI.
Example: ADD AX, [BX+SI]
Based on Transfer of control, addressing modes are:
PC relative addressing mode:
PC relative addressing mode is used to implement intra segment transfer of
control.
In this mode effective address is obtained by adding displacement to PC.
EA= PC + Address field value PC= PC + Relative value.
Base register addressing mode:
Base register addressing mode is used to implement inter segment transfer of
control.
In this mode effective address is obtained by adding base register value to
address field value.
EA= Base register + Address field value.
PC= Base register + Relative value.
Note:
• PC relative and based register both addressing modes are suitable for program
relocation at runtime.
• Based register addressing mode is best suitable to write position independent codes.

Advantages of Addressing Modes

• To give programmers to facilities such as Pointers, counters for loop controls, indexing of
data and program relocation.
• To reduce the number bits in the addressing field of the Instruction.
Basic Input/Output Operations
• Input/Output operations which transfer data from the processor or
memory to and from the real world are essential.
• In general, the rate of transfer from any input device to the processor,
or from the processor to any output device is likely to the slower than
the speed of a processor.
• The difference in speed makes it necessary to create mechanisms to synchronize the
data transfer between them.
• Let us consider a simple task of reading a character from a keyboard and
displaying that character on a display screen.
• A simple way of performing the task is called program-controlled I/O.
• There are two separate blocks of instructions in the I/O program that perform this
task:
• One block of instructions transfers the character into the processor.
• Another block of instructions causes the character to be displayed.
Bus

Processor
D T AIN D A TA OUT

SIN SOUT

Ke yboard Display

Input:
•When a key is struck on the keyboard, an 8-bit character code is stored in the buffer register DATAIN.
•A status control flag SIN is set to 1 to indicate that a valid character is in DATAIN.
•A program monitors SIN, and when SIN is set to 1, it reads the contents of DATAIN.
•When the character is transferred to the processor, SIN is automatically cleared.
•Initial state of SIN is 0.
• Buffer registers DATAIN and DATAOUT, and status flags SIN and SOUT are part of a
circuitry known as device interface.
• To perform I/O transfers, we need machine instructions to:
• Monitor the status of the status registers (SIN and SOUT).
• Transfer data among the I/O devices and the processor.
• Instructions have similar format to the instructions used for moving data between the
processor and the memory.
Processor Memory

Bus

I/O de vice 1 I/O de vice n

•Multiple I/O devices may be connected to the processor and the memory via a bus.
•Bus consists of three sets of lines to carry address, data and control signals.
•Each I/O device is assigned an unique address.
•To access an I/O device, the processor places the address on the address lines.
•The device recognizes the address, and responds to the control signals.
• I/O device is connected to the bus using an I/O interface circuit which
has: Address decoder, control circuit, and data and status registers.
• Address decoder decodes the address placed on the address lines thus
enabling the device to recognize its address (each device has a unique
address).
• Data register (DATAIN and DATAOUT) holds the data being
transferred to or from the processor.
• Status register (SIN and SOUT) holds information necessary for the
operation of the I/O device.
• Data and status registers are connected to the data lines.
• control circuit receive and transmit the control signals through the
control line.

You might also like