Книга: Introduction to Microprocessors and Microcontrollers

Full and partial decoding

Full and partial decoding

Full decoding

In the above example, the 8 kbyte memory chips used 13 address lines and the decoder used three. This makes a total of 16 lines used out of a 16-bit address bus. There are no unused lines and this is referred to as ‘full decoding’.

Partial decoding

Now let’s make a small change. The memory chips used are 4 kbyte each rather than 8 kbyte. What effect would this have?

The first result would be that the number of address lines going to the chips would be reduced to 12. There are still only eight chips to be selected so a 3–8 decoder is enough. So what have we got now?

Twelve address lines to the chips and three to the decoder and one left over and unused. If nothing is connected to this line, then it cannot matter what voltage it carries (see Table 7.4).

Table 7.4 One address line is unused 

A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0
1 1 0 X 0 0 1 0 1 1 1 1 0 0 0 1
?3 lines for decoding? This line is unused lines so it can have a value of 0 or 1 ?12 lines to the memory?

We will look at our previous address C2F1H. If it happened to go to a value of 1, the address would change from:

1 1 0 0 0 0 1 0 1 1 1 1 0 0 0 1 (C2F1H)

to

1 1 0 1 0 0 1 0 1 1 1 1 0 0 0 1 (D2F1H).

We now have two numbers that can be placed on the address bus which will result in access to the same memory location since all the bits that are actually used are identical. If we instructed the microprocessor to store some information in the address C2F1H and then to recover the information from address D2F1H, we would get the same information again. The address D2F1H is referred to as a ghost address or an image address. It is important to appreciate that ghost or image addresses have no effect at all on the operation of the microprocessor system. They are merely alternative names for a single address. Incomplete or partial decoding always gives rise to image addresses, their number and their addresses are easily worked out. In technospeak, we say that partial decoding results in more than one software addresses pointing to the same hardware address.

A worked example

The eight memory chips were now changed to 1 kbyte chips. Some data is stored in the address 4000H. Find (a) how many image addresses will occur and (b) the image addresses.

(a) A 1 kbyte memory chip would have 10 address lines. This was taken from Table 7.1 and the decoder chip still needs three inputs. The 16-bit address we were given, 4000H would result in three unused lines as in Table 7.5. These three binary digits can take on the values 000, 001, 010, 011, 100, 101, 110 and 111 which results in eight different values. This could have been done the slick way by saying 2?=8. Putting these eight numbers into the address will result in eight different addresses.

One real address and seven ghosts or images. But which is the ghost and which is the real one? It doesn’t matter. We can assume anything we like since they all point to the same physical memory. Having said this, most people seem to opt for the lowest address as the ‘real’ one.

Table 7.5 There are now three unused address lines A

A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0
0 1 0 1 1 0 0 0 1 0 1 0 0 1 0 1
?To the decoder? ?Three unused lines? ?To the 1 kbyte memory chip?

(b) Now, to find the actual ghost addresses, all we have to do is to feed in all the binary options, 000, 001 etc. into the ‘real’ address to generate each of the ghost addresses. This is shown in Table 7.6.

Table 7.6 Generating the image addresses

A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0 Address
0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4000
0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 4400
0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 4800
0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 4C00
0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 5000
0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 5400
0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 5800
0 1 0 1 1 1 0 0 0 0 0 0 0 0 0 0 5C00

The resulting addresses are 4000H, 4400H, 4800H, 4C00H, 5000H, 5400H, 5800H and 5C00H. Strictly speaking, we should, perhaps, only give the last seven addresses since the question asked for the image addresses and the first one is actually the real address. Notice how the addresses increase in a definite pattern. It always works out this way.

Image addresses and the memory map

You may remember the memory maps that we looked at in the last chapter. They showed the addresses taken by the various memory devices and the unused addresses in between them. When we have partial decoding, it gives rise to image addresses. Now, if we put these image addresses on the memory map a curious thing occurs. Every image address always falls in one of the unused areas on the map so they will never cause problems by clashing with an existing memory chip.

Оглавление книги


Генерация: 1.894. Запросов К БД/Cache: 3 / 1
поделиться
Вверх Вниз