Access odd memory locations without hardware
Some RISC controllers, like the NEC V850 family, use an internal 32-bit architecture with an external 16-bit bus. The architecture also allows interfaces with 8-bit memories. However, with 8-bit memories, accesses to and from odd locations automatically access the higher-order byte. Thus, you would need external transceivers to access both even and odd locations. However, you can "trick" the processor and thereby save the space and cost associated with the external transceivers. Like everything else in life, the method doesn't come free—the price you pay is execution time.
The idea (Figure 1) is fairly simple: Connect the memory data bus to the least-significant bit (D0 to D7) of the µC. Then, connect the memory-address bus to the µC without using A0, so that the memory never sees an odd address. Thus, addressing the memory generates only even addresses. At first glance, the method might seem wasteful, because the memory occupies twice the space it needs, but with large memory spaces available (the V850 family can address as much as 16 Mbytes), the wastage should not present a problem. As an example, suppose register r2 contains the following data that you should store in a 1kX8 memory, starting at address 0x100:
After storing is complete, the memory resembles the following:
Assuming (r1)=0x100, the sample program in Listing 1 arranges the storage operation. The tradeoff between extra hardware and longer execution time depends on the application's requirements. (DI #2366)