MIC 02 - Basic Computer System
MIC 02 - Basic Computer System
System
Lesson 02
3
The invention of stored program
computers has been ascribed to a
mathematician, John von Neumann,
who was a contemporary of Mauchley
and Eckert.
Stored-program computers have
become known as von Neumann
Architecture systems.
4
Today’s stored-program computers have the
following characteristics:
➢ Three hardware systems:
A central processing unit (CPU)
A main memory system
An I/O system
➢ The capacity to carry out sequential
instruction processing.
➢ A single data path between the CPU
and main memory.
This single path is known as the von
Neumann bottleneck.
5
Computer System
Address bus
I/O I/O
ROM RAM
interface devices
CPU
Data bus
Control bus
9
The memory stores groups of binary digits (words)
that can be represent instructions (programs) that
the computer is perform and the data that are to be
operated on by the program and storage for
intermediate and final results of arithmetic
operations. The memory is connected with the
control unit for read or write operation.
Basic Operations: read/write
LOAD
◦ read a value from a memory location
STORE
◦ write a value to a memory location
address words
0000
0001
0010 01101100
0011 00101001
0100
0101
0110
•
•
•
1101 01100010
1110 01111010
1111
30
We know that:
1 GB = 1024 MB
1 MB = 1024 KB
1 KB = 1024 B
1 B = 8 bits
So, 32-bit address bus has access to 2^32 locations with 8
bits(1Byte) of information.
2^32 locations =2^2 * 2^10 * 2^10 * 2^10 locations
2^32 locations =2^2 * 2^10 * 2^10 * 1024 B
2^32 locations =2^2 * 2^10 * 1024 KB
2^32 locations =2^2 * 1024 MB
2^32 locations =4 GB of location containing 8 bits (1Byte)
of information.
Therefore, 4 GB * 1 B = 4 GB information.
Dr. Mohammed Majid Al Khalidy 19
therefore, general formula to find out ROM memory size is 2^m * n,
where m is address lines and n is data lines.
Example:
For 1M×16 memory chips, how many address lines and data lines
are required?
Since, we know that 1K = 2^10, 1M = 2^20, 1G = 2^30, ….
> 1M * 16
> 2^20 * 16
→ it means 20 address lines and 16 data lines.
To select
a certain address
input
memory
from the If E=1 the
memory memory will
be active
system If E=0 the
memory is
disable
No. of word = 2n
27
3. I/O Unit
◦ Input/output (I/O), refers to the communication
between an information processing system (such as a
computer), and the outside world possibly a human, or
another information processing system.
◦ Inputs are the signals or data received by the system,
and outputs are the signals or data sent from it
◦ Devices that provide input or output to the computer
are called peripherals
◦ On a typical personal computer, peripherals include
input devices like the keyboard and mouse, and output
devices such as the display and printer. Hard disk
drives, floppy disk drives and optical disc drives serve as
both input and output devices. Computer networking is
another form of I/O.
28
4. The Bus System:
The processor has three buses which carry out all
the information and signals involved in the
system operation. These buses connect the
microprocessor to each of the memory and I/O
elements so that data and information can flow
between the µp and any of their other elements.
▪ Address bus
▪ Data bus
▪ Control bus
Dr. Mohammed Majid Al Khalidy 29
Address bus
I/O I/O
ROM RAM
interface devices
CPU
Data bus
Control bus
33
Part Two
Basic Microprocessor
Architecture
Two-byte instruction
Op code
Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
Address of operand
Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
46
Anatomy of a Register
Extended Register
Word Register
AX
16-bit register
AH AL
8-bit reg. 8-bit reg.
PC PROGRAM CONTER
15 8 7 0
SYSTEM BYTE USER VYTE SR STATUS REGISTER 51
➢ Accumulator: A
a register in which intermediate arithmetic
and logic results are stored.
In most cases it is implicit source operand,
and implicit destination (like, ADD C ; add C
with A and stor the result in A).
example for accumulator use is summing a
list of numbers.
◦ The accumulator is initially set to zero, then each
number in turn is added to the value in the
accumulator.
◦ Only when all numbers have been added is the
result held in the accumulator written to main
memory or to another, non-accumulator, CPU
register.
52
➢ Condition code register (CCR)
53
➢ Flag Register
The Flag register is a Special Purpose Register and is completely different
from the other registers in a microprocessor. It consists of 8 bits and only 5 of
them are useful in 8085. The other 3 are left vacant and are in the future Intel
versions. Therefore, 8085 has five flags - Sign flag, Zero flag, Auxillary
carry flag, Parity flag and the Carry flag.
The flag acts like a Status Register which provides the status of the ALU
operations performed in the microprocessor. It means that the information
stored in the accumulator is provided to the programmer via the flag
register and this is the main function of the flag.
Dr. Mohammed Majid Al Khalidy 54
1. SIGN FLAG
Sign flag occupies the 7th bit of the flag register which is also known as the
Most Significant Bit ( MSB ). It helps the programmer to know whether the
number stored in the accumulator is positive or negative. According to the
logic of flag, ‘1’(binary number) signifies that the flag is set whereas ‘0’ means
the flag is reset. Now if the sign flag is set(1), it means that the number
stored in the accumulator is negative and if reset(0), the number is positive.
2. ZERO FLAG
Zero flag occupies the 6th bit of the flag register. It is set(1) when the
operation performed in the ALU ( Arithmetic and Logic unit ) results in 0 and
is reset(0) when the result is not zero.
It occupies the 4th bit of the flag register. In an arithmetic operation, when
the carry is generated by the 3rd bit and is passed on to the 4th bit,
Auxillary Carry flag is set(1). If not, flag is reset(0). This flag is used only for
BCD( Binary Coded Decimal) operations.
2nd bit of flag register. This flag tests for number of 1 bits in the
accumulator(final result). If the accumulator holds even number of 1’s , even
parity exists and the flag bit is set(1). On the other hand, if the number of 1’s is
odd, parity is odd and the flag is reset(0).
5. CARRY FLAG
0th bit of the flag register. Also known as the Least Significant bit( LSB ). If the
arithmetic operation finally results in a carry, carry flag is set(1). Else, it is
reset(0).
Now let’s check what each bit means. Refer the above explanations
simultaneously to connect them with these examples.
• 7th bit is reset(0), which means number stored in the accumulator is positive.
• 6th bit is also reset(0), thus result of the operations performed in the ALU is
non-zero.
• 4th bit is set(1). Therefore, Auxillary carry is generated in the operations
performed in the ALU operation.
• 2nd bit is set(1). It means that even parity exists,i.e. accumulator holds even
number of 1s.
• 0th bit is set(1), which means carry flag is generated in the arithmetic
operation.
Dr. Mohammed Majid Al Khalidy 58
Flag Name Description
Indicates that the result of a mathematical or logical operation
Z Zero flag
was zero.
60
➢ Stack pointer (SP)
Used as memory pointer. It points to the
memory location called stack. Generally stack is
a reserved portion of memory where
information can be stores or taken back
together.
The stack is configured as a data structure that
grows downward from high memory to low
memory. (first in last out)
At any given time, the SP holds the 16-bit
address of the next free location in the stack.
The stack acts like any other stack when there
is a subroutine call or on an interrupt. ie.
pushing the return address on a jump, and
retrieving it after the operation is complete to
come back to its original location.
61
➢ Buffers
▪ Used to isolate the weak internal busses from the
external busses.
▪ They are important because of loading effects, which
happens when there isn’t enough output current to drive
another unit.
▪ Buffers in μP’s are amplifiers that amplify the current so
that the μP can drive many loads.
▪ There are two types of buffers:
• Address buffers
• Data buffers, that of two types:
Internal Data Buffer and External Data Buffer.
Alternatively, only one data buffer can be used.
Dr. Mohammed Majid Al Khalidy 62
3. Timing and Control section:
The major function of this µp section is to
fetch and decode instructions from program
memory and then to generate the necessary
control signals required by the ALU and
register section for executing these
instructions.
R/W’ = 1 READ
R/W’ = 0 WRITE
Dr. Mohammed Majid Al Khalidy 68
RESET (RES)’: When this input is active. Most of the microprocessor
internal registers are reset to 0.
72
Motherboard
Peripheral
73
Dynamic Power
P
dyn k
iCiVAif
2
i
units
Static CMOS: current flows when active
◦ Combinational logic evaluates new inputs
◦ Flip-flop, latch captures new value (clock edge)
Terms
◦ C: capacitance of circuit
wire length, number and size of transistors
◦ V: supply voltage
◦ A: activity factor
◦ f: frequency
Future: Fundamentally power-constrained
Iron Law
Time
Processor Performance = ---------------
Program
75
Computer Performance
CPU operates on data. If no data, CPU has to
wait; performance degrades.
◦ typical workstation: 3.2GHz CPU, Memory
667MHz. Memory 5 times slower.
◦ Moore’s law: CPU speed doubles every 18
months
◦ Memory speed increases much much slower;
Fast CPU requires sufficiently fast memory.
Rule of thumb: Memory size in GB=R_theor in
GFLOPS
◦ 1CPU cycle (1 FLOPS) handles 1 byte of data
◦ 1MFLOPS needs 1MB of data/memory
◦ 1GFLOPS needs 1GB of data/memory
Many “tricks” designed for performance improvement
targets the memory 76
CPU Performance
Computer time is measured in terms of
CPU cycles
◦ Minimum time to execute 1 instruction is 1 CPU
cycle
Time to execute a given program:
nc
T = nc tc = ni tc = ni CPI tc
ni
n_c: total number of CPU cycles
n_i: total number of instructions
CPI = n_c/n_i, average cycles per instruction
t_c: cycle time, 1GHz → t_c=1/(10^9Hz) = 10^(-9)sec = 1ns
77
To Make a Program/Computer
Faster…
Reduce cycle time t_c:
◦ Increase clock frequency; however, there is a physical
limit
◦ In 1ns, light travels 30cm
◦ Currently ~ GHz; 3GHz cpu → light travels 10cm within 1
cpu cycle → length/size must be < 10cm.
◦ 1 atom about 0.2 nm;
Reduce number of instructions n_i:
◦ More efficient algorithms
◦ Better compilers
Reduce CPI -- The key is parallelism.
◦ Instruction-level parallelism. Pipelining technology
◦ Internal parallelism, multiple functional units; superscalar
processors; multi-core processors
◦ External parallelism, multiple CPUs, parallel machine
78