Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data...

40
68000 Microprocessor Module 11: Address Decoding Address decoder design methodology Full address decoder P ti l dd d d Partial address decoder © 2006-2008 [email protected] 11-1

Transcript of Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data...

Page 1: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

Module 11: Address Decoding

Address decoder design methodologyFull address decoderP ti l dd d dPartial address decoder

© 2006-2008 [email protected] 11-1

Page 2: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

Function of Address Decoder

Address busData bus

D15:0A23:1

68000ROM RAM Parallel

I/OSerial

I/O

Addressdecoder

ASChip selects

AS

To transfer data correctly and prevent system damage, only one device at a time h ld b ll d t d i th d t bshould be allowed to drive the data bus.

The address decoder selects and enables one and only one data transfer device at a time.The decoder decodes (detects) the value of the address bus based on the memory

© 2006-2008 [email protected] 11-2

The decoder decodes (detects) the value of the address bus based on the memory map

Page 3: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

Memory MapWhen implementing a system the designer creates a memory map.Map would include where RAM 00 0000Map would include where RAM, ROM and I/O are.Useful Constants:

$400 = 1 kilo = 10 lines Unused

ROM64K bytes

00 0000

00 FFFE

$400 = 1 kilo = 10 lines$1000 = 4 kilo$4000 = 16 kilo$100000 = 1 Mega

Unused

RAM64K bytes

40 0000

40 FFFE$100000 = 1 Mega

I/O registers

40 FFFE

FF C000

Unused

I/O registers1024 bytes

FF FFFE

Flight-68k memory map

© 2006-2008 [email protected] 11-3

g y p

Page 4: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

Address Decoding Strategy

EPROM Address bus

M bits to memory

( A1 - AM )or

SRAM Address bus

(M+N bits)

CSN bits to decoder

( AM+1 - A23 )

AS

Address decoder

SEL

( M+1 23 )

ValidAddress bus Must activate

SEL only when AS

SEL

AS = 0 because address bus in invalid at other

times

© 2006-2008 [email protected] 11-4

Page 5: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

How Many Bits to Decode?In general,

memories have many internal locations many lines connect direct to address bus.I/O devices have very few location few connections to addr bus

Examples memory chips:6164 8KB SRAM or 2764 8KB EPROM:

13 dd li hi13 address lines to chip# address lines to decoder 24 – 13 = 9

27C040 512KB EPROM19 address lines to chip19 address lines to chip#address lines to decoder 24 – 19 = 5

Examples I/O chips:68230 PI/T

32 registers 5 address lines (RS1-RS5) but must connect to A1-A5List of address lines to decoder A23 .. A6 = 17

74HC574 latch or 74HC541 buffer8 bits 1 address exactly no addr line to device

© 2006-2008 [email protected] 11-5

8 bits 1 address exactly no addr line to deviceAll address lines go to decoder

Page 6: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

Address Decoding Methods

Full address decodingAll the address lines are used to specify a memory locationE h h i l l i i id ifi d b i ddEach physical memory location is identified by a unique address

Partial address decodingSince not all the address space is implemented, only a subset of theSince not all the address space is implemented, only a subset of the address lines are needed to point to the physical memory locationsEach physical memory location is identified by several possible addresses (using all combinations of the address lines that were notaddresses (using all combinations of the address lines that were not used)

© 2006-2008 [email protected] 11-6

Page 7: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

Implementing Address DecodersCombinational logic

AND, NAND, OR, NOR, NOTHigh speed (propagation signals)g p (p p g g )High chip-countLacks flexibility

Decoders2-to-4, 3-to-8, etcMore appropriate than random logicThe selection of devices is determined by the physical wiringAll th bl k t h th iAll the memory blocks must have the same size

Other methods (beyond the scope of the lecture) areProgrammable Array Logic (PAL)Programmable Address DecodersProgrammable Address DecodersProgrammable Read Only Memory (PROM)Field Programmable Gate Arrays (FPGA) – Most complex & elegant. A single chip can provide all necessary glue logic (memory control, DTACK generator &

© 2006-2008 [email protected] 11-7

p p y g g ( y , gaddress decoder).

Page 8: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

Memory Decoder Design Steps

1. Determine range of address for each device:Find starting address (base address)Find memory system size (#bytes provided per device group)Find ending address

2. Determine which address lines go to decoderFind #address lines on deviceLow address go direct from µP to memoryRemaining address lines to go memory decoder -> find required pattern to decode

3. Design decoder to detect the required address bus patternWrite starting address in binaryWrite ending address in binaryHigh order address bits that go to decoder must match in both starting & ending addresses

© 2006-2008 [email protected] 11-8

Draw circuit to detect these high order bits

Page 9: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

Example 1Design the decoding circuit for interfacing 2764 EPROMs with a basic 68000 system. Assume that the 2764 chips is the only memory device used.used

1. Find address rangeFind starting addressFind starting address

All ROMs for basic system must start at $000000Find memory system size

Each 2764 chip has 8KB in 8k x 8 organization -> covers only one half of data busEach 2764 chip has 8KB in 8k x 8 organization > covers only one half of data busTo provide data for upper/lower data bus, must use 2 chips2 chips will provide 8 KB x 2 = 16 KB = 16 x 1024 = 16384 bytesWrite down 16384 in hex -> $4000

Find ending addressEnding address = starting address + memory system size – 10 + $4000 – 1 = $3FFF

© 2006-2008 [email protected] 11-9

Page 10: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

Example 1 cont2. Determine which address lines to go decoder

Find # address lines go to memory system#lines = log2(memory system size)#lines log2(memory system size)

= log2(16384) = log2(16 x 1024)= log2 (24 x 210)= 14 lines A0 – A13A14 – A23

Low address go to memory systemlowest 14 lines of µP internal address bus -> A0 to A13A0 is internal to µP > just ignore

0000 0000 00xx xxxx xxxx xxxx

A0 is internal to µP -> just ignoreA1 – A13 of µP go to A0 - A12 of every chip

Remaining address to decoderA14 – A23

0000 0000 0000 0000 0000 0000

0000 0000 0011 1111 1111 1111

($000000)

($003FFF)A14 A23

01234567891011121314151617181920212223

To decoder To memory

© 2006-2008 [email protected] 11-10

0 0 0 0 0 0 0 0 0 0 X X X X X X X X X X X X X X

Page 11: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

Example 1 cont3. Design decoder to detect the required address

bus patternStarting Address = $000000:

A23

A22

A21Starting Address $000000:= 0000 0000 0000 0000 0000 0000

Ending address = $003FFF:= 0000 0000 0011 1111 1111 1111

A21

A20

A19

Write this range in short form= 0000 0000 00xx xxxx xxxx xxxx

Bits that are not x are the bits that must be

A18

A17

A16

SEL

detected:A23-A14 = 0000 0000 00AS* = 0

SEL will be low

A15

A14

01234567891011121314151617181920212223

To decoder To memory

SEL will be low when µP is

accessing any address in the

range $000000 -

AS

© 2006-2008 [email protected] 11-11

0 0 0 0 0 0 0 0 0 0 X X X X X X X X X X X X X Xrange $000000

$003FFF

Page 12: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

Example 2A circuit containing 64K words of RAM is to be interfaced to a 68000-based systemThe first address of RAM (the base address) is atThe first address of RAM (the base address) is at $480000

What is the entire range of RAM addresses?Design a FULL address decoderDesign a FULL address decoder

SolutionThe address range for the RAM is from $480000 to $480000+(128K=$20000)-1=$4A0000-1=$49FFFF$480000+(128K $20000) 1 $4A0000 1 $49FFFF

© 2006-2008 [email protected] 11-12

Page 13: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

Example 3Design a full address decoder for a 68000-based system that contains

2MB of EPROM at a starting2MB of EPROM at a starting address $00 0000 using 512Kx8 chips2MB of RAM at a starting address $20 0000 using 256Kx8 chips64KB I/O space starting at $FF0000

SOLUTIONFor the EPROM we will need 4 512Kx8 chips, organized as 2 pairs of 512x8 chips (in order to use UDS*/LDS*) We will call these pairsUDS /LDS ). We will call these pairs ROM1 and ROM2For the RAM we will need 8 256Kx8 chips, organized as 4 pairs of

© 2006-2008 [email protected] 11-13

p , g p256Kx8: RAM1 to RAM4

Page 14: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

Example 3A23 A22 A21 A20 A19 A18 A17 A16 A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0

ROM1 0 0 0 0 X X X X X X X X X X X X X X X X X X X X

ROM2 0 0 0 1 X X X X X X X X X X X X X X X X X X X X

RAM1 0 0 1 0 0 X X X X X X X X X X X X X X X X X X X

RAM2 0 0 1 0 1 X X X X X X X X X X X X X X X X X X X

RAM3 0 0 1 1 0 X X X X X X X X X X X X X X X X X X X

RAM4 0 0 1 1 1 X X X X X X X X X X X X X X X X X X X

I/O 1 1 1 1 1 1 1 1 X X X X X X X X X X X X X X X X

A23A22A21 ROM2SEL*A20AS*

A23A22A21A20

RAM4SEL*

A19

© 2006-2008 [email protected] 11-14

AS*A19

Page 15: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

Partial Decoding

The memory space covered by all memory chip is usually much less than the full 16 MB space addressable by the 68kFor systems with not more than 8 different devices, using the 74HC138 decoder is better solutionEach device occupy block of same sizeEach device occupy block of same size

© 2006-2008 [email protected] 11-15

Page 16: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

74HC138Inputs

OutputsEnable Select

E1 E2 E3 A2 A1 A0 Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7

X X 1 X X X 1 1 1 1 1 1 1 1

HC family is compatible with original HMOS 68000, low-power HCMOS 68HC000 &

LS logic family.X X 1 X X X 1 1 1 1 1 1 1 1

X 1 X X X X 1 1 1 1 1 1 1 1

0 X X X X X 1 1 1 1 1 1 1 1

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

Y0

Y1

A0A1

‘HC138

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

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

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

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

Y2

Y3

Y4

A2

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

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

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

Y5

Y6

Y7

E1

E2

E3

When chip is not enabled: all 8 outputs high independent of A inputsWhen chip enabled (E1*,E2*,E3=001) only one output goes low, rest high

© 2006-2008 [email protected] 11-16

Inputs A2,A1,A0 select which of 8 outputs goes low

Page 17: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

Example 4 – Partial Decoder for Simple System‘HC138

00 0000

20 0000

ROM12MB

RAM

Y0

Y1

Y2

A0A1

A2

$000000-$1FFFFF (ROM1)$100000-$3FFFFF (RAM)$400000-$5FFFFF (ROM2)A23

A22A21

‘HC138

2MB

ROM22MB

40 0000

Y3

Y4

Y5

A2

E1

$ $ ( )$600000-$7FFFFF$800000-$9FFFFF$A00000-$BFFFFF (PER1)VCC

Unused

Unused

60 0000

80 0000

Y6

Y7

E2

E3

( )$C00000-$DFFFFF (PER2)$E00000-$FFFFFF (PER3)AS*

GND

Unused

Peripheral12MB

A0 0000Block size = memory size /

A23 A22 A21 A20 A19 A18 A17 A16 - - - A1 A0

ROM1 0 0 0 y y y X X - - - x X

RAM 0 0 1 y y y X X - - - x X

E0 0000

Peripheral22MB

Peripheral3

C0 0000 size / #decoder outputs = 16 MB / 8 = 2 MB

ROM2 0 1 0 y y y X X - - - x X

PER1 1 0 1 y y y X X - - - x X

PER2 1 1 0 Y Y Y X X - - - X X

PER3 1 1 1 y y y X X - - - x X

© 2006-2008 [email protected] 11-17

2MB = 2 MBConnection To decoder No Connect Direct to Device

Page 18: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

Mirror Effect in Partial DecodingWhen device size < block size, aliasing or mirroring occurs

Device will respond to >1 addressExample: using 27C010 (512k x 8) device in 2 MB block

‘010 has 17 linesA1 A17 di t t ‘010 hiA1-A17 go direct to ‘010 chipsA21-A23 go to decoderA18-A20 unconnected chip has 7 aliases

Device will respond anytime A21-A23 = 000

e.g. CLR $100000 will have same effect $

A23 A22 A21 A20 A19 A18 A17 A16 A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0

as CLR $000000Same effect for rest of decoder outputs

© 2006-2008 [email protected] 11-18

ROM1 Z Z Z y y y x x x x x x x x x x x x x x x x x x

Connection To decoder No Connect To memory chip

Page 19: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

Example 5 – Alternative Partial Decoding Scheme00 000000 0000 ROM1

256KB

RAM256KB

ROM2

04 000003 FFFE

07 FFFE08 0000

Unused

ROM2256KB

U d

08 0000

0B FFFE

10 0000

0C 0000

0F FFFE

Unused

Peripheral1256KB

Peripheral217 FFFE

13 FFFE14 0000

18 0000 Each block is 256KB.256KB

Peripheral3256KB

1B FFFE1C 0000

1F FFFE

Unused20 0000

Instead of A18-A20 unconnected, we can have A21-A23 unconnected (see analysis for ROM1 below)W A21 dditi l bl tUnused

FF FFFE

We can use A21 as additional enable to reduce aliasing

A23 A22 A21 A20 A19 A18 A17 A16 A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0

O

© 2006-2008 [email protected] 11-19

ROM1 y y y z z z x x x x x x x x x x x x x x x x x x

Connection No Connect To decoder To memory chip

Page 20: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

Example 6 – System with 16 Devices00 0000‘HC138 00 0000 ROM1 256KB

ROM2 256KB

ROM3 256KB

04 0000

08 0000

Each block is 256KB.A21 is used to select top decoder (A21=0) or bottom d d (A21 1)

Y0

Y1

Y2

Y3

A0A1

A2

ROM1*ROM2*ROM3*ROM4*

A20A19A18

10 0000

0C 0000

14 0000

ROM4 256KB

RAM1 256KB

RAM2 256KB

decoder (A21=1)

A21 = 0 completes decoder enables for

Y4

Y5

Y6

Y7

E1

E2

E3

RAM1*RAM2*

AS*A21

VCC

Unused

18 0000

decoder enables for top decoder

Y0

Y1

Y2

A0A1

A2A20A19A18

‘HC138

PI/T 32 bytes

DUART 16 bytes 3C 0000

40 0000

38 0000

A21 = 1 completes d d bl f

Y3

Y4

Y5

Y6

A2

E1

E2 PIT*A21

GNDUnused

FF FFFE

A23 A22 A21 A20 A19 A18 A17 A16 A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0

ROM1 y y w z z z x x x x x x x x x x x x x x x x x x

decoder enables for bottom decoder

Y7E3 DUART*AS*

© 2006-2008 [email protected] 11-20

ROM1 y y w z z z x x x x x x x x x x x x x x x x x x

Connection N.C. To decoder To memory chip

Page 21: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

Example 3 Revisited

Use 1-to-2 decoder2 decoder

Use 3-to-8 d d

Use 2-to-4 decoder. Can

8 decoder use ‘HC138 or simpler ‘HC139

Can be fully decoded or

ignored altogether

A23 A22 A21 A20 A19 A18 A17 A16 A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0

ROM1 0 0 0 0 X X X X X X X X X X X X X X X X X X X X

altogether

ROM2 0 0 0 1 X X X X X X X X X X X X X X X X X X X X

RAM1 0 0 1 0 0 X X X X X X X X X X X X X X X X X X X

RAM2 0 0 1 0 1 X X X X X X X X X X X X X X X X X X X

RAM3 0 0 1 1 0 X X X X X X X X X X X X X X X X X X X

© 2006-2008 [email protected] 11-21

RAM4 0 0 1 1 1 X X X X X X X X X X X X X X X X X X X

I/O 1 1 1 1 1 1 1 1 X X X X X X X X X X X X X X X X

Page 22: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

2-Stage Decoders

Y0A0‘HC138

A21($000000-$1FFFFF)($000000-$1FFFFF)

A20

ROM1SEL*

1-to-2 decoder

Y1

Y2

Y3

Y4

A1

A2

A22

A23

($000000-$1FFFFF)

ROM2SEL*

‘HC138

2-to-4 decoder

Y5

Y6

Y7

E1

E2

E3AS*

VCC

GND

‘HC138

($E00000-$FFFFFF)

Y0

Y1

Y2

Y3

A0A1

A2

HC138

GND

A18

A17 RAM1SEL*

RAM2SEL*

RAM3SEL*

RAM4SEL*

Y0

Y1

Y2

Y3

A0A1

A2

HC138

A19

A18

A17 Y4

Y5

Y6

Y7

E1

E2

E3GND

VCCBypass decoder and take IOSEL* signal here if aliasing is acceptable

Y4

Y5

Y6

Y7

E1

E2

E3

A20

A16 IOSEL*

E3GNDif aliasing is acceptable

© 2006-2008 [email protected] 11-22

Y7E3A16 IOSEL

Page 23: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

Example 7 – EASy68K Hardware ModelROM is not defined in the simulator!

ROM exists in all systems but a simulator is not a real system.You must have ROM to implement TRAP #15 routinesYou must have ROM to implement TRAP #15 routines.

You can write your program anywhere!This does not happen in a real system

Let’s create something close EZ68kLet’s create something close EZ68k00 0000

LED Digit 1E0 0000

LED Digit 2E0 0002

Reserved4 KB

00 1000

I/O Locations

User RAM1 MB

LED Digit 2E0 0002

LED Digit 3E0 0004

LED Digit 4E0 0006

LED Digit 5E0 0008

LED Digit 6E0 000A

00 1000

I/O Space & Stack RAM

E0 0000

LED Digit 6E0 000A

LED Digit 7E0 000C

LED Digit 8E0 000E

LED x 8E0 0010

Rocker switchE0 0012

© 2006-2008 [email protected] 11-23

2 MBFF FFFE Pushbutton switchE0 0014

Page 24: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

EZ68k Memory Map

00 0000 LED Digit 1E0 0000User RAM

2 MB

20 0000

LED Digit 1E0 0000

LED Digit 2E0 0002

LED Digit 3E0 0004

LED Digit 4E0 0006ROM

Unused

LED Digit 5E0 0008

LED Digit 6E0 000A

LED Digit 7E0 000C

LED Digit 8E0 000E

ROM2 MB

40 0000

0 0000

I/O Space1 MB

E0 0000

Unused LED Digit 8E0 000E

LED x 8E0 0010

Rocker switchE0 0012

Pushbutton switchE0 0014

Stack RAM1 MBFF FFFE

F0 0000 E0 0016

EF FFFE

© 2006-2008 [email protected] 11-24

Page 25: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

EZ68k Decoder WorksheetA23 A22 A21 A20 A19 A18 A17 A16 A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0

User RAM 0 0 0 x x x x x x x x x x x x x x x x x x x x x

ROM 0 0 1 x x x x x x x x x x x x x x x x x x x x x

7SLED #1 1 1 1 0 0 0 0 0 07SLED #1 1 1 1 0 0 0 0 0 0

7SLED #2 1 1 1 0 0 0 0 1 0

7SLED #3 1 1 1 0 0 0 1 0 0

7SLED #4 1 1 1 0 0 0 1 1 0

7SLED #5 1 1 1 0 0 1 0 0 0

7SLED #6 1 1 1 0 0 1 0 1 0

7SLED #7 1 1 1 0 0 1 1 0 0

7SLED #8 1 1 1 0 0 1 1 1 0

LED8 1 1 1 0 1 0 0 0 0

Rocker 1 1 1 0 1 0 0 1 0

Pushbutton 1 1 1 0 1 0 1 0 0

Stack RAM 1 1 1 1 x x x x x x x x x x x x x x x x x x x x

Use 3-to-8 decoder

(1xHC138)

Use 1-to-2 decoder

Use 4-to-16 decoder

(2xHC138)

© 2006-2008 [email protected] 11-25

( ) (2xHC138)

Page 26: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

Decoder Circuit

© 2006-2008 [email protected] 11-26

Page 27: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

Wrong Way to Connect ROMA0 = UDS/LDSA1-A14 microboth ROMs A0-A13ROM1 D8 D15ROM1 = D8-D15ROM2 = D0-D7Address decoder selects ROMs forselects ROMs for A16,A17,A18=000ROM: $0000 -

$03FFF, other 138 outputs used for otheroutputs used for other devices, RAM etc

© 2006-2008 [email protected] 11-27

Page 28: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

Connecting RAM

Addition of two 32K x 8 RAM to previous slide( two of ROM of last slide( two of ROM of last slide not shown for clarity )Again pair for 16bits wideROM A16-A18=000ROM A16 A18 000RAM A16-A18=001 Now R/~W neededDTACK* as long as eitherDTACK as long as either ROM or RAM accessed.

© 2006-2008 [email protected] 11-28

Page 29: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

16 bit wide ROMD0-D15 ROM uPAll uP A1-A16

ROM A0-A1564k x 16 ROMCE* from 138 decoder when

A17,A18,A19=000Other combinations for otherOther combinations for other devicesAs ROM all accesses are read so *OE=CE*DTACK* low

while ROM selected

A19 A18 A17 A16 A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1

0 0 0 x x x x x x x x x x x x x x x x ROM 00000H-0FFFFH

0 0 1 ………………………………………………………………….. Next Device 10000H

© 2006-2008 [email protected] 11-29

0 1 0 ………………………………………………………………… Another Device20000H

Page 30: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

Connecting LEDsNeed a byte-wide output portThe LEDs cannot be connected directly to data bus

Difficult to select the LEDsLEDs would only display value for very short period of time (about 400ns, or 2 clock cycles)

Only when data bus carries the correct signal

Microprocessor cannot sink enough current

© 2006-2008 [email protected] 11-3011-30

Page 31: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

Connecting LEDsInstead, we need to capture the values on the data bus, and hold them until changed

The 74HC374 octal latch will do nicelyThe 74HC374 octal latch will do nicely

Latch is very fast (around 20 ns), so DTACK* does not need to be delayed.Needs only 1 memory address.

68000 74HC374Data bus

© 2006-2008 [email protected] 11-3111-31

Page 32: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

Connecting LEDs

68000 74HC374Data bus

74HC138Address

bus 74HC138decoder

bus

© 2006-2008 [email protected] 11-3211-32

Page 33: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

74LS373 & 74LS374

© 2006-2008 [email protected] 11-3311-33

Page 34: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

Elementary Output with 68000

68000 74HC374

D0-D7 or

D8-D15

68000 74HC374

D0-D7

A1-A23

AS

Address decoder

CP

Vcc

DTACK

DTACK sourcesfrom other devices

© 2006-2008 [email protected] 11-3411-34

Page 35: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

Connecting SwitchesNeed a byte-wide input portSwitches cannot be connected directly to data bus

Must transfer switch values to data bus at the correct timeA tri-state buffer chip will be just the thing

© 2006-2008 [email protected] 11-3511-35

Page 36: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

74LS244 & 74LS541 Octal 3-State Buffer/Line Driver

© 2006-2008 [email protected] 11-3611-36

Page 37: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

Elementary Input with 68000

D0-D7

68000 Buffer

orD8-D15

A1 A23

D0-D7

A1-A23

AS

Addressdecoder OE

Vcc

DTACK

Other DTACKsources

© 2006-2008 [email protected] 11-37

Page 38: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

An Alternative Decoder for Glue Logic

74LS139 Decoder Contains 2 x 2-to-4 decoders in one chipOnly one enable per decoder

1Y01A0

1Y1

1Y2

1Y3

1A1

1EInputs

OutputsEnable Select

E A1 A0 Y0 Y1 Y2 Y3

2Y0

2Y1

2A0

2A1

E A1 A0 Y0 Y1 Y2 Y3

1 X X 1 1 1 1

0 0 0 0 1 1 1

0 0 1 1 0 1 1

2Y2

2Y2

2E0 1 0 1 1 0 1

0 1 1 1 1 1 0

© 2006-2008 [email protected] 11-38

Page 39: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

Using FPGA or CPLD as Glue Logic

The most elegant solution for glue logic!FPGA (Field-Programmable Gate Array) or CPLD (Complex Programmable Logic Device) is a very attractive device capable of implement ALL glue logic functions in one chip

DecoderDecoderMemory read/write enablesDTACK generator including wait statesBERR generatorBERR generator

Must program using Verilog or VHDL languageExample chips:Example chips:

Xilinx 9572 CPLD (http://www.kmitl.ac.th/%7Ekswichit%20/68k/68ksbc.pdf)

© 2006-2008 [email protected] 11-39

Page 40: Module 11: Address Decoding · Function of Address Decoder 68000 Microprocessor Address bus Data bus D15:0 A23:1 68000 ROM RAM Parallel I/O Serial I/O Address decoder AS Chip selects

68000 Microprocessor

Using PLD for Glue Logic

Simpler than FPGA or CPLDSeveral versions:

PAL (programmable array logic) – programmable OR gates, fixed AND gates, may contain flip-flops, programmable onceGAL (general array logic) – replaces PAL, reprogrammableROMPLA (programmable logic array)

To implement DTACK & BERR designer must know internalTo implement DTACK & BERR, designer must know internal architecture of each device to avoid using too many chipsTo program GAL or PLA, may need to know another p g ylanguage such as ABEL

© 2006-2008 [email protected] 11-40