Memory-mapped I/O vs port-mapped I/O
关于MMIO和PIO,我看到的解释最清楚的文章,原文在这里:Memory-mapped I/O vs port-mapped I/O - 2015
Microprocessors normally use two methods to connect external devices: memory mapped or port mapped I/O. However, as far as the peripheral is concerned, both methods are really identical.
Memory mapped I/O is mapped into the same address space as program memory and/or user memory, and is accessed in the same way.
Port mapped I/O uses a separate, dedicated address space and is accessed via a dedicated set of microprocessor instructions.
The difference between the two schemes occurs within the microprocessor. Intel has, for the most part, used the port mapped scheme for their microprocessors and Motorola has used the memory mapped scheme.
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 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.
I/O
devices are mapped into the system memory map along with RAM and ROM.
To access a hardware device, simply read or write to those 'special'
addresses using the normal memory access instructions.
The advantage to this method is that every instruction which can access memory can be used to manipulate an I/O device.
The
disadvantage to this method is that the entire address bus must be
fully decoded for every device. For example, a machine with a 32-bit
address bus would require logic gates to resolve the state of all 32
address lines to properly decode the specific address of any device.
This increases the cost of adding hardware to the machine.
Picture source : IO Devices
I/O
devices are mapped into a separate address space. This is usually
accomplished by having a different set of signal lines to indicate a
memory access versus a port access. The address lines are usually shared
between the two address spaces, but less of them are used for accessing
ports. An example of this is the standard PC which uses 16 bits of port
address space, but 32 bits of memory address space.
The
advantage to this system is that less logic is needed to decode a
discrete address and therefore less cost to add hardware devices to a
machine. On the older PC compatible machines, only 10 bits of address
space were decoded for I/O ports and so there were only 1024 unique port
locations; modern PC's decode all 16 address lines. To read or write
from a hardware device, special port I/O instructions are used.
From a software perspective, this is a slight disadvantage because more
instructions are required to accomplish the same task. For instance, if
we wanted to test one bit on a memory mapped port, there is a single
instruction to test a bit in memory, but for ports we must read the data
into a register, then test the bit.
Comparison - Memory-mapped vs port-mapped
Memory-mapped IO | Port-mapped IO |
---|---|
Same address bus to address memory and I/O devices | Different address spaces for memory and I/O devices |
Access to the I/O devices using regular instructions | Uses a special class of CPU instructions to access I/O devices |
Most widely used I/O method | x86 Intel microprocessors - IN and OUT instructions |
We can check the reserved memory address space from the Resource Monitor via our desktop's Task Manager.
Memory-mapped I/O vs port-mapped I/O的更多相关文章
- System and method for parallel execution of memory transactions using multiple memory models, including SSO, TSO, PSO and RMO
A data processor supports the use of multiple memory models by computer programs. At a device extern ...
- 【DM642学习笔记六】TI参考文档--DM642 Video Port Mini Driver
这个文档介绍了在DM642EVM板上视频采集和显示微驱动的使用和设计.用EDMA进行存储器和视频端口的数据传输.为了增强代码的复用性和简化设计过程,驱动分为通用视频端口层和特定编解码芯片微驱动层两个 ...
- Anatomy of a Program in Memory
Memory management is the heart of operating systems; it is crucial for both programming and system a ...
- [转]Anatomy of a Program in Memory
Memory management is the heart of operating systems; it is crucial for both programming and system a ...
- Method and apparatus for providing total and partial store ordering for a memory in multi-processor system
An improved memory model and implementation is disclosed. The memory model includes a Total Store Or ...
- Unity3D Optimizing Graphics Performance for iOS
原地址:http://blog.sina.com.cn/s/blog_72b936d801013ptr.html icense Comparisons http://unity3d.com/unity ...
- linux 查看系统状态方法
Linux下如何查看系统启动时间和运行时间 1.uptime命令输出:16:11:40 up 59 days, 4:21, 2 users, load average: 0.00, 0.01, 0.0 ...
- linux包之dmidecode
http://www.dmtf.org/standards/smbios Dmidecode 这款软件允许你在 Linux 系统下获取有关硬件方面的信息.Dmidecode 遵循 SMBIOS/DMI ...
- System Address Map Initialization in x86/x64 Architecture Part 2: PCI Express-Based Systems
原文 http://resources.infosecinstitute.com/system-address-map-initialization-x86x64-architecture-pa ...
- psutil官方文档
psutil documentation¶ Quick links Home page Install Blog Forum Download Development guide What’s new ...
随机推荐
- eclipse Java EE安装和web项目的创建
一.根据http://www.itnose.net/detail/6139800.html基本安装成功二.根据http://www.cnblogs.com/freebsd-pann/archive/2 ...
- python - opencv 的一些小技巧备忘
python - opencv 的一些小技巧备忘 使用python-opencv来处理图像时,可以像matlab一样,将一幅图像看成一个矩阵,进行矢量操作,以加快代码运行速度. 下面记录几个常用的操作 ...
- 微信答题小程序 微信小程序 答题 demo 头脑王者这样的答题小程序开发 答题的微信小程序开发经验 微信答题比赛小程序
最近随着王思聪的我撒币,我快乐,直播答题非常火.同时知乎的答题小程序头脑王者也非常火爆.大家在微信和微信群里玩的不亦乐乎. 好吧,快乐总是属于你们,我却只能埋头写代码... 公司要求赶紧开发一个这样的 ...
- es6模板语法使用上的一点问题
var str = "test"; console.log(str); // test console.log(`str`) //str 这里的str是模板语法里面的,而不是变量s ...
- AC日记——[USACO09JAN]全流Total Flow 洛谷 P2936
题目描述 Farmer John always wants his cows to have enough water and thus has made a map of the N (1 < ...
- HDU 6206 Apple
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6206 判断给定一点是否在三角形外接圆内. 给定三角形三个顶点的坐标,如何求三角形的外心的坐标呢? 知乎 ...
- 微信小程序 之三元运算符代替wx:if 来解决背景图片显示隐藏
最近在开发一个小程序项目时,碰到一个问题, 在一个多条件单项选择中,为选中条件添加一个选中状态,选中状态为灰色背景,但是这个背景要用到背景图片 大家都知道在小程序 中wxss是无法读到本地图标资源,只 ...
- Java 基础【04】数组内存分配
可能Java 数组大家都很熟悉,最近我遇到了一个关于Java 数组内存分配的问题. 突然发现许多书上“基本数据类型存储在栈内存当中,对象则保存在堆内存”这句话完全是错误的.下面是个简单的例子代码: p ...
- 总结 Eclipse 编程常用的快捷键
Eclipse 常用快捷键Eclipse的编辑功能非常强大,掌握了Eclipse快捷键功能,能够大大提高开发效率.Eclipse中有如下一些和编辑相关的快捷键. 1. [ALT+/] 此快捷键为用户编 ...
- Codeforces 576D Flights for Regular Customers(矩阵加速DP)
题目链接 Flights for Regular Customers 首先按照$d$的大小升序排序 然后分成$m$个时刻,每条路径一次处理过来. $can[i][j]$表示当前时刻$i$能否走到$j ...