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

Kalinga University Department of Computer Science

This document provides an overview of the key functional units of a computer system. It discusses the central processing unit (CPU) which controls the operation of the computer and includes the control unit, arithmetic logic unit (ALU), and registers. The document also describes the main memory which stores data, input/output (I/O) units which move data between the computer and external devices, and the system interconnection which allows communication between the CPU, memory, and I/O units. Additional functional units include the arithmetic logic unit for performing data processing and the control unit for managing computer resources and coordinating other units.

Uploaded by

vivekkumars
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
91 views

Kalinga University Department of Computer Science

This document provides an overview of the key functional units of a computer system. It discusses the central processing unit (CPU) which controls the operation of the computer and includes the control unit, arithmetic logic unit (ALU), and registers. The document also describes the main memory which stores data, input/output (I/O) units which move data between the computer and external devices, and the system interconnection which allows communication between the CPU, memory, and I/O units. Additional functional units include the arithmetic logic unit for performing data processing and the control unit for managing computer resources and coordinating other units.

Uploaded by

vivekkumars
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 29

Kalinga University

Department of Computer Science

Course- DICS Sem-IV


Subject- Computer Organization
Subject Code: DICS405

UNIT-I

Computer organization refers to the operational units and their interconnections that realize
the architectural specifications. Examples of architectural attributes include the instruction
set, the number of bits used to represent various data types (e.g., numbers, characters), I/O
mechanisms, and techniques for addressing memory. Organizational attributes include those
hardware details transparent to the programmer, such as control signals; interfaces between
the computer and peripherals; and the memory technology used.

It is an organizational issue whether that instruction will be implemented by a special


multiply unit or by a mechanism that makes repeated use of the add unit of the system. The
organizational decision may be based on the anticipated frequency of use of the multiply
instruction, the relative speed of the two approaches, and the cost and physical size of a
special multiply unit

Structure and Function


A computer is a complex system; contemporary computers contain millions of elementary
electronic components. How, then, can one clearly describe them? The key is to recognize the
hierarchical nature of most complex systems, including the computer A hierarchical system is
a set of interrelated subsystems, each of the latter, in turn, hierarchical in structure until we
reach some lowest level of elementary subsystem. The hierarchical nature of complex
systems is essential to both their design and their description. The designer need only deal
with a particular level of the system at a time. At each level, the system consists of a set of
components and their interrelationships. The behaviour at each level depends only on a
simplified, abstracted characterization of the system at the next lower level. At each level, the
designer is concerned with structure and function:

• Structure: The way in which the components are interrelated

1
• Function: The operation of each individual component as part of the structure

Function

Both the structure and functioning of a computer are, in essence, simple. Figure 1.1 depicts
the basic functions that a computer can perform. In general terms, there are only four:
• Data processing
• Data storage
• Data movement
• Control

2
The computer, of course, must be able to process data. The data may take a wide variety of
forms, and the range of processing requirements is broad. However, we shall see that there
are only a few fundamental methods or types of data processing. It is also essential that a
computer store data. Even if the computer is processing data on the fly (i.e., data come in
and get processed, and the results go out immediately), the computer must temporarily store
at least those pieces of data that are being worked on at any given moment. Thus, there is at
least a short-term data storage function. Equally important, the computer performs a long-
term data storage function. Files of data are stored on the computer for subsequent retrieval
and update. The computer must be able to move data between itself and the outside world.
The computer’s operating environment consists of devices that serve as either sources or

3
destinations of data. When data are received from or delivered to a device that is directly
connected to the computer, the process is known as input–output (I/O), and the device is
referred to as a peripheral. When data are moved over longer distances, to or from a remote
device, the process is known as data communications. Finally, there must be control of these
three functions. Ultimately, this control is exercised by the individual(s) who provides the
computer with instructions. Within the computer, a control unit manages the computer’s
resources and orchestrates the performance of its functional parts in response to those
instructions. At this general level of discussion, the number of possible operations that can be
performed is few. Figure 1.2 depicts the four possible types of operations. The computer can
function as a data movement device (Figure 1.2a), simply transferring data from one
peripheral or communications line to another. It can also function as a data storage device
(Figure 1.2b), with data transferred from the external environment to computer storage (read)
and vice versa (write). The final two diagrams show operations involving data processing, on
data either in storage (Figure 1.2c) or route between storage and the external environment
(Figure 1.2d).

Structure

Figure 1.3 is the simplest possible depiction of a computer. The computer interacts in some
fashion with its external environment. In general, all of its linkages to the external
environment can be classified as peripheral devices or communication lines. We will have
something to say about both types of linkages.

4
But of greater concern in this book is the internal structure of the computer itself, which is
shown in Figure 1.4. There are four main structural components:

• Central processing unit (CPU): Controls the operation of the computer and performs its
data processing functions; often simply referred to as processor.
• Main memory: Stores data.
• I/O: Moves data between the computer and its external environment.

5
• System interconnection: Some mechanism that provides for communication among CPU,
main memory, and I/O. A common example of system interconnection is by means of a
system bus, consisting of a number of conducting wires to which all the other components
attach.
There may be one or more of each of the aforementioned components. Traditionally, there
has been just a single processor. In recent years, there has been increasing use of multiple
processors in a single computer. Some design issues relating to multiple processors crop up
and are discussed as the text proceeds; Part Five focuses on such computers. Each of these
components will be examined in some detail in Part Two. However, for our purposes, the
most interesting and in some ways the most complex component is the CPU. Its major
structural components are as follows:

• Control unit: Controls the operation of the CPU and hence the computer
• Arithmetic and logic unit (ALU): Performs the computer’s data processing functions
• Registers: Provides storage internal to the CPU
• CPU interconnection: Some mechanism that provides for communication among the
control unit, ALU, and registers

Each of these components will be examined in some detail in Part Three, where we will see
that complexity is added by the use of parallel and pipelined organizational techniques.
Finally, there are several approaches to the implementation of the control unit; one common
approach is a microprogrammed implementation. In essence, a microprogrammed control
unit operates by executing microinstructions that define the functionality of the control unit.

Functional units of a computer

Computer: A computer is a combination of hardware and software resources which


integrate together and provides various functionalities to the user. Hardware are the physical
components of a computer like the processor, memory devices, monitor, keyboard etc. while
software is the set of programs or instructions that are required by the hardware resources to
function properly.

 A computer organization describes the functions and design of the various units of a
digital system.

6
 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

o Input units are used by the computer to read the data. The most commonly used input
devices are keyboards, mouse, joysticks, trackballs, microphones, etc.

o 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

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

7
Memory unit

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

o The Memory unit can be categorized in two ways namely, primary memory and
secondary memory.

o It enables a processor to access running execution applications and services that are
temporarily stored in a specific memory location.

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

o It is also known as the volatile form of memory, means when the computer is shut
down, anything contained in RAM is lost.

o Cache memory is also a kind of memory which is used to fetch the data very soon.
They are highly coupled with the processor.

o The most common examples of primary memory are RAM and ROM.

o Secondary memory is used when a large amount of data and programs have to be
stored for a long-term basis.

o It is also known as the Non-volatile memory form of memory, means the data is
stored permanently irrespective of shut down.

o The most common examples of secondary memory are magnetic disks, magnetic
tapes, and optical disks.

8
Arithmetic & logical unit

o 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

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

o The control unit is also known as the nerve center of a computer system.

o 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

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

o 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 Computer Instruction

The basic computer has 16-bit instruction register (IR) which can denote either memory
reference or register reference or input-output instruction.

9
1. Memory Reference – These instructions refer to memory address as an operand. The
other operand is always accumulator. Specifies 12-bit address, 3-bit opcode (other
than 111) and 1-bit addressing mode for direct and indirect addressing.

Example –
IR register contains = 0001XXXXXXXXXXXX, i.e. ADD after fetching and
decoding of instruction we find out that it is a memory reference instruction for ADD
operation.

Hence, DR ← M[AR]

AC ← AC + DR, SC ← 0

2. Register Reference – These instructions perform operations on registers rather than


memory addresses. The IR(14 – 12) is 111 (differentiates it from memory reference)
and IR(15) is 0 (differentiates it from input/output instructions). The rest 12 bits
specify register operation.

Example –
IR register contains = 0111001000000000, i.e. CMA after fetch and decode cycle we
find out that it is a register reference instruction for complement accumulator.

Hence, AC ← ~AC

3. Input/Output – These instructions are for communication between computer and


outside environment. The IR(14 – 12) is 111 (differentiates it from memory reference)
and IR(15) is 1 (differentiates it from register reference instructions). The rest 12 bits
specify I/O operation.

10
Example –
IR register contains = 1111100000000000, i.e. INP after fetch and decode cycle we
find out that it is an input/output instruction for inputing character. Hence, INPUT
character from peripheral device.
/li>
The set of instructions incorporated in16 bit IR register are:

1. Arithmetic, logical and shift instructions (and, add, complement, circulate left, right,
etc)
2. To move information to and from memory (store the accumulator, load the
accumulator)
3. Program control instructions with status conditions (branch, skip)
4. Input output instructions (input character, output character)

Symbol Hexadecimal Code Description


AND 0xxx 8xxx And memory word to AC
ADD 1xxx 9xxx Add memory word to AC
LDA 2xxx Axxx Load memory word to AC
STA 3xxx Bxxx Store AC content in memory
BUN 4xxx Cxxx Branch Unconditionally
BSA 5xxx Dxxx Add memory word to AC
ISZ 6xxx Exxx Increment and skip if 0
CLA 7800 Clear AC
CLE 7400 Clear E(overflow bit)
CMA 7200 Complement AC
CME 7100 Complement E
CIR 7080 Circulate right AC and E
CIL 7040 Circulate left AC and E
INC 7020 Increment AC
SPA 7010 Skip next instruction if AC > 0
SNA 7008 Skip next instruction if AC < 0
SZA 7004 Skip next instruction if AC = 0
SE 7002 Skip next instruction if E = 0
HLT 7001 Halt computer
INP F800 Input character to AC
OUT F400 Output character from AC
SKI F200 Skip on input flag
SKO F100 Skip on output flag
IEN F080 Interrupt On

Historically there have been 2 types of Computers:

11
1. Fixed Program Computers – Their function is very specific and they couldn’t be
programmed, e.g. Calculators.
2. Stored Program Computers – These can be programmed to carry out many different
tasks, applications are stored on them, hence the name.

The modern computers are based on a stored-program concept introduced by John Von
Neumann. In this stored-program concept, programs and data are stored in a separate storage
unit called memories and are treated the same. This novel idea meant that a computer built
with this architecture would be much easier to reprogram.

The basic structure is like,

It is also known as IAS computer and is having three basic units:

1. The Central Processing Unit (CPU)


2. The Main Memory Unit
3. The Input/Output Device
Let’s consider them in details.
 Control Unit –

12
A control unit (CU) handles all processor control signals. It directs all input and
output flow, fetches code for instructions and controlling how data moves around the
system.
 Arithmetic and Logic Unit (ALU) –
The arithmetic logic unit is that part of the CPU that handles all the calculations the
CPU may need, e.g. Addition, Subtraction, Comparisons. It performs Logical
Operations, Bit Shifting Operations, and Arithmetic Operation.

Figure – Basic CPU structure, illustrating ALU

 Main Memory Unit (Registers) –


1. Accumulator: Stores the results of calculations made by ALU.
2. Program Counter (PC): Keeps track of the memory location of the next
instructions to be dealt with. The PC then passes this next address to Memory
Address Register (MAR).
3. Memory Address Register (MAR): It stores the memory locations of
instructions that need to be fetched from memory or stored into memory.
4. Memory Data Register (MDR): It stores instructions fetched from memory
or any data that is to be transferred to, and stored in, memory.
5. Current Instruction Register (CIR): It stores the most recently fetched
instructions while it is waiting to be coded and executed.
6. Instruction Buffer Register (IBR): The instruction that is not to be executed
immediately is placed in the instruction buffer register IBR.
7.

13
 Input/Output Devices – Program or data is read into main memory from the input
device or secondary storage under the control of CPU input instruction. Output
devices are used to output the information from a computer. If some results are
evaluated by computer and it is stored in the computer, then with the help of output
devices, we can present it to the user.

 Buses – Data is transmitted from one part of a computer to another, connecting all
major internal components to the CPU and memory, by the means of Buses. Types:
1. Data Bus: It carries data among the memory unit, the I/O devices, and the
processor.
2. Address Bus: It carries the address of data (not the actual data) between
memory and processor.

3. Control Bus: It carries control commands from the CPU (and status signals
from other devices) in order to control and coordinate all the activities within
the computer.

Bus structures

A bus is a connection between components or devices connected to a computer. For example,


a bus carries data between a CPU and the system memory via the motherboard. The bus
contains multiple wires (signal lines) with addressing information describing
the memory location of where the data is being sent or retrieved. Each wire in the bus carries
a bit(s) of information, which means the more wires a bus has, the more information it can
address. For example, a computer with a 32-bit address bus can address 4 GB of memory,
and a computer with a 36-bit bus can address 64 GB of memory.

A bus transfers electrical signals from one place to another. An actual bus appears as an
endless amount of etched copper circuits on the motherboard's surface. The bus is connected
to the CPU through the Bus Interface Unit.
Data travels between the CPU and memory along the data bus. The location (address) of that
data is carried along the address bus. A clock signal which keeps everything in synch travels
along the control bus.

14
The clock acts like a traffic light for all the PC's components; the "green light" goes on with
each clock tick. A PC's clock can "tick" anywhere from 20 to 65 million times per second,
which makes it seem like a computer is really fast. But since each task (such as saving a file)
is made up of several programmed instructions, and each of those instructions takes several
clock cycles to carry out, a person sometimes has to sit and wait for the computer to catch up.

Addressing Modes

Addressing Modes– The term addressing modes refers to the way in which the operand of an
instruction is specified. The addressing mode specifies a rule for interpreting or modifying
the address field of the instruction before the operand is actually executed.
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: 

 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.
o Displacement: It is an 8 bit or 16 bit immediate value given in the instruction.
o Base: Contents of base register, BX or BP.
o 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)

15
 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: In 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.

The 8086 CPUs let you access memory indirectly through a register using the register
indirect addressing modes.
 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.
Example:

16
Add R1, (R2)+  // OR
R1 = R1 +M[R2]
R2 = R2 + d
Useful for stepping through arrays in a loop. R2 – start of array d – size of an
element
 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.
Example:
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:
1. 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.
2. Memory Indirect:In this mode effective address is in the memory, and
corresponding memory address will be maintained in the address field of an

17
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:
1. 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.
2. EA= PC + Address field value
PC= PC + Relative value.
3. 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.
4. EA= Base register + Address field value.
5. PC= Base register + Relative value.
Note:
1. PC relative nad based register both addressing modes are suitable for
program relocation at runtime.
2. Based register addressing mode is best suitable to write position
independent codes.

Stack based CPU Organization

The computers which use Stack-based CPU Organization are based on a data structure
called stack. The stack is a list of data words. It uses Last In First Out (LIFO) access
method which is the most popular access method in most of the CPU. A register is used to
store the address of the topmost element of the stack which is known as Stack pointer (SP).
In this organisation, ALU operations are performed on stack data. It means both the operands
are always required on the stack. After manipulation, the result is placed in the stack.
The main two operations that are performed on the operators of the stack are Push and Pop.
These two operations are performed from one end only.

1. Push –
This operation results in inserting one operand at the top of the stack and it decrease
the stack pointer register. The format of the PUSH instruction is:

PUSH

18
It inserts the data word at specified address to the top of the stack. It can be
implemented as:
//decrement SP by 1
SP <-- SP - 1

//store the content of specified memory address


//into SP; i.e, at top of stack
SP <-- (memory address)
2. Pop –
This operation results in deleting one operand from the top of the stack and it increase
the stack pointer register. The format of the POP instruction is:
POP
It deletes the data word at the top of the stack to the specified address. It can be
implemented as:
//transfer the content of SP (i.e, at top most data)
//into specified memory location
(memory address) <-- SP

//increment SP by 1
SP <-- SP + 1
Operation type instruction does not need the address field in this CPU organization.
This is because the operation is performed on the two operands that are on the top of
the stack. For example:
br>

SUB
This instruction contains the opcode only with no address field. It pops the two top
data from the stack, subtracting the data, and pushing the result into the stack at the
top.
PDP-11, Intel’s 8085 and HP 3000 are some of the examples of the stack organized
computers.
The advantages of Stack based CPU organization –
o Efficient computation of complex arithmetic expressions.
o Execution of instructions is fast because operand data are stored in
consecutive memory locations.
o Length of instruction is short as they do not have address field.
The disadvantages of Stack based CPU organization –
o The size of the program increases.
Note:Stack based CPU organisation uses zero address instruction.

19
Memory location and addresses

Memories are made up of registers. Each register in the memory is one storage location.
Storage location is also called as memory location. Memory locations are identified
using Address. The total number of bit a memory can store is its capacity.
A storage element is called a Cell. Each register is made up of storage element in which one
bit of data is stored. The data in a memory are stored and retrieved by the process
called writing and reading respectively

A word is a group of bits where a memory unit stores binary information. A word with group
of 8 bits is called a byte. A memory unit consists of data lines, address selection lines, and
control lines that specify the direction of transfer. Data lines provide the information to be
stored in memory. The control inputs specify the direction transfer. The k-address lines
specify the word chosen.

When there are k address lines, 2k memory word can be accessed.

Instructions and instruction sequencing

Computer perform task on the basis of instruction provided. An instruction in computer


comprises of groups called fields. These field contains different information as for computers
everything is in 0 and 1 so each field has different significance on the basis of which a CPU
decide what to perform. The most common fields are:

 Operation field which specifies the operation to be performed like addition.

 Address field which contain the location of operand, i.e., register or memory location.

 Mode field which specifies how operand is to be founded.


20
Each phase of Instruction Cycle can be decomposed into a sequence of elementary micro-
operations. In the above examples, there is one sequence each for the Fetch, Indirect, Execute
and Interrupt Cycles.

The Indirect Cycle is always followed by the Execute Cycle. The Interrupt Cycle is always


followed by the Fetch Cycle. For both fetch and execute cycles, the next cycle depends on the
state of the system.
The time period during which one instruction is fetched from memory and executed when a
computer is given an instruction in machine language. There are typically four stages of an
instruction cycle that the CPU carries out:
1. Fetch the instruction from memory. This step brings the instruction into
the instruction register, a circuit that holds the instruction so that it can be decoded and
executed.
2. Decode the instruction.
3. Read the effective address from memory if the instruction has an indirect address.
4. Execute the instruction.
Steps 1 and 2 are called the fetch cycle and are the same for each instruction. Steps 3 and 4
are called the execute cycle and will change with each instruction.
The term refers to both the series of four steps and also the amount of time that it takes to
carry out the four steps.

Instruction Execution

It contains a special register — the instruction register — whose bit pattern determines what
the central processor unit can do. Once that action has been completed, the bit pattern within
the instruction register may be modified, and also the central processor unit can perform the
operation nominative by this next bit pattern.

21
Since directions are simply bit patterns, they will be kept in memory. The instruction pointer
register continuously has the memory address of (points to) the next instruction to be
executed. So as for the management unit to execute this instruction, it’s derived into the
instruction register. The case is as follows:

1. A sequence of instructions is stored in memory.

2. The memory address wherever the first instruction is found is copied to the instruction
pointer.

3. The CPU sends the address within the instruction pointer to memory on the address
bus.

4. The CPU sends a “read” signal to the control bus.

5. Memory responds by sending a copy of the state of the bits at that memory location
on the data bus that the CPU then copies into its instruction register.

6. The instruction pointer is automatically incremented to contain the address of the next
instruction in memory.

7. The CPU executes the instruction within the instruction register.

8. Go to step 3

9. Steps 3, 4, and 5 are called an instruction fetch. Notice that steps 3 – 8 constitute a
cycle, the instruction execution cycle.

Machine language is the low level programming language. Machine language can only be
represented by 0s and 1s. In earlier when we have to create a picture or show data on the
screen of the computer then it is very difficult to draw using only binary digits(0s and 1s).
For example: To write 120 in the computer system its representation is 1111000. So it is
very difficult to learn. To overcome this problem the assembly language is invented.

Assembly language is the more than low level and less than high-level language so it is
intermediary language. Assembly languages use numbers, symbols, and abbreviations
instead of 0s and 1s.For example: For addition, subtraction and multiplications it uses
symbols likes Add, sub and Mul, etc.

22
Machine Language Assembly Language

Machine language is only understand by the Assembly language is only understand by human
computers. beings not by the computers.

In machine language data only represented with the In assembly language data can be represented with
help of binary format(0s and 1s), hexadecimal and the help of mnemonics such as Mov, Add, Sub,
octadecimal. End etc.

Machine language is very difficult to understand by Assembly language is easy to understand by the
the human beings. human being as compare to machine language.

Modifications and error fixing cannot be done in Modifications and error fixing can be done in
machine language. assembly language.

Machine language is very difficult to memorize so it Easy to memorize the assembly language because
is not possible to learn the machine language. some alphabets and mnemonics are used.

Execution is fast in machine language because all Execution is slow as compared to machine
data is already present in binary format. language.

There is no need of translator.The machine Assembler is used as translator to convert


understandable form is the machine language. mnemonics into machine understandable form.

Assembly language is the machine dependent and


Machine language is hardware dependent. it is not portable.

Language Processors –  
Compilers, interpreters, translate programs written in high-level languages into machine
code that a computer understands. And assemblers translate programs written in low-level
or assembly language into machine code. In the compilation process, there are several
stages. To help programmers write error-free code, tools are available.

Assembly language is machine-dependent, yet mnemonics used to represent instructions in


it are not directly understandable by machine and high-Level language is machine-
independent. A computer understands instructions in machine code, i.e. in the form of 0s
and 1s. It is a tedious task to write a computer program directly in machine code. The
programs are written mostly in high-level languages like Java, C++, Python etc. and are

23
called source code. These source code cannot be executed directly by the computer and
must be converted into machine language to be executed. Hence, a special translator system
software is used to translate the program written in a high-level language into machine code
is called Language Processor and the program after translated into machine code (object
program/object code).  

The language processors can be any of the following three types:  


1. Compiler : 

The language processor that reads the complete source program written in high-level
language as a whole in one go and translates it into an equivalent program in machine
language is called a Compiler.  Example: C, C++, C#, Java.   

In a compiler, the source code is translated to object code successfully if it is free of errors.
The compiler specifies the errors at the end of the compilation with line numbers when
there are any errors in the source code. The errors must be removed before the compiler can
successfully recompile the source code again
 

2. Assembler :

The Assembler is used to translate the program written in Assembly language into machine
code. The source program is an input of an assembler that contains assembly language
instructions. The output generated by the assembler is the object code or machine code
understandable by the computer. Assembler is basically the 1st interface that is able to
communicate humans with the machine. We need an Assembler to fill the gap between
human and machine so that they can communicate with each other. code written in
assembly language is some sort of mnemonics(instructions) like ADD, MUL, MUX, SUB,
DIV, MOV and so on. and the assembler is basically able to convert these mnemonics in
Binary code. Here, these mnemonics also depend upon the architecture of the machine.  

24
For example, the architecture of intel 8085 and intel 8086 are different.
 

3. Interpreter : 

The translation of a single statement of the source program into machine code is done by a
language processor and executes immediately before moving on to the next line is called an
interpreter. If there is an error in the statement, the interpreter terminates its translating
process at that statement and displays an error message. The interpreter moves on to the
next line for execution only after the removal of the error. An Interpreter directly executes
instructions written in a programming or scripting language without previously converting
them to an object code or machine code.       Example: Perl, Python and Matlab.
 

Difference between Compiler and Interpreter – 


 
Compiler Interpreter

A compiler is a program that converts the entire


source code of a programming language into An interpreter takes a source program
executable machine code for a CPU.   and runs it line by line, translating
  each line as it comes to it

The compiler takes a large amount of time to An interpreter takes less amount of
analyze the entire source code but the overall time to analyze the source code but

25
Compiler Interpreter

execution time of the program is comparatively


faster.  the overall execution time of the
  program is slower.

The compiler generates the error message only


after scanning the whole program, so debugging is Its Debugging is easier as it continues
comparatively hard as the error can be present translating the program until the error
anywhere in the program.   is met.

It requires less memory than a


The compiler requires a lot of memory for compiler because no object code is
generating object codes. generated.

No intermediate object code is


Generates intermediate object code.  generated.

The interpreter is a little vulnerable in


For Security purpose compiler is more useful. case of security.

Examples: Python, Perl, JavaScript,


Examples: C, C++, Java   Ruby

BIOS

BIOS stands for Basic Input/Output System. BIOS is the first program to run when the
computer starts. It is a ROM chip (EEPROM chip) found on motherboards and is used for
hardware initialization during the booting process. It is pre-installed in the computer
system. When BIOS boots up the computer system, it checks if all of the components are in
place and working and then it loads the operating system into the computer’s RAM from
the hard disk of the system.
Nowadays BIOS is written on flash memory, to ease the process of rewriting the BIOS
chip, whenever needed.

26
 
History of BIOS

BIOS was first introduced in 1975, in CP/M Operating System. Control Program for
Microcomputers, was developed for Intel 8080/85-based microcomputers by Gary Kildall
of Digital Research, Inc. The system had a simple boot loader in its ROM.
IBM classified the system-bios in two categories when PS/2 machines were introduced:
 CBIOS: CBIOS stands for Compatibility BIOS. The real-mode portion
provided backward compatibility with current operating systems, thus was
named CBIOS.
 ABIOS: The ABIOS stands for Advanced BIOS. It provided new interfaces
specically the one suited for multitasking OS.

Functions of BIOS
 POST: Power on Self Test is the process performed by BIOS immediately after
the computer system starts to check any hardware related issues. if any error is
found in this process, the system alerts through flashing LEDs, audible beeps, or
error messages on the monitor, all of which are technically referred to as POST
codes, beep codes, and on-screen POST error messages, respectively.

 Bootstrap Loader: The bootstrap program stored in ROM is loaded in hard


drive, as soon as the computer starts. The bootstrap loader locates the operating
system and passes the control to it.

 Next, Bootstrap Driver configures basic hardware so that system can run. They


are low-level drivers and gives basic information about computer hardware.
 CMOS Setup: Complementary Metal-Oxide Semiconductor(CMOS) chip, saves
some system’s information, such as the time, date, and other essential system
settings. CMOS chip is powered by the battery located in the motherboard. It
also stores some information about hardware. The chip’s content is copied to
RAM(main memory) of the system to increase the speed, since CMOS chip is
quite slow.

27
It is because the BIOS and CMOS, setup configure the system’s crucial
information like the password, date, and time.

 Bootdevice selection: One of the CMOS’s most important role is, it can alter the
device boot process. This is important for system restoration because the CMOS
may need to change boot priority from the hard drive to the optical drive or flash
drive to launch the operating system installer or adjust which hard drive to load
the operating system from.

Flowchart of BIOS

Features of BIOS
 Every BIOS implementation is specifically designed for a particular type of
motherboard model or particular computer.
 Originally, BIOS firmware was stored in the ROM memory but nowadays it is
stored in Flash memory so that it can be rewritten without removing the chip
from the motherboard.
 The other reason for doing this is that it allows easy updates of BIOS firmware,
so new features can be added and bugs can be fixed.
 The latest advancement of BIOS is UEFI(Unified Extensible Firmware
Interface).
Advantages
 The computer system will gain better compatibility.
 The booting time of system decreases.
 The overall performance of system improves
Disadvantage
 The disadvantag is that it is a time consuming process. BIOS often boots in 16-
bit real mode (not 32-bit nor 64-bit protected mode), and because of the type of
chip used, it is not always the fastest.

28
 If something goes wrong during the process, the motherboard might get affected.
Solving this will not be an easy process.

29

You might also like