Report On Cpu
Report On Cpu
Report On Cpu
: Prepared by :
DEPARTMENT OF HUMANITIES
Letter of Transmittal
From
Students of S.E.-COMPTUTER (A),
PIIT, New Panvel -410206
To
Prof .Dr. (Mrs.) Malavika Sharma
PIIT, New Panvel -410206.
Dear Madam,
We have tried to meet your requests and hope that the report will be useful for your
reference.
Thank you
Yours faithfully,
Akhil Reghunathan
Nilesh P.Jamade
Manisha Arutla
Babu.C.Laxmanan
i
PREFACE
ACKNOWLEDGEMENT
Executive Summary
Table of Content
Letter of transmittal i
Preface ii
Acknowledgments iii
Executive Summary iv
Chapter I Introduction 1
Bibliography 21
Appendix 22
Glossary 26
Index 28
Chapter I
INTRODUCTION
In order to work, a computer needs some sort of "brain" or "calculator". At the
core of every computer is a device roughly the size of a large postage stamp.
This device is known as the central processing unit, or CPU for short. This is the
"brain" of the computer; it reads and executes program instructions, performs
calculations, and makes decisions. The CPU is reponsible for storing and
retrieving information on disks and other media. It also handles information on
from one part of the computer to another like a central switching station that
directs the flow of traffic throughout the computer system.
“The Heart of the computer” that takes care of all the computations and
processes.
Controls the operation of the computer and performs its data processing
functions; often simply referred to as processor
• I/O: Moves data between the computer and its external environment
Control Unit: Controls the operation of the CPU and hence the computer
Arithmetic & Logic Unit: Performs the computer’s data processing functions
• Internal CPU bus is needed to transfer data between the various registers
and the ALU.
Chapter II
CPU Architecture
2) Control unit
3) Memory Unit
After you enter data through the input device it is stored in the primary storage
unit. The actual processing of the data and instruction are performed by
Arithmetic Logical Unit. The major operations performed by the ALU are addition,
subtraction, multiplication, division, logic and comparison. Data is transferred to
ALU from storage unit when required. After processing the output is returned
back to storage unit for further processing or getting stored.
The next component of computer is the Control Unit, which acts like the
supervisor seeing that things are done in proper fashion. The control unit
determines the sequence in which computer programs and instructions are
executed. Things like processing of programs stored in the main memory,
interpretation of the instructions and issuing of signals for other units of the
computer to execute them. It also acts as a switch board operator when several
users access the computer simultaneously. Thereby it coordinates the activities
of computer’s peripheral equipment as they perform the input and output.
Therefore it is the manager of all operations mentioned in the previous section.
3. Memory Unit:
Main memory is needed in a computer to store in instructions and the data at the
3
time of program execution. It was pointed out by Von Neumann that the same
memory can be used for storing data and instruction. The memory unit stores all
information in a group of memory cells as binary digits. Each memory location
has unique address and can be addressed independently. The contents of
desired memory location are provided to the CPU by referring to the address of
memory location. The amount of information, which can be transferred between
CPU & memory, depends on the sizes of Bus connecting the two.
Address Registers:
Address registers store the addresses of specific memory locations. Often many
integer and logic operations can be performed on address registers directly (to
allow for computation of addresses).
Sometimes the contents of address register(s) are combined with other special
purpose registers to compute the actual physical address. This allows for the
hardware implementation of dynamic memory pages, virtual memory, and
protected memory.
• MIX: one jump registers; named J-register; two bytes and sign is always
positive
• Motorola 680x0, 68300: 8 long word (32 bit) address registers; named A0,
A1, A2, A3, A4, A5, A6, and A7 (also called the stack pointer)
Store addresses in
PC: Program Counter to hold address of next instruction to be fetched
4
Accumulator:
Accumulators are registers that can be used for arithmetic, logical, shift, rotate, or
other similar operations. The first computers typically only had one accumulator.
Many times there were related special purpose registers that contained the
source data for an accumulator. Accumulators were replaced with data registers
and general purpose registers. Accumulators reappeared in the first
microprocessors
Shifter:
Stores, carries and rotates results
Program Counter:
Almost every digital computer ever made uses a program counter. The program
counter points to the memory location that stores the next executable instruction.
Branching is implemented by making changes to the program counter. Some
processor designs allow software to directly change the program counter, but
usually software only indirectly changes the program counter (for example, a
JUMP instruction will insert the operand into the program counter). An assembler
has a location counter, which is an internal pointer to the address (first byte) of
the next location in storage (for instructions, data areas, constants, etc.) while the
source code is being converted into object code.
Register
Stack Pointer :
Register
Control Path:
STACK:
Register(s)
The Instruction Fetch Execute Cycle is one of the most important mental models of
computation as aptly put by Prof. Rockford Ross. This embodies the basic principle of
how all modern processors work. This functional model has remained more or less the
same over the decades no matter how and when the development of processors have
taken place ever since the days of Von Newmann architecture to today’s Super
computers. This document is to be read in conjunction with the tutorial presented on the
Instruction Fetch Execute Cycle of the Intel processor.
The principles are fairly simple and can be easily generalized to any processor or
Operating System. It further proceeds to explain what happens when a computer is first
switched on till the time it is ready to accept instructions from the user. It is very
important to appreciate the fact that an Operating System (OS) is just
like any other program albeit a little more complex as compared to user written
programs.
The OS provides the functionality to load and execute other programs and thus
possesses certain privileges which user programs do not possess. A user program can
and does request for OS intervention through a mechanism called system calls e.g.
trap, page fault etc.
INSTRUCTION CYCLE:
An instruction as the name instructs the computer what to do. In simple terms,
every line of a program that we as users write instructs the computer to perform a
series of operations. We may argue that our programs comprise of the
instructions belonging to one of those of the High Level Languages like C, C++,
and Java etc. A computer understand these high level instructions by converting
them into a machine
understandable form known as machine language comprising of 1’s and 0’s.
Thus the
following instruction in C
The processing required for a single operation is called an instruction cycle. The
entire process of fetching, decoding and executing an instruction constitutes the
CPU’s instruction cycle. It uses simplified two steps referred as fetch cycle and
execute cycle as shown in figure below. Program execution halts only if the
machine is turned OFF, some sort of unrecoverable error occurs or a program
instruction that halts the computer is encountered.
8
DATA FLOW:
• Fetch
— Meanwhile PC incremented by 1
The exact sequence of events during an instruction cycle depends on the design
of the processor. We can however, indicate in general terms what must happen.
Let us assume that a processor that employs a memory address register (MAR),
a memory buffer register (MBR), a program counter (PC), and an instruction
register (IR).
During fetch cycle, an instruction is read from memory. Figure shows the flow of
data during this cycle. The PC contains the address of the next instruction to be
fetched. This address is moved to MAR and placed on the address bus. The
control unit requests a memory read, and the result is placed on the data bus and
copied into the MBR and then moved to the IR. Meanwhile, the PC is
incremented by 1, preparatory for the next fetch.
Once the fetch cycle is over, the control unit examines the contents of the IR to
determine if it contains an operand specifier using indirect addressing. If so, an
indirect cycle is performed. As shown in figure, this is a simple cycle. The
rightmost N bits of MBR, which contains the address reference, are transferred to
the MAR. Then the control unit requests a memory read, to get the desired
address of the operand into the MBR.
9
Execution Cycle:
• Processor-memory
• Processor I/O
• Data processing
• Control
— e.g. jump
• Combination of above
The fetch and indirect cycles are simple and predictable. The execute cycle takes
many forms; the form depends on which of the various machine instruction is in
the IR. This cycle may involve transferring data among registers, read or write
from memory or I/O, and/or the invocation of the ALU.
10
INSTRUCTION CYCLE STATE DIAGRAM:
The execution cycle for a particular instruction may involve more thane one
reference to memory. For any given instruction cycle, some states may be null
and others may be visited more than once. In the figure shown below, on first line
three circles (operations) represent the CPU access to memory or I/O. And on
second line five circles (operations) represent the internal CPU operation. The
states can be described as:
• Instruction Fetch (if): Read instruction from its memory location into CPU.
• Operand Fetch (of): Fetch the operand from memory or read it in from I/O.
• Operand Store (os): Write the result into memory or out to I/O.
11
Chapter IV
INSTRUCTION FORMAT
Normally defines the location that contains the operand Instruction formats vary
between microprocessors and minicomputers and mainframe computers. As the
machine instructions are generally longer in larger computers with their larger
memory words, the instruction format or how the instruction is translated differs.
Each instruction is composed of fields. The lengths of instructions and the
lengths and positions of the fields differ depending on the instruction and the
computer. An operation (function) code is part of all instructions. How the
remainder of the instruction is translated and the names assigned to the parts
vary. Let’s take a look at two examples of computer instruction formats, one
for a microcomputer and one for a mainframe. We begin with the op (function)
code, which is common to both; only the length differs. A typical machine
instruction begins with the specification of an operation to be performed, the
operation (op) code. Refer back to figure 8-1. The op code tells the
computer/processor what basic operation to perform. The op code, a part of
every instruction, is usually located at the beginning of each instruction format.
Following the op code is information, if needed, to define the location of the
data or the operand on which the operation is to be performed. This location
in memory, called the operand address, at the start of the operation (the source),
or that will contain the modified operand upon completion of the operation (the
destination). The remainder of the instruction and how it is structured differs from
one computer or computer type to another. The designators in each field and the
positions of the fields within the instruction determine how the instruction will
affect the operand, registers, memory, and general flow of data in and out of the
computer.
12
computers with their larger memory words, the instruction format or how the
instruction is translated differs. Each instruction is composed of fields. The
lengths of instructions and the lengths and positions of the fields differ depending
on the instruction and the computer. An operation (function) code is part of all
instructions. How the remainder of the instruction is translated and the names
assigned to the parts vary. Let’s take a look at two examples of computer
An instruction format defines the layout of the bits of an instruction, in terms of its
constituents parts. An instruction format must include an opcode and, implicitly or
explicitly, zero or more operands. Each explit operand is referenced using one of
the addressing modes that are available for that machine. The format must,
implicitly or explicitly, indicate the addressing mode of each operand. For most
instruction sets, more than one instruction format is used. Four common
instruction formats are shown in the figure on the next slide .instruction formats,
one for a microcomputer and one for a mainframe. We begin with the
op(function) code, which is common to both; only the length differsThis section
discusses variable and fixed length instructions, RISC, and CISC. You should
emphasize the dependence of the instruction format on the coding method for
various operand types as described in Chapter 4. Also make it clear that the term
instruction format should be interpreted in the plural, not the singular. That is, a
CPU uses various formats representing various combinations of operands.
13
CISC architectures so they are not the differentiating characteristics they once
were. See the text web site for references that cover these topics. We discuss
the fields and the designators as we discuss the two instruction formats.
Microcomputer Instruction Formats A basic 16-bit microinstruction is divided into
a number of separate fields. Refer to figure 8-3 as a reference. You’ll notice the
lengths of the fields vary. The op code is located in the most significant bits (215
through 213). B (bit 212) tells the computer to use all 16 bits as a word or divide
the 16 bits into 8-bit bytes
• Includes opcode
Opcode
14
Operand
• The operand field is used to specify the add. of the operands in main
memory or in processor.
Registers
15
Basic Instruction Format
The processor can access operands in various ways. The addressing mode refer
to the effective address EA.(i.e. final address used to access a operand)
formation mechanisms. Addressing modes are either explicitly specified ir implied
bt the instruction. The different major addressing modes available are as follows:
1. Immediate Addressing
2. Register Addressing
3. Direct Addressing
6. Implicit Addressing
All the above listed modes are not provided on all processors. Different
processors may refer to an addressing mode using different names. Now we
consider each addressing mode separately.
The operand data is directly specified in the operand field. The instruction is a
multiword instruction, where the operand immediately follows the opcode. Both
the opcode & the operand are fetched from memory using program counter. The
instruction format of immediate addressing is as shown in fig.
The immediate addressing modes can be used for (1) Loading internal registers
with initial value, (2) Perform arithmetic or logical operation on immediate data.
In this addressing mode the instruction opcode specifies the CPU registers
16
where the operand is stored. There are different ways of implementing this.
When 2 registers are specified one will be used as source while the other will be
used as destination. Using internal registers instead of memory for operand
makes this mode instructions execute faster than other mode instructions. The
instruction format of register addressing is as shown in fig
The effective memory address where the operand is present is directly specified
with in the instruction. The instruction will contain opcode followed by direct
memory address. Both the opcode and direct address are fetched from memory
by using program counter. The direct address available is then used to access
the operand. The instruction format of direct addressing is as shown in fig.
17
In this register indirect mode the instruction opcode specifies an internal register
or register pair which contains the effective address to be used for addressing
operand in memory. This mode is used to save program space & improve speed
of program execution in situations where data elements are to be accessed from
memory. The instruction format of register indirect addressing is as shown in fig.
(a) Address register indirect with post increment. In this the effective address is in
the specified address register. The operand is accessed using this address. After
the operand is accessed the effective address in address register is incremented
by the operand size.
18
Accumulator
Data
19
Chapter VI
Conclusion
BIBLIOGRAPHY
http://www-03.ibm.com/servers/deepcomputing/bluegene.html
http://www.es.jamstec.go.jp/esc/eng/ES/hardware.html
William Stallings. Computer Organization and Architecture 4/E and 5/E. Prentice
Hall.
http://williamstallings.com/COA5e.html
and/http://williamstallings.com/COA/COA7e.html
Heuring, V.; Jordan, H., "Computer systems design and architecture", Menlo
Park, CA
[etc.]: Addison Wesley Longman, cop. 1997.
Appendix
GLOSSARY
address bus That portion of a system bus used for the transfer of an address.
Typically, the address identifies a main memory location or an I/O device.
arithmetic and logic unit (ALU) A part of a computer that performs arithmetic
operations, logic operations, and related operations.
bit In the pure binary numeration system, either of the digits 0 and 1.
buffer Storage used to compensate for a difference in rate of flow of data, or time of
occurrence of events, when transferring data from one device to another.
cache A relatively small fast memory interposed between a larger, slower memory
and the logic that accesses the larger memory. The cache holds recently accessed
data, and is designed to speed up subsequent access to the same data.
central processing unit (CPU) That portion of a computer that fetches and executes
instructions. It consists of an arithmetic and Logic Unit (ALU), a control unit, and
registers. Often simply referred to as a processor.
26
data bus That portion of a system bus used for transfer of data.
execute cycle That portion of the instruction cycle during which the CPU performs
the operation specified by the instruction opcode.
fetch cycle That portion of the instruction cycle during which the CPU fetches from
the memory the instruction to be executed.
immediate address The contents of an address part that contains the value of an
operand rather than an address.
indexed address An address that modified by the content of an index register prior to
or during the execution of a computer instruction.
index register A register whose contents can be used to modify an operand address
during the execution of computer instruction; it can be also used as a counter. An index
register may be used to control the execution of a loop, to control the use of an array, as
a switch, for table lookup, or as a pointer
input –Output (I/O) Permiting to either input or output or both. Refers to the
movement of data between a computer & a directly attached peripheral
I/O Controller A relatively simple i/o o/p module that requires detailed control from the
CPU.
I/O processor An i/o module with its own processor, capable of executing its own
specialized i/o instruction, in some cases general purpose machine instructions.
MAR memory address register contains address of the storage location being
accessed.
MBR memory buffer register contains data read from the memory or data to be written
to memory.
stack An ordered list in which terms are appended to & deleted from the same end of
the list i.e. the top.
27
INDEX