0% found this document useful (0 votes)
6 views40 pages

Unit Ii - Coa

The document outlines the basic structure and functional units of computers, including input, memory, arithmetic and logic, output, and control units. It explains operational concepts such as instruction sequencing, addressing modes, and the role of buses in connecting components. A case study of the 8086 microprocessor is also included, highlighting memory organization, instruction types, and execution processes.

Uploaded by

abrarshaik00977
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)
6 views40 pages

Unit Ii - Coa

The document outlines the basic structure and functional units of computers, including input, memory, arithmetic and logic, output, and control units. It explains operational concepts such as instruction sequencing, addressing modes, and the role of buses in connecting components. A case study of the 8086 microprocessor is also included, highlighting memory organization, instruction types, and execution processes.

Uploaded by

abrarshaik00977
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/ 40

Basic Structure of Computers

UNIT -II
UNIT II

Basic structure of computers: Functional Units of a


computer, Operational concepts, Bus structures, Memory
addresses and operations, assembly language ,
Instructions, Instruction sequencing, Addressing modes.
Case study: 8086.
Functional Units
 A computer consist of five parts namely: input, memory, arithmetic and
logic, output and control units.
 The input unit receives the coded information from the user, through
various electromechanical device such as keyboard etc.
 The information received is either stored in computer’s memory for later
use or it can be immediately utilized for operations.
 Finally the results are displayed to the user through the output unit.
 All these actions are coordinated by the control unit.
 The information handled by the computer are categorized as either
instructions and data.
 Instructions or machine instructions, are explicit commands which,
 helps in the transfer of information within the computer as well as
between the computer and its I/O device.
 specify the arithmetic and logic operations to be performed.
 The list of instructions that performs the task is called a program and it is
stored in the memory.
Input Unit:
 Computer accepts the information through input unit. The most commonly
used input device is 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 memory or
processor.
 Many other kind of input devices such as joysticks, trackballs, mouse and
microphone.
Memory Unit:
 The function of memory unit is to store program and data. The memory unit is
divided into two types: primary and secondary.
 Primary memory: it is called as the computer memory that can be directly
accessed by the CPU. It holds the data and instructions that the processor is
currently working on.
 Secondary memory/Storage: The contents of the secondary memory first
get transferred to the primary memory and then are accessed by the
processor, this is because the processor does not directly interact with the
secondary memory.
Primary Secondary
Primary memory is temporary. Secondary memory is
permanent.
Primary memory is directly Secondary memory is not
accessible by Processor/CPU. directly accessible by the CPU.
Nature of Parts of Primary It’s always Non-volatile in
memory varies, RAM- volatile in nature.
nature. ROM- Non-volatile.
The memory devices used for The secondary memory devices
primary memory are are magnetic and optical
Primary Secondary
Primary memory is also known Secondary memory is also
as Main memory or Internal known as External memory or
memory. Auxiliary memory.
Examples: RAM, ROM, Cache Examples: Hard Disk, Floppy
memory, Disk, Magnetic Tapes

Arithmetic and Logic Unit:


 Computer operations are carried out by Arithmetic and Logic Unit (ALU) of
the processor.
 Example: suppose two numbers located in the memory are to be added, first
the numbers should be brought into the processor and then the addition is
carried out by the ALU. The results can be stored in the memory or retained in
the processor.
 When the operands are brought into the processor, they are stored in a high-
speed storage element called Registers.
Output Unit: its function is to send the processed results to the outside world.
Control Unit:
 The memory, arithmetic and logic and input and output units store and process
information and perform input and output operations. These operations must be
coordinated in some way, which is done by the control unit.
 The control unit sends control signals to other units and sense their states.
These control signals are called timing signals. The timing signals helps to
determine when a given action can take place.
Basic Operational Concept
 To perform a given task an appropriate program consisting of a list of
instructions is stored in the memory.
 Individual instructions are brought from the memory into the processor, which
executes the specified operations.
 Examples: - Add LOCA, R0
 This instruction adds the operand at memory location LOCA, to operand in
register R0 & places the sum into register. This instruction requires the
performance of several steps:
 First the instruction is fetched from the memory into the processor.
 The operand at LOCA is fetched and added to the contents of R0.
 Finally the resulting sum is stored in the register R0
 In some other type of computers, these two types of operations are performed
by separate instructions for performance reasons.
Load LOCA, R1
Add R1, R0
 The fig shows how memory & the processor can be connected. In addition to
the ALU & the control circuitry, the processor contains a number of registers
used for several different purposes.
 The instruction register (IR):- Holds the instructions that is currently being
executed.
 The program counter PC:- This is another specialized register that keeps
track of execution of a program. It contains the information of the next
instruction to be fetched and executed.
 Besides IR and PC, there are n-general purpose registers R0 through Rn.The
other two registers which facilitate communication with memory are: -
 1. MAR – (Memory Address Register):- It holds the address of the location
to be accessed.
 2. MDR – (Memory Data Register):- It contains the data to be written into
or read out of the address location.
 Operating steps:
Example:
LOAD LOCA, R1
ADD R1, R0
1. Execution of the program starts when the PC is set to point to the first
instruction of a program.
2. The contents of the PC are transferred to the MAR and a Read control
signal is sent to the memory.
3. After some time, addressed word is read out of the memory and loaded into
the MDR.
4. Next the contents of the MDR are transferred to the IR. At this point, the
instructions is ready to be decoded and executed.
5. If the instruction involves an operation to be performed by ALU, then its
necessary to obtain the required operand.
6. If an operand resides in the memory (it could also be in the GPR), it has to be
fetched by setting its address to MAR and initiating Read signal.
7. When the operand has been read from the memory into the MDR, it is
transferred from the MDR to ALU. After one or more operands are fetched in this
way, the ALU can perform the desired operation.
8. If the result of this operation is to be stored in the memory, then the result is
sent to MDR and the address of the result is to be stored in MAR and a write
signal is initiated.
9. The contents of the PC are incremented so that PC points to the next instruction
to be executed.
BUS Structure
 A Bus is a collection of wires that connects several devices. Buses are used to
send control signals and data between the processor and other components.
 In computer system all the peripherals are connected to microprocessor through
Bus.
 Types of Bus structure:
 Address bus
 Data bus
 Control bus
 Address Bus:
 Address bus carry the memory address while reading from writing into
memory.
 Address bus carry I/O port address or device address from I/O port.
 Data bus:
 Data bus carry the data. It is bidirectional.
 Data bus fetch the instructions from memory.
 Data bus used to store the result of an instruction into memory. It carry
commands to an I/O device controller .
 Control Bus:
 Memory Read: This signal, is issued by the CPU when performing a read
operation with the memory.
 Memory Write: This signal is issued by the CPU when performing a write
operation with the memory.
 I/O Read: This signal is issued 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.
Memory Locations and Addresses
 Memory locations and addresses determine how the computer’s memory is
organized so that the user can efficiently store or retrieve information from the
computer.
 The computer’s memory is made of millions of storage cell, where each storage
cell is capable to store a bit of information which value is either 0 or 1.
 But the fact is, computer memory holds instructions and data. And a single bit is
very small to hold this information so bits are rarely used individually. As a
solution to this, the bits are grouped in fixed sizes of n bits.
 The group of n bit is termed as word where n is termed as the word length. he
word length of the computer has evolved from 8, 16, 24, 32 to 64 bits. General-
purpose computers nowadays have 32 to 64 bits. The group of 8 bit is called
a byte.
 Data are written into memory and readout of memory, based on their address.
Byte and Word Addressability

Byte Addressable Memory Word Addressable Memory


It is called byte addressable memory It is called word addressable memory
because it uses byte wise storage because it uses word wise storage
configuration. configuration.
Byte addressable memory is best Word addressable memory is suitable for
suited for the processes that need a processes that requires data comprising
single byte data at a time. single word at a time.
The byte addressable memory issues The word accessible memory issues the
a single address for accessing a address of word that contains required
single byte. byte.
Byte addressable memory chip Word addressable memory chip stores
stores data byte by byte. data word by word.
 Byte Addressability is of two types : Big Endian and Little Endian.
 The word endian is the order or sequence of bytes of a word of digital data
in computer memory. The bytes in the computer memory are read in a certain
order.
 Big Endian: is used when lower byte addresses are used for the most
significant byte (MSB).
 Little Endian: is used when the lower byte addresses are used for the least
significant byte (LSB).
Memory Operation
 Both program instructions and data operands are stored in the memory. To
execute an instruction, the processor control circuits cause the word (words)
containing the instruction to be transferred from the memory to the processor.
 The operands and results must also moved between the memory and the
processor.
 The basic two operations involved in the memory are:
 Load (Read or Fetch)
 Store (Write)
 The load operation transfers the copy of the contents from a specific memory
location to the processor. The memory contents remains unchanged.
 To start the load operation, the processor sends the address of desired location to
the memory and requests that its contents to be read. The memory read the data
stored at that address and sends them to the processor.
 The store operation transfers an information from the processor to a specific
memory location, destroying the former contents of that location.
 The processor sends the desired location to the memory along with the data to be
written.
 An information item of either one word or one byte can be transferred between
the processor and the memory in a single operation. The processor contains small
number of registers, each capable of holding a word. These registers are either
source or destination.
Instructions
 The instructions stored in the memory performs some operations. The four types of
operation performed by an instruction are:
 Data transfer between the memory and the processor registers
 Arithmetic and logical operations on data
 Program sequencing and control
 I/O transfers
 The operations and operands are represented by two types of notations:
 Register Transfer Notation (RTN)
 Assembly Language Notation (ALN)
 Register Transfer Notation (RTN):
 The information can be transferred from one location to another in the computer, the
possible location involved in this transfer may include memory locations, processor
registers or registers in I/O systems.
 In RTN, the memory will be represented in Capital letters. Example: LOCA, LOCB, A, B
etc.
 The processor registers are represented as R0,R1,R2…
 I/O operations can be represented as DATAIN, DATAOUT…
 The contents are represented using square brackets [].
 Example 1: C= A+B, to represent this in RTN
 The left hand side contains the destination
 The right hand side contains the source.

C [A]+[B]
 Example 2: move A to R0
R0[A]
 Example 3 move contents from R2 to A
A[R2]
Assembly Language Notation:
 Example 1: C=A+B
Move A, R1
Add B, R1
Move R1,C
Types of Instructions
Types:
1. Three address instruction
2. Two address instruction
3. One address instruction
4. Zero address instruction
1. Three Address Instruction:
Syntax: Operation Source 1, Source 2, Destination
Example C=A+B
Add A,B,C
Add R0,R1,C
2. Two Address Instruction:
Syntax: Operation Source, Source/Destination
Move A, R0
Add B, R0
Move R0, C
3. One Address Instruction:
Syntax: Operation, Source/Destination
C=A+B
Move A (stored in accumulator register)
Add B
Move C
4. Zero Address Instruction: These instructions do not specify any operands or
addresses. Instead the operands will be stored in stack.
Instruction Execution and Straight
Line Sequencing
 The program counter holds the instructions to be executed next. To begin the
execution, the address of the first instructions must be placed into the PC.
 Then the processor control circuits use the information in the PC to fetch and
execute the instruction one at a time in the order of increasing addresses. This is
called straight line sequencing.
 Executing an instruction is a two-phase procedure. The first phase is called
instruction fetch- instruction is fetched from the memory location using the
address in the PC.
 After fetching the instructions it is placed in the Instruction Register (IR).
 The second phase is called instruction execution. The instruction in the IR is
examined to determine which operation is to be performed. The specified operation
is then performed by the processor. This includes fetching operand from the
memory or processor registers, performing ALU operations and storing the result
in the destination.
Branching:
 Lets consider the task of adding a list of n numbers. The addresses of the memory
location containing the n numbers are represented as NUM1, NUM2,….NUMn and
a separate Add instruction is used to add each number to the contents of register
R0.
 Finally, after adding all the numbers, the result is placed in the memory location
SUM.
 Instead of adding long list of Add instructions, it is possible to place a single Add
instruction in a program loop. The loop is a straight line sequence of instructions
executed as many times as needed.
 It starts at the location LOOP and ends at the instruction Branch>0. During each
pass through the loop, address of the next list entry is determined and it is added to
R0.
Addressing Modes
 The different ways in which the location of an operand is specified in an
instruction are referred to as addressing modes.
 Different types of addressing modes:
 Register mode
 Absolute mode
 Immediate mode
 Indirect mode
 Index mode
 Relative mode
 Auto increment mode
 Auto decrement mode
 Register mode: the operand is the contents of a processor register, the name of
the register is given in the instruction.
Move R1,R2
 Absolute (direct) mode: the operand is in the memory location, the address of
this location is given explicitly in the instruction.
Move LOCA, R2
 Immediate mode: the operand is given explicitly in the instruction.
Example 1: Move #200, R0
Example 2: A=B+6
Move B,R1
Add #6, R1
Move R1, A
 Indirect Addressing mode: this type of addressing mode does not give the
operand or its address explicitly. Instead, it provides information from which the
memory address of the operand can be determined. It is called as the effective
address (EA) of the operand.
 Index Addressing mode: the effective address of the operand is generated by
adding a constant value to the contents of a register.
 The register used may be either a special register provided for this purpose or
more commonly it may be any one of a set of general- purpose registers in the
processor. In either case it is referred to as an index register.
 The index mode is symbolically indicated as
X(Ri)
 The effective address of the operand is given by
EA=X+[Ri]
 Variations in Index addressing modes:
 Base Index mode
 Base Index & offset
 Base Index mode:
 Effective Address (EA) = (Ri)+(Rj)
where, Ri is the general purpose register
Rj contains the contents of the X
 Base Index & offset:
 Effective Address (EA) = X+(Ri)+(Rj)
where, Ri, Rj- operands
X- constant (offset)
 Relative Addressing mode:
 Effective address is obtained by adding displacement (constant) to the PC.

X(PC)
 Autoincrement mode: The 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 item in a list.
(Ri)+
 Autodecrement mode: the contents of a register specified in the instruction are
first automatically decremented and are then used as the effective address of the
operand.
-(Ri)
 The reason for the address is decremented before it is used in the Autodecrement
mode and incremented after it is used in the Autoincrement mode.

 The
PUSHpush and pop operation can be implemented
POP as

Subtract #4, SP Move (SP),ITEM


Move NEWITEM, (SP) Add #4, SP
 If the processor has the Autoincrement and Autodecrement addressing modes,
then the push and pop operation can be performed by the single instruction.
Move NEWITEM, -(SP)
Move (SP)+, ITEM
Assembly Language
 Assembly Language is a low-level programming language. It helps in
understanding the programming language of machine code.
 It is a series of instructions that provide the necessary information to a user’s
CPU (Central Processing Unit) to carry out a particular task (add, subtract,
compare values, etc.).
 In computers, there is an assembler that helps in converting the assembly code
into machine code executable.
 Assembly language uses a series of mnemonic codes to represent machine
language instructions.
 The normal words such as move, add, increment, branch can be replaced by
acronyms called mnemonics, such MOVE, ADD, INC and BR. Similarly,
notation R3 is used to refer register 3 and LOC used to refer a memory location.
 The set of rules for using the mnemonics are called as the syntax of the language.
 The assembly language is translated into corresponding machine instructions
using assembler.
 The user program is usually entered into a computer through a keyboard and stored
either in the memory or on a magnetic disk.
 At this point, the user program is simply a set of lines of alphanumeric characters.
 The assembler then reads the user program, analyze it and then generated the machine
language program.
 The original user program in alphanumeric characters are called a source program
and the assembled machine language program is called as a object program.
 The assembly language for a given computer may or may not be case sensitive.
 Example: MOVE R0,SUM
 The mnemonics MOVE followed by one blank space character, then the information
that specifies the operand is given.
 The source operand is register R0 followed by destination operands. Both the source
and destination separated by comma with no intervening blanks.
 Since there are several possible addressing modes for specifying operand locations,
the assembly language mush indicate which mode is being used.
MOVE R0,SUM
ADD #5,R3
ADDI 5,R3
MOVE #5,(R2)
 Assembler directives (commands): the assembly language allows the
programmer to specify other information needed to translate the program into
the object program.
SUM EQU 200

You might also like