L10 Memory Interfacing
L10 Memory Interfacing
Microprocessor
Memory Interfacing
Introduction
A0
D0
RAM
DM-1
AN-1
WE
CS OE
3
Why Active Low Control Signals?
o The stray capacitances of the control pins can get charged from
noise voltages, and this may cause the signals to cross the
threshold of ‘high’ level as defined for TTL
o Thus, if the control signals are active high, it may cause wrong
triggering
o On the other hand, an active low signal trigger will happen only
when the line is pulled low deliberately by the controller
4
Address Decoding (not 8086 specific)
Lower 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Address
Upper Address 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1
7
Address Decoding (not 8086 specific)
1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1
8
Address Decoding Concept
9
Address Decoding Using Block Decoders: 74LS138
o A very popular decoder is the 3 to 8 decoder (74LS138)
o The output lines are active low and depending on the selection inputs,
one output line will be low Inputs Outputs
Enable Select
G1 G2 C B A Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7
A L X X X X H H H H H H H H
Select
B Y0 X H X X X H H H H H H H H
Inputs Y1
C H L L L L L H H H H H H H
Y2
Y3 H L L L H H L H H H H H H
74LS138 Y4 H L L H L H H L H H H H H
Y5
H L L H H H H H L H H H H
G2A Y6
Enable Y7 H L H L L H H H H L H H H
Inputs G2B
H L H L H H H H H H L H H
G1
H L H H L H H H H H H L H
10
H L H H H H H H H H H H L
Address Decoding Using Block Decoders: 74LS139
o 74LS139 is a dual 2 to 4-line decoder
o The output lines are active low
Inputs Outputs
1A 1Y0
Select
1B 1Y1 Channel-1 Enabl Select
Inputs e
1Y2 Outputs
Enable
1E 1Y3 E B A Y0 Y1 Y2 Y3
Input
74LS139 H X X H H H H
H L L L H H H
2Y0
2A H L H H L H H
Select 2Y1 Channel-2
2B H H L H H L H
Inputs 2Y2 Outputs
Enable
2E 2Y3 H H H H H H L
Input Decoding Table
11
Address Decoding Using Block Decoders: 74LS138
A10
A11 RAM
A12 D0 – D 7
1K x 8
A13
A14
A15 CS
A16
A17
A18
A19
A19 A18 A17 A16 A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0
Lower 0 0 0 0 0 0 0 0 0 0
Address
Upper Address 1 1 1 1 1 1 1 1 1 1
12
Address Decoding Using Block Decoders: 74LS138
A10
A11 RAM
A12 D0 – D 7
1K x 8
A13
A14
A15 CS
A16
A17
A18
A19
A19 A18 A17 A16 A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0
Lower 0 1 1 0 0 0 0 0 0 0 0 0 0
Address
Upper Address 0 1 1 1 1 1 1 1 1 1 1 1 1
13
Address Decoding Using Block Decoders: 74LS138
A10
A11 RAM
A12 D0 – D 7
1K x 8
A13
A14
A15 CS
A16
A17
A18
A19
A19 A18 A17 A16 A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0
Lower 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 0 0 0 0 0
Address
Upper Address 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1
14
Address Range: 0xFEC00 to 0xFE7FF
Address Decoding Using Block Decoders: 74LS138
RAM D0 – D 7
A19 A0 – A15 64K x 8
CS
For ROM
A19 A18 A17 A16 A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0
Lower 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Address
Upper Address 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
15
Address Decoding Using Block Decoders: 74LS138
RAM D0 – D 7
A19 A0 – A15 64K x 8
CS
For ROM
A19 A18 A17 A16 A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0
Lower 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Address
Upper Address 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16
Address Decoding Using Block Decoders: 74LS138
RAM D0 – D 7
A19 A0 – A15 64K x 8
CS
For ROM
A19 A18 A17 A16 A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0
Lower 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Address
Upper Address 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
17
Address Range: 0x90000 to 0x9FFFF
Address Decoding Using Block Decoders: 74LS138
RAM D0 – D 7
A19 A0 – A15 64K x 8
CS
For RAM
A19 A18 A17 A16 A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0
Lower 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Address
Upper Address 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
18
Address Decoding Using Block Decoders: 74LS138
RAM D0 – D 7
A19 A0 – A15 64K x 8
CS
For RAM
A19 A18 A17 A16 A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0
Lower 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Address
Upper Address 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
19
Address Decoding Using Block Decoders: 74LS138
RAM D0 – D 7
A19 A0 – A15 64K x 8
CS
For RAM
A19 A18 A17 A16 A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0
Lower 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Address
Upper Address 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
20
Address Range: 0xC0000 to 0xCFFFF
Partial Address Decoding
RAM ROM
8K x 8 8K x 8
CS CS
A13
A14
For RAM
A19 A18 A17 A16 A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0
X X X X X 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
X X X X X 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1
RAM ROM
8K x 8 8K x 8
CS CS
A13
A14
For ROM
A19 A18 A17 A16 A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0
X X X X X 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0
X X X X X 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
RAM-2 RAM-1
1Kx8 1Kx8
D7 – D 0 D7 – D 0
D15 – D8 D7 – D 0
SODIMM Module
29
Case 1 (Discrete memory with each location 1
Byte)
1 Byte
Address from Address from
processor perspectivememory perspective
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
Memory
30
Case 2 (Discrete memory with each location 2
Bytes)
2 Bytes
Address from Address from
processor perspectivememory perspective
0 0
2 1
4 2
6 3
8 4
10 5
12 6
14 7
Memory
31
Case 2 (Discrete memory with each location 2
Bytes)
2 Bytes
Address from
memory perspective
0
1
2
3
From processor perspective, 4
this is address 0 5
6
7
Memory
32
Case 2 (Discrete memory with each location 2
Bytes)
2 Bytes
Address from
memory perspective
0
1
2
3
and this is address 1 4
5
6
7
Memory
33
Case 3 (2 Discrete memories with each location 1 Byte concatenated)
1 Byte 1 Byte
Address from Address from Address from Address from
proc pers Mem pers proc pers Mem pers
1 0 0 0
3 1 2 1
5 2 4 2
7 3 6 3
9 4 8 4
11 5 10 5
13 6 12 6
15 7 14 7
Memory 2 Memory 1
D15 – D8 D7 – D 0
Data Bus (D15 – D0) 34
34
Address Bus to 16-bit discrete memory from
Processor
2 Bytes
A0
A12-A1
Processor
39
8086 Memory Interfacing
41
Memory Banks
HIGH/ODD Bank LOW/EVEN Bank
1 Byte 1 Byte
1 0 0 0
3 1 2 1
5 2 4 2
7 3 6 3
9 4 8 4
11 5 10 5
13 6 12 6
15 7 14 7
D15 – D8 D7 – D 0
48
8086 Example Memory interface
A0
Address
Decoder
(A19 – A16)
CS CS
RAM RAM
32Kx8 32Kx8
(A19 – A0) (A15 – A1) (A15 – A1)
(Odd (Even
Bank) Bank)
52
Example Case
o Now write the address mapping in binary
ROM1: 0000H – 00FFFH
A1 A1 A1 A1 A1 A1 A1 A1 A1 A1 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0
9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1
RAM1: 08000H – 08FFFH
A1 A1 A1 A1 A1 A1 A1 A1 A1 A1 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0
9 8 7 6 5 4 3 2 1 0
0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 1 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1
RAM2: 09000H – 09FFFH
A1 A1 A1 A1 A1 A1 A1 A1 A1 A1 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0
9 8 7 6 5 4 3 2 1 0
0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 53
0
0 0 0 0 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1
Example Case
o Now using decoder generate the enable signals
BHE A0
S ROM1 ROM1E
O0
A16 A E
L O1 ROM1O
A15 B E
A12 C RAM1 RAM1E
C T O2
A1 A0 A1
A17 CS A0
A18 CS
A19
G1
7
A12 C 4 A0
BHE
A15 B 1
3 3
A16 A 2
8
0
G2A G2B
55
A13 A14
Decoder using discrete gates Even memory Bank
Odd memory Bank
RAM2O RAM2E
RAM1O
ROM1O RAM1E
A11 A10 D15 –D8 A11 ROM1E
D7 –D0
A10
A16 2K
A17 2K
A18 A0 A1
A1
A19
X0
CS A0
CS
A13
A14
A12 RO1
A0
A15
BHE
ROM1
A12 RA1
A15 RAM1
RAM2
A12 RA2
A15 56
Example Case
Memory Requirements
o 128K of ROM from 00000H
o 128K of ROM from E0000H
o Rest of the address for RAM
Chips available:
o 64 KB ROM chip 4 nos.
o 128 KB RAM chip 6 nos.
o LS138 2 nos.
Use Absolute Addressing
Only System Bus Signals available
57
Example Case
Check number of Chips
128K ROM starting from 00000H 2 ROM chips
128K ROM starting from E0000H 2ROM chips
Total 4 ROM chips and enough chips are available
ROM-1 End address 00000H + 128K-1 = 1FFFFH
ROM-2 Start address E0000H
Memory in between = C0000H
Number of RAM chips required = C0000KB/128KB = 6 (3 sets of even
and odd. Each set is 256 KBytes)
ROM-2 End address = E0000H+128K-1 = FFFFFH
That is the end of system memory space. So, no RAM after that
58
Total 6 RAM chips and enough of chips are available
Example Case
Address mapping
59
Example Case
Address mapping
ROM1: 00000H – 1FFFFH
A1 A1 A1 A1 A1 A1 A1 A1 A1 A1 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0
9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
60
Example Case
Address mapping
RAM1: 20000H – 5FFFFH
A1 A1 A1 A1 A1 A1 A1 A1 A1 A1 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0
9 8 7 6 5 4 3 2 1 0
0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
A1 A1 A1 A1 A1 A1 A1 A1 A1 A1 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0
9 8 7 6 5 4 3 2 1 0
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
62
Example Case
Address mapping
RAM3: C0000H – FFFFFH
A1 A1 A1 A1 A1 A1 A1 A1 A1 A1 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0
9 8 7 6 5 4 3 2 1 0
1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
o It is possible that some I/O peripheral has the same address as that
of a memory (ROM/RAM)
o So blindly generating CS only based on address may cause issue
o We should also check whether processor is accessing memory or IO
o Based on the memory read/write signals are generated
64
Example Case
Generation of Control signals
M/IO
IORD
RD
WR IOWR
BHE MEMRD_O
MEMRD
A0 MEMRD_E
BHE MEMWR_O
MEMWR
A0 MEMWR_E
65
Example Case
Generation of Chip Select
A18
A19
RAM1
RAM2
Vcc
66
Example Case
Generation of Chip Select
A18
A19 ROM1
RAM1
RAM2
ROM2
Vcc
67
WR’ RD’ WR’ RD’
WR’ RD’ WR’ RD’
D7 –D0
A18 A16 A15 D15 –D8 A16 A15
A19
ROM2O
ROM2E
ROM1
ROM1O
ROM1E
A17
64K 64K
A0 BHE
ROM2
A1 A0 CS’ A1 A0 CS’
CS’ CS’
Vcc
WR’ RD’ WR’ RD’
WR’ RD’ RD’
A18
WR’
D7 –D0
A17 A16 A17 A16
RAM2E
A19 D15 –D8
RAM1E
RAM2O
RAM1O
RAM1
RAM2
A0 BHE 128
128 K
A1 AK
0
CS’ A1 A0 CS’
CS’ CS’
Vcc
Example Case
69
Thank you
any questions
70