Memory Mapped I/O Physical Implementation

Hi,

I have used memory mapped I/O and understand it from a programmer's perspective, but I am curious as to how it gets implemented in hardware. I basically want to know how physically(in hardware) this memory mapping takes place.

For example, when the processor sends out 0xf000 on the address lines(bus) as part of a read request, how does the correct peripheral know that a read request has been issued for that address. By searching the groups I found out that the peripherals are connected to the address bus and listen for certain addresses where they are supposed to be mapped and respond accordingly.

If I could get a clearer explanation of this or some references to look at that would be great. Also, since the peripheral has to listen for a specific address, is this address defined by the peripheral hardware manufacturer and is it sometimes selectable? In other words, can I choose to maybe map a peripheral to either 0xf000 or 0xa120 if the hardware was designed with this in mind?

Thanks.

Reply to
joshc
Loading thread data ...

here is an example of memmory mapped device

formatting link

on the lower left corner sith the uart chip it is mapped to 0x002c8000 , real stuff starts at 0x00400000

Pozdrawiam.

--
RusH   //
 http://randki.o2.pl/profil.php?id_r=352019
Like ninjas, true hackers are shrouded in secrecy and mystery.
You may never know -- UNTIL IT'S TOO LATE.
Reply to
RusH

It's in exactly the same way as memory: this is what happens. When the processor outputs an address, an address decoder (for a simple one, google for the 74HC138) outputs a device select signal. This can be connected to RAM, fixed code memory (EPROM/Flash etc) or to anything else you care to tag onto it. In this case, it is a peripheral device. With this chip select signal, this peripheral now knows that it needs to take in the value on the data bus if it's a write cycle, or output a value to the bus if it's a read cycle.

The decoder can be an external device like the HC138, or a programmable logic device, or it can be internal to the processor. Sometimes the whole caboodle is inside, as in microcontrollers, but the principle is the same.

Here's the simplest example of all: the highest address line (say A15) goes to an inverter. When the address is less that 0x8000, A15 is high, and the inverter output is low. We use A15 (the chip select is usually active low) to select the RAM, and the output of the inverter to select the peripheral. So the RAM area is 0-0x7fff. When the address is 0x8000 or over, A15 is high and the inverter output is low. The RAM is deselected and the peripheral is selected.

Paul Burke

Reply to
Paul Burke

Paul,

Thanks for your extremeley informative response! I did some googling for that decoder you mentioned and understand things a lot better now. I want to confirm something though. If you use the 74HC138, for example, then you can obviously determine where you want to map the different I/O devices in the processor's address space by adding your own logic to generate the 3 decoder select inputs. Am I right about this?

However, on a development board since this is all wired up for you I would have to consult the documentation to see where the different peripherals are mapped to in the address space, right? I assume for development boards that contain microcontrollers this depends on how the chip selects are wired up to RAM, UART, etc. that are on the development board, right?

Thanks for your help.

Reply to
joshc

Of course you have to consult the documentation! What else do you think they wrote it for?

--
Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.
Reply to
Hans-Bernhard Broeker

Yes, in the Good Old Days when we designed our mappings with these devices, we used to first break the map up into how much RAM, EPROM and IO we wanted, then apply address lines to the 138s to get that mapping. Back in about 1985 (for me- other people would have been earlier) we started using programmable logic - PALs - and just put enough address lines onto the inputs, then wrote the equations for the output mapping we needed.

Yes, and don't forget that some microcontrollers have internal address decoders, that you have to set up in software when you boot the board.

Paul Burke

Reply to
Paul Burke

Reply to
Charles Jean

Thank you all for your great responses!

Reply to
joshc

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.