Файл: Embedded Controller Hardware Design (Ken Arnold, 2000).pdf
ВУЗ: Не указан
Категория: Не указан
Дисциплина: Не указана
Добавлен: 13.06.2025
Просмотров: 2726
Скачиваний: 0
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 maximum 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
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.
TCE
TOE TDF
TAA
The CPU ALE line is 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 tPHL is 16 nS max. This 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
131CHAPTER SIX
A Detailed Design Example
the output (Q) is only 23 nS, much less than the time the CPU takes to put its address out on the bus. The delay in the ALE path is:
TLHLL-TAVLL = 140 - 60 = 80 nS
Since the latch is enabled in 23 nS, but the address is not available from the CPU until 57 nS later, this path is not considered. In this, as in most designs, the ALE delay path is not critical, so it is ignored. This must be considered for some CPUs, such as the Dallas Semiconductor high-speed 80C320 family of microcontrollers. Path B, from D to Q, is always worth examining.
Path B
From the time a valid address is available on port 0 (the multiplexed bus), plus the maximum D to Q delay through the latch, and the EPROM address access time, until valid data is on the bus.
The CPU allows the same total of 320 nS delay time for this path as above. In this case however, there is the additional delay of the latch that reduces the time available to the memory. The latch is specified for a maximum D to Q delay, tP D->Q of 16nS worst case. So from the 320 nS available, 16 nS is used by the latch, and 300 nS is used by the EPROM, leaving only four nanoseconds of margin!
TAVIV - EPROM tACC - Latch tP D->Q = 320 - 300 - 16 = 4 nS margin
This is a slim, but acceptable margin, as long as the device outputs can drive the actual loads on their outputs. If the load capacitance exceeded the specified test load capacitance usually listed in the notes in the timing section, then the rise/fall time would be extended, possibly throwing this design out of the specified limits at the full 12 MHz clock speed.
Path C
For Path C, we need to evaluate the delay between the time the CPU enables the program memory and when the memory instruction output appears on the bus. The enable access time is from the activation of /PSEN, which enables the EPROM chip enable (/CE), until the EPROM provides a stable and valid instruction on the data bus.
132EMBEDDED CONTROLLER
Hardware Design
Once again, the design margin is the time allowed by the CPU, less the time taken by the external circuits. The CPU allows TPLIV or 150 nS.
TPLIV - EPROM tCE = 150 - 300 = -150 nS NEGATIVE design margin!
When /PSEN is directly connected to the EPROM /CE line, the CPU provides 150 nS (TPLIV) for the EPROM enable access time, but the -30 EPROM tCE is 300 nS, which is 150 nS TOO SLOW!
At this point, we have several options:
•Decrease the CPU clock speed.
•Buy a faster EPROM.
•Change the wiring: connect /PSEN to /OE instead of /CE.
Let’s examine these three alternatives more closely.
1)Reduce the clock speed of the CPU to conform to the EPROM’s chip enable access time. This has the obvious disadvantage that the processor will run more slowly.
2)Buy an EPROM with faster chip enable access time. Faster parts cost more and, in this case, the fastest device in the table has a chip enable access time of 170 nS, which is still too slow.
3)Rewire the /PSEN line to EPROM output enable input (/OE) and connect the chip enable (/CE) to ground. This does not require slowing the chip or using a faster, more expensive memory.
There is one other solution that is not available on the standard 8051 processor: the use of “wait states” which stretch the memory cycle timing by one or more clock cycles. The standard 8051 family parts do not incorporate this feature, but the high-speed versions do. The 80C320 family of high-speed microcontrollers from Dallas Semiconductor does allow wait states. These devices have internal registers that can be programmed to stretch memory cycles as needed to accommodate slower memories. Some other types of processors require external hardware to insert wait states.
Comparing all options, the simplest solution is probably 3). Let’s see what happens to the Path C timing design margin calculation when we use that approach. In this version, the CPU’s /PSEN line drives the EPROM’s /OE input, with the /CE grounded. As before, the CPU allows TPLIV or 150 nS,