memory interfacing

180
Memory Interfacing ECE 511: Digital System & Microprocessor

Upload: morse

Post on 16-Jan-2016

115 views

Category:

Documents


2 download

DESCRIPTION

Memory Interfacing. ECE 511: Digital System & Microprocessor. What we will learn in this session:. Review several important aspects of memory access. Buffering and its importance in a M68k system. Types of memory. How to design a Memory Address Decoder: Full addressing Partial addressing. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Memory Interfacing

Memory Interfacing

ECE 511: Digital System & Microprocessor

Page 2: Memory Interfacing

What we will learn in this session:

Review several important aspects of memory access.

Buffering and its importance in a M68k system. Types of memory. How to design a Memory Address Decoder:

Full addressing Partial addressing

Page 3: Memory Interfacing

M68k & Memory

M68k has limited space to store data & instructions:8 x Data registers.1 x Instruction Register.

Not enough for practical applications. Memory expands storage space:

Stores instructions & data in memory.

Page 4: Memory Interfacing

M68k & Memory

M68k has 24-bit (23 + 1) address bus:Can address 224 locations.16,777,216 locations (16 MB).Can store much more data, instructions.

Page 5: Memory Interfacing

Bus Buffering

Page 6: Memory Interfacing

Bus Buffering

The system bus consists of:Address bus: A1 – A23Data bus: D0 – D15Control bus: BERR, VPA, CLK, R/W, etc..

Page 7: Memory Interfacing

Bus Buffering

System bus is connected to all components in µP system:Memory: RAM, ROM. I/O devices: keyboard, mouse, display card.Storage devices: HDD, CD-ROM drive.

Page 8: Memory Interfacing

Block Diagram

Parallel I/O Serial I/OInterrupt

Circuit

Timing CPU Memory

System Bus = Data Bus + Address Bus + Control Bus

Page 9: Memory Interfacing

Fan-Out All connected devices drain current from

M68k. If too many devices connected, M68k fan-

out overloaded:Causes unreliable input/output.Fan-out specified by manufacturer.

Page 10: Memory Interfacing

Fan-Out: Normal Situation

Address Bus (M68k fan-out limit = 3.2mA)

Device #2

Device #3

Device #4

Device #1

-0.8

mA

-0.8

mA

-0.8

mA

-0.8

mA

Page 11: Memory Interfacing

Fan-Out: Overloaded Situation

Address Bus (M68k fan-out limit = 3.2mA)

Device #2

Device #3

Device #4

Device #5

Device #1

Device #6

-0.8

mA

-0.8

mA

-0.8

mA

-0.8

mA

-0.8

mA

-0.8

mA

Page 12: Memory Interfacing

Bus Buffering

Increases M68k fan-out limit by attaching high-current buffer to system bus. Can connect more devices.

Common buffers: 74LS244 unidirectional buffer: can transfer data in

one direction only. 74LS245 bidirectional buffer: can transfer data in both

directions. Each IC can buffer 8 lines only.

Page 13: Memory Interfacing

Address Bus Buffering

A1 – A8(FOL = 3.2mA)

A9 – A16(FOL = 3.2mA)

A10 – A23(FOL = 3.2mA)

M68k

A1 – A8(FOL = 24mA)

A9 – A16(FOL = 24mA)

A10 – A23(FOL = 24mA)

To devices

To devices

To devices

74LS244

74LS244

74LS244

Page 14: Memory Interfacing

Data Bus Buffering

To devices

To devices

74LS245

74LS245D0-D8

(FOL = 3.2mA)

D9-D16(FOL = 3.2mA)

D0-D8(FOL = 24mA)

D9-D16(FOL = 24mA)

M68k

R/W

DIR

DIR

If R/W = 1, direction into M68k,If R/W = 0, direction to devices.

Page 15: Memory Interfacing

Buffering in M68k System

Parallel I/O Serial I/OInterrupt

Circuit

Timing CPU Memory

System Bus = Data Bus + Address Bus + Control Bus

74LS244 74LS245

Page 16: Memory Interfacing

Bus Buffering

All pins in M68k need to be buffered:Address bus: buffered using 74LS244.Data bus: buffered using 74LS245.Control bus: buffered using

74LS244/74LS245: If unidirectional, use 74LS244. If bidirectional, use 74LS245.

Page 17: Memory Interfacing

M68k Pin-Out

CLK

DTACK

HALT

RESET

VPA

BERR

VMA

E

FC0

FC1

FC2 LDS

R/W

UDS

AS

A1-A23

D0-D15

IPL0

BR

BG

BGACK

IPL2

IPL1

+5V

GND GND

VCC VCC

68000Processor Status

6800 Peripheral Control

System Control

Data Bus

Address Bus

Asynchronous Bus Control

Bus Arbitration Control

Interrupt Control

*A0 is used inside 68k

Page 18: Memory Interfacing

Designing with Available Memories

Page 19: Memory Interfacing

Types of Memory

Typically, M68k systems are designed with 2 types of memory:EPROM: Erasable Programmable Read-Only

Memory.SRAM: Static Random Access Memory.

To design a memory system, it’s important to know the name and size of chip.

Page 20: Memory Interfacing

Typical EPROM Chips

Part Size Address Lines

2716 2kB 11

2732 4kB 12

2764 8kB 13

27128 16kB 14

27256 32kB 15

27512 64kB 16

Page 21: Memory Interfacing

Typical SRAM Chips

Part Size Address Lines

6116 2kB 11

6264 8kB 13

62256 32kB 15

Page 22: Memory Interfacing

Typical EPROM Chips2716 EPROM 27512 EPROM

Page 23: Memory Interfacing

Typical SRAM Chips2716 EPROM 62256 SRAM

Page 24: Memory Interfacing

Characteristics

ROM chips have OE* (output enable) and CS* (chip select).

RAM chips have E* (enable), CS* (chip select), and WE* (write enable).

To activate a RAM/ROM chip, both OE*/E* and CS* must be active.

Page 25: Memory Interfacing

Characteristics

OE*/E* is connected to UDS*/LDS*. CS* is connected to Memory Address

Decoder. WE* is connected to R/W* pin on M68k.

If R/W* = 1, read from memory. If R/W* = 0, write to memory.

Page 26: Memory Interfacing

D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D12 D13 D14 D15

D0

D1

D2

D3

D4

D5

D6

D7

CS

D0

D1

D2

D3

D4

D5

D6

D7

CS

WE

Memory Address Decoder

AS

LDS

R/W

WER/W

UDS

Address Bus

OE

OE

Chip #2

Chip #1

*Chip activated only when OE and CS are active.

Page 27: Memory Interfacing

Memory Decoding

Page 28: Memory Interfacing

Memory Decoding

Method to access data in memory. Enables/disables certain chips based on

data required. Done using special circuit – Memory

Address Decoder (MAD).

Page 29: Memory Interfacing

Memory Address Decoder (MAD)

Special circuit. Connected to address bus. Activates specific memory chips based on

address pattern in address bus. 2 methods to design:

Full address decoding (FAD)Partial address decoding (PAD)

Page 30: Memory Interfacing

D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D12 D13 D14 D15

D0

D1

D2

D3

D4

D5

D6

D7

CS

D0

D1

D2

D3

D4

D5

D6

D7

CS

WE

Memory Address Decoder

AS

LDS

R/W

WER/W

UDS

Address Bus

OE

OE

Chip #2

Chip #1

*Chip activated only when OE and CS are active.

Page 31: Memory Interfacing

Full Address Decoding

Uses all available address lines to design decoder:All 23 lines used for addressing/decoding.

Since all lines used, decoder circuit design is more complex.

Used in systems with large memory.

Page 32: Memory Interfacing

Partial Address Decoding

Uses only uses a few address lines to design decoder: Some lines are not connected to decoder circuit.

Typically used in systems with smaller memory. Decoder circuit design is simple, but hard to

expand if more memory needs to be added later.

Page 33: Memory Interfacing

Full Address Decoding Example

512kBRAM

512kBRAM

LDS

CS CS E E

UDS

A1

– A

19

A1

– A

19

D8

– D

15

D0

– D

7

SEL

A23

A22

A21

A20

AS

EVEN ODD

MAD

*All address lines used – A1 A23A20 A23 for MADA1 A19 for addressing

Page 34: Memory Interfacing

Partial Address Decoding Example

SELROM

LDSUDS

2kBROM

2kBROM

CS CSOE OE

A1

– A

11

A1

– A

11

D8

– D

15

D0

– D

7

SELRAM

2kBRAM

2kBRAM

CS CSE E

A1

– A

11

A1

– A

11

D8

– D

15

D0

– D

7

LDSUDS

A12

AS

MAD

*Not all address lines used:A12 for MADA1 A11 for addressing

Page 35: Memory Interfacing

Comparison between FAD and PAD

Partial Address DecoderFull Address Decoder

Address lines used

Uses only a part of address lines for addressing

or decoding. The rest ignored.

Uses all lines for addressing or decoding.

MAD circuitLess complex circuit, since

only a few address lines are used.

More complex circuit, since need to use all address lines.

When to useWhen M68k system has

small memory requirements.

When the M68k system is large and requires a lot

of memory.

UpgradeDifficult to upgrade, requires

complete redesign of decoder.

Easy to upgrade, extra memory can be added with little modifications

to original decoder.

Page 36: Memory Interfacing

Full Address Decoder Design

Page 37: Memory Interfacing

Full Address Decoder Design

Determine available information. Determine the required number of address

lines. Set base address. Determine lower address range. Determine upper address range. Design decoder. Draw memory block diagram.

Page 38: Memory Interfacing

Example #1

Page 39: Memory Interfacing

Example #1

512kWords (1024 kB) of RAM needs to be interfaced to a 68k-based system, The base address is $400000. Design the decoder circuit.

Page 40: Memory Interfacing

Step 1: Determine Available Information Three things must be determined:

How much memory to interface.Base address of memory.How many chips need to be used.

Page 41: Memory Interfacing

Step 1: Determine Available Information 1024 kB need to be interfaced:

RAM needs to be interfaced. 2 chips used.512kB for even address (UDS), 512kB for odd

address (LDS). Base address is $400000.

Page 42: Memory Interfacing

Step 1: Determine Available Information

1024 kB (512 kWords)

Chip #1 (512 kB)

(even addresses)

Chip #2 (512 kB)

(odd addresses)

* Controlled by UDS * Controlled by LDS

Page 43: Memory Interfacing

Step 2: Determine Number of Required Address Lines Determines how many address lines need

to be used by one chip. Use the following formula:

2log

log

10

10 yx y = storage size of one chip (kB)x = number of reserved lines

Page 44: Memory Interfacing

Step 2: Determine Number of Required Address Lines Each chip contains 512,000 memory

locations:Needs 19 address lines.

000,5122 x

000,512log2log 1010 x

1997.183010.0

7093.5

2log

000,512log

10

10 x

*Always round to higher.

Page 45: Memory Interfacing

Step 3: Allocate Address Line

Address lines allocated based on Step 2. Start with A1. Fill with don’t cares (X).

Page 46: Memory Interfacing

Step 3: Allocate Address Line

A23 A22 A21 A20 A19

X

A18

X

A17

X

A16

X

A15

X

A14

X

A13

X

A12

X

A11

X

A10

X

A9

X

A8

X

A7

X

A6

X

A5

X

A4

X

A3

X

A2

X

A1

X

A0

UDS/LDS(reserved)

19 lines allocated

Page 47: Memory Interfacing

Step 4: Set Base Address

Set base address using the remaining address lines.

Page 48: Memory Interfacing

Step 4: Set Base Address

A23

0

A22

1

A21

0

A20

0

A19

X

A18

X

A17

X

A16

X

A15

X

A14

X

A13

X

A12

X

A11

X

A10

X

A9

X

A8

X

A7

X

A6

X

A5

X

A4

X

A3

X

A2

X

A1

X

A0

UDS/LDS(reserved)

4

* Base address is $400000

Page 49: Memory Interfacing

Step 5: Determine Lower Address Range Replace all don’t cares and A0 with zeros. Should get the same base address as

question.

Page 50: Memory Interfacing

Step 5: Determine Lower Address Range

A23

0

A22

1

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

A14

0

A13

0

A12

0

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

0

A3

0

A2

0

A1

0

A0

0

4

A23

0

A22

1

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

A14

0

A13

0

A12

0

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

0

A3

0

A2

0

A1

0

A0

0

4 0 0 0 0 0

Lower range: $400000

Fill with zeros

Page 51: Memory Interfacing

Step 6: Determine Upper Address Range Replace all don’t cares and A0 with ones. This determines the upper limit of the

memory chip address.

Page 52: Memory Interfacing

Step 6: Determine Upper Address Range

A23

0

A22

1

A21

0

A20

0

A19

1

A18

1

A17

1

A16

1

A15

1

A14

1

A13

1

A12

1

A11

1

A10

1

A9

1

A8

1

A7

1

A6

1

A5

1

A4

1

A3

1

A2

1

A1

1

A0

1

4Fill with ones

A23

0

A22

1

A21

0

A20

0

A19

1

A18

1

A17

1

A16

1

A15

1

A14

1

A13

1

A12

1

A11

1

A10

1

A9

1

A8

1

A7

1

A6

1

A5

1

A4

1

A3

1

A2

1

A1

1

A0

1

4 F F F F F

Upper range: $4FFFFF

Page 53: Memory Interfacing

Step 7: Design Decoder using Remaining Addresses The decoder must be designed so that

only the specific bit combinations in the base address can generate a zero on CS (output).

Typically uses NAND gate. AS must be included together in decoder.

Page 54: Memory Interfacing

Step 7: Design Decoder using Remaining Addresses

A23

0

A22

1

A21

0

A20

0

4 NAND

A23

A22

A21

A20

AS

CS

Page 55: Memory Interfacing

Actual Implementation

512kBRAM

512kBRAM

LDS

CS CS E E

UDS

A1

– A

19

A1

– A

19

D8

– D

15

D0

– D

7

CS

MAD

NAND

A23

A22

A21

A20

AS

EVEN ODD

WE WE

R/W

Page 56: Memory Interfacing

Step 8: Draw Memory Block Diagram Memory block diagram shows assignment

of memory addresses. Begins at $000000, ends at $FFFFFF. Mark the locations where memory has

been interfaced.

Page 57: Memory Interfacing

Memory Block Diagram

unused

Interfaced with M68k (1024 kB RAM)

unused

$FFFFFF

$000000

$400000

$4FFFFF

(Lower Range)

(Upper Range)

Page 58: Memory Interfacing

Example #2

Page 59: Memory Interfacing

Example #2

8k Words (16 kB) of ROM needs to be interfaced to a 68k-based system, so that the base ROM address is at $AE0000. Determine the address range and design the decoder circuit.

Page 60: Memory Interfacing

Step 1: Determine Available Information 8 kWords (16kB) need to be interfaced:

2 chips need to be used.8kB for even address, 8kB for odd address.

Base address is $AE0000.

Page 61: Memory Interfacing

Step 2: Determine Number of Required Address Lines Each chip contains 8,000 (8kB) memory

locations:Needs 13 address lines.

80002 x

8000log2log 1010 x

1397.123010.0

9031.3

2log

8000log

10

10 x*Always round to higher.

Page 62: Memory Interfacing

Step 3: Allocate Address Line

A23 A22 A21 A20 A19 A18 A17 A16 A15 A14 A13

X

A12

X

A11

X

A10

X

A9

X

A8

X

A7

X

A6

X

A5

X

A4

X

A3

X

A2

X

A1

X

A0

UDS/LDS(reserved)

13 lines allocated

Page 63: Memory Interfacing

Step 4: Set Base Address

A23

1

A22

0

A21

1

A20

0

A19

1

A18

1

A17

1

A16

0

A15

0

A14

0

A13

X

A12

X

A11

X

A10

X

A9

X

A8

X

A7

X

A6

X

A5

X

A4

X

A3

X

A2

X

A1

X

A0

UDS/LDS(reserved)

A E Unused, fill with zeros

Page 64: Memory Interfacing

Step 5: Determine Lower Address Range

A23

1

A22

0

A21

1

A20

0

A19

1

A18

1

A17

1

A16

0

A15

0

A14

0

A13

0

A12

0

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

0

A3

0

A2

0

A1

0

A0

0

A EFill with zeros

A23

1

A22

0

A21

1

A20

0

A19

1

A18

1

A17

1

A16

0

A15

0

A14

0

A13

0

A12

0

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

0

A3

0

A2

0

A1

0

A0

0

A E 0 0 0 0

Lower range: $AE0000

Page 65: Memory Interfacing

Step 6: Determine Upper Address Range

A23

1

A22

0

A21

1

A20

0

A19

1

A18

1

A17

1

A16

0

A15

0

A14

0

A13

1

A12

1

A11

1

A10

1

A9

1

A8

1

A7

1

A6

1

A5

1

A4

1

A3

1

A2

1

A1

1

A0

1

A EFill with ones

A23

1

A22

0

A21

1

A20

0

A19

1

A18

1

A17

1

A16

0

A15

0

A14

0

A13

1

A12

1

A11

1

A10

1

A9

1

A8

1

A7

1

A6

1

A5

1

A4

1

A3

1

A2

1

A1

1

A0

1

A E 3 F F F

Upper range: $AE3FFF

Page 66: Memory Interfacing

Step 7: Design Decoder using Remaining Addresses

A23

1

A22

0

A21

1

A20

0

A19

1

A18

1

A17

1

A16

0

A15

0

A14

0

A ENAND

A23

A22

A21

A20

A19

A18

A17

A16

OR

A15

A14

AS

CS

Page 67: Memory Interfacing

Why can’t we do it like this?

NAND

A23

A22

A21

A20

A19

A18

A17

A16

A15

A14

AS

CS

Correct, but 11-input NAND gate doesn’t exist (max = 8).

A23

1

A22

0

A21

1

A20

0

A19

1

A18

1

A17

1

A16

0

A15

0

A14

0

A E

Page 68: Memory Interfacing

Memory Block Diagram

unused

Interfaced with M68k (16 kB ROM)

unused

$FFFFFF

$000000

$AE0000

$AE3FFF

Page 69: Memory Interfacing

Actual Implementation

NAND

A23

A22

A21

A20

A19

A18

A17

A16

OR

A15

A14

AS

CS

MAD

8kBROM

8kBROM

LDS

CS CSOE OE

UDS

A1

– A

13

A1

– A

13

D8

– D

15

D0

– D

7

Page 70: Memory Interfacing

Example #3

Page 71: Memory Interfacing

Example #3

Show how 32kB of EPROM and 32kB of SRAM can be interfaced to the M68k to implement a system containing 64kB of ROM commencing at location $C00000 and 32kW of RAM commencing at location $300000.

Page 72: Memory Interfacing

Step 1: Determine Available Information 64 kB of ROM & 32kW of RAM need to be

interfaced:4 chips need to be used.32kB for even ROM, 32kB for odd ROM.32kB for even RAM, 32kB for odd ROM.

ROM base address is $C00000. SRAM base address is $300000.

Page 73: Memory Interfacing

Step 2(a): Determine Number of Required Address Lines for ROM Each ROM chip contains 32,000 memory

locations:Needs 15 address lines.

000,322 x

000,32log2log 1010 x

1597.143010.0

5051.4

2log

000,32log

10

10 x*Always round to higher.

Page 74: Memory Interfacing

Step 2(b): Determine Number of Required Address Lines for RAM Each RAM chip contains 32,000 memory

locations:Needs 15 address lines.

000,322 x

000,32log2log 1010 x

1597.143010.0

5051.4

2log

000,32log

10

10 x*Always round to higher.

Page 75: Memory Interfacing

Step 3: Allocate Address Line

A23 A22 A21 A20 A19 A18 A17 A16 A15

X

A14

X

A13

X

A12

X

A11

X

A10

X

A9

X

A8

X

A7

X

A6

X

A5

X

A4

X

A3

X

A2

X

A1

X

A0

UDS/LDS(reserved)

15 lines allocated

A23 A22 A21 A20 A19 A18 A17 A16 A15

X

A14

X

A13

X

A12

X

A11

X

A10

X

A9

X

A8

X

A7

X

A6

X

A5

X

A4

X

A3

X

A2

X

A1

X

A0

UDS/LDS(reserved)

15 lines allocated

ROM

RAM

Page 76: Memory Interfacing

Step 4: Set Base Address

A23

1

A22

1

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

X

A14

X

A13

X

A12

X

A11

X

A10

X

A9

X

A8

X

A7

X

A6

X

A5

X

A4

X

A3

X

A2

X

A1

X

A0

UDS/LDS(reserved)

15 lines allocated

A23

0

A22

0

A21

1

A20

1

A19

0

A18

0

A17

0

A16

0

A15

X

A14

X

A13

X

A12

X

A11

X

A10

X

A9

X

A8

X

A7

X

A6

X

A5

X

A4

X

A3

X

A2

X

A1

X

A0

UDS/LDS(reserved)

15 lines allocated

ROM

RAM

C 0

3 0

Page 77: Memory Interfacing

Step 5(a): Determine Lower Address Range (ROM)

A23

1

A22

1

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

A14

0

A13

0

A12

0

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

0

A3

0

A2

0

A1

0

A0

0

C 0Fill with zeros

ROM Lower range: $C00000

A23

1

A22

1

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

A14

0

A13

0

A12

0

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

0

A3

0

A2

0

A1

0

A0

0

C 0 0 0 0 0

Page 78: Memory Interfacing

Step 5(b): Determine Lower Address Range (RAM)

A23

0

A22

0

A21

1

A20

1

A19

0

A18

0

A17

0

A16

0

A15

0

A14

0

A13

0

A12

0

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

0

A3

0

A2

0

A1

0

A0

0

3 0Fill with zeros

RAM Lower range: $300000

A23

0

A22

0

A21

1

A20

1

A19

0

A18

0

A17

0

A16

0

A15

0

A14

0

A13

0

A12

0

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

0

A3

0

A2

0

A1

0

A0

0

3 0 0 0 0 0

Page 79: Memory Interfacing

Step 6(a): Determine Upper Address Range (ROM)

A23

1

A22

1

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

1

A14

1

A13

1

A12

1

A11

1

A10

1

A9

1

A8

1

A7

1

A6

1

A5

1

A4

1

A3

1

A2

1

A1

1

A0

1

C 0Fill with ones

ROM upper range: $C0FFFF

A23

1

A22

1

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

1

A14

1

A13

1

A12

1

A11

1

A10

1

A9

1

A8

1

A7

1

A6

1

A5

1

A4

1

A3

1

A2

1

A1

1

A0

1

C 0 F F F F

Page 80: Memory Interfacing

Step 6(b): Determine Upper Address Range (RAM)

A23

0

A22

0

A21

1

A20

1

A19

0

A18

0

A17

0

A16

0

A15

1

A14

1

A13

1

A12

1

A11

1

A10

1

A9

1

A8

1

A7

1

A6

1

A5

1

A4

1

A3

1

A2

1

A1

1

A0

1

3 0Fill with ones

RAM upper range: $30FFFF

A23

0

A22

0

A21

1

A20

1

A19

0

A18

0

A17

0

A16

0

A15

1

A14

1

A13

1

A12

1

A11

1

A10

1

A9

1

A8

1

A7

1

A6

1

A5

1

A4

1

A3

1

A2

1

A1

1

A0

1

3 0 F F F F

Page 81: Memory Interfacing

Step 7(a): Design Decoder using Remaining Addresses (ROM)

A23

1

A22

1

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

C 0

ROMSEL

NAND

A23

A22

A21

A20

A19

A18

A17

A16

ORAS

Page 82: Memory Interfacing

Step 7(b): Design Decoder using Remaining Addresses (RAM)

A23

0

A22

0

A21

1

A20

1

A19

0

A18

0

A17

0

A16

0

3 0

RAMSEL

NAND

A23

A22

A21

A20

A19

A18

A17

A16

ORAS

Page 83: Memory Interfacing

Actual Implementation

ROMSEL

MAD

LDSUDS

32kBROM

32kBROM

CS CSOE OE

A1

– A

15

A1

– A

15

D8

– D

15

D0

– D

7

NAND

OR

AS

NAND

A23

A22

A21

A20

A19

A18

A17

A16

OR

RAMSEL

32kBRAM

32kBRAM

CS CSE E

A1

– A

15

A1

– A

15

D8

– D

15

D0

– D

7

LDSUDS

R/W

Page 84: Memory Interfacing

Memory Block Diagram

unused

Interfaced with M68k (RAM)

unused

$FFFFFF

$000000

$300000

$30FFFF

Interfaced with M68k (ROM)$C00000

$C0FFFF

unused

Page 85: Memory Interfacing

Example #4

Page 86: Memory Interfacing

Example #4

Design an address decoding network to satisfy the following memory map:RAM1: $000000 - $00FFFF.RAM2: $010000 - $01FFFF. I/O1: $E00000 - $E0001F. I/O2: $E00000 - $E0002F.

Page 87: Memory Interfacing

Determine Available Information

2 RAM and 2 I/O locations need to be interfaced.

Memory address range already given:Start of base address not given.Start of required address lines not given.Have to determine by examining memory

range.

Page 88: Memory Interfacing

Memory Block Diagram

unused

Interfaced with M68k (RAM2)$010000

$01FFFF

Interfaced with M68k (RAM1)$000000

$00FFFF

Interfaced with M68k (I/O1)$E00000

$E0001F

Interfaced with M68k (I/O2)$E00020

$E0003F

unused

unused

unused

$FFFFFF

Page 89: Memory Interfacing

RAM1 Address Range

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

A14

0

A13

0

A12

0

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

0

A3

0

A2

0

A1

0

A0

0

0 0

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

1

A14

1

A13

1

A12

1

A11

1

A10

1

A9

1

A8

1

A7

1

A6

1

A5

1

A4

1

A3

1

A2

1

A1

1

A0

1

0 0 F F F F

* Required address lines: A1 A15, Decoder address lines: A16 A23

0 0 0 0

Page 90: Memory Interfacing

RAM1 Decoder A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

0 0

ASA16

A17

A18

A19

A20

A21

A22

A23

RAM1SEL

Page 91: Memory Interfacing

RAM2 Address Range

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

0

A16

1

A15

0

A14

0

A13

0

A12

0

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

0

A3

0

A2

0

A1

0

A0

0

0 1

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

0

A16

1

A15

1

A14

1

A13

1

A12

1

A11

1

A10

1

A9

1

A8

1

A7

1

A6

1

A5

1

A4

1

A3

1

A2

1

A1

1

A0

1

0 1 F F F F

* Required address lines: A1 A15, Decoder address lines: A16 A23

0 0 0 0

Page 92: Memory Interfacing

RAM2 Decoder A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

0

A16

1

0 1

ASA16

A17

A18

A19

A20

A21

A22

A23

RAM2SEL

Page 93: Memory Interfacing

I/O1 Address Range

A23

1

A22

1

A21

1

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

A14

0

A13

0

A12

0

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

0

A3

0

A2

0

A1

0

A0

0

E 0

A23

1

A22

1

A21

1

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

A14

0

A13

0

A12

0

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

1

A3

1

A2

1

A1

1

A0

1

E 0 0 0 1 F

* Required address lines: A1 A4, Decoder address lines: A5 A23

0 0 0 0

Page 94: Memory Interfacing

I/O1 Decoder

A23

A23

1

A22

1

A21

1

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

A14

0

A13

0

A12

0

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

E 0 00 0

IO1SEL

A23A22A21

A20A19A18A17A16A15A14

A13

A12A11A10A9A8A7A6A5

AS

Page 95: Memory Interfacing

I/O2 Address Range

A23

1

A22

1

A21

1

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

A14

0

A13

0

A12

0

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

1

A4

0

A3

0

A2

0

A1

0

A0

0

E 0

A23

1

A22

1

A21

1

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

A14

0

A13

0

A12

0

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

1

A4

1

A3

1

A2

1

A1

1

A0

1

E 0 0 0 3 F

* Required address lines: A1 A4, Decoder address lines: A5 A23

0 0 2 0

Page 96: Memory Interfacing

I/O2 Decoder

A23

A23

1

A22

1

A21

1

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

A14

0

A13

0

A12

0

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

1

E 0 00 0

A6

IO2SEL

A23A22A21

A20A19A18A17A16A15A14

A13

A12A11A10A9A8A7

ASA5

Page 97: Memory Interfacing

Example #5

Page 98: Memory Interfacing

Example 5

A 256kB RAM memory is composed of sixteen 16kB RAM chips. The address ranges for the RAM chips are as follows: 00000 to 07FFF 08000 to 0FFFF 10000 to 17FFF 18000 to 1FFFF 20000 to 27FFF 28000 to 2FFFF 30000 to 37FFF 38000 to 3FFFF

Use the 74LS138 to design the memory address decoder.

Page 99: Memory Interfacing

74LS138 3-8 Line Decoder

E1

A0

A1

O0

O1

O2

O3

O4

O5

O6

O7

E2

E3

A2

Page 100: Memory Interfacing

E1 I0I1 O3 O0O1O2

1 XX 1 111

X XX 1 111

X XX 1 111

0 00 1 011

0 10 1 101

E2

X

1

X

0

0

E3

X

X

0

1

1

I2

X

X

X

0

0

O7 O4O5O6

1 111

1 111

1 111

1 111

1 111

0 01 1 1100 1 0 1 111

0 11 0 1110 1 0 1 111

0 00 1 111

0 10 1 111

0

0

1

1

1

1

1 011

1 101

0 01 1 1110 1 1 1 110

0 11 1 1110 1 1 0 11174LS

138

Tru

th T

able

Page 101: Memory Interfacing

RAM1: 00000 to 07FFF

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

A14

0

A13

0

A12

0

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

0

A3

0

A2

0

A1

0

A0

0

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

A14

1

A13

1

A12

1

A11

1

A10

1

A9

1

A8

1

A7

1

A6

1

A5

1

A4

1

A3

1

A2

1

A1

1

A0

1

0 0 0 0 0 0

0 0 7 F F F

Page 102: Memory Interfacing

RAM2: 08000 to 0FFFF

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

1

A14

0

A13

0

A12

0

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

0

A3

0

A2

0

A1

0

A0

0

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

1

A14

1

A13

1

A12

1

A11

1

A10

1

A9

1

A8

1

A7

1

A6

1

A5

1

A4

1

A3

1

A2

1

A1

1

A0

1

0 0 8 0 0 0

0 0 F F F F

Page 103: Memory Interfacing

RAM3: 10000 to 17FFF

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

0

A16

1

A15

0

A14

0

A13

0

A12

0

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

0

A3

0

A2

0

A1

0

A0

0

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

0

A16

1

A15

0

A14

1

A13

1

A12

1

A11

1

A10

1

A9

1

A8

1

A7

1

A6

1

A5

1

A4

1

A3

1

A2

1

A1

1

A0

1

0 1 0 0 0 0

0 1 7 F F F

Page 104: Memory Interfacing

RAM4: 18000 to 1FFFF

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

0

A16

1

A15

1

A14

0

A13

0

A12

0

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

0

A3

0

A2

0

A1

0

A0

0

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

0

A16

1

A15

1

A14

1

A13

1

A12

1

A11

1

A10

1

A9

1

A8

1

A7

1

A6

1

A5

1

A4

1

A3

1

A2

1

A1

1

A0

1

0 1 8 0 0 0

0 1 F F F F

Page 105: Memory Interfacing

RAM5: 20000 to 27FFF

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

1

A16

0

A15

0

A14

0

A13

0

A12

0

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

0

A3

0

A2

0

A1

0

A0

0

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

1

A16

0

A15

0

A14

1

A13

1

A12

1

A11

1

A10

1

A9

1

A8

1

A7

1

A6

1

A5

1

A4

1

A3

1

A2

1

A1

1

A0

1

0 2 0 0 0 0

0 2 7 F F F

Page 106: Memory Interfacing

RAM6: 28000 to 2FFFF

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

1

A16

0

A15

1

A14

0

A13

0

A12

0

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

0

A3

0

A2

0

A1

0

A0

0

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

1

A16

0

A15

1

A14

1

A13

1

A12

1

A11

1

A10

1

A9

1

A8

1

A7

1

A6

1

A5

1

A4

1

A3

1

A2

1

A1

1

A0

1

0 2 8 0 0 0

0 2 F F F F

Page 107: Memory Interfacing

RAM7: 30000 to 37FFF

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

1

A16

1

A15

0

A14

0

A13

0

A12

0

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

0

A3

0

A2

0

A1

0

A0

0

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

1

A16

1

A15

0

A14

1

A13

1

A12

1

A11

1

A10

1

A9

1

A8

1

A7

1

A6

1

A5

1

A4

1

A3

1

A2

1

A1

1

A0

1

0 3 0 0 0 0

0 3 7 F F F

Page 108: Memory Interfacing

RAM7: 38000 to 3FFFF

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

1

A16

1

A15

1

A14

0

A13

0

A12

0

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

0

A3

0

A2

0

A1

0

A0

0

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

1

A16

1

A15

1

A14

1

A13

1

A12

1

A11

1

A10

1

A9

1

A8

1

A7

1

A6

1

A5

1

A4

1

A3

1

A2

1

A1

1

A0

1

0 3 8 0 0 0

0 3 F F F F

Page 109: Memory Interfacing

RAM1 – RAM8

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

0 0 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

Goes to decoder input(I0,I1,I2)

Goes to activate Decoder (E1,E2,E3)

Page 110: Memory Interfacing

E1 I0I1 O3 O0O1O2

1 XX 1 111

X XX 1 111

X XX 1 111

0 00 1 011

0 10 1 101

E2

X

1

X

0

0

E3

X

X

0

1

1

I2

X

X

X

0

0

O7 O4O5O6

1 111

1 111

1 111

1 111

1 111

0 01 1 1100 1 0 1 111

0 11 0 1110 1 0 1 111

0 00 1 111

0 10 1 111

0

0

1

1

1

1

1 011

1 101

0 01 1 1110 1 1 1 110

0 11 1 1110 1 1 0 11174LS

138

Tru

th T

able

Page 111: Memory Interfacing

MAD Design

AS

A16

SELRAM1

SELRAM2

SELRAM3

SELRAM4

SELRAM5

SELRAM6

SELRAM7

SELRAM8

A17

A23A22

A21

A20

A19

A18

A15

E1

E2

E3

I0

I1

I2

O0

O1

O2

O3

O4

O5

O6

O7

74LS138

Page 112: Memory Interfacing

Designing A Partial Address Decoder

Page 113: Memory Interfacing

Design Steps

Determine available information. Determine the required number of address lines. Set base address. Determine lower address range. Determine upper address range. Find unique pattern. Design Decoder. Draw memory block diagram.

Page 114: Memory Interfacing

Example #1

M68k needs to be interfaced with 4kW of memory (2kW EPROM, 2kW RAM). The ROM base address is $1000 and the RAM base address is $3000. Design the Partial Address Decoder.

Page 115: Memory Interfacing

Step 1: Determine Available Information 4kW of memory needs to be interfaced:

2kW ROM = 2 x 2kB EPROM2kW RAM = 2 x 2kB RAM4 chips need to be interfaced.

Starting address $1000 (ROM), $3000 (RAM).

Page 116: Memory Interfacing

Step 2: Determine Number of Required Address Lines (RAM & ROM)

Each chip contains 2,000 memory locations:Needs 11 address lines.

000,22 x

000,2log2log 1010 x

1197.103010.0

3010.3

2log

000,2log

10

10 x*Always round to higher.

Page 117: Memory Interfacing

Step 3: Allocate Address Line

A23 A22 A21 A20 A19 A18 A17 A16 A15 A14 A13 A12 A11

X

A10

X

A9

X

A8

X

A7

X

A6

X

A5

X

A4

X

A3

X

A2

X

A1

X

A0

UDS/LDS(reserved)

11 lines allocated

ROM

A23 A22 A21 A20 A19 A18 A17 A16 A15 A14 A13 A12 A11

X

A10

X

A9

X

A8

X

A7

X

A6

X

A5

X

A4

X

A3

X

A2

X

A1

X

A0

UDS/LDS(reserved)

11 lines allocated

RAM

Page 118: Memory Interfacing

Step 4: Set Base Address

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

A14

0

A13

0

A12

1

A11

X

A10

X

A9

X

A8

X

A7

X

A6

X

A5

X

A4

X

A3

X

A2

X

A1

X

A0

UDS/LDS(reserved)

ROM

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

A14

0

A13

1

A12

1

A11

X

A10

X

A9

X

A8

X

A7

X

A6

X

A5

X

A4

X

A3

X

A2

X

A1

X

A0

UDS/LDS(reserved)

RAM

0 0 1

0 0 3

Page 119: Memory Interfacing

Step 5: Determine Lower Address Range

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

A14

0

A13

0

A12

1

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

0

A3

0

A2

0

A1

0

A0

0

ROM

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

A14

0

A13

1

A12

1

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

0

A3

0

A2

0

A1

0

A0

0

RAM

0 0 1

0 0 3

0 0 0

0 0 0

Page 120: Memory Interfacing

Step 6: Determine Upper Address Range

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

A14

0

A13

0

A12

1

A11

1

A10

1

A9

1

A8

1

A7

1

A6

1

A5

1

A4

1

A3

1

A2

1

A1

1

A0

1

ROM

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

A14

0

A13

1

A12

1

A11

1

A10

1

A9

1

A8

1

A7

1

A6

1

A5

1

A4

1

A3

1

A2

1

A1

1

A0

1

RAM

0 0 1

0 0 3

F F F

F F F

Page 121: Memory Interfacing

Step 7: Find Unique Pattern

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

A14

0

A13

0

A12

1

A11

X

A10

X

A9

X

A8

X

A7

X

A6

X

A5

X

A4

X

A3

X

A2

X

A1

X

A0

ROM

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

A14

0

A13

1

A12

1

A11

X

A10

X

A9

X

A8

X

A7

X

A6

X

A5

X

A4

X

A3

X

A2

X

A1

X

A0

RAM

Page 122: Memory Interfacing

Step 8: Design Decoder CircuitTo select ROM, A13 = 0, and AS = 0.To select RAM, A13 = 1, and AS = 0

A13

AS

SELROM

SELRAM

A13 AS SELROM SELRAM

0 0 0 1

0 1 1 1

1 0 1 0

1 1 1 1

A13

AS

0 1

0

1

0 1

11

SELROM

A13

AS

0 1

0

1

1 0

11

SELRAM

Page 123: Memory Interfacing

Actual Implementation

SELROM

MAD

LDSUDS

2kBROM

2kBROM

CS CSOE OE

A1

– A

11

A1

– A

11

D8

– D

15

D0

– D

7

SELRAM

2kBRAM

2kBRAM

CS CSE E

A1

– A

11

A1

– A

11

D8

– D

15

D0

– D

7

LDSUDS

A13

AS

WE WE

R/W

Page 124: Memory Interfacing

Example #2

Page 125: Memory Interfacing

Example #2

64kB RAM and 32kB ROM need to be interfaced with a M68k-system. The ROM starting address is $400000. The RAM starting address is $FF0000. Design the decoder using partial addressing method.

Page 126: Memory Interfacing

Step 1: Determine Available Information 96kB of memory needs to be interfaced:

32kB ROM = 2 x 16kB EPROM64kB RAM = 2 x 32kB RAM4 chips need to be interfaced.

Starting address $400000 (ROM), $FF0000 (RAM).

Page 127: Memory Interfacing

Step 2a: Determine Number of Required Address Lines (RAM) Each chip contains 32,000 memory

locations:Needs 15 address lines.

000,322 x

000,32log2log 1010 x

1597.143010.0

5051.4

2log

000,32log

10

10 x

*Always round to higher.

Page 128: Memory Interfacing

Step 2b: Determine Number of Required Address Lines (ROM) Each chip contains 16,000 memory

locations:Needs 14 address lines.

000,162 x

000,16log2log 1010 x

1496.133010.0

2041.4

2log

000,16log

10

10 x

*Always round to higher.

Page 129: Memory Interfacing

Step 3: Allocate Address Line

A23 A22 A21 A20 A19 A18 A17 A16 A15 A14

X

A13

X

A12

X

A11

X

A10

X

A9

X

A8

X

A7

X

A6

X

A5

X

A4

X

A3

X

A2

X

A1

X

A0

UDS/LDS(reserved)

14 lines allocated

ROM

A23 A22 A21 A20 A19 A18 A17 A16 A15

X

A14

X

A13

X

A12

X

A11

X

A10

X

A9

X

A8

X

A7

X

A6

X

A5

X

A4

X

A3

X

A2

X

A1

X

A0

UDS/LDS(reserved)

15 lines allocated

RAM

Page 130: Memory Interfacing

Step 4: Set Base Address

A23

0

A22

1

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

A14

X

A13

X

A12

X

A11

X

A10

X

A9

X

A8

X

A7

X

A6

X

A5

X

A4

X

A3

X

A2

X

A1

X

A0

UDS/LDS(reserved)

ROM

A23

1

A22

1

A21

1

A20

1

A19

1

A18

1

A17

1

A16

1

A15

X

A14

X

A13

X

A12

X

A11

X

A10

X

A9

X

A8

X

A7

X

A6

X

A5

X

A4

X

A3

X

A2

X

A1

X

A0

UDS/LDS(reserved)

RAM

4 0

F F

Page 131: Memory Interfacing

Step 5: Determine Lower Address Range

A23

0

A22

1

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

A14

0

A13

0

A12

0

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

0

A3

0

A2

0

A1

0

A0

0

ROM

A23

1

A22

1

A21

1

A20

1

A19

1

A18

1

A17

1

A16

1

A15

0

A14

0

A13

0

A12

0

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

0

A3

0

A2

0

A1

0

A0

0

RAM

4 0 0

F F 0

0 0 0

0 0 0

Page 132: Memory Interfacing

Step 6: Determine Upper Address Range

A23

0

A22

1

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

A14

1

A13

1

A12

1

A11

1

A10

1

A9

1

A8

1

A7

1

A6

1

A5

1

A4

1

A3

1

A2

1

A1

1

A0

1

ROM

A23

1

A22

1

A21

1

A20

1

A19

1

A18

1

A17

1

A16

1

A15

1

A14

1

A13

1

A12

1

A11

1

A10

1

A9

1

A8

1

A7

1

A6

1

A5

1

A4

1

A3

1

A2

1

A1

1

A0

1

RAM

4 0 7

F F F

F F F

F F F

Page 133: Memory Interfacing

Step 7: Find Unique Pattern

A23

0

A22

1

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

A14

1

A13

1

A12

1

A11

1

A10

1

A9

1

A8

1

A7

1

A6

1

A5

1

A4

1

A3

1

A2

1

A1

1

A0

1

ROM

A23

1

A22

1

A21

1

A20

1

A19

1

A18

1

A17

1

A16

1

A15

1

A14

1

A13

1

A12

1

A11

1

A10

1

A9

1

A8

1

A7

1

A6

1

A5

1

A4

1

A3

1

A2

1

A1

1

A0

1

RAM

4 0 7

F F F

F F F

F F F

Page 134: Memory Interfacing

Step 8: Design Decoder CircuitTo select ROM, A23 = 0, and AS = 0.To select RAM, A23 = 1, and AS = 0

A23

AS

SELROM

SELRAM

Page 135: Memory Interfacing

Actual Implementation

SELROM

MAD

LDSUDS

16kBROM

16kBROM

CS CSOE OE

A1

– A

14

A1

– A

14

D8

– D

15

D0

– D

7

SELRAM

32kBRAM

32kBRAM

CS CSE E

A1

– A

15

A1

– A

15

D8

– D

15

D0

– D

7

LDSUDS

A23

AS

R/W

Page 136: Memory Interfacing

Example #3

Page 137: Memory Interfacing

Example #3

A small system need to interface memory to a 68k-based system. The address ranges are:ROM: $0000 - $07FFRAM: $2000 – $2FFF I/O: $A000 - $A7FF

Design the memory address decoder using Partial Addressing method.

Page 138: Memory Interfacing

Step 1: Determine Available Information 3 types of memory locations need to be

decoded. Memory size not given. Address range given:

ROM: $0000 - $07FFRAM: $2000 – $2FFF I/O: $A000 - $A7FF

Page 139: Memory Interfacing

Step 2a: Determine Number of Required Address Lines (ROM)

A15

0

A14

0

A13

0

A12

0

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

0

A3

0

A2

0

A1

0

A0

0

0 0 0 0

0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1

0 7 F F

Lower Range

UpperRange

0 0 0 0 0 X X X X X X X X X X XTo Decoder

Page 140: Memory Interfacing

Step 2b: Determine Number of Required Address Lines (RAM)

A15

0

A14

0

A13

1

A12

0

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

0

A3

0

A2

0

A1

0

A0

0

2 0 0 0

0 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1

2 F F F

Lower Range

UpperRange

0 0 1 0 X X X X X X X X X X X XTo Decoder

Page 141: Memory Interfacing

Step 2c: Determine Number of Required Address Lines (I/O)

A15

1

A14

0

A13

1

A12

0

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

0

A3

0

A2

0

A1

0

A0

0

A 0 0 0

1 0 1 0 0 1 1 1 1 1 1 1 1 1 1 1

A 7 F F

Lower Range

UpperRange

1 0 1 0 0 X X X X X X X X X X XTo Decoder

Page 142: Memory Interfacing

Step 7: Find Unique Pattern

0 0 0 0 0 X X X X X X X X X X XROM

0 0 1 0 X X X X X X X X X X X XRAM

1 0 1 0 0 X X X X X X X X X X XI/O

A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0

0 0

0 1

1 1

X X

0

0

0

1

A15 A13 AS

SELROM

SELRAM

SELIO

All Disabled

Page 143: Memory Interfacing

Step 8: Design Decoder Circuit

0 0

0 1

1 1

X X

0

0

0

1

A15 A13 AS

SELROM = 0 (activated)

SELRAM = 0 (activated)

SELIO = 0 (activated)

All Disabled

Output

A15

A13

AS

A15

A13

AS

A15

A13

AS

SELROM

SELRAM

SELIO

Page 144: Memory Interfacing

Example #4

Page 145: Memory Interfacing

Example #4

A M68k system needs to be built with the following specifications:EPROM: 4kB needed, start address $1000.SRAM: 2kB needed, start address $2000. I/O: 2kB needed, start address $3000.

Design the decoder using partial address decoding.

Page 146: Memory Interfacing

Step 1: Determine Available Information 8kB of memory needs to be interfaced:

4 kB ROM = 2 x 2kB ROM.2 kB RAM = 2 x 1kB RAM2 kB I/O = 2 x 1kB I/O6 chips need to be interfaced.

Starting address $1000 (ROM), $2000 (RAM), $3000 (I/O).

Page 147: Memory Interfacing

Step 2a: Determine Number of Required Address Lines (ROM) Each chip contains 2,000 memory

locations:Needs 11 address lines.

000,22 x

000,2log2log 1010 x

1197.103010.0

3010.3

2log

000,2log

10

10 x*Always round to higher.

Page 148: Memory Interfacing

Step 2b: Determine Number of Required Address Lines (RAM) Each chip contains 1,000 memory

locations:Needs 10 address lines.

000,12 x

000,1log2log 1010 x

1097.93010.0

3

2log

000,1log

10

10 x

*Always round to higher.

Page 149: Memory Interfacing

Step 2c: Determine Number of Required Address Lines (I/O) Each chip contains 1,000 memory

locations:Needs 10 address lines.

000,12 x

000,1log2log 1010 x

1097.93010.0

3

2log

000,1log

10

10 x

*Always round to higher.

Page 150: Memory Interfacing

Step 3a: Allocate Address Lines (ROM)

A23 A22 A21 A20 A19 A18 A17 A16 A15 A14 A13 A12 A11

X

A10

X

A9

X

A8

X

A7

X

A6

X

A5

X

A4

X

A3

X

A2

X

A1

X

A0

UDS/LDS(reserved)

11 lines allocated

ROM

Page 151: Memory Interfacing

Step 3b: Allocate Address Lines (RAM)

A23 A22 A21 A20 A19 A18 A17 A16 A15 A14 A13 A12 A11 A10

X

A9

X

A8

X

A7

X

A6

X

A5

X

A4

X

A3

X

A2

X

A1

X

A0

UDS/LDS(reserved)

10 lines allocated

ROM

Page 152: Memory Interfacing

Step 3c: Allocate Address Lines (I/O)

A23 A22 A21 A20 A19 A18 A17 A16 A15 A14 A13 A12 A11 A10

X

A9

X

A8

X

A7

X

A6

X

A5

X

A4

X

A3

X

A2

X

A1

X

A0

UDS/LDS(reserved)

10 lines allocated

ROM

Page 153: Memory Interfacing

Step 4a: Set Base Address (ROM)

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

A14

0

A13

0

A12

1

A11

X

A10

X

A9

X

A8

X

A7

X

A6

X

A5

X

A4

X

A3

X

A2

X

A1

X

A0

UDS/LDS(reserved)

ROM

0 0 1

Page 154: Memory Interfacing

Step 4b: Set Base Address (RAM)

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

A14

0

A13

1

A12

0

A11

0

A10

X

A9

X

A8

X

A7

X

A6

X

A5

X

A4

X

A3

X

A2

X

A1

X

A0

UDS/LDS(reserved)

ROM

0 0 2

Page 155: Memory Interfacing

Step 4c: Set Base Address (I/O)

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

A14

0

A13

1

A12

1

A11

0

A10

X

A9

X

A8

X

A7

X

A6

X

A5

X

A4

X

A3

X

A2

X

A1

X

A0

UDS/LDS(reserved)

ROM

0 0 3

Page 156: Memory Interfacing

Step 5a: Determine Lower Address Range (ROM)

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

A14

0

A13

0

A12

1

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

0

A3

0

A2

0

A1

0

A0

0

ROM

0 0 1 0 0 0

Page 157: Memory Interfacing

Step 5b: Determine Lower Address Range (RAM)

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

A14

0

A13

1

A12

0

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

0

A3

0

A2

0

A1

0

A0

0

RAM

0 0 2 0 0 0

Page 158: Memory Interfacing

Step 5c: Determine Lower Address Range (I/O)

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

A14

0

A13

1

A12

1

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

0

A3

0

A2

0

A1

0

A0

0

I/O

0 0 3 0 0 0

Page 159: Memory Interfacing

Step 6a: Determine Upper Address Range (ROM)

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

A14

0

A13

0

A12

1

A11

1

A10

1

A9

1

A8

1

A7

1

A6

1

A5

1

A4

1

A3

1

A2

1

A1

1

A0

1

ROM

0 0 1 F F F

Page 160: Memory Interfacing

Step 6b: Determine Upper Address Range (RAM)

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

A14

0

A13

1

A12

0

A11

0

A10

1

A9

1

A8

1

A7

1

A6

1

A5

1

A4

1

A3

1

A2

1

A1

1

A0

1

RAM

0 0 2 7 F F

Page 161: Memory Interfacing

Step 6c: Determine Upper Address Range (I/O)

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

A14

0

A13

1

A12

1

A11

0

A10

1

A9

1

A8

1

A7

1

A6

1

A5

1

A4

1

A3

1

A2

1

A1

1

A0

1

I/O

0 0 3 7 F F

Page 162: Memory Interfacing

Step 7: Find Unique Pattern

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

A14

0

A13

0

A12

1

A11

X

A10

X

A9

X

A8

X

A7

X

A6

X

A5

X

A4

X

A3

X

A2

X

A1

X

A0

ROM

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

A14

0

A13

1

A12

0

A11

0

A10

X

A9

X

A8

X

A7

X

A6

X

A5

X

A4

X

A3

X

A2

X

A1

X

A0

RAM

A23

0

A22

0

A21

0

A20

0

A19

0

A18

0

A17

0

A16

0

A15

0

A14

0

A13

1

A12

1

A11

0

A10

X

A9

X

A8

X

A7

X

A6

X

A5

X

A4

X

A3

X

A2

X

A1

X

A0

I/O

Page 163: Memory Interfacing

Step 8: Design Decoder Circuit

A13

0

A12

1

1 0

1 1

ROM

RAM

I/O

AS*

0

0

0

1X X

A13

A12

AS*

A13

A12

AS*

A13

A12

AS*

SELROM*

SELRAM*

SELIO*

Page 164: Memory Interfacing

Example #5

Page 165: Memory Interfacing

Example #5

Use PAD to design the decoder for these memory ranges: RAM1: $108000 to $1087FF RAM2: $108800 to $108FFF RAM3: $109000 to $1097FF RAM4: $109800 to $109FFF RAM5: $10A000 to $10A7FF RAM6: $10A800 to $108FFF RAM7: $10B000 to $1087FF RAM8: $10B800 to $108FFF

Page 166: Memory Interfacing

RAM1: 108000 to 1087FF

A23

0

A22

0

A21

0

A20

1

A19

0

A18

0

A17

0

A16

0

A15

1

A14

0

A13

0

A12

0

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

0

A3

0

A2

0

A1

0

A0

0

A23

0

A22

0

A21

0

A20

1

A19

0

A18

0

A17

0

A16

0

A15

1

A14

0

A13

0

A12

0

A11

0

A10

1

A9

1

A8

1

A7

1

A6

1

A5

1

A4

1

A3

1

A2

1

A1

1

A0

1

1 0 8 0 0 0

1 0 8 7 F F

Page 167: Memory Interfacing

RAM2: 108800 to 108FFF

A23

0

A22

0

A21

0

A20

1

A19

0

A18

0

A17

0

A16

0

A15

1

A14

0

A13

0

A12

0

A11

1

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

0

A3

0

A2

0

A1

0

A0

0

A23

0

A22

0

A21

0

A20

1

A19

0

A18

0

A17

0

A16

0

A15

1

A14

0

A13

0

A12

0

A11

1

A10

1

A9

1

A8

1

A7

1

A6

1

A5

1

A4

1

A3

1

A2

1

A1

1

A0

1

1 0 8 8 0 0

1 0 8 F F F

Page 168: Memory Interfacing

RAM3: 109000 to 1097FF

A23

0

A22

0

A21

0

A20

1

A19

0

A18

0

A17

0

A16

0

A15

1

A14

0

A13

0

A12

1

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

0

A3

0

A2

0

A1

0

A0

0

A23

0

A22

0

A21

0

A20

1

A19

0

A18

0

A17

0

A16

0

A15

1

A14

0

A13

0

A12

1

A11

0

A10

1

A9

1

A8

1

A7

1

A6

1

A5

1

A4

1

A3

1

A2

1

A1

1

A0

1

1 0 9 0 0 0

1 0 9 7 F F

Page 169: Memory Interfacing

RAM4: 109800 to 109FFF

A23

0

A22

0

A21

0

A20

1

A19

0

A18

0

A17

0

A16

0

A15

1

A14

0

A13

0

A12

1

A11

1

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

0

A3

0

A2

0

A1

0

A0

0

A23

0

A22

0

A21

0

A20

1

A19

0

A18

0

A17

0

A16

0

A15

1

A14

0

A13

0

A12

1

A11

1

A10

1

A9

1

A8

1

A7

1

A6

1

A5

1

A4

1

A3

1

A2

1

A1

1

A0

1

1 0 9 8 0 0

1 0 9 F F F

Page 170: Memory Interfacing

RAM5: 10A000 to 10A7FF

A23

0

A22

0

A21

0

A20

1

A19

0

A18

0

A17

0

A16

0

A15

1

A14

0

A13

1

A12

0

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

0

A3

0

A2

0

A1

0

A0

0

A23

0

A22

0

A21

0

A20

1

A19

0

A18

0

A17

0

A16

0

A15

1

A14

0

A13

1

A12

0

A11

0

A10

1

A9

1

A8

1

A7

1

A6

1

A5

1

A4

1

A3

1

A2

1

A1

1

A0

1

1 0 A 0 0 0

1 0 A 7 F F

Page 171: Memory Interfacing

RAM6: 10A800 to 10AFFF

A23

0

A22

0

A21

0

A20

1

A19

0

A18

0

A17

0

A16

0

A15

1

A14

0

A13

1

A12

0

A11

1

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

0

A3

0

A2

0

A1

0

A0

0

A23

0

A22

0

A21

0

A20

1

A19

0

A18

0

A17

0

A16

0

A15

1

A14

0

A13

1

A12

0

A11

1

A10

1

A9

1

A8

1

A7

1

A6

1

A5

1

A4

1

A3

1

A2

1

A1

1

A0

1

1 0 A 8 0 0

1 0 A F F F

Page 172: Memory Interfacing

RAM7: 10B000 to 10B7FF

A23

0

A22

0

A21

0

A20

1

A19

0

A18

0

A17

0

A16

0

A15

1

A14

0

A13

1

A12

1

A11

0

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

0

A3

0

A2

0

A1

0

A0

0

A23

0

A22

0

A21

0

A20

1

A19

0

A18

0

A17

0

A16

0

A15

1

A14

0

A13

1

A12

1

A11

0

A10

1

A9

1

A8

1

A7

1

A6

1

A5

1

A4

1

A3

1

A2

1

A1

1

A0

1

1 0 B 0 0 0

1 0 B 7 F F

Page 173: Memory Interfacing

RAM8: 10B800 to 10BFFF

A23

0

A22

0

A21

0

A20

1

A19

0

A18

0

A17

0

A16

0

A15

1

A14

0

A13

1

A12

1

A11

1

A10

0

A9

0

A8

0

A7

0

A6

0

A5

0

A4

0

A3

0

A2

0

A1

0

A0

0

A23

0

A22

0

A21

0

A20

1

A19

0

A18

0

A17

0

A16

0

A15

1

A14

0

A13

1

A12

1

A11

1

A10

1

A9

1

A8

1

A7

1

A6

1

A5

1

A4

1

A3

1

A2

1

A1

1

A0

1

1 0 B 8 0 0

1 0 B F F F

Page 174: Memory Interfacing

Step 7: Find Unique Pattern0 0 0 1 0 0 0 0 1 0 0 0 0

0 0 0 1 0 0 0 0 1 0 0 0 1

0 0 0 1 0 0 0 0 1 0 0 1 0

0 0 0 1 0 0 0 0 1 0 0 1 1

0 0 0 1 0 0 0 0 1 0 1 0 0

0 0 0 1 0 0 0 0 1 0 1 0 1

0 0 0 1 0 0 0 0 1 0 1 1 0

0 0 0 1 0 0 0 0 1 0 1 1 1

RAM1

RAM2

RAM3

RAM4

RAM5

RAM6

RAM7

RAM8

Page 175: Memory Interfacing

Step 8: Design Decoder Circuit

0 0 0

0 0 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

RAM1

RAM2

RAM3

RAM4

RAM5

RAM6

RAM7

RAM8

A13A12A11AS*

SELRAM1*

A13A12A11AS*

SELRAM2*

A13A12A11AS*

SELRAM3*

A13A12A11 SELRAM4*

AS*

A13A12A11AS*

SELRAM5*

A13A12A11AS*

SELRAM6*

A13A12A11AS*

SELRAM7*

A13A12A11AS*

SELRAM8*

Page 176: Memory Interfacing

Conclusion

Page 177: Memory Interfacing

Bus Buffering

Buffering helps prevent bus overloading by increasing the bus fan-out current.2 buffer choices 74LS244 or 74LS245.Depends on direction:

Unidirectional Bidirectional

Page 178: Memory Interfacing

Memory Chips

Has: Address pins. Data pins. CS* OE*/E* WE* (RAM only).

Both E* and CS* must be on to activate a memory chip.

E* is activated by UDS*/LDS*. CS* is activated by memory address decoder.

Page 179: Memory Interfacing

Memory Interfacing

Method to connect memory chips to M68k. Involves design of MAD. Two methods:

Full address decoding: uses all address lines.Partial address decoding: only uses several

address lines.

Page 180: Memory Interfacing

The End

Please read:

Antonakos, 263-275