13

Pls explain the difference between memory mapped IO and IO mapped IO

kabhay
  • 133
  • 1
  • 1
  • 5

5 Answers5

9

Uhm,... unless I misunderstood, you're talking about two completely different things. I'll give you two very short explanations so you can google up what you need to now.

Memory-mapped I/O means mapping I/O hardware devices' memory into the main memory map. That is, there will be addresses in the computer's memory that won't actually correspond to your RAM, but to internal registers and memory of peripheral devices. This is the machine architecture Pointy was talking about.

There's also mapped I/O, which means taking (say) a file, and having the OS load portions of it in memory for faster access later on. In Unix, this can be accomplished through mmap().

I hope this helped.

salezica
  • 74,081
  • 25
  • 105
  • 166
  • 1
    Your answer is informative but you have not explained IO mapped IO. – Jagdish Dec 19 '15 at 14:32
  • *"there will be addresses in the computer's memory that won't actually correspond to your RAM, but to internal registers and memory of peripheral devices."* Does each device have its own internal registers and memory that they map to RAM (for example: can a printer have 4 registers while a webcam have 7 registers), or is there a standard number of registers and memory that all devices must implement? – John May 29 '17 at 13:04
  • 1
    Each device is different, both internally and interface-wise. Memory mappings can be used, or not. It's highly device-dependent – salezica May 29 '17 at 17:35
8

Memory mapped I/O is mapped into the same address space as program memory and/or user memory, and is accessed in the same way.

Port mapped I/O uses a separate, dedicated address space and is accessed via a dedicated set of microprocessor instructions.

As 16-bit processors will slowly become obsolete and replaced with 32-bit and 64-bit in general use, reserving ranges of memory address space for I/O is less of a problem, as the memory address space of the processor is usually much larger than the required space for all memory and I/O devices in a system.

Therefore, it has become more frequently practical to take advantage of the benefits of memory-mapped I/O.

The disadvantage to this method is that the entire address bus must be fully decoded for every device. For example, a machine with a 32-bit address bus would require logic gates to resolve the state of all 32 address lines to properly decode the specific address of any device. This increases the cost of adding hardware to the machine.

The advantage of IO Mapped IO system is that less logic is needed to decode a discrete address and therefore less cost to add hardware devices to a machine. However more instructions could be needed.

Ref:- Check This link

RootPhoenix
  • 1,626
  • 1
  • 22
  • 40
8

On x86 there are two different address spaces, one for memory, and another one for I/O ports.

The port address space is limited to 65536 ports, and is accessed using the IN/OUT instructions.

As an example, a video card's VGA functionality can be accessed using some I/O ports, but the framebuffer is memory-mapped.

Other CPU architectures only have one address space. In those architectures, all devices are memory-mapped.

ninjalj
  • 42,493
  • 9
  • 106
  • 148
1

Memory mapped I/O is mapped into the same address space as program memory and/or user memory, and is accessed in the same way.

I/O mapped I/O uses a separate, dedicated address space and is accessed via a dedicated set of microprocessor instructions.

The difference between the two schemes occurs within the Micro processor’s / Micro controller’s. Intel has, for the most part, used the I/O mapped scheme for their microprocessors and Motorola has used the memory mapped scheme.

https://techdhaba.com/2018/06/16/memory-mapped-i-o-vs-i-o-mapped-i-o/

1

I have one more clear difference between the two. The memory mapped I/O device is that I/O device which respond when IO/M is low. While a I/O (or peripheral) mapped I/O device is that which respond when IO/M is high.

Ketan
  • 11
  • 1