Memory-mapped I/O and I/O-mapped I/O are the two major classifications that are based on the way, I/O devices are interfaced in a microprocessor-based system. The significant difference between memory-mapped I/O and I/O-mapped I/O is that in the case of memory-mapped I/O, the I/O device is mapped into memory thus address space is used by both memory and I/O device. As against, in case of I/O mapped I/O, I/O device is mapped into I/O space thus two separate address spaces are used for memory and I/O device.
In memory mapped I/O the memory-specific instructions are used by the I/O device. While in case I/O mapped I/O only IN and OUT instructions are accessed.
Content: Memory-mapped I/O Vs I/O-mapped I/O
|Basis for Comparison||Memory mapped I/O||I/O mapped I/O|
|Basic||I/O devices are treated as memory.||I/O devices are treated as I/O devices.|
|Allotted address size||16-bit (A0 – A15)||8-bit (A0 – A7)|
|Data transfer instructions||Same for memory and I/O devices.||Different for memory and I/O devices.|
|Cycles involved||Memory read and memory write||I/O read and I/O write|
|Interfacing of I/O ports||Large (around 64K)||Comparatively small (around 256)|
|Control signal||No separate control signal is needed for I/O devices.||Special control signals are used for I/O devices.|
|Decoder hardware||More decoder hardware required.||Less decoder hardware required.|
|IO/M’||During memory read or memory write operations, IO/M’ is kept low.||During I/O read and I/O write operation, IO/M’ is kept high.|
|Data movement||Between registers and ports.||Between accumulator and ports.|
|Usability||In small systems where memory requirement is less.||In systems that need large memory space.|
|Speed of operation||Slow||Comparatively fast|
|Example of instruction||LDA ****H|
MOV A, M
Definition of Memory-mapped I/O
In memory mapping of I/O devices, the I/O ports are assigned 16-bit address within the memory. Here each bus is common thus the same set of instructions is used for memory and I/O devices. Thus, I/O is considered as memory and the same address space is used by both memory and I/O devices. This reduces the addressing capability of the memory.
In this case, the processor considers the I/O ports as memory locations for the purpose of reading and writing. So, whenever, an address is generated on the address bus then resultantly control signal is generated for memory read. In such a case, the processor is not concerned whether the responding data is coming from a memory device or an I/O device. The same is the case with the memory write operation.
Definition of I/O-mapped I/O
It is also known as Isolated I/O mapping and the reason for the same is that here the address space of memory and I/O are separated from each other. Thus, different read and write instructions are used for I/O and memory. In this approach, there is a common bus for I/O devices and memory however, individual read and write control lines are used for I/O.
Here the operation takes place in a way that, if the data over which operation is to be performed is to be collected from the I/O devices then address is placed on the address line and I/O read and I/O write control lines will get activated so that data transfer can be performed between the processor and I/O.
For the transfer of data between the processor and I/O devices, only IN and OUT instructions are used in the isolated mapping. The required chip select signals in this case are generated by an individual decoding unit.
Key Differences Between Memory-mapped I/O and I/O-mapped I/O
- The key factor of differentiation between memory-mapped I/O and Isolated I/O is that in memory-mapped I/O, the same address space is used for both memory and I/O device. While in I/O-mapped I/O, separate address spaces are used for memory and I/O device.
- When memory-mapped I/O is done then the whole available memory space cannot be used for addressing the memory as the I/O devices are also addressed within the same memory. Thus, it is suitable for systems where less memory requirement exists. Whereas, when I/O-mapped I/O is done then the overall memory space can address the memory. Hence, suits the systems that require large memory capacity.
- In memory-mapped I/O, the I/O ports or peripherals are considered as memory locations and due to this reason, the memory-specific instructions can be used for data transfer between the I/O device and the processor. As against, there are separate instructions, IN and OUT are used for data transfer between the I/O device and the processor in I/O-mapped I/O.
- In the memory-mapped I/O approach, the I/O devices are accessible through memory read and memory write cycles. However, the same case does not apply to isolated I/O as in IO-mapped IO, the devices are accessible through I/O read and I/O write cycle.
- The memory-mapped ports allow data to get transferred between any register and the ports. While the I/O mapped ports, allow the transfer of data to take place between the I/O devices and the processor.
- The memory mapping of the I/O devices facilitates interfacing of more number of I/O ports but the I/O mapping of I/O devices facilitates interfacing of fewer IO ports nearly 256.
- During the memory read and memory write cycle, the IO/M’ signal is kept low while during IO read and IO write cycle, the IO/M’ signal is asserted high.
Thus, from this discussion, we can conclude that I/O-mapped I/O offers easy decoding but memory-mapped I/O offers difficult decoding and the reason for the same is that the latter has more number of address lines.