Fundamentals of Computer Design
Fundamentals of Computer Design
Introduction:
The concept of stored program computers appeared in 1945 when John von
Neumann drafted the first version of EDVAC (Electronic Discrete Variable
Computer). Those ideas have since been the milestones of computers:
• An input device through which data and instructions can be entered.
• Storage in which data can be read/written; instructions are like data, they
reside in the same memory
• An arithmetic unit to process data.
• A control unit which fetches instructions, decode and execute them.
• Output devices for the user to access the results.
Four lines of evolution have emerged from the first computers (definitions are
very loose and in many case the borders between different classes are blurring)
1. Mainframes: large computers that can support very many users while delivering
great computing power. It is mainly in mainframes where most of the innovations
(both in architecture and in organization) have been made.
1
when DEC introduced the first minicomputer, PDP-8), mainly due to the evolution
of integrated circuits technology (the first IC appeared in 1958).
For many years the evolution of computers was concerned with the problem
of object code compatibility. A new architecture had to be, at least partly,
compatible with older ones. Older programs (“the dusty deck”) had to run without
changes on the new machines. A dramatic example is the IBM-PC architecture,
launched in 1981, it proved so successful that further developments had to conform
with the first release, despite the flaws which became apparent in a couple of years
thereafter. The assembly language is no longer the language in which new
applications are written, although the most sensitive parts continue to be written in
assembly language, and this is due to advances in languages and compiler
technology.
2
them hybrids of “classical” families: graphical supercomputers, multiprocessors,
MPP (Massively Parallel Processors), mini supercomputers, etc.
Functional Units:
The input unit accepts coded information from human operators using
devices such as keyboards, or from other computers over digital communication
lines. The information received is stored in the computer’s memory, either for later
use or to be processed immediately by the arithmetic and logic unit. The
processing steps are specified by a program that is also stored in the memory.
Finally, the results are sent back to the outside world through the output unit. All of
these actions are coordinated by the control unit. An interconnection network
provides the means for the functional units to exchange information and coordinate
their actions. The arithmetic and logic circuits, in conjunction with the main
3
control circuits, is the processor. Input and output equipment is often collectively
referred to as the input-output (I/O) unit.
1) Input Unit
Computers accept coded information through input units. The most common
input device is the keyboard. Whenever a key is pressed, the corresponding letter
or digit is automatically translated into its corresponding binary code and
transmitted to the processor. Many other kinds of input devices for human-
computer interaction are available, including the touchpad, mouse, joystick, and
trackball. These are often used as graphic input devices in conjunction with
displays. Microphones can be used to capture audio input which is then sampled
and converted into digital codes for storage and processing. Similarly, cameras can
be used to capture video input. Digital communication facilities, such as the
Internet, can also provide input to a computer from other computers and database
servers.
4
2) Memory Unit:
The function of the memory unit is to store programs and data. There are
two classes of storage, called primary and secondary.
Primary Memory:
Primary memory, also called main memory, is a fast memory that operates at
electronic speeds. Programs must be stored in this memory while they are being
executed. The memory consists of a large number of semiconductor storage cells,
each capable of storing one bit of information. These cells are rarely read or
written individually. Instead, they are handled in groups of fixed size called words.
The memory is organized so that one word can be stored or retrieved in one basic
operation. The number of bits in each word is referred to as the word length of the
computer, typically 16, 32, or 64 bits. To provide easy access to any word in the
memory, a distinct address is associated with each word location. Addresses are
consecutive numbers, starting from 0, that identify successive locations.
Instructions and data can be written into or read from the memory under the
control of the processor. A memory in which any location can be accessed in a
short and fixed amount of time after specifying its address is called a random-
access memory (RAM). The time required to access one word is called the
memory access time. This time is independent of the location of the word being
accessed. It typically ranges from a few nanoseconds (ns) to about 100 ns for
current RAM units.
Cache Memory:
Secondary Storage:
Most computer operations are executed in the arithmetic and logic unit
(ALU) of the processor. Any arithmetic or logic operation, such as addition,
subtraction, multiplication division, or comparison of numbers, is initiated by
bringing the required operands into the processor, where the operation is
performed by the ALU. When operands are brought into the processor, they are
stored in high-speed storage elements called registers. Each register can store one
word of data. Access times to registers are even shorter than access times to the
cache unit on the processor chip.
6
4) Output Unit
5) Control Unit
The memory, arithmetic and logic, and I/O units store and process
information and perform input and output operations. The operation of these units
must be coordinated in some way. This is the responsibility of the control unit. The
control unit is effectively the nerve center that sends control signals to other units
and senses their states. I/O transfers, consisting of input and output operations, are
controlled by program instructions that identify the devices involved and the
information to be transferred. Control circuits are responsible for generating the
timing signals that govern the transfers. They determine when a given action is to
take place. Data transfers between the processor and the memory are also managed
by the control unit through timing signals. A large set of control lines (wires)
carries the signals used for timing and synchronization of events in all units.
• The computer accepts information in the form of programs and data through an
input unit and stores it in the memory.
7
• Information stored in the memory is fetched under program control into an
arithmetic and logic unit, where it is processed.
Registers
1) Fetch 2)Execute
Fetch Cycle
Execute Cycle
Processor interprets instruction and performs required actions, such as:
Processor – memory
data transfer between CPU and main memory
Processor - I/O
Data transfer between CPU and I/O module
Data processing
Some arithmetic or logical operation on data
Control
Alteration of sequence of operations
e.g. jump
Combination of above.
9
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.
1. Immediate Addressing Mode
2. Register Addressing Mode
3. Register Indirect Addressing Mode
4. Direct Addressing Mode
5. Indirect Addressing Mode
6. Implied Addressing Mode
7. Relative Addressing Mode
8. Indexed Addressing Mode
9. Base Register Addressing Mode
10.Autoincrement or Autodecrement Addressing Mode
Move Immediate:
MVI A, 15h A← 15h Here 15h is the immediate operand
Add Immediate:
ADI 3Eh A ← A + 3Eh Here 3Eh is the immediate operand
10
2) 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.
Move:
MOV C , A C ← A Here A is the operand specified in register
Add:
ADD B A ← A + B Here B is the operand specified in register
11
4) Direct addressing/ Absolute addressing Mode:
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.
• Load Accumulator
LDA 2805h A ← [2805]
It loads the data from memory location 2805 to A.
• Store Accumulator
STA 2803h [2803] ← A
It stores the data from A to memory location 2803.
12
5) Indirect addressing Mode:
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:
13
6) Implied Addressing Mode
• It is also called inherent addressing mode.
• The operand is implied by the instruction.
• The operand is hidden/fixed inside the instruction.
• Complement Accumulator CMA
(Here accumulator A is implied by the instruction)
• Complement Carry Flag CMC
(Here Flags register is implied by the instruction)
• Set Carry Flag STC
(Here Flags register is implied by the instruction)
14
8) Indexed Addressing Mode
In index addressing mode, contents of Index register is added to
address part of instruction to obtain effective address. The address part of
instruction holds the beginning/base address and is called as base. The index
register hold the index value, which is +ve. Base remains same, the index
changes. When the base is added to the index register the resultant number is
the memory location where the operand will be placed.
15
9) Base Register Addressing Mode
In base register addressing mode, contents of base register is added to
address part of instruction to obtain effective address. It is similar to the
indexed addressing mode except the register now is called as base instead of
index. The base register hold the beginning/base address. The address part of
instruction holds the offset. Offset remains same, the base changes. When
the offset is added to the base register the resultant number is the memory
location where the operand will be placed.
16
10) Auto increment or Auto decrement Addressing Mode
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.
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.
17
18
Von Neumann Architecture:
19
1. The Central Processing Unit (CPU)
2. The Main Memory Unit
3. The Input/Output Device
Control Unit:
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.
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.
20
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.
21
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.
1. Programmer write code in text editor using any language like C++, JAVA,
and Python etc.
2. This code is given to the compiler and it actually converts it to assembly
code that is very close to machine hardware as it depend on instruction set
which is then converted to binary that is 0 and 1 which actually represent
digital voltage feeded to transistors inside the chip.
22
3. Now we have voltages which is actually required to run the hardware. These
voltages actually connect the correct circuitry inside the chip and perform that
specific task for example addition, subtraction etc .All these operations are
done by combination of little transistors if we go into low level or flip-flops
which are combination of gates and gates are combination of transistors. So, it
all started with the invention of transistors.
4. The chip has lot of circuits inside it to perform various task like arithmetic and
logical task. The computer hardware also contain RAM which is another chip
which can store data temporary and hard disk which can permanently store
data.
5. Operating system is also responsible to feed the software to the right hardware
like keyboard, mouse, screen etc.
The following picture depict the whole process:
23
Simplified Instructional Computer (SIC):
24
Status Word Register:
25
5. Instruction Set
Load And Store Instructions: To move or store data from accumulator to
memory or vice-versa. For example LDA, STA, LDX, STX etc.
Comparison Instructions: Used to compare data in memory by contents in
accumulator. For example COMP data.
Arithmetic Instructions: Used to perform operations on accumulator and
memory and store result in accumulator. For example ADD, SUB, MUL,
DIV etc.
Conditional Jump: compare the contents of accumulator and memory and
performs task based on conditions. For example JLT, JEQ, JGT
Subroutine Linkage: Instructions related to subroutines. For example
JSUB, RSUB
6. Input and Output
It is performed by transferring 1 byte at a time from or to rightmost 8 bits of
accumulator. Each device has 8 bit unique code. There are 3 I/O instructions:
Test Device (TD) tests whether device is ready or not. Condition code in
Status Word Register is used for this purpose.
Read data(RD) reads a byte from device and stores in register A.
Write data(WD) writes a byte from register A to the DEVIC.
SIC/XE Architecture:
26
SIC/XE machine architecture:
1. Memory:
Memory consists of 8 bit-bytes and the memory size is 1 megabytes (220 bytes).
Standard SIC memory size is very small. This change in the memory size leads to
change in the instruction formats as well as addressing modes. 3 consecutive bytes
form a word (24 bits) in SIC/XE architecture.
All address are byte addresses and words are addressed by the location of their
lowest numbered byte.
2. Registers:
It contain 9 registers (5 SIC registers + 4 additional registers). Four additional
registers are:
3. Data Formats:
Integers are represented by Binary numbers.
Characters are represented using ASCII codes.
Floating points are represented using 48-bits.
4. Instruction formats:
In SIC/XE architecture there are 4 types of formats available
27
The Bit(e) is used to distinguish between Formats 3 and Formats 4,
e=0 means Format 3 and e=1 means Format 4
5. Addressing Modes:
To use Format 3 use of Base register and Program counter is there.
Mode Indication Target Address (TA)
Base relative b=1, p=0 TA=(B) + displacement
Program-counter b=0, p=1 TA=(PC) + displacement
relative
Target address is the effective address of the instruction.
28
6. Instruction Set:
IN SIC/XE all the instructions are same as that of SIC architecture but
because of Floating point data format it provide Floating point Arithmetic
functions too.
To perform floating-point arithmetic operations,
ADDF = Add floating points,
Example: An ADD instruction will use index addressing to specify one operand in
memory and direct addressing to specify second operand in memory. This
instruction would use another memory location to store the result. Thus, this
instruction would use three memory references for execution.
Many CISC architectures read the inputs and write their outputs in the
memory system instead of a register file. As CISC architecture takes large number
of addressing modes, more hardware logic is required to implement them. This
reduces the computation speed. Basically, the CISC architecture attempts to
provide a single machine instruction for the statements that are written in a high-
level language.
30
Example: The IBM 370 computer uses the CISC architecture
RISC uses relatively a simple instruction format and is easy to decode. Here,
the instruction length can be fixed and aligned on word boundaries. The RISC
processors have the ability to execute one instruction per clock cycle. This is done
using pipelining, which involves overlapping the fetch, decode, and execute phases
of two or three instructions. As RISC takes relatively a large number of registers in
the processor unit, it takes less time to execute its program when compared to
CISC.
31
RISC versus CISC
There are some significant differences between RISC and CISC processors. The
comparison between the common characteristics of RISC and CISC processor is
shown in table.
CISC RISC
Many instructions Few instructions
Many addressing modes. Few addressing modes. Most instructions
have register to register addressing modes.
Includes complex instructions and takes Includes simple instructions and takes one
multiple cycles. cycle.
Most of the instructions refer to memory. Some of the instructions refer to memory.
Microprogram executes the instructions. Hardware executes the instructions.
Variable format instructions. Fixed format instructions.
Difficult to decode as instructions have Easier to decode as instructions have fixed
variable format. format.
Single register set is used. Multiple register sets are used.
CISC is not pipelined or less pipelined. RISC is highly pipelined.
Load and store functions are found in a Load and store functions are separate
single instruction. instructions.
32