Memory-mapped I O And Port-mapped I O

Aus Regierungsräte:innen Wiki
Zur Navigation springen Zur Suche springen

youtube.com
Memory-mapped I/O (MMIO) and port-mapped I/O (PMIO) are two complementary methods of performing enter/output (I/O) between the central processing unit (CPU) and peripheral units in a pc (typically mediating access via chipset). An alternative approach is utilizing devoted I/O processors, commonly often called channels on mainframe computers, which execute their own directions. The memory and registers of the I/O devices are mapped to (associated with) address values, so a memory handle may seek advice from both a portion of physical RAM or to memory and registers of the I/O gadget. Every I/O device either monitors the CPU's tackle bus and responds to any CPU access of an tackle assigned to that machine, connecting the system bus to the desired machine's hardware register, or makes use of a devoted bus. To accommodate the I/O gadgets, some areas of the handle bus used by the CPU have to be reserved for I/O and must not be available for normal bodily memory; the vary of addresses used for I/O units is set by the hardware.



The reservation may be everlasting, or short-term (as achieved via financial institution switching). An instance of the latter is discovered within the Commodore 64, which uses a type of memory mapping to cause RAM or I/O hardware to look in the 0xD000-0xDFFF vary. Port-mapped I/O usually makes use of a special class of CPU instructions designed specifically for performing I/O, such as the in and out directions discovered on microprocessors based on the x86 architecture. Completely different varieties of these two instructions can copy one, two or four bytes (outb, outw and outl, respectively) between the EAX register or one in every of that register's subdivisions on the CPU and a specified I/O port tackle which is assigned to an I/O device. I/O units have a separate tackle space from basic memory, both achieved by an additional "I/O" pin on the CPU's physical interface, or an entire bus devoted to I/O. As a result of the tackle area for I/O is remoted from that for important memory, that is sometimes referred to as remoted I/O.



On the x86 architecture, index/data pair is often used for port-mapped I/O. Different CPU-to-device communication strategies, resembling memory mapping, do not affect the direct memory access (DMA) for a device, because, by definition, DMA is a memory-to-gadget communication methodology that bypasses the CPU. Hardware interrupts are another communication methodology between the CPU and peripheral units, nevertheless, for a lot of reasons, interrupts are all the time handled separately. An interrupt is machine-initiated, versus the methods talked about above, which are CPU-initiated. Additionally it is unidirectional, as info flows solely from system to CPU. Lastly, every interrupt line carries only one bit of knowledge with a fixed meaning, particularly "an event that requires consideration has occurred in a machine on this interrupt line". I/O operations can slow memory entry if the tackle and data buses are shared. This is because the peripheral device is usually much slower than primary memory. In some architectures, port-mapped I/O operates through a dedicated I/O bus, alleviating the problem.



One advantage of memory-mapped I/O is that, by discarding the additional complexity that port I/O brings, a CPU requires much less inside logic and is thus cheaper, quicker, easier to construct, consumes much less energy and could be bodily smaller; this follows the fundamental tenets of diminished instruction set computing, and can be advantageous in embedded techniques. The opposite advantage is that, as a result of regular memory instructions are used to address gadgets, Memory Wave Audio all of the CPU's addressing modes are available for the I/O as properly as the memory, and directions that perform an ALU operation instantly on a memory operand (loading an operand from a memory location, storing the end result to a Memory Wave Audio location, or both) can be utilized with I/O machine registers as well. In contrast, port-mapped I/O directions are sometimes very restricted, typically offering only for simple load-and-retailer operations between CPU registers and i/O ports, so that, for example, to add a relentless to a port-mapped system register would require three directions: read the port to a CPU register, add the fixed to the CPU register, and Memory Wave write the consequence back to the port.