Before having a discussion regarding the demerits of I/O mapped I/O and merits of memory-mapped I/O, let us have a generic discussion regarding the difference between I/O mapped I/O and memory mapped I/O.
In Memory Mapped Input Output −
We allocate a memory address to an Input-Output device.
Any instructions related to memory can be accessed by this Input-Output device.
The Input-Output device data are also given to the Arithmetic Logical Unit.
Input-Output Mapped Input Output −
We give an Input-Output address to an Input-Output device
Only IN and OUT instructions are accessed by such devices.
The ALU operations are not directly applicable to such Input-Output data.
So as a summary we can mention that −
I/O is any general-purpose port used by processor/controller to handle peripherals connected to it.
I/O mapped I/Os have a separate address space from the memory. So, total addressed capacity is the number of I/Os connected and a memory connected. Separate I/O-related instructions are used to access I/Os. A separate signal is used for addressing an I/O device.
Memory-mapped I/Os share the memory space with external memory. So, total addressed capacity is memory connected only. This is underutilisation of resources if your processor supports I/O-mapped I/O. In this case, instructions used to access I/Os are the same as that used for memory.
Let's take an example of the 8085 processor. It has 16 address lines i.e. addressing capacity of 64 KB memory. It supports I/O-mapped I/Os. It can address up to 256 I/Os.
If we connect I/Os to it an I/O-mapped I/O then, it can address 256 I/Os + 64 KB memory. And special instructions IN and OUT are used to access the peripherals. Here we fully utilize the addressing capacity of the processor.
If the peripherals are connected in memory mapped fashion, then total devices it can address is only 64K. This is underutilisation of the resource. And only memory-accessing instructions like MVI, MOV, LOAD, SAVE are used to access the I/O devices.
Now we shall discuss demerits of I/O mapped I/O and merits of memory-mapped I/O −
We use only the instructions IN and OUT for the addressing of Input-Output Mapped Input Output ports. But we use a large number of instructions for the communication process with a memory mapped Input-Output port. All the instructions which we use to access memory locations are used for accessing a memory mapped Input-Output port.
|LXI H, FFF0H||HL pair loaded with FFF0H|
|MOV C, M ;||C register loaded with contents of input port FFF0H|
|INR M ;||Increment by 1 contents of input port FFF0H|
|ANA M ;||Perform AND of accumulator and input port FFF0H|
|ADD M ;||Add accumulator contents and input port FFF0H|
The designer who designs a microprocessor requires to produce a unique chip design with the minimum number of possible pins. For this reason, we find multiplexed address and data pins ranging from AD7-AD0.
By using Input Output Mapped Input Output only accumulator communicates with the Input Output port. But we use memory-mapped Input Output any registers communicate with the Input Output port. An example to be cited as “MOV C, M” can be used to load C register with contents of a memory-mapped I/O port, whose address is provided in HL pair.
We use Input Output Mapped Input Output such that only 256 input ports and 256 output ports are addressed in the 8085 system as the length of the of the Input-Output port is of 8 length bits wide.