s********k 发帖数: 6180 | 1 【 以下文字转载自 CS 讨论区 】
发信人: silverhawk (silverhawk), 信区: CS
标 题: register在CPU中,但是也可以用内存地址访问?(embedded)
发信站: BBS 未名空间站 (Fri Dec 10 14:00:56 2010, 美东)
一般register是内存地址最开始的一段。既然不在RAM但是在CPU中,那么register和
RAM中其他内存用连续地址用处在于软件比较好访问?或者对于VM好操作? |
j*****u 发帖数: 1133 | 2 没看懂你的问题,你是问RAM中连续地址的好处?
地址连续的话可以直接计算出地址,比如array中取某个元素可以很容易的计算出其地址
另外一个好处是cache方便,可以preload到cache中增加cache命中的机率 |
s********k 发帖数: 6180 | 3 差不多就是这个意思,register和RAM物理上不在一起,但是一起编地址。为何cache方
便?可以RAM有自己地址从0x0000开始,register另外一个地址,反正只需要CPU知道就
是了,这样的话难道cache机制不一样?
地址
【在 j*****u 的大作中提到】 : 没看懂你的问题,你是问RAM中连续地址的好处? : 地址连续的话可以直接计算出地址,比如array中取某个元素可以很容易的计算出其地址 : 另外一个好处是cache方便,可以preload到cache中增加cache命中的机率
|
W****r 发帖数: 835 | 4 感觉除了能精简指令集之外,没有太大意义。
http://en.wikipedia.org/wiki/Addressing_mode#Memory-mapped_registers
Memory-mapped registers
On some computers, the registers were regarded as occupying the first 8 or
16 words of memory (e.g. ICL 1900, DEC PDP-10). This meant that there was no
need for a separate "Add register to register" instruction — you could
just use the "add memory to register" instruction.
In the case of early models of the PDP-10, which did not have any cache
memory, you could actually load a tight inner loop into the first few words
of memory (the fast registers in fact), and have it run much faster than if
it would have in magnetic core memory.
Later models of the DEC PDP-11 series mapped the registers onto addresses in
the input/output area, but this was primarily intended to allow remote
diagnostics. Confusingly, the 16-bit registers were mapped onto consecutive
8-bit byte addresses. |
m*****g 发帖数: 226 | 5 原话的问题基本是不懂computer architecture的。
就算embedded也是从通用体系来的,区别不会太大。 |