Course Teacher: Prof. Dr.
Israt Jahan
Computer Basics
Computer is an electronic machine that stores,
retrieves and processes data.
Performs computations and makes logical decisions
It cannot think or reason
It can only carry out instructions given to it
Millions / billions times faster than human beings
Work flow of Computer
Input Processing Output
• Input data from disk, keyboard or other storage media
• Process data
• Output results to display screen, disk or other media
Programming Languages
Computer programs
Sets of instructions which directs a computer to
perform certain function.
Types:
Machine language
Assembly language
High-level languages
Machine language
Binary
Machine dependent
Stored in the computer when the program is running
A CPU can only execute machine language
instructions - computer’s language
Example:
01110110001010010010 ….
Assembly language
Symbolic addressing, i.e.,
Use Symbolic names to represent operations, registers and
memory locations.
One-to-one correspondence with machine language
A program written in assembly language must be converted to
machine language before the CPU can execute it.
A program called the assembler translates each assembly
language statement into single machine language instruction.
Example:
MOV AX,A
ADD AX,4
STORE Z
Automatically translating assembly language to
machine language
High-level languages
Closer to how people think about their problems
No one-to-one correspondence to machine language
General purpose
Example:
Z = A+ 4
High-level languages
Fortran
Basic
Visual Basic
C
C++
Java
Advantages of Assembly languages
Efficient
It is so close to machine language.
Produces a faster, shorter machine language program.
Some operations, such as reading or writing to specific
memory locations and I/O ports can be done easily in
assembly language but may be impossible at a higher
level.
It also provides the way to realize how the computer
“thinks” and performs the inner operations.
Computer Hardware Organization
CPU
Registers RAM | ROM
program data
storage storage
Control, data, address
bus
ALU
Control
unit
output input
unit unit
Registers
Information inside the microprocessor is stored in registers.
Even though the processor can operate on data stored in
memory, the same instruction is faster if the data are stored in
registers.
Types
• Registers are classified into three
categories according to the functions they
perform. Each register is 16 bit.
– Data registers
– Hold data for an operation
– Address registers
– Hold the address of an instruction and data
– Status registers
– Keep the current status of the processor
Data Registers
8086 has four data registers for general data manipulation. They are:
AX (Accumulator Register)
BX (Base Register)
CX ( Count Register )
DX (Data Register)
The high and low bytes of the data registers can be accessed
separately. The high byte of AX is called AH and the low byte is AL.
Data Registers
• AX (Accumulator Register….AH+AL)
– Use in arithmetic, logic and data transfer
instructions because its use generates the shortest
machine code.
– In multiplication and division operations, one of
the numbers involved must be in AX or AL.
• BX (Base Register…..BH+BL)
– Serves as an address register
Data Registers
CX (Count Register……CH+CL)
Use in program loop constructions….serves as loop counter
Use in REP (repeat), string operations, shift and rotate
operations.
DX (Data Register…..DH+DL)
Use in multiplication and division
Use in I/O operations
Basic element of a computer are
•CPU
•Memory
•Input/Output (I/O) units.
Translates instructions
Perform arithmetic of logic operations
CPU instructions & data in its
Temporarily stores internal high-speed registers
Memory : Stores Program & Data
I/O Unit : Interfaces the computer with external
device such as Keyboard and Display.
With the advent of semiconductor technology, it
is possible to integrate CPU in a chip.
Result : Microprocessor
Technology : MOS (both by Intel & Motorola)
Single chip microcomputers are also available in
which microprocessors, memory and I/O are all
fabricated the same chip. (limited capabilitis ideal
for peripheral controllers)
Single Chip microcomputers Microcontrollers
Microcontrollers Automotive systems,
home entertainment system.
Evolution of the Microprocessor
• Intel corporation introduced 1st Microprocessor
• 4004 (4bit) in 1971.
• The 4004 evolved from a development effort while
designing a Calculator Chip set.
• Soon after 4004 appeared Commercially, 3 other
microprocessors use introduced
• Rockwell International Intel 8 bit 8008 &
National Semiconductor 16 bit Imp-16.
• Microprocessor between 1971 and 1973 :
1st Generation system Designed with PMOS technology.
• This technology provides
Low cost
Slow Speed
Low input current &
Was not compatible with TTL
• After 1973, 2nd Generation Microprocessor such as,
MOS technology 6502
Motorola 6800 & 6809
Intel 8085 & Zilog Z80 evolved
• There 8 bit processors were fabricated using NMOS
technology.
• NMOS process offers faster speed and higher density
than PMOS & is TTL-Compatible.
• After 1978, the 3rd Generation microprocessors were
introduced.
• These processors are 16 bits wide (16 bit ALU) &
include: Intel 8086/80186/80286 &
Motorola 68000/68010
Technology : HMOS (High Density MOS)
•HMOS provides the following advantages
over NMOS
❖ Speed-Power-Product (SPP) is 4 times
better than NMOS
❖Circuit densities provided by HMOS are
approximately twice than of NMOS.
•Later, Intel utilized the HMOS technology to
fabricate 8085A. High Speed Version of
8085 A is 8085 AH.
•In 1980, 4th generation microprocessors are
evolved.
❖Intel introduced the first commercial 32 bit
microprocessor the problematic Intel 432. This
Processor was eventually discontinued by Intel.
❖Since 1985, mouse 32 bit microprocessors have
been introduced. These include:
Motorola’s MC 68020/68030/68040
Intel’s 80386/804486
Intel Pentium processors.
•These processors are fabricated using Low-power
version of the HMOS technology called the
HCMOS.
•The performance offered by the 32 bit processor is
make comparable to that of superminicomputers
such as DEC’s VAX 11/750 & VAX 11/780.
•Both Intel & Motorola introduced 32 bit RISC
processor (Intel 80960 & Motorola
MC88100/PowerPC) with simplified instruction
sets.
•Purpose of RISC processors : Maximize speed
by reducing clock cycles per instruction.
•RISC microprocessor have hardwired instructions
sets like non RISC microprocessor (Such as Intel
8085 & MOS 6502).
• This means that for every instruction, there exist
actual, Physical connections that provide the
desired instruction decoding.
• The microprocessor, therefore does not use
valuable clock cycle (machine cycle) in instruction
decoding.
•Since RISC type microprocessor are hardwired,
instructions may be executed simultaneously (as
long as instruction do not share the same
register).
•This technique is pipelining.
•The processor continues to fetch instructions
even though it has not executed the present
instructions.
•At this stage, the instructions are intelligently
fed into the instructing execution unit.
•Registers are checked whether second
instruction can be executed.
•The RISC microprocessor can execute as any as 5
instruction simultaneously.
•The trend in microprocessor is implementation of more
on-chip functions and for improvement of the speeds
of memory and I/O devices.
Overview
Pipelining is widely used in modern processors.
Pipelining improves system performance in terms of
throughput.
Pipelined organization requires sophisticated
compilation techniques.
Making the Execution of
Programs Faster
Use faster circuit technology to build the processor
and the main memory.
Arrange the hardware so that more than one operation
can be performed at the same time.
In the latter way, the number of operations performed
per second is increased .
Traditional Pipeline Concept
Laundry Example
Ann, Brian, Cathy, Dave
each have one load of clothes
to wash, dry, and fold A B C D
Washer takes 30 minutes
Dryer takes 40 minutes
“Folder” takes 20 minutes
Traditional Pipeline Concept
6 PM 7 8 9 10 11 Midnight
Time
30 40 20 30 40 20 30 40 20 30 40 20
Sequential laundry takes 6
A hours for 4 loads
If they learned pipelining,
how long would laundry
B
take?
D
Traditional Pipeline Concept
6 PM 7 8 9 10 11 Midnight
Time
T
a 30 40 40 40 40 20
s
k A
Pipelined laundry takes 3.5
hours for 4 loads
O B
r
d C
e
r D
What is Pipelining
A technique used in advanced microprocessors where the
microprocessor begins executing a second instruction
before the first has been completed.
- A Pipeline is a series of stages, where some work is done at
each stage. The work is not finished until it has passed
through all stages.
With pipelining, the computer architecture allows the next
instructions to be fetched while the processor is
performing arithmetic operations, holding them in a buffer
close to the processor until each instruction operation can
performed.
How Pipelines Works
The pipeline is divided into segments and each
segment can execute it operation concurrently with
the other segments. Once a segment completes an
operations, it passes the result to the next segment in
the pipeline and fetches the next operations from the
preceding segment.
Example
Instruction 1 Instruction 2
X X
Instruction 4 Instruction 3
X X
Four sample instructions, executed linearly
5
IF ID EX M W
1
IF ID EX M W
1
IF ID EX M W
1
IF ID EX M W
Four Pipelined Instructions
Instructions Fetch
The instruction Fetch (IF) stage is responsible for obtaining
the requested instruction from memory. The instruction
and the program counter (which is incremented to the next
instruction) are stored in the IF/ID pipeline register as
temporary storage so that may be used in the next stage at
the start of the next clock cycle.
Instruction Decode
The Instruction Decode (ID) stage is responsible for
decoding the instruction and sending out the various
control lines to the other parts of the processor. The
instruction is sent to the control unit where it is decoded
and the registers are fetched from the register file.
Execution
The Execution (EX) stage is where any calculations are
performed. The main component in this stage is the ALU.
The ALU is made up of arithmetic, logic and capabilities.
Memory and IO
The Memory and IO (MEM) stage is responsible for storing
and loading values to and from memory. It also responsible
for input or output from the processor
Write Back
The Write Back (WB) stage is responsible for writing
the result of a calculation, memory access or input into
the register file.