Memory-mapped I/O

From Academic Kids

For more generic meanings of input/output port, see port (computing).

Memory-mapped I/O (MMIO) and port I/O (also called port-mapped I/O or PMIO) are two complementary methods of performing input/output between the CPU and I/O devices in a computer. Another method is using dedicated I/O processors (channels, used in IBM mainframe computers).

Memory-mapped I/O uses the same bus to address both memory and I/O devices, and the CPU instructions used to read and write to memory are also used in accessing I/O devices. In order to accommodate the I/O devices, areas of CPU addressable space must be reserved for I/O rather than memory. This does not have to be permanent, for example the Commodore 64 could bank switch between its I/O devices and regular memory. The I/O devices monitor the CPU's address bus and respond to any CPU access of their assigned address space, mapping the address to their hardware registers.

Port-mapped I/O uses a special class of CPU instructions specifically for performing I/O. This is generally found on Intel microprocessors, specifically the IN and OUT instructions which can read and write a single byte to an I/O device. I/O devices have a separate address space from general memory, either accomplished by an extra "I/O" pin on the CPU's physical interface, or an entire bus dedicated to I/O.

Relative merits of the two I/O methods

The main advantage of using port-mapped I/O is on CPUs with a limited addressing capability. Because port-mapped I/O separates I/O access from memory access, the full address space can be used for memory. It is also obvious to a person reading an assembly language program listing when I/O is being performed, due to the special instructions that can only be used for that purpose.

The advantage of using memory mapped I/O is that, by discarding the extra complexity that port I/O brings, a CPU requires less internal logic and is thus cheaper, faster and easier to build; this follows the basic tenets of reduced instruction set computing. As 16-bit CPU architectures have become obsolete and replaced with 32-bit and 64-bit architectures in general use, reserving space on the memory map for I/O devices is no longer a problem. The fact that regular memory instructions are used to address devices also means that all of the CPU's addressing modes are available for the I/O as well as memory.

With the popularisation of higher-level programming languages such as C and Lisp, which do not support generation of the special port-mapped I/O instructions without incompatible and proprietary extensions, port-mapped I/O has become remarkably cumbersome to use. Contrast this situation with when assembly language was dominant and port-mapped I/O instructions simplified the code.

See also

Personal tools
Navigation

    Information

    • Home Page (http://academickids.com/encyclopedia/index.php)
    • New Articles (http://www.academickids.com/encyclopedia/index.php/Special:Newpages)
    • Contact Us (http://www.academickids.com/encyclopedia/index.php/Contactus)


    Academic Kids Menu

    • Art and Cultures (http://www.academickids.com/encyclopedia/index.php/Art_and_Cultures)
      • Art (http://www.academickids.com/encyclopedia/index.php/Art)
      • Architecture (http://www.academickids.com/encyclopedia/index.php/Architecture)
      • Cultures (http://www.academickids.com/encyclopedia/index.php/Cultures)
      • Music (http://www.academickids.com/encyclopedia/index.php/Music)
      • Musical Instruments (http://academickids.com/encyclopedia/index.php/List_of_musical_instruments)
    • Biographies (http://www.academickids.com/encyclopedia/index.php/Biographies)
    • Clipart (http://www.academickids.com/encyclopedia/index.php/Clipart)
    • Geography (http://www.academickids.com/encyclopedia/index.php/Geography)
      • Countries of the World (http://www.academickids.com/encyclopedia/index.php/Countries)
      • Maps (http://www.academickids.com/encyclopedia/index.php/Maps)
      • Flags (http://www.academickids.com/encyclopedia/index.php/Flags)
      • Continents (http://www.academickids.com/encyclopedia/index.php/Continents)
    • History (http://www.academickids.com/encyclopedia/index.php/History)
      • Ancient Civilizations (http://www.academickids.com/encyclopedia/index.php/Ancient_Civilizations)
      • Industrial Revolution (http://www.academickids.com/encyclopedia/index.php/Industrial_Revolution)
      • Middle Ages (http://www.academickids.com/encyclopedia/index.php/Middle_Ages)
      • Prehistory (http://www.academickids.com/encyclopedia/index.php/Prehistory)
      • Renaissance (http://www.academickids.com/encyclopedia/index.php/Renaissance)
      • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
      • United States (http://www.academickids.com/encyclopedia/index.php/United_States)
      • Wars (http://www.academickids.com/encyclopedia/index.php/Wars)
      • World History (http://www.academickids.com/encyclopedia/index.php/History_of_the_world)
    • Human Body (http://www.academickids.com/encyclopedia/index.php/Human_Body)
    • Mathematics (http://www.academickids.com/encyclopedia/index.php/Mathematics)
    • Reference (http://www.academickids.com/encyclopedia/index.php/Reference)
    • Science (http://www.academickids.com/encyclopedia/index.php/Science)
      • Animals (http://www.academickids.com/encyclopedia/index.php/Animals)
      • Aviation (http://www.academickids.com/encyclopedia/index.php/Aviation)
      • Dinosaurs (http://www.academickids.com/encyclopedia/index.php/Dinosaurs)
      • Earth (http://www.academickids.com/encyclopedia/index.php/Earth)
      • Inventions (http://www.academickids.com/encyclopedia/index.php/Inventions)
      • Physical Science (http://www.academickids.com/encyclopedia/index.php/Physical_Science)
      • Plants (http://www.academickids.com/encyclopedia/index.php/Plants)
      • Scientists (http://www.academickids.com/encyclopedia/index.php/Scientists)
    • Social Studies (http://www.academickids.com/encyclopedia/index.php/Social_Studies)
      • Anthropology (http://www.academickids.com/encyclopedia/index.php/Anthropology)
      • Economics (http://www.academickids.com/encyclopedia/index.php/Economics)
      • Government (http://www.academickids.com/encyclopedia/index.php/Government)
      • Religion (http://www.academickids.com/encyclopedia/index.php/Religion)
      • Holidays (http://www.academickids.com/encyclopedia/index.php/Holidays)
    • Space and Astronomy (http://www.academickids.com/encyclopedia/index.php/Space_and_Astronomy)
      • Solar System (http://www.academickids.com/encyclopedia/index.php/Solar_System)
      • Planets (http://www.academickids.com/encyclopedia/index.php/Planets)
    • Sports (http://www.academickids.com/encyclopedia/index.php/Sports)
    • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
    • Weather (http://www.academickids.com/encyclopedia/index.php/Weather)
    • US States (http://www.academickids.com/encyclopedia/index.php/US_States)
          Advertisement