Файл: Embedded Controller Hardware Design (Ken Arnold, 2001).pdf

ВУЗ: Не указан

Категория: Не указан

Дисциплина: Не указана

Добавлен: 13.06.2025

Просмотров: 2691

Скачиваний: 0

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.
Figure 6-1: Preliminary design of the CPU and memory interface.

126EMBEDDED CONTROLLER

Hardware Design

accessed using three memory cycles: program read, data read, and data write. Three separate, mutually exclusive control signals from the CPU determine which of the three types of external memory cycle are to occur. Only one

of the signals is active at any one time, making the memory interface very simple. A program read cycle is indicated when the /PSEN (active low, program strobe enable becomes active, a RAM data read cycle when /RD (active low, read) goes active, and a RAM data write cycle is indicated when /WR (active low, write) becomes active. The /PSEN signal can be directly connected to enable the program ROM, and the /RD and /WR signals can be connected to the output enable and write enable pins of the data RAM. Since the lower eight address bits are multiplexed on the data bus, they are held by a transparent latch (74x373). The processor outputs an active high enable signal, ALE (address latch enable), to control the latch. The processor, latch, program EPROM, and SRAM are shown in Figure 6-1. The timing diagrams for the three memory

cycles as shown in the

8031

RD

processor specification,

WR

along with the timing

PSEN

Program

Data

parameters for the CPU,

EPROM

OE SRAM

Enable

WE

are shown in Figure

Address

Address

6-2. The CPU timing

D0..7

D0..7

requirements must be

Address

8 A8..15

16

reconciled with the

A8..15

A0..15

requirements of the

8

ALE

E

other chips in the sys­

Q0..7

A0..7

tem, beginning with

Address/Data Bus

D0..7

the memory chips.

AD0..7

Memory Selection and Interfacing

Most embedded computer designs make use of EPROM for non-volatile pro­ gram storage and SRAM for volatile data storage. For this example we will use one of each type: 32Kx8 UV erasable EPROM to store the program, and a 32Kx8 CMOS static RAM. The multiplexed address bits, A0..7, will be latched from the AD0..7 lines using a 74ALS373 transparent latch. Since there is only one memory of each type, no address decoding is necessary for the chips to be enabled directly from the processor memory control lines /PSEN, /RD, and /WR.


127CHAPTER SIX

A Detailed Design Example

Preliminary Timing Analysis

Critical timing parameters for the EPROM, SRAM, and address latch are shown in Tables 6-1 and 6-2 and are excerpted from the component specification sheets. For an experienced designer, the preliminary timing analysis may consist of just a quick look at the data sheets. A limited analysis of key timing parameters will be performed first to identify any major changes that may need to be made in the design. The parameters to be evaluated here will be the CPU memory access time requirements versus the various memory maximum access time capabilities, control signal pulse widths, all related to clock speed. First, we will examine the program memory read access time, and then the data read and write access times.

The instruction fetch (program memory read) cycle of the CPU is shown in Figure 6-2.

Instruction Cycle

Instruction Fetch Cycle

Data Fetch Cycle

Program Memory

Data Memory

PSEN

4

Fetch Cycle 5

RD

RD Cycle

ALE

1

3

Latch Output

Instruction Address

Data Address

Address/Data Bus

2

Instruction

Data Addr.

WR Data

Instruc. Addr.

Figure 6-2: Instruction cycle timing diagram.

The sequence of events is as follows:

1)ALE goes active (high), enabling the external latch to pass A0..7 through to its outputs. The 16-bit PC (program counter) value, containing the address of the next instruction byte to be fetched from EPROM, will then be used to drive the 16 address lines.

2)The lower eight address lines A0..7 are driven on Port 0 (also known as AD0..7 since it is multiplexed with A0..7 and D0..7), at the same time as A8..15 are driven on Port 2. At this point, the complete 16-bit address of the next instruction is available on Port 2 and the address latch. As soon as the address lines are stable and valid, the address access time for the memory begins. Since the address will be valid before ALE goes low, a transparent latch is used to give the memory the address as soon as possible.


128EMBEDDED CONTROLLER

Hardware Design

If a negative edge triggered register was used instead of a transparent latch to hold the address bits, then address bits A0..7 would not be available until a propagation time after the falling edge of ALE.

3)Once the address lines are valid, ALE goes low, latching A0..7 bits in the external address latch. This allows the multiplexed data lines to be used for data transfer without disturbing the lower eight address lines that are held in the latch for the remainder of the cycle. Since the upper eight address lines (A8..15) are not multiplexed, they remain valid for the rest of the cycle and do not need to be latched.

4)/PSEN goes active (low) to indicate that this is a program memory read cycle, enabling the EPROM to drive the data bus. This enable signal begins the program memory read access cycle time for the EPROM.

5)/PSEN goes inactive (high) signaling the end of the program read cycle and clocking the EPROM data into the processor. Because this signal is used to clock data into the CPU from the data bus, there are associated setup and hold times for the data relative to the rising edge of the /PSEN signal.

Using the preliminary design, the first parameters to be investigated are the access times. Table 6-1 gives the program memory timing parameters for the 8031. The memories that have longer access times are less expensive than the fast ones, so we would like to use the least expensive parts that will meet the specifications.

Both the address and enable access times are of interest, including all possible propagation paths for these signals. The slowest path will determine the maxi­ mum clock frequency that can be used for reliable operation, up to 12 MHz, the maximum CPU clock frequency. The ALE path will be ignored for now. All three paths must be evaluated to determine which one is the speed limiting condition. The three signal propagation paths for the program read cycle are:

a) Valid address A8..15 on Port 2,

8031

EPROM address access time

PSEN

Program

Path C

EPROM

b) Valid address on port 0, D to Q

Enable

delay through the latch, and

Path A

Address

D0..7

EPROM address access

Path B

c) /PSEN active, EPROM enable

Address

8

A8..15

16

A8..15

A0..15

access time

ALE

E

8

These three propagation paths are

Q0..7

A0..7

D0..7

shown in Figure 6-3. Figure 6-4

Address/Data Bus

shows the program memory

AD0..7

timing diagram for the 8031.

Figure 6-3: Three access propagation paths for program read.


129CHAPTER SIX

A Detailed Design Example

Variable

Clock

12

MHz Clock

1/TCLCL =

1.2 to 12 MHz

Symbol

Parameter

min

max

units

min

max

units

TCLCL

Oscillator Period

83

nS

83

833

nS

TCY

Minimum Instruction Time

1.0

uS

12TCLCL

nS

TLHLL

ALE Pulse Width

140

nS

2TCLCL-30

nS

TAVLL

Address Set Up to ALE

60

nS

TCLCL-25

nS

TLLAX

Address Hold After ALE

50

nS

TCLCL-35

nS

TPLPH

/PSEN Width

230

nS

3TCLCL-20

nS

TLHLH

/PSEN, ALE Cycle Time

500

nS

6TCLCL

nS

TPLIV

/PSEN to Valid Data In

150

nS

3TCLCL-100

nS

TPHDX

Input Data Hold After /PSEN

0

nS

0

nS

TPHDZ

Input Data Float After /PSEN

75

nS

TCLCL-10

nS

TAVIV

Address to Valid Data In

320

nS

5TCLCL-100

nS

TAZPL

Address Float to /PSEN

0

nS

0

nS

NOTE: Test Conditions T=0–70°C, Vcc= 5V±5%

Port 0, ALE and /PSEN Outputs: CL = 150 pF

All Other Outputs: CL = 80 pF

Table 6-1: 8031 program memory timing parameters.

T12

T1

T2

T3

T4

T5

T6

T7

T8

T9

T10

T11

T12

T1

T2

OSC

TCY

TLHLL

TLHLH

ALE

TPLPH

PSEN

RD, WR

Port 2

ADDRESS A15-A8

ADDRESS A15-A8

ADDRESS

OR SFR P2

TLLAX

TAVLL

TPLIV

TPHDZ

TAZPL

TPHDX

Port 0

FLOAT

A7-A0

FLOAT

INSTR

IN

FLOAT

A7-A0

FLOAT

INSTR

IN

FLOAT

TAVIV

Figure 6-4: 8031 program memory timing.

Assuming a 12MHz clock, the timing analysis for the three paths is:

Path A

The delay from when the CPU provides a valid address A8..15 onPport 2 until the end of the EPROM address access time, resulting in valid data from the EPROM on the data bus. Figure 6-5 shows the EPROM timing diagram. The


Data
Figure 6-5: EPROM timing diagram.
Chip
Enable
Output
Enable
Address

130EMBEDDED CONTROLLER

Hardware Design

CPU requires that the data from the EPROM be available 320 nanoseconds (nS) (TAVIV) after being presented with a valid address. The -30 version of the EPROM has an address access time of 300 nS max. (EPROM tAA), so there is 20 nS of margin for this EPROM at this clock speed.

TAVIV - EPROM tAA = 320 - 300 = 20 nS margin

Test

-15

-20

-25

-30

Parameter

Symbol

Conditions

min max

min max

min max

min max

Units

Address access

tAA

/CE=/OE= VIL

170

200

250

300

nS

/CE access

tCE

/OE= VIL

170

200

250

300

nS

/OE access

tOE

/CE= VIL

10

60

10

70

10

100

10

120

nS

Output disable

tDF

/CE= VIL

0

50

0

50

0

60

0

105

nS

Table 6-2: EPROM timing parameters.

Note that the -15, -20, etc. at the top of Table 6-2 are suffixes that refer to the

memory access times.

The CPU ALE line is

TCE

TOE TDF

TAA

connected directly to the latch enable input

of the 74ALS373 transparent latch. Table 6-3 gives timing specifications for this device. Remember that this type of latch simply passes the D inputs directly through to the Q outputs (after a propagation delay), as long as the enable

input remains high. The ‘373

Parameter

From

To

min

max

Unit

(input)

(output)

tPLH

D

Q

2

12

nS

tPHL

D

Q

4

16

nS

tPLH

E

Any Q

6

22

nS

tPHL

E

Any Q

7

23

nS

tPZH

/OC

Any Q

6

18

nS

tPZL

/OC

Any Q

5

20

nS

tPHZ

/OC

Any Q

2

10

nS

tPLZ

/OC

Any Q

2

12

nS

Table 6-3: Timing specifications for 74ALS373 transparent latch.

type latch has an asymmetrical propagation delay from the D input to the Q output, since tPLH from D->Q is 12 nS max,

and t is 16 nS max. This

PHL

corresponds to the first part of the propagation path B.

As can be seen in Figure 6-2, ALE goes high before the address goes valid. The delay from the enable (E) input to