5EC3-01: Computer Architecture: Unit-I What Are Digital Computers?
5EC3-01: Computer Architecture: Unit-I What Are Digital Computers?
5EC3-01: Computer Architecture: Unit-I What Are Digital Computers?
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.
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.
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.
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:
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.
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:
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.
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
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.
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.
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:
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:
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
Disadvantages
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.
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:
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.
Page | 16 Dr S K Singh
How instructions access and process data;
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 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
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.
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