02 Computer Structure
02 Computer Structure
02 Computer Structure
Gökhan İnce
Berk Üstündağ
Topics
Computer Structure
Memory Systems
Computer Structure
A computer is a programmable machine
designed to automatically carry out a sequence
of arithmetic or logical operations.
Arithmetic
logic Disk
unit
memory
Registers Input/output
program data
unit Monitor
storage storage
Microprocessor
Keyboard
What is a computer ?
System Bus
(Common or Separate):
Address bus,
Data bus,
Control bus 6
Memory
Memory stores information such as instructions and data in
binary format (0’s and 1’s). It provides this information to the
microprocessor whenever it is needed.
D Q D Q D Q D Q
Clock
Control Bus
Data Bus
Data
Register
Control
Address Bus I/O
Address
Register
CPU
Memory
13
Basic Computer Architecture
Instruction
Memory Control
Data
Data Data
Control
Input/output Processing
Unit
Unit
Control/Status
Microprocessor
Clock
Stored Program Procedure
The Clock: The stored program processor is a large
synchronous sequential network (logic circuit) that requires a
clock signal to synchronize all its elements.
The signal from the clock is a periodic pulse waveform.
Arithmetic Logic
Registers
Unit ALU
Stored Program Procedure
The control unit is a synchronous sequential logic
circuit that sends control signals to the data
processing unit, memory and other parts of the system.
The signals from the control unit tells the data processing
unit to manipulate data according to the algorithm built
into the sequential logic circuit.
The control unit is instruction controlled; therefore it
can do more than one algorithm based on its design.
Typical control units recognize several hundred different
instruction codes.
The Memory: The memory holds instruction code
numbers and data numbers
The I/O Unit: The input/output unit includes any
hardware that allows data transfer between the CPU
and the real world.
Von Neumann Architecture
Instruction and data are in the same memory
Memory
Control&Address
Address Instruction
Data
CPU
Input
Data
Control
I/O Processing
Unit
Unit
Output
Control/status
Clock
Harvard Architecture
There are two memories: Instruction and data
Data Instruction
Memory Memory
Control&Address
Address Instruction
Data
CPU
Input
Data
Control
I/O Processing
Unit
Unit
Output
Control/status
Clock
Operation of Computer
Example: The X and Y numbers will be written on
memory addresses $3000 and $3001. The sum of
X and Y will be stored on address $3002
Memory Address Instruction
$1001 Load X to ACC (accumulator)
$1002 Store contents of ACC to address $3000
$1003 Load Y to ACC
$1004 Store contents of ACC to address $3001
$1005 Add contents of $3000 to ACC
$1006 Store contents of ACC to address $3002
$3000 X
$3001 Y Results after execution
$3002 X+Y
Instruction Cycle
Fetch
Instruction
Decode
Fetch Cycle
Fetch-Decode-Execute Instruction
Read
Operand
Execute
Execution Cycle
Store
Results
Next
Instruction
8 bit
word
Instruction Templates
3+1 Address instruction template (Example: ADD X,Y,Z,N)
Opcode Register
Topics
Computer Structure
Memory Systems
Memory
The memory holds instruction code numbers
and data numbers
Non-volatile memory
Read only memory (ROM)
Programmable read-only memory (PROM)
Erasable programmable ROM (EPROM)
Volatile memory
Static random-access memory (SRAM)
Dynamic random-access memory (DRAM)
Memory Types
Non-volatile Memory
Read-only memory (ROM) can only be read
but not written by the processor
Vcc
HIGH
bit LOW 0
time
Common widths: Byte (8 bits), Short (16 bits), Int (32 bits)
CPU-Memory Connection
Data Bus (M)
0 0000111
Address Bus (k) 1 0001000
0 0010001
1 0010011
Decoder 2kxM 1 1110000
CPU 0 0001111
1 1000011
Adr.Dec.
CE
1 0011001
RD OE :
WR WE
Control Bus
:
Memory
CPU-Memory Connection
Data Bus
1
1
0
0
1
0
0
1
0 0000111
Address Bus 1 0001000
0 0010001
1 0010011
Decoder 1 1110000
CPU 0 0001111
1 1000011
Adr.Dec.
CE
1 0011001
RD OE
WR WE :
Control Bus
Read instruction Memory :
62C256 SRAM: Pin layout
62C256
1- 62C→CMOS SRAM: 𝑊𝐸 , 𝑂𝐸 , 𝐶𝐸
2- 62C→I/O0…I/O7
1- 62C→CMOS SRAM: 𝑊𝐸 , 𝑂𝐸 , 𝐶𝐸
2- 62C→I/O0…I/O7
3- x128→ M=128kbit=128x1024=217bits
AS5C4008
1- AS6C→CMOS SRAM: 𝑊𝐸 , 𝑂𝐸 , 𝐶𝐸 SRAM
2- Cxx8→I/O0…I/O7
3- C4008→ Memory=Mbit=4x1024x1024=222bits
ROM Device:
120ns
2- 27C→O0…O7
3- C54→ Memory=64kbit=64x1024=216bits
1- 28C→CMOS EEPROM: 𝑊𝐸 , 𝑂𝐸 , 𝐶𝐸
2- 28C→I/O0…I/O7
Since 24C refers SCL: Serial Clock and SDA: Serial Data with respect I2C standard,
2- 41xx→D, Q
Each word is 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 1 0 0
identified with 1 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 1
the address
2 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 1 0
210=1024 (1K) :
words
:
Each word is 1021 1 1 1 1 1 1 1 1 0 1 0 1 0 1 1 0 0 1
8-bit wide
1022 1 1 1 1 1 1 1 1 1 0 1 1 1 0 0 1 0 0
1KByte 1023 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 0 1
memory
MAR 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 1 0 MDR
10 bit 8 bit
Example
Memory Address Memory
0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 1 0 0
1 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 1
2 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 1 0
1021 1 1 1 1 1 1 1 1 0 1 0 1 0 1 1 0 0 1
1022 1 1 1 1 1 1 1 1 1 0 1 1 1 0 0 1 0 0
1023 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 0 1
MAR 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 1 0 MDR
10 bit 8 bit
Relationship between MAR, MDR and Memory
Data
Address
MAR-MDR Example
Memory Access
Each memory location has a unique address
Address from an instruction is copied to the MAR which
finds the location in memory
CPU determines if it is a store or retrieval
Transfer takes place between the MDR and memory
MDR is a two way register
Data Bus
CPU Memory
Address Bus
Memory Access
For the microprocessor to access Data Bus
(Read or Write) information in
memory (RAM or ROM), it needs
to do the following:
Address Bus
Select the right memory chip
Memory
(using part of the address bus).
Identify the memory location
(using the rest of the address
bus).
Access the data (using the data SELECT READ/WRITE
bus).
Memory Access
NxM
NxM
Address Bus
CPU Memory 2
Memory 3
Memory Access
NxM
NxM
01 0001100011
Address Bus
CPU Memory 2
Memory 3
Memory Access
NxM
NxM
01 0001100011
Address Bus
CPU Memory 2
Memory 3
The Tri-State Buffer
An important circuit element that is used
extensively in memory.
This buffer is a logic circuit that has three states:
Logic 0, Logic 1, and high impedance.
When this circuit is in high impedance mode, it looks
as if it is disconnected from the output completely.
Enable Enable
The Basic Memory Element
The basic memory element is similar to a D
latch.
D Q(t+1)
Input 0 0
Output 1 1
Enable
Data Input Data Output
D Q
Enable
EN
The Basic Memory Element
Data is always present on the input and the output is
always set to the content of the latch.
Tri-state buffers are added at the input and output of
the latch.
WR RD
D Q
Data Input Data Output
Enable
EN
The Basic Memory Element
Data is always present on the input and the output is
always set to the content of the latch.
Tri-state buffers are added at the input and output of
the latch.
Data Bus
WR Control Bus RD
D Q
Data Input Data Output
Enable
EN
The Basic Memory Element
The WR signal controls the input buffer.
The bar over WR means that this is an active
low signal.
If WR is 0 the input data reaches the latch
input.
If WR is 1 the input of the latch looks like a
wire connected to nothing.
The RD signal controls the output in a similar
manner.
A Memory "Register"
If four latches are connected together, a 4-bit
memory register is obtained
I0 I1 I2 I3
WR
D D D D
Q Q Q Q
EN EN EN EN
Enable
RD
O0 O1 O2 O3
Memory Addressing
Using the RD and WR controls we
can determine the direction of I0 I1 I2 I3
flow either into or out of memory.
WR Input Buffers
Using the appropriate Enable input
we enable an individual memory EN0 Memory Register 0
R/W
I O I O I O I O
EN EN
EN0 EN EN
I O I O I O I O
EN EN EN EN
EN1
I O I O I O I O
EN EN EN EN
EN2
The Design of a Memory Chip
Data Bus Control Bus
Since we have tri-state
buffers on both the inputs WR RD
and outputs of the flip D Q
flops, we can actually use Data Input
Data Output
one set of pins only.
Enable
EN
WR Input Buffers
D0 D0
A D D0
Memory Reg. 0
d e A1 D1 A1 D1
A1 d c D1
Memory Reg. 1
r o
D2 D2
e d A0 A0
Memory Reg. 2 D2
A0 s e
s r D3 D3
Memory Reg. 3 D3
4x4 Memory
Memory Components
Decoder is a combinational circuit that converts
binary information from n-coded inputs to
maximum of 2n outputs
Data Bus
A2
Address Bus
A1
3 to 8
Decoder
A0
8x8 Memory
74HC138 2x8 Decoder Example
Two Dimensional Addressing
M
A0
3 to 8 decoder
A1 32X8 memory
A2
N arranged in 2D
configuration
A3
A4 2 to 4 decoder
Why?
Two Dimensional Addressing II
This arrangement is more economical than 5-
to-32 Decoder
Check the cost of 2-4 decoder and 3-8 decoder
D0
A0 D1
D2
A1 D3
E
Memory Read
Motorola 6802 example:
81