Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

5EC3-01: Computer Architecture: Unit-I What Are Digital Computers?

Download as pdf or txt
Download as pdf or txt
You are on page 1of 19

5EC3-01: Computer Architecture

Dr. S. K. Singh, Professor, ECE,


JECRC.

UNIT-I
What are Digital Computers?
The digital computer is a digital system that performs various computational tasks. Digital computers
use the binary number system, which has two digits: 0 and 1. A binary digit is called a bit. Information
is represented in digital computers in groups of bits. By using various coding techniques, groups of bits
can be made to represent not only binary numbers but also other discrete symbols, such as decimal
digits or letters of the alphabet.

Digital Computers: Computer Organization


Computer Organization is concerned with the way the hardware components operate and the way they
are connected together to form the computer system.
The various components are assumed to be in place and the task is to investigate the organizational
structure to verify that the computer parts operate as intended.

Digital Computers: Computer Design


Computer Design is concerned with the hardware design of the computer. Once the computer
specifications are formulated, it is the task of the designer to develop hardware for the system.
Computer design is concerned with the determination of what hardware should be used and how the
parts should be connected. This aspect of computer hardware is sometimes referred to as computer
implementation.

Digital Computers: Computer Architecture


Computer Architecture is concerned with the structure and behavior of the computer as seen by the
user.
It includes the information, formats, the instruction set, and techniques for addressing memory. The
architectural design of a computer system is concerned with the specifications of the various functional
modules, such as processors and memories, and structuring them together into a computer system.
Two basic types of computer architecture are:

1. von Neumann architecture


2. Harvard architecture

Page | 1 Dr S K Singh
1. von Neumann architecture
The von Neumann architecture describes a general framework, or structure, that a computer's
hardware, programming, and data should follow. Although other structures for computing have been
devised and implemented, the vast majority of computers in use today operate according to the von
Neumann architecture.
von Neumann envisioned the structure of a computer system as being composed of the following
components:

1. ALU: The Arithmetic-Logic unit that performs the computer's computational and logical functions.
2. RAM: Memory; more specifically, the computer's main, or fast, memory, also known as Random
Access Memory(RAM).
3. Control Unit: This is a component that directs other components of the computer to perform certain
actions, such as directing the fetching of data or instructions from memory to be processed by the
ALU; and
4. Man-machine interfaces; i.e. input and output devices, such as keyboard for input and display
monitor for output.

Block diagram of a Digital Computer

An example of computer architecture base on the von Neumann architecture is the desktop personal
computer.

Page | 2 Dr S K Singh
2. Harvard architecture
The Harvard architecture uses physically separate storage and signal pathways for their instructions
and data.

In a computer with Harvard architecture, the CPU can read both an instruction and data from memory
at the same time, leading to double the memory bandwidth.
Microcontroller(single-chip microcomputer)-based computer systems and DSP(Digital Signal
Processor)-based computer systems are examples of Harvard architecture.

Integrated Circuit(IC)
Complex digital circuits are constructed with integrated circuits. IC is a small silicon semiconductor
crystal, called a chip, containing the electronic components for the digital gates. The various gates are
interconnected inside the chip to form the required circuit. The chip is mounted in a ceramic or plastic
container and the connections are welded to the external pins to form an IC. The number of pins of IC vary
from 14 to several thousand. Each pin is identified by a unique number printed on its body.

Categories of Integrated Circuits


1. SSI(Small Scale Integration Device)
It contains several independent gates in a single package. The inputs and outputs of gates are connected
directly to the pins in the package. The number of gates is usually less than 10.
2. MSI(Medium Scale Integration Device)
It contains 10 to 200 gates in a single package. They perform elementary digital functions such as
decoders, adders, registers.
3. LSI(Large Scale Integration Device)
It contains gates between 200 to few thousand in a single package. They include digital systems such as
processors, memory chips etc.
4. VLSI(Very Large Scale Integration Device)
It contains thousands of gates within a single package such as microcomputer chip.
5. ULSI(Ultra Large Scale Integration Device)
It contains hundred of thousands of gates within a single package such as microcomputer chip.
Page | 3 Dr S K Singh
Architecture of Computer System
Computer is an electronic machine that makes performing any task very easy. In computer, the CPU
executes each instruction provided to it, in a series of steps, this series of steps is called Machine Cycle, and
is repeated for each instruction. One machine cycle involves fetching of instruction, decoding the
instruction, transferring the data, executing the instruction.
Computer system has five basic units that help the computer to perform operations, which are given below:

1. Input Unit
2. Output Unit
3. Storage Unit
4. Arithmetic Logic Unit
5. Control Unit

Input Unit
Input unit connects the external environment with internal computer system. It provides data and
instructions to the computer system. Commonly used input devices are keyboard, mouse, magnetic tape etc.
Input unit performs following tasks:

 Accept the data and instructions from the outside environment.


 Convert it into machine language.
 Supply the converted data to computer system.

Output Unit
It connects the internal system of a computer to the external environment. It provides the results of any
computation, or instructions to the outside world. Some output devices are printers, monitor etc.

Storage Unit
This unit holds the data and instructions. It also stores the intermediate results before these are sent to the
output devices. It also stores the data for later use.
The storage unit of a computer system can be divided into two categories:

 Primary Storage: This memory is used to store the data which is being currently executed. It is used for
temporary storage of data. The data is lost, when the computer is switched off. RAM is used as primary
storage memory.

Page | 4 Dr S K Singh
 Secondary Storage: The secondary memory is slower and cheaper than primary memory. It is used for
permanent storage of data. Commonly used secondary memory devices are hard disk, CD etc.

Arithmetic Logical Unit


All the calculations are performed in ALU of the computer system. The ALU can perform basic operations
such as addition, subtraction, division, multiplication etc. Whenever calculations are required, the control
unit transfers the data from storage unit to ALU. When the operations are done, the result is transferred
back to the storage unit.

Control Unit
It controls all other units of the computer. It controls the flow of data and instructions to and from the
storage unit to ALU. Thus it is also known as central nervous system of the computer.

CPU
It is Central Processing Unit of the computer. The control unit and ALU are together known as CPU. CPU
is the brain of computer system. It performs following tasks:

 It performs all operations.


 It takes all decisions.
 It controls all the units of computer.

Above figure shows the block diagram of a computer.

Page | 5 Dr S K Singh
Registers in Computer Architecture
Register is a very fast computer memory, used to store data/instruction in-execution.
A Register is a group of flip-flops with each flip-flop capable of storing one bit of information. An n-bit
register has a group of n flip-flops and is capable of storing binary information of n-bits.
A register consists of a group of flip-flops and gates. The flip-flops hold the binary information and gates
control when and how new information is transferred into a register. Various types of registers are available
commercially. The simplest register is one that consists of only flip-flops with no external gates.
These days registers are also implemented as a register file.

Loading the Registers


The transfer of new information into a register is referred to as loading the register. If all the bits of register
are loaded simultaneously with a common clock pulse than the loading is said to be done in parallel.

Register Transfer Language


The symbolic notation used to describe the micro-operation transfers amongst registers is called Register
transfer language.
The term register transfer means the availability of hardware logic circuits that can perform a stated
micro-operation and transfer the result of the operation to the same or another register.
The word language is borrowed from programmers who apply this term to programming languages. This
programming language is a procedure for writing symbols to specify a given computational process.
Following are some commonly used registers:

1. Accumulator: This is the most common register, used to store data taken out from the memory.
2. General Purpose Registers: This is used to store data intermediate results during program execution.
It can be accessed via assembly programming.
3. Special Purpose Registers: Users do not access these registers. These registers are for Computer
system,
o MAR: Memory Address Register are those registers that holds the address for memory unit.
o MBR: Memory Buffer Register stores instruction and data received from the memory and sent
from the memory.
o PC: Program Counter points to the next instruction to be executed.
o IR: Instruction Register holds the instruction to be executed.

Page | 6 Dr S K Singh
Register Transfer
Information transferred from one register to another is designated in symbolic form by means of
replacement operator.
R2 ← R1
It denotes the transfer of the data from register R1 into R2.
Normally we want the transfer to occur only in predetermined control condition. This can be shown by
following if-then statement: if (P=1) then (R2 ← R1)
Here P is a control signal generated in the control section.

Control Function
A control function is a Boolean variable that is equal to 1 or 0. The control function is shown as:
P: R2 ← R1
The control condition is terminated with a colon. It shows that transfer operation can be executed only if
P=1.

Micro-Operations
The operations executed on data stored in registers are called micro-operations. A micro-operation is an
elementary operation performed on the information stored in one or more registers.
Example: Shift, count, clear and load.
Types of Micro-Operations
The micro-operations in digital computers are of 4 types:

1. Register transfer micro-operations transfer binary information from one register to another.
2. Arithmetic micro-operations perform arithmetic operations on numeric data stored in registers.
3. Logic micro-operations perform bit manipulation operation on non-numeric data stored in registers.
4. Shift micro-operations perform shift micro-operations performed on data.

Arithmetic Micro-Operations
Some of the basic micro-operations are addition, subtraction, increment and decrement.
Add Micro-Operation
It is defined by the following statement:
R3 → R1 + R2
The above statement instructs the data or contents of register R1 to be added to data or content of register
R2 and the sum should be transferred to register R3.

Page | 7 Dr S K Singh
Subtract Micro-Operation
Let us again take an example:
R3 → R1 + R2' + 1
In subtract micro-operation, instead of using minus operator we take 1's compliment and add 1 to the
register which gets subtracted, i.e R1 - R2 is equivalent to R3 → R1 + R2' + 1
Increment/Decrement Micro-Operation
Increment and decrement micro-operations are generally performed by adding and subtracting 1 to and
from the register respectively.
R1 → R1 + 1
R1 → R1 – 1
Symbolic Designation Description

R3 ← R1 + R2 Contents of R1+R2 transferred to R3.

R3 ← R1 - R2 Contents of R1-R2 transferred to R3.

R2 ← (R2)' Compliment the contents of R2.

R2 ← (R2)' + 1 2's compliment the contents of R2.

R3 ← R1 + (R2)' + 1 R1 + the 2's compliment of R2 (subtraction).

R1 ← R1 + 1 Increment the contents of R1 by 1.

R1 ← R1 - 1 Decrement the contents of R1 by 1.

Logic Micro-Operations
These are binary micro-operations performed on the bits stored in the registers. These operations consider
each bit separately and treat them as binary variables.
Let us consider the X-OR micro-operation with the contents of two registers R1 and R2.
P: R1 ← R1 X-OR R2
In the above statement we have also included a Control Function.
Assume that each register has 3 bits. Let the content of R1 be 010 and R2 be 100. The X-OR micro-
operation will be:

Page | 8 Dr S K Singh
Shift Micro-Operations
These are used for serial transfer of data. That means we can shift the contents of the register to the left or
right. In the shift left operation the serial input transfers a bit to the right most position and in shift
right operation the serial input transfers a bit to the left most position.
There are three types of shifts as follows:
a) Logical Shift
It transfers 0 through the serial input. The symbol "shl" is used for logical shift left and "shr" is used for
logical shift right.
R1 ← shl R1
R1 ← shr R1
The register symbol must be same on both sides of arrows.
b) Circular Shift
This circulates or rotates the bits of register around the two ends without any loss of data or contents. In
this, the serial output of the shift register is connected to its serial input. "cil" and "cir" is used for circular
shift left and right respectively.
c) Arithmetic Shift
This shifts a signed binary number to left or right. An arithmetic shift left multiplies a signed binary
number by 2 and shift left divides the number by 2. Arithmetic shift micro-operation leaves the sign bit
unchanged because the signed number remains same when it is multiplied or divided by 2.

Arithmetic Logical Unit


Instead of having individual registers performing the micro-operations, computer system provides a number
of registers connected to a common unit called as Arithmetic Logical Unit (ALU). ALU is the main and
one of the most important unit inisde CPU of computer. All the logical and mathematical operations of
computer are performed here. The contents of specific register is placed in the in the input of ALU. ALU
performs the given operation and then transfer it to the destination register.

Page | 9 Dr S K Singh
Computer Architecture: Instruction Codes
While a Program, as we all know, is, A set of instructions that specify the operations, operands, and the
sequence by which processing has to occur. An instruction code is a group of bits that tells the computer
to perform a specific operation part.

Instruction Code: Operation Code


The operation code of an instruction is a group of bits that define operations such as add, subtract, multiply,
shift and compliment. The number of bits required for the operation code depends upon the total number of
operations available on the computer. The operation code must consist of at least n bits for a
given 2^n operations. The operation part of an instruction code specifies the operation to be performed.

Instruction Code: Register Part


The operation must be performed on the data stored in registers. An instruction code therefore specifies not
only operations to be performed but also the registers where the operands (data) will be found as well as the
registers where the result has to be stored.

Stored Program Organisation


The simplest way to organize a computer is to have Processor Register and instruction code with two
parts. The first part specifies the operation to be performed and second specifies an address. The
memory address tells where the operand in memory will be found.
Instructions are stored in one section of memory and data in another.

Computers with a single processor register is known as Accumulator (AC). The operation is performed
with the memory operand and the content of AC.

Page | 10 Dr S K Singh
Common Bus System
The basic computer has 8 registers, a memory unit and a control unit. Paths must be provided to transfer
data from one register to another. An efficient method for transferring data in a system is to use a Common
Bus System. The output of registers and memory are connected to the common bus.

Load(LD)
The lines from the common bus are connected to the inputs of each register and data inputs of memory. The
particular register whose LD input is enabled receives the data from the bus during the next clock pulse
transition.
Before studying about instruction formats lets first study about the operand address parts.
When the 2nd part of an instruction code specifies the operand, the instruction is said to have immediate
operand. And when the 2nd part of the instruction code specifies the address of an operand, the instruction
is said to have a direct address. And in indirect address, the 2nd part of instruction code, specifies the
address of a memory word in which the address of the operand is found.

Computer Instructions
The basic computer has three instruction code formats. The Operation code (opcode) part of the
instruction contains 3 bits and remaining 13 bits depends upon the operation code encountered.
There are three types of formats:
1. Memory Reference Instruction
It uses 12 bits to specify the address and 1 bit to specify the addressing mode (I). I is equal to 0for direct
address and 1 for indirect address.
2. Register Reference Instruction
These instructions are recognized by the opcode 111 with a 0 in the left most bit of instruction. The other 12
bits specify the operation to be executed.
3. Input-Output Instruction
These instructions are recognized by the operation code 111 with a 1 in the left most bit of instruction. The
remaining 12 bits are used to specify the input-output operation.

Format of Instruction
The format of an instruction is depicted in a rectangular box symbolizing the bits of an instruction. Basic
fields of an instruction format are given below:

1. An operation code field that specifies the operation to be performed.


2. An address field that designates the memory address or register.
3. A mode field that specifies the way the operand of effective address is determined.

Computers may have instructions of different lengths containing varying number of addresses. The number
of address field in the instruction format depends upon the internal organization of its registers.

Page | 11 Dr S K Singh
Adressing Modes and Instruction Cycle
The operation field of an instruction specifies the operation to be performed. This operation will be
executed on some data which is stored in computer registers or the main memory. The way any
operand is selected during the program execution is dependent on the addressing mode of the
instruction. The purpose of using addressing modes is as follows:

1. To give the programming versatility to the user.

2. To reduce the number of bits in addressing field of instruction.

Types of Addressing Modes


Below we have discussed different types of addressing modes one by one:

Immediate Mode
In this mode, the operand is specified in the instruction itself. An immediate mode instruction has an
operand field rather than the address field.
For example: ADD 7, which says Add 7 to contents of accumulator. 7 is the operand here.

Register Mode
In this mode the operand is stored in the register and this register is present in CPU. The instruction has
the address of the Register where the operand is stored.

Advantages

 Shorter instructions and faster instruction fetch.

 Faster memory access to the operand(s)

Disadvantages

 Very limited address space

 Using multiple registers helps performance but it complicates the instructions.


Page | 12 Dr S K Singh
Register Indirect Mode
In this mode, the instruction specifies the register whose contents give us the address of operand which
is in memory. Thus, the register contains the address of operand rather than the operand itself.

Auto Increment/Decrement Mode


In this the register is incremented or decremented after or before its value is used.

Direct Addressing Mode


In this mode, effective address of operand is present in instruction itself.

 Single memory reference to access data.

 No additional calculations to find the effective address of the operand.

For Example: ADD R1, 4000 - In this the 4000 is effective address of operand.
NOTE: Effective Address is the location where operand is present.

Page | 13 Dr S K Singh
Indirect Addressing Mode
In this, the address field of instruction gives the address where the effective address is stored in
memory. This slows down the execution, as this includes multiple memory lookups to find the
operand.

Displacement Addressing Mode


In this the contents of the indexed register is added to the Address part of the instruction, to obtain the
effective address of operand.
EA = A + (R),
In this the address field holds two values, A(which is the base value) and R(that holds the
displacement), or vice versa.

Relative Addressing Mode


It is a version of Displacement addressing mode.
In this the contents of PC(Program Counter) is added to address part of instruction to obtain the
effective address.
EA = A + (PC), where EA is effective address and PC is program counter.
The operand is A cells away from the current cell(the one pointed to by PC)
Page | 14 Dr S K Singh
Base Register Addressing Mode
It is again a version of Displacement addressing mode. This can be defined as EA = A + (R), where A is
displacement and R holds pointer to base address.

Stack Addressing Mode


In this mode, operand is at the top of the stack. For example: ADD, this instruction will POP top two
items from the stack, add them, and will then PUSH the result to the top of the stack.

Instruction Cycle
An instruction cycle, also known as fetch-decode-execute cycle is the basic operational process of a
computer. This process is repeated continuously by CPU from boot up to shut down of computer.
Following are the steps that occur during an instruction cycle:

1. Fetch the Instruction


The instruction is fetched from memory address that is stored in PC(Program Counter) and stored in
the instruction register IR. At the end of the fetch operation, PC is incremented by 1 and it then points
to the next instruction to be executed.

2. Decode the Instruction


The instruction in the IR is executed by the decoder.

3. Read the Effective Address


If the instruction has an indirect address, the effective address is read from the memory. Otherwise
operands are directly read in case of immediate operand instruction.

4. Execute the Instruction


The Control Unit passes the information in the form of control signals to the functional unit of CPU.
The result generated is stored in main memory or sent to an output device.

The cycle is then repeated by fetching the next instruction. Thus in this way the instruction cycle is
repeated continuously.

Page | 15 Dr S K Singh
What is Assembly Language?
Each personal computer has a microprocessor that manages the computer's arithmetical, logical, and
control activities.

Each family of processors has its own set of instructions for handling various operations such as
getting input from keyboard, displaying information on screen and performing various other jobs.
These set of instructions are called 'machine language instructions'.

A processor understands only machine language instructions, which are strings of 1's and 0's.
However, machine language is too obscure and complex for using in software development. So, the
low-level assembly language is designed for a specific family of processors that represents various
instructions in symbolic code and a more understandable form.

Advantages of Assembly Language


Having an understanding of assembly language makes one aware of −

 How programs interface with OS, processor, and BIOS;

 How data is represented in memory and other external devices;

 How the processor accesses and executes instruction;

Page | 16 Dr S K Singh
 How instructions access and process data;

 How a program accesses external devices.

Other advantages of using assembly language are :

 It requires less memory and execution time;

 It allows hardware-specific complex jobs in an easier way;

 It is suitable for time-critical jobs;

 It is most suitable for writing interrupt service routines and other memory resident programs.

Stack

A Stack data structure works on Last In First Out principle, also abbreviated as LIFO. A Stack requires
only one reference variable, known as a top pointer. Stack data structures are normally represented as a
vertical representation of data items.
A Stack Data Structure can be represented in static arrays as well as linked lists. In a stack, the data
items can be inserted and deleted from the same end. The element to be inserted first is the last element
to get deleted. Both the operations, insertion and deletion occur at the TOP reference pointer. A Stack
doesn’t necessarily contain ordered collection of data items.

Queue

A Queue data structure works on First In First Out principle, also abbreviated as FIFO. A Queue
requires two reference variables. Queue is normally represented as a horizontal representation of data
items. The Queue data structure contains FRONT and REAR as its reference points for data
processing.
A Queue can also be represented in by static arrays as well as linked lists. In a Queue, the data items
can be inserted and deleted from different ends. The element to be inserted first is the first element to
get deleted. The insertion operation is done at rear end whereas the deletion occurs at the front end. A
Queue contains ordered collection of data items. A Queue can be divided into sub sections and it has
the following extensions: Double Ended Queue, Simple Queue, Priority Queue and Circle Queue.

Page | 17 Dr S K Singh
Difference Between Stack and Queue
Stack Queue

A Stack Data Structure works on Last In First Out A Queue Data Structure works on First In First Out
(LIFO) principle. (FIFO) principle.

A Stack requires only one reference pointer. A Queue requires two reference pointers.

A Stack is primarily a vertical representation of data


items. A Queue is a horizontal representation of data items.

A Stack contains TOP as its reference for data A Queue contains REAR and FRONT as its
processing. reference for data processing.

The data items are inserted and deleted from the The data items in a queue are inserted and deleted
same end. from different ends.

The element to be inserted first is removed last. The element to be inserted first is removed first.

To check if a stack is empty, following condition is To check if a queue is empty, following condition is
used: used:
TOP == -1 FRONT == -1 || FRONT == REAR + 1

The insertion and deletion operations occur at the The insertion operation occurs at REAR end and the
TOP end of a Stack. deletion operation occurs at FRONT end.

A Stack data structure is not necessarily an ordered A Queue data structure is an ordered collection of
collection of data items. data.

To check if a stack is full, following condition is To check if a queue is full, following condition is
used: used:
TOP == MAX – 1 REAR == MAX – 1

A Queue can be divided into sub sections and it has


A Stack cannot be divided into sub sections and it the following extensions: Double Ended Queue,
doesn’t have extensions. Simple Queue, Priority Queue and Circle Queue.

A Queue offers services in operations research,


Used in infix to postfix conversion, scheduling transportation and computer science that involves
algorithms, depth first search and evaluation of an persons, data, events and objects to be stored for
expression. later processing.

Page | 18 Dr S K Singh
Subroutine
A set of Instructions which are used repeatedly in a program can be referred to as Subroutine. Only one
copy of this Instruction is stored in the memory. When a Subroutine is required it can be called many
times during the Execution of a Particular program. A call Subroutine Instruction calls the Subroutine.
Care Should be taken while returning a Subroutine as Subroutine can be called from a different place
from the memory.
The content of the PC must be Saved by the call Subroutine Instruction to make a correct return to the
calling program.

Figure – Process of subroutine in a program

Subroutine linkage method is a way in which computer call and return the Subroutine. The simplest
way of Subroutine linkage is saving the return address in a specific location, such as register which can
be called as link register call Subroutine.

--------------------------------End of Unit-1-----------------------------------

Page | 19 Dr S K Singh

You might also like