Unit -4 Address Decoding 2021-1
Unit -4 Address Decoding 2021-1
1K
8 bits
1. With a neat diagram, illustrate simple NAND gate address decoding logic.
2. Illustrate how a 3-8 line decoder could be used to interface eight 8K memory
chips.
3. Design an 8086 based system to interface with 2K byte EPROM. Assume
EPROM is connected at FF800h. Use NANG gate for address decoding
4. Design an 8086 based system to interface with 64K byte EPROM. Assume
EPROM is connected at 30000h. Use 74LS138 for address decoding.
5. Interface four 8 KB RAMS starting with an address of 6000H. Draw the
address decoder table and memory map. Use 74LS138 for address decoding.
6. Explain the memory bank selection in 8086.
7. Develop an I/O port decoder, using a 74ALS138 that generates low-bank I/O
strobes, for 8086, for the following 8-bit I/O port addresses: 10H, 12H, 14H,
16H, 18H, 1AH, 1CH, and 1EH.
8. Develop an I/O port decoder, using a 74ALS138 that generates high-bank I/O
strobes, for an 8086, for the following 8-bit I/O port addresses: 11H, 13H,
15H, 17H, 19H, 1BH, 1DH, and 1FH.
9. Differentiate between Memory mapped I/O and I/O mapped I/O.
ADDRESS DECODING
• WHY Decoding of address is necessary
― to attach a memory device to the microprocessor.
― It allows the microprocessor to address a single address within a
block of Memory or Input/ Output.
―It can access the data stored in the memory by specifying its address
―In 8086 has 20 address lines connections and the 2716 EPROM has
11 connections.
―The 8086 sends out a 20-bit memory address whenever it reads or
writes data
―Because the 2716 has only 11 address pins,
there is a mismatch that must be corrected
―The decoder corrects the mismatch by decoding address pins that
do not connect to the memory component.
00000H RAM
FFFFFH EROM
1. Design an 8086 based system to interface with 2K byte EPROM.
Use NAND gate for address decoding.
C B A
Memory Map 2K x 8 EPROM
A A A A A A A A A A A A A A A A A A A A
19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0
FF800H -TO
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
FFFFFH
( using calc to find no. of lines ln2000/ln2 = 10.9 =11 address lines)
i.e A10 to A0
The remaining nine address pins (A19–A11).
The decoder selects the EPROM from one of the 2K-byte sections of
Cont’d simple NAND gate decoder
When the 2K × 8 EPROM is used,
• address connections A10 to A1 of the 8086 are connected to address
inputs A10 to A0 of the EPROM.
• Decoding
• The remaining nine address pins (A19–A11) are connected to the inputs
of a NAND gate decoder
• In this circuit a NAND gate decodes the memory address
In this circuit , whenever the 8086 address pins attached to its input
are logic are’1’.
Output of NAND gate is logic ‘0’
The active low output of NAND gate decoder is connected to Chip
enable(CE) input pin enables the EPROM
The output enable OE pin is activated by the 8086 RD signal
When chip enable pin and output enable pin is logic 0
Then EPROM will read the data
Cont’d simple NAND gate decoder
• If the 20-bit binary address, decoded by the NAND
gate, is written so that the leftmost nine bits( A19-
A11) are 1s
• and the rightmost 11 bits (A0- A10) are don’t cares
(X), the actual address range of the EPROM can be
determined.
• a don’t care is a logic 1 or a logic 0, whichever is appropriate
• Example:
• 1111 1111 1xxx xxxx xxxx
• Or
• 1111 1111 1000 0000 0000 (FF800H) to
• 1111 1111 1111 1111 1111(FFFFFH)--
• The(211 ) 2K EPROM is decoded at memory address locations
FF800H–FFFFFH
The 3-to-8 Line Decoder Knowledge of IC
(74LS138)
a common integrated
circuit decoder found in
many systems is the
74LS138 3-to-8 line
decoder.
Knowledge of IC
• The truth table shows that only one of the eight outputs ever
goes low at any time.
• To be active, the G2A and G2B inputs must both be low (logic
0), and G1 must be high (logic 1).
1 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1
F0000H -TO F1FFFH
1 1 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1
F2000H to F3FFFH
ABC are input select lines which are connected to A13,A14,A15
G1= Input G1 is connected directly to A16.
G2B: When all three address inputs (A17 A18 A19) are high, the output of this
NAND gate goes low and enables input G2B of the 74LS138.
G2A is grounded.
EPROM
DECODER
Select lines
Enable
Inputs
Design
When the 8K × 8 EPROM is used,
• Address connections A12–A0 of the 8086 are connected to address
inputs A12–A0 of the EPROM.
• The remaining nine address pins (A19–A13) are connected to the
inputs of 3-8 line decoder
8K x 8 EPROM.
= 23 x 1K = 23 x 210 = 213 B
Required EPROM is 64KB hence 8KB eight is required
Therefore address lines required is13 line i.e A12 to A0
A19 toA13 are connected to 3-8 line decoder 74138
ABC are input select lines which are connected to A13,A14,A15
G1= Input G1 is connected directly to A16.
G2B: When all three address inputs (A17 A18 A19) are high, the
output of this NAND gate goes low and enables input G2B of the
74LS138.
G2A is grounded.
Basic 8086 Memory Interface
Physical Memory System
Example (16 bit microprocessor)
High Bank Low Bank
(odd bank) (even bank)
FFFFFF FFFFFE
FFFFFD FFFFFC
FFFFFA
ECE291
FFFFFB
8 bits
8 bits
000005 000004
000003 000002
000001 000000
D15 - D8 D7- D0
0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
06000H -TO 07FFFH 1st chip select
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
• Memory Map
06000H – 07FFFH----------- 1st chip select
08000H – 09FFFH----------- 2nd chip select
0A000H – 0BFFFH----------- 3rd chip select
0C000H – 0DFFFH----------- 4th chip select
Decoder
A12- A1
Decoder 74134
MRD
CS2
Y4 CS1 RD
MWR
WR
Y3 MRD A12- A0
RD A12- A0 A12- A1
MWR WR
A13 A
D15- D0
A14 B
A12- A1
A15 C Y6
y5 CS4 MRD
CS3 RD
MRD WR MWR
y0 A12- A0 A12- A1 A12- A0
A16 G1 MWR
RD
GND GA Y1 WR
y2
D15- D0
GB y7
A17
A18
A19
D9-D15
A1-A16
A1-A16
A0
I/O Port Address Decoding
I/O INTERFACE
The I/O Instructions
•The instruction set contains a type of instruction that transfers
information to an I/O device (OUT) from microprocessor ( write
operation)
•Another to read information from an I/O device to microprocessor
(IN).
2 IN and OUT transfer data between the Memory-mapped I/O does not use the IN, or
microprocessor’s accumulator or memory OUTS instructions, but it uses All memory
and the I/O device. instructions are use Eg: MOV AX, N1
A7 A6 A5 A4 A3 A2 A1 A0
1 1 1 1 0 1 0 0
A7 A6 A5 A4 A3 A2 A1 A0
1 1 1 1 0 0 0 1
Figure 11–10
shows a 74ALS138 decoder that decodes 8-bit I/O ports F0H - F7H.
Identical to a memory address decoder except it is only connect address
bits A7–A0
to the inputs of the decoder
Logic 0
Q2.Develop an I/O port decoder, using a 74ALS138 that generates low-bank I/O strobes, for
8086, for the following 8-bit I/O port addresses: 10H, 12H, 14H, 16H, 18H, 1AH, 1CH, and 1EH.
Sol.
1EH:
A7 A6 A5 A4 A3 A2 A1 A0
0 0 0 1 1 1 1 0
1CH :
A7 A6 A5 A4 A3 A2 A1 A0
0 0 0 1 1 1 0 0
1AH:
A7 A6 A5 A4 A3 A2 A1 A0
0 0 0 1 1 0 1 0
18H
Connected To NAND to GB2 G1 GA2 gnd C B A
A7 A6 A5 A4 A3 A2 A1 A0
0 0 0 1 1 0 0 0
16H
A7 A6 A5 A4 A3 A2 A1 A0
0 0 0 1 0 1 1 0
14H:
A7 A6 A5 A4 A3 A2 A1 A0
0 0 0 1 0 1 0 0
12H:
A7 A6 A5 A4 A3 A2 A1 A0
0 0 0 1 0 0 1 0
11H:
A7 A6 A5 A4 A3 A2 A1 A0
0 0 0 1 0 0 0 1
A7 A6 A5 A4 A3 A2 A1 A0 Output Address of
G1 G2A C B A numbe the port.
G2B r
0 0 0 1 0 0 0 1 1 11H
0 0 0 1 0 0 1 0 2 12H
0 0 0 1 0 1 0 0 4 14H
0 0 0 1 0 1 1 0 6 16H
G2A
0 0 0 1 0 0 0 0 18H
1
G2A
0 0 0 1 0 1 0 2 1AH
1
G2A
0 0 0 1 1 0 0 4 1CH
1
G2A
0 0 0 1 1 1 0 6 1EH
A0 A1 A2 A3 A4 A5 A6 A7
A
11H
Y1
B 12H
C Y2
Y4
14H
Y6 16H
GA2
GB2
G1
G1
18H
Y0
GB2 Y2 1AH
GA2 1CH
Y4
Y6 1EH
A
B