Файл: Digital design with CPLD applications and VHDL (R. Dueck, 2000).pdf
ВУЗ: Не указан
Категория: Не указан
Дисциплина: Не указана
Добавлен: 13.06.2025
Просмотров: 8178
Скачиваний: 6
640 C H A P T E R 1 3 • Memory Devices and Systems
each waveform is stored as 256 consecutive 8-bit numbers. For example, the data for one cycle of the sine waveform are stored at addresses 0000H to FFFFH, as shown in hex form in Table 13.1. (FF is maximum positive, 80 is zero, and 00 is maximum negative.) The square wave data are stored at addresses 0100 to 01FF, also shown in Table 13.1. The data for other functions, stored in subsequent 256-byte blocks, are not shown. A full list of the function data and an ANSI C program to generate an EPROM record file (Intel format) are included in Appendix E.
The counter and EPROM can also be implemented in a CPLD. Alternatively, a VHDLdesigned state machine can replace the counter and EPROM, except for the sine function.
Table 13.1 EPROM Sine and Square Wave Data
SINE
Base |
Byte Addresses |
|||||||||||||||
Address |
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
A |
B |
C |
D |
E |
F |
0000 |
80 |
83 |
86 |
89 |
8C |
8F |
92 |
95 |
98 |
9C |
9F |
A2 |
A5 |
A8 |
AB |
AE |
0010 |
B0 |
B3 |
B6 |
B9 |
BC |
BF |
C1 |
C4 |
C7 |
C9 |
CC |
CE |
D1 |
D3 |
D5 |
D8 |
0020 |
DA |
DC |
DE |
E0 |
E2 |
E4 |
E6 |
E8 |
EA |
EC |
ED |
EF |
F0 |
F2 |
F3 |
F5 |
0030 |
F6 |
F7 |
F8 |
F9 |
FA |
FB |
FC |
FC |
FD |
FE |
FE |
FF |
FF |
FF |
FF |
FF |
0040 |
FF |
FF |
FF |
FF |
FF |
FF |
FE |
FE |
FD |
FC |
FC |
FB |
FA |
F9 |
F8 |
F7 |
0050 |
F6 |
F5 |
F3 |
F2 |
F0 |
EF |
ED |
EC |
EA |
E8 |
E6 |
E4 |
E2 |
E0 |
DE |
DC |
0060 |
DA |
D8 |
D5 |
D3 |
D1 |
CE |
CC |
C9 |
C7 |
C4 |
C1 |
BF |
BC |
B9 |
B6 |
B3 |
0070 |
B0 |
AE |
AB |
A8 |
A5 |
A2 |
9F |
9C |
98 |
95 |
92 |
8F |
8C |
89 |
86 |
83 |
0080 |
7F |
7C |
79 |
76 |
73 |
70 |
6D |
6A |
67 |
63 |
60 |
5D |
5A |
57 |
54 |
51 |
0090 |
4F |
4C |
49 |
46 |
43 |
40 |
3E |
3B |
38 |
36 |
33 |
31 |
2E |
2C |
2A |
27 |
00A0 |
25 |
23 |
21 |
1F |
1D |
1B |
19 |
17 |
15 |
13 |
12 |
10 |
0F |
0D |
0C |
0A |
00B0 |
09 |
08 |
07 |
06 |
05 |
04 |
03 |
03 |
02 |
01 |
01 |
00 |
00 |
00 |
00 |
00 |
00C0 |
00 |
00 |
00 |
00 |
00 |
00 |
01 |
01 |
02 |
03 |
03 |
04 |
05 |
06 |
07 |
08 |
00D0 |
09 |
0A |
0C |
0D |
0F |
10 |
12 |
13 |
15 |
17 |
19 |
1B |
1D |
1F |
21 |
23 |
00E0 |
25 |
27 |
2A |
2C |
2E |
31 |
33 |
36 |
38 |
3B |
3E |
40 |
43 |
46 |
49 |
4C |
00F0 |
4F |
51 |
54 |
57 |
5A |
5D |
60 |
63 |
67 |
6A |
6D |
70 |
73 |
76 |
79 |
7C |
SQUARE |
||||||||||||||||
Base |
Byte Addresses |
|||||||||||||||
Address |
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
A |
B |
C |
D |
E |
F |
0100 |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
0110 |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
0120 |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
0130 |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
0140 |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
0150 |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
0160 |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
0170 |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
FF |
0180 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
0190 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
01A0 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
01B0 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
01C0 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
01D0 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
01E0 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
01F0 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
13.3 • Read Only Memory (ROM) |
641 |
These configurations are designed and built as exercises in the lab manual that accompanies this book.
The most significant bits of the EPROM address select the waveform function by selecting a block of 256 address. The 8 least significant bits of the EPROM address are connected to an 8-bit (mod-256) counter, which continuously cycles through the 256 selected addresses. A 27C64 EPROM (8K 8) has 13 address lines. After the eight lower lines are accounted for, the remaining five lines can be used to select up to 32 digital functions. With the two binary Function Select switches, we can potentially select 4 functions.
For example, to select the Sine function, inputs A9 and A8, which comprise the most significant digit of the EPROM address, are set to 00. Thus, the 8-bit counter cycles through addresses 0000–00FF, the location of the sine data. The Square Wave function is selected by setting A9 and A8 to 01, thus selecting the address block 0100–01FF. Other functions can be similarly selected.
The data at each address are sent to the D/A converter (MC1408), which, in combination with the op amp, is configured to produce a bipolar (both positive and negative) output. (We use a high slew rate op amp so that the generated square waves will have vertical sides.) The circuit generates a continuous waveform by retracing the data points in one 256-byte section of the EPROM over and over.
The DAC/op amp combination produces a maximum negative voltage for a hex input of 00, a 0 V output for an input of 80, and a maximum positive voltage for an input of FF. (You might wish to refer to the section Bipolar Operation of MC1408 in Chapter 12 for details of the DAC operation.)
You can see from the Sine function data in Table 13.1 that 8 bits are not sufficient to represent each of the 256 steps of a digital sine function as a unique number. The peaks of the waveform are changing too slowly to be represented accurately by an 8-bit quantization, and as a result, the top of the sine wave is flat for several clock pulses. (Mathematically, a sine function is tangential to a horizontal line at its peak. However, since tangential means touching at one point, the flat top is a distortion.) A unique number for each of 256 steps of a sine function needs at least 13 bits,1 but this requires additional bits on the D/A converter input, and therefore a different DAC and an expanded memory word length.
The output frequency of the function generator is 1/256 of the clock rate. Given that the settling time of the MC1408 DAC is about 300ns, the maximum clock rate of the circuit is 1/300 ns 3.33 MHz. At this rate, the output frequency is 3.33 MHz/256 13 kHz.
EEPROM
K E Y T E R M
EEPROM (or E2PROM) Electrically erasable programmable read only memory. A type of read only memory that can be field-programmed and selectively erased while still in a circuit.
As was discussed in the previous section, EPROMs have the useful property of being erasable. The problem is that they must be removed from the circuit for erasure, and bits
1Bits required:
●360°/256 steps 1.40625°/step.
●Sine function changes most slowly at peak, so calculate A sin(90° 1.40625°) to find smallest amplitude change.
●The smallest power-of-2 amplitude, A, for which A sin(90°) A sin(90° 1.40625°) 1 is 4096.
●The amplitude range 4096 A 4095 can be represented by a 13-bit number.
642 C H A P T E R 1 3 • Memory Devices and Systems
cannot be selectively erased; the whole memory cell array is erased as a unit.
Electrically erasable programmable read only memory (EEPROM or E2PROM) provides the advantages of EPROM along with the additional benefit of allowing erasure of selected bits while the chip is in the circuit; it combines the read/write properties of RAM with the nonvolatility of ROM. EEPROM is useful for storage of data that need to be changed occasionally, but that must be retained when power is lost to the EEPROM chip. One example is the memory circuit in an electronically tuned car radio that stores the channel numbers of local stations.
Like the UV-erasable EPROM, the memory cell of the EEPROM is based on the FAMOS transistor. Unlike the EPROM, the FAMOS FET is coupled with a standard MOSFET, as shown in Figure 13.19.
The FAMOS FET is programmed in the same way as UV-erasable EPROM: a programming voltage pulse (VPP) drives high-energy electrons into the floating gate of the
FIGURE 13.19
EEPROM Cell
FAMOS transistor, where they remain trapped and change the threshold voltage of the transistor. The cell is read by keeping the programming line at 5 V and making the cell’s Row Select line HIGH. The FAMOS transistor will or will not turn on, depending on its programmed state.
The FAMOS transistors used in EPROM and EEPROM differ in one important respect. The EEPROM transistor is manufactured with a very thin oxide layer between the drain and the upper (nonfloating) gate. This construction allows trapped electrons in the floating gate to be forced out electrically, thus erasing the cell contents.
Given the obvious advantages of EEPROM, why doesn’t it replace all other types of memory? There are several reasons:
1.EEPROM has a much slower access time than RAM and is thus not good for high-speed applications.
2.The currently available EEPROMs have significantly smaller bit capacities than commercially available RAM (especially dynamic RAM) and EPROM.
3.EEPROM has a fixed number of write/erase cycles, typically 100,000. After that, new data cannot be programmed into the device.
13.3 • Read Only Memory (ROM) |
643 |
Flash Memory
K E Y T E R M S
Flash memory A nonvolatile type of memory that can be programmed and erased in sectors, rather than byte-at-a-time.
Sector A segment of flash memory that forms the smallest amount that can be erased and reprogrammed at one time.
Boot block A sector in a flash memory reserved for primary firmware.
Top boot block A boot block sector in a flash memory placed at the highest address in the memory.
Bottom boot block A boot block sector in flash memory paced at the lowest address in the memory.
A popular variation on EEPROM is flash memory. This type of nonvolatile memory generally has a larger byte capacity (e.g., 8 Mb) than EEPROM devices and thus can be used to store fairly large amounts of firmware, such as the BIOS (basic input/output system) of a PC.
A flash memory is divided into sectors, groups of bytes that are programmed and erased at one time. One sector is designated as the boot block, which is either the sector with the highest (top boot block) or lowest (bottom boot block) address. The primary firmware is usually stored in the boot block, with the idea that the system using the flash memory is configured to look there first for firmware instructions. The boot block can also be protected from unauthorized erasure or modification (e.g., by a virus), thus adding a security feature to the device.
Figure 13.20 shows the arrangement of sectors of a 512K 8-bit (4 Mb) flash memory with a bottom boot block architecture. The range of addresses are shown alongside the blocks. For example, sector S0 (the boot block) has a 16 KB address range of 00000H to 03FFFH. Sector S1 has an 8 KB address range from 04000H to 05FFFH. The first 64 KB of the memory are divided into one 16 KB, two 8 KB, and one 32 KB sectors. The remainder of the memory is divided into equal 64 KB sectors. Note that even though the boot block is drawn at the top of Figure 13.20, it is a bottom boot block because it is the sector with the lowest address.
A flash memory with a top boot block would have the same proportions given over to its sectors, but mirror-image to the diagram in Figure 13.20. That is, S10 (boot block) would be a 16 KB sector from 7C000H to 7FFFFH. The other sectors would be identical to the bottom boot block architecture, but in reverse order.
As with other EEPROM devices, a flash memory can be erased and reprogrammed while installed in a circuit. The memory cells in a flash device have a limited number of program/erase cycles, like other EEPROMs. The sector architecture of the flash memory makes it faster to erase and program than other EEPROM-based memories which must erase or program bytes one at a time. This same characteristic makes it unsuitable for use as system RAM, which must be able to program single bytes.
SECTION 13.3 REVIEW PROBLEM
13.3A flash memory has a capacity of 8 Mb, organized as 1M 8-bit. List the address range for the 32 KB boot block sector of the memory if the device has a bottom boot block architecture and if it has a top boot block architecture.