Contents. 1 Overview 2 Memory barriers 3 Example 4 Basic types of address decoding 5 Complete and incomplete address decoding

Similar documents
The Central Processing Unit

Lesson 4: The Network Interface Card

Computer Architecture 2/26/01 Lecture #

Microprocessors and Microcontrollers (EE-231)

Robotic Systems ECE 401RB Fall 2006

Machine Architecture. or what s in the box? Lectures 2 & 3. Prof Leslie Smith. ITNP23 - Autumn 2014 Lectures 2&3, Slide 1

CREATED BY M BILAL & Arslan Ahmad Shaad Visit:

5 Computer Organization

Introduction to Microcontrollers

Week 1. Introduction to Microcomputers and Microprocessors, Computer Codes, Programming, and Operating Systems

CC411: Introduction To Microprocessors

Moodle WILLINGDON COLLEGE SANGLI (B. SC.-II) Digital Electronics

Dec Hex Bin ORG ; ZERO. Introduction To Computing

Microprocessors I MICROCOMPUTERS AND MICROPROCESSORS

Microprocessors/Microcontrollers

Sencer Yeralan and Helen Emery Gainesville, Florida January 2000

5 Computer Organization

ECE 471 Embedded Systems Lecture 2

Computer Organization

MICROPROCESSOR AND MICROCONTROLLER BASED SYSTEMS

x86 Architectures; Assembly Language Basics of Assembly language for the x86 and x86_64 architectures

Chapter 3. Top Level View of Computer Function and Interconnection. Yonsei University

OS And Hardware. Computer Hardware Review PROCESSORS. CPU Registers. CPU Registers 02/04/2013

THE MICROCOMPUTER SYSTEM CHAPTER - 2

EEM336 Microprocessors I. I/O Interface

ECE 571 Advanced Microprocessor-Based Design Lecture 3

Embedded Systems. Read pages

Lecture #2 January 30, 2004 The 6502 Architecture

Computer Systems Organization

The x86 Microprocessors. Introduction. The 80x86 Microprocessors. 1.1 Assembly Language

ELEG3923 Microprocessor Ch.0 & Ch.1 Introduction to Microcontroller

Advanced Parallel Architecture Lesson 3. Annalisa Massini /2015

Segment 1A. Introduction to Microcomputer and Microprocessor

Chapter TEN. Memory and Memory Interfacing

Spring 2017 :: CSE 506. Device Programming. Nima Honarmand

History and Basic Processor Architecture

The Instruction Set. Chapter 5

Homeschool Enrichment. The System Unit: Processing & Memory

MICROPROCESSOR MEMORY ORGANIZATION

Assembly Language. Lecture 2 - x86 Processor Architecture. Ahmed Sallam

Unit - II. Computer Concepts and C Programming 06CCP13. Unit II

Microprocessors and Microcontrollers Prof. Santanu Chattopadhyay Department of E & EC Engineering Indian Institute of Technology, Kharagpur

WEEK 7. Chapter 4. Cache Memory Pearson Education, Inc., Hoboken, NJ. All rights reserved.

Chapter 9: A Closer Look at System Hardware

Z8 Pod Adapter. for the. Fluke 9000-Series Troubleshooter

Chapter 9: A Closer Look at System Hardware 4

Lecture Objectives. Introduction to Computing Chapter 0. Topics. Numbering Systems 04/09/2017

Chapter 4 Main Memory

Microcomputer Architecture and Programming

Module 5 - CPU Design

8086 INTERNAL ARCHITECTURE

Computer Architecture

Advanced Microprocessors

(Advanced) Computer Organization & Architechture. Prof. Dr. Hasan Hüseyin BALIK (4 th Week)

Assembly Language. Lecture 2 x86 Processor Architecture

MICROCONTROLLER UNIT 1

For your convenience Apress has placed some of the front matter material after the index. Please use the Bookmarks and Contents at a Glance links to

Computer Architecture

William Stallings Computer Organization and Architecture 10 th Edition Pearson Education, Inc., Hoboken, NJ. All rights reserved.

UNIT- 5. Chapter 12 Processor Structure and Function

INPUT/OUTPUT ORGANIZATION

CS 101, Mock Computer Architecture

Latches. IT 3123 Hardware and Software Concepts. Registers. The Little Man has Registers. Data Registers. Program Counter

e-pg Pathshala Subject : Computer Science Paper: Embedded System Module: 8051 Architecture Module No: CS/ES/5 Quadrant 1 e-text

Computer Organization

Installing Linux (Chapter 8) Note packet # 4. CSN 115 Operating Systems Ken Mead Genesee Community College. Objectives

Embedded Systems Design (630414) Lecture 1 Introduction to Embedded Systems Prof. Kasim M. Al-Aubidy Computer Eng. Dept.

machine cycle, the CPU: (a) Fetches an instruction, (b) Decodes the instruction, (c) Executes the instruction, and (d) Stores the result.

icroprocessor istory of Microprocessor ntel 8086:

Computers and Microprocessors. Lecture 34 PHYS3360/AEP3630

BASIC COMPUTER ORGANIZATION. Operating System Concepts 8 th Edition

3.1 Description of Microprocessor. 3.2 History of Microprocessor

Introduction to the Personal Computer

Computer Organization ECE514. Chapter 5 Input/Output (9hrs)

Cache Memory Part 1. Cache Memory Part 1 1

Materials: 1. Projectable Version of Diagrams 2. MIPS Simulation 3. Code for Lab 5 - part 1 to demonstrate using microprogramming

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: MIPS Instruction Set Architecture

Chapter 1 Basic Computer Organization

Tutorial on Memory Management, Deadlock and Operating System Types

16-Bit Intel Processor Architecture

Mark II Aiken Relay Calculator

Data Manipulation. Chih-Wei Tang ( 唐之瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan

Computer Hardware Requirements for ERTSs: Microprocessors & Microcontrollers

address ALU the operation opcode ACC Acc memory address

1 PC Hardware Basics Microprocessors (A) PC Hardware Basics Fal 2004 Hadassah College Dr. Martin Land

Digital System Design Using Verilog. - Processing Unit Design

The Microcontroller. Lecture Set 3. Major Microcontroller Families. Example Microcontroller Families Cont. Example Microcontroller Families

Microprocessor (COM 9323)

Personal computer hardware From Wikipedia, the free encyclopedia (Redirected from Computer hardware)

Modes of Transfer. Interface. Data Register. Status Register. F= Flag Bit. Fig. (1) Data transfer from I/O to CPU

Introduction to Computers - Chapter 4

Chapter ELEVEN 8255 I/O PROGRAMMING

Problem Set 1 Solutions

ECE 471 Embedded Systems Lecture 2

Microprocessor Architecture. mywbut.com 1

ECE 1160/2160 Embedded Systems Design. Midterm Review. Wei Gao. ECE 1160/2160 Embedded Systems Design

INTRODUCTION TO INFORMATION & COMMUNICATION TECHNOLOGY (ICT) LECTURE 2 : WEEK 2 CSC-111-T

Advanced Parallel Architecture Lesson 3. Annalisa Massini /2015

ADVANCED COMPUTER ARCHITECTURE TWO MARKS WITH ANSWERS

VIII. DSP Processors. Digital Signal Processing 8 December 24, 2009

Transcription:

Memory-mapped I/O From Wikipedia, the free encyclopedia For more generic meanings of input/output port, see Computer port (hardware). "MMIO" redirects here. For the airport serving Saltillo, Mexico, assigned the ICAO code MMIO, see Plan de Guadalupe International Airport. Memory-mapped I/O (MMIO) and port-mapped I/O (PMIO) (which is also called isolated I/O) are two complementary methods of performing input/output between the CPU and peripheral devices in a computer. An alternative approach is using dedicated I/O processors commonly known as channels on mainframe computers that execute their own instructions. Memory-mapped I/O (not to be confused with memory-mapped file I/O) uses the same address bus to address both memory and I/O devices the memory and registers of the I/O devices are mapped to (associated with) address values. So when an address is accessed by the CPU, it may refer to a portion of physical RAM, but it can also refer to memory of the I/O device. Thus, the CPU instructions used to access the memory can also be used for accessing devices. Each I/O device monitors the CPU's address bus and responds to any CPU access of an address assigned to that device, connecting the data bus to the desired device's hardware register. To accommodate the I/O devices, areas of the addresses used by the CPU must be reserved for I/O and must not be available for normal physical memory. The reservation might be temporary the Commodore 64 could bank switch between its I/O devices and regular memory or permanent. Port-mapped I/O often uses a special class of CPU instructions specifically for performing I/O. This is found on Intel microprocessors, with the IN and OUT instructions. These instructions can read and write one to four bytes (outb, outw, outl) 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. Because the address space for I/O is isolated from that for main memory, this is sometimes referred to as isolated I/O. Contents 1 Overview 2 Memory barriers 3 Example 4 Basic types of address decoding 5 Complete and incomplete address decoding 1 of 7 http://en.wikipedia.org/wiki... 05/14/2014 11:02 PM

6 Accessing Port I/O via Kernel Device Driver 7 See also 8 References Overview A device's direct memory access (DMA) is not affected by CPU-to-device communication methods, like memory mapping. This is because by definition DMA is a memory-to-device communication method that bypasses the CPU. Hardware interrupt is yet another communication method between CPU and peripheral devices. However, it is always treated separately for a number of reasons. It is device-initiated, as opposed to the methods mentioned above, which are CPU-initiated. It is also unidirectional, as information flows only from device to CPU. Lastly, each interrupt line carries only one bit of information with a fixed meaning, namely "an event that requires attention has occurred in a device on this interrupt line". Also, I/O operations can slow memory access if the address and data buses are shared. This is because the peripheral device is usually much slower than main memory. In some architectures, port-mapped I/O operates via a dedicated I/O bus, alleviating the problem. One merit of 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, easier to build, consumes less power and can be physically smaller; this follows the basic tenets of reduced instruction set computing, and is also advantageous in embedded systems. The other advantage is that, because regular memory instructions are used to address devices, all of the CPU's addressing modes are available for the I/O as well as the memory, and instructions that perform an ALU operation directly on a memory operand loading an operand from a memory location, storing the result to a memory location, or both, can be used with I/O device registers as well. In contrast, port-mapped I/O instructions are often very limited, often providing only for simple load and store operations between CPU registers and I/O ports, so that, for example, to add a constant to a port-mapped device register would require three instructions: read the port to a CPU register, add the constant to the CPU register, and write the result back to the port. As 16-bit processors have 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 2 of 7 http://en.wikipedia.org/wiki... 05/14/2014 11:02 PM

memory-mapped I/O. However, even with address space being no longer a major concern, neither I/O mapping method is universally superior to the other, and there will be cases where using port-mapped I/O is still preferable. Memory-mapped I/O is preferred in x86-based architectures because the instructions that perform port-based I/O are limited to one register: EAX, AX, and AL are the only registers that data can be moved into or out of, and either a byte-sized immediate value in the instruction or a value in register DX determines which port is the source or destination port of the transfer. [1][2] Since any general purpose register can send or receive data to or from memory and memory-mapped I/O, memory-mapped I/O uses fewer instructions and can run faster than port I/O. AMD did not extend the port I/O instructions when defining the x86-64 architecture to support 64-bit ports, so 64-bit transfers cannot be performed using port I/O. [3] Memory barriers Memory-mapped I/O is the cause of memory barriers in older generations of computers. The 640 KiB barrier is due to the IBM PC placing the Upper Memory Area in the 640 1024 KiB range (of its 20-bit memory addressing). Example Consider a simple system built around an 8-bit microprocessor. Such a CPU might provide 16-bit address lines, allowing it to address up to 64 kilobytes (KiB) of memory. On such a system, perhaps the first 32 KiB of address space would be allotted to random access memory (RAM), another 16K to read only memory (ROM) and the remainder to a variety of other devices such as timers, counters, video display chips, sound generating devices, and so forth. The hardware of the system is arranged so that devices on the address bus will only respond to particular addresses which are intended for them; all other addresses are ignored. This is the job of the address decoding circuitry, and it is this that establishes the memory map of the system. Thus we might end up with a memory map like so: 3 of 7 http://en.wikipedia.org/wiki... 05/14/2014 11:02 PM

address range (hexadecimal) size 0000 7FFF 32 KiB RAM 8000 80FF 9000 90FF A000 A7FF 256 bytes 256 bytes 2 KiB C000 FFFF 16 KiB ROM general purpose I/O sound controller device video controller/text-mapped display RAM Note that this memory map contains gaps; that is also quite common. Assuming the fourth register of the video controller sets the background colour of the screen, the CPU can set this colour by writing a value to the memory location A003 using its standard memory write instruction. Using the same method, graphs can be displayed on a screen by writing character values into a special area of RAM within the video controller. Prior to cheap RAM that enabled bit-mapped displays, this character cell method was a popular technique for computer video displays (see Text user interface). Basic types of address decoding Exhaustive 1:1 mapping of unique addresses to one hardware register (physical memory location) Partial n:1 mapping of n unique addresses to one hardware register. Partial decoding allows a memory location to have more than one address, allowing the programmer to reference a memory location using n different addresses. It may also be done just to simplify the decoding hardware, when not all of the CPU's address space is needed. Synonyms: foldback, multiply mapped, partially mapped. Linear Address lines are used directly without any decoding logic. This is done with devices such as RAMs and ROMs that have a sequence of address inputs, and with peripheral chips that have a similar sequence of inputs for addressing a bank of registers. Linear addressing is rarely used alone (only when there are few devices on the bus, as using purely linear addressing for more than one 4 of 7 http://en.wikipedia.org/wiki... 05/14/2014 11:02 PM

device usually wastes a lot of address space) but instead is combined with one of the other methods to select a device or group of devices within which the linear addressing selects a single register or memory location. Complete and incomplete address decoding Addresses may be decoded completely or incompletely by a device. Complete decoding Involves checking every line of the address bus, causing an open data bus when the CPU accesses an unmapped region of memory. (Note that even with incomplete decoding, decoded partial regions may not be associated with any device, leaving the data bus open when those regions are accessed.) Incomplete (partial) decoding Uses simpler and often cheaper logic that examines only some address lines. Such simple decoding circuitry might allow a device to respond to several different addresses, effectively creating virtual copies of the device at different places in the memory map. All of these copies refer to the same real device, so there is no particular advantage in doing this, except to simplify the decoder (or possibly the software that uses the device). This is also known as address aliasing; [4][5] Aliasing has other meanings in computing. Commonly, the decoding itself is programmable, so the system can reconfigure its own memory map as required, though this is a newer development and generally in conflict with the intent of being cheaper. Accessing Port I/O via Kernel Device Driver In Windows-based computers, memory can also be accessed via specific drivers such as DOLLx8KD which gives I/O access in 8, 16 and 32-bit on most Windows platforms starting from Windows 95 up to Windows 7. Installing I/O Port drivers will ensure memory access by activating the drivers with simple DLL calls allowing Port I/O and when not needed, the driver can be closed to prevent unauthorized access to the I/O ports. Linux provides the pcimem utility to allow reading from and writing to MMIO addresses. The Linux kernel also allows tracing MMIO access from kernel modules (drivers) using the kernel's mmiotrace debug facility. To enable this, the Linux kernel should be compiled with the corresponding option enabled. mmiotrace is used for debugging closed-source device drivers. 5 of 7 http://en.wikipedia.org/wiki... 05/14/2014 11:02 PM

See also mmap, not to be confused with memory-mapped I/O Early examples of computers with port-mapped I/O PDP-8 Nova PDP-11, an early example of a computer architecture using memory-mapped I/O Unibus, a dedicated I/O bus used by the PDP-11 University lecture notes about computer I/O (http://www.cs.nmsu.edu /~pfeiffer/classes/473/notes/io.html) Input/Output Base Address Bank switching References 1. 2. 3. 4. 5. ^ "Intel 64 and IA-32 Architectures Software Developer s Manual: Volume 2A: Instruction Set Reference, A-M" (http://www.intel.com/assets/pdf/manual /253666.pdf) (PDF). Intel 64 and IA-32 Architectures Software Developer s Manual. Intel Corporation. June 2010. pp. 3 520. Retrieved 2010-08-21. ^ "Intel 64 and IA-32 Architectures Software Developer s Manual: Volume 2B: Instruction Set Reference, N-Z" (http://www.intel.com/assets/pdf/manual /253667.pdf) (PDF). Intel 64 and IA-32 Architectures Software Developer s Manual. Intel Corporation. June 2010. pp. 4 22. Retrieved 2010-08-21. ^ "AMD64 Architecture Programmer's Manual: Volume 3: General-Purpose and System Instructions" (http://support.amd.com/us/processor_techdocs /24594_APM_v3.pdf) (PDF). AMD64 Architecture Programmer's Manual. Advanced Micro Devices. November 2009. pp. 117, 181. Retrieved 2010-08-21. ^ Microsoft (December 4, 2001). "Partial Address Decoding and I/O Space in Windows Operating Systems" (http://www.microsoft.com/whdc/system/sysinternals /partialaddress.mspx#efd). ^ HP. "Address aliasing" (http://docs.hp.com/en/a3725-96022/ch03s03.html). Retrieved from "http://en.wikipedia.org/w/index.php?title=memory-mapped_i /O&oldid=592470278" Categories: Input/output 6 of 7 http://en.wikipedia.org/wiki... 05/14/2014 11:02 PM

This page was last modified on 26 January 2014 at 12:46. Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization. 7 of 7 http://en.wikipedia.org/wiki... 05/14/2014 11:02 PM