字可寻址和字节可寻址的区别 [英] Difference between word addressable and byte addressable
问题描述
有人能解释一下 Word
和 Byte
可寻址之间的区别吗?它与内存大小等有什么关系?
Can someone explain what's the different between Word
and Byte
addressable? How is it related to memory size etc.?
推荐答案
- 一个字节是一个内存单元strong> 用于存储
- 内存芯片充满了这样的字节.
- A byte is a memory unit for storage
- A memory chip is full of such bytes.
- 一个二进制地址总是只指向
一个
字节. - 一个词就是
一组
字节 –2
、4
、8
取决于数据总线的CPU大小.
- A binary address always points to
a single
byte only. - A word is just
a group of
bytes –2
,4
,8
depending upon the data bussize of
the CPU. - MAR(内存地址寄存器)
- MDR(内存数据寄存器)
- PC(程序计数器寄存器)
- MBR(内存缓冲寄存器)
- MAR(memory address register)
- MDR(memory data register)
- PC(program counter register)
- MBR(memory buffer register)
32-bits
用于数据/地址8-bit
用于 OPCODE.32-bits
for data/addresses8-bit
for OPCODE.
内存单元可寻址.这是我们可以使用内存的唯一方法.
Memory units are addressable. That is the only way we can use memory.
实际上,内存只是字节可寻址.意思是:
In reality, memory is only byte addressable. It means:
了解内存操作强>完全,您必须熟悉CPU的各种寄存器和RAM的内存端口.我假设您知道它们的含义:
To understand the memory operation fully, you must be familiar with the various registers of the CPU and the memory ports of the RAM. I assume you know their meaning:
RAM有两种
内存端口:
<小时>
假设 CPU 想要读取 a
word(比如 4
bytes)从地址 xyz
开始.CPU将地址放在MAR上,发送内存读取信号给内存控制器芯片.在接收到地址和读取信号后,内存控制器会将数据总线连接到32位
port 和 4 bytes
从 address 开始的 xyz
会流出 port 到 MDR.
Suppose CPU wants to read a
word (say 4
bytes) from the address xyz
onwards. CPU would put the address on the MAR, sends a memory read signal to the memory controller chip. On receiving the address and read signal, memory controller would connect the data bus to 32-bit
port and 4 bytes
starting from the address xyz
would flow out of the port to the MDR.
如果CPU想要获取下一条指令,它会将地址放入PC寄存器并向内存控制器发送获取信号.在接收到地址并获取信号后,内存控制器会将数据总线连接到8
位端口和位于地址的单个
字节长 操作码接收到的数据将从 RAM 流入 CPU 的 MDR.
If the CPU wants to fetch the next instruction, it would put the address onto the PC register and sends a fetch signal to the memory controller. On receiving the address and fetch signal, memory controller would connect the data bus to 8
-bit port and a single
byte long opcode located at the address received would flow out of the RAM into the CPU's MDR.
这就是当我们说某个寄存器是内存可寻址或字节可寻址时的意思.现在,当您在 MAR 上的 binary
中输入 decimal 2
并打算读取 word 时会发生什么> 2
,不是 (byte 没有 2
)?
So that is what it means when we say a certain register is memory addressable or byte addressable. Now what will happen when you put, say decimal 2
in binary
on the MAR with an intention to read the word 2
, not (byte no 2
)?
Word 没有 2
表示 bytes 4
, 5
, 6
, 7
用于 32-bit
机器.在真实物理内存中,仅字节可寻址.所以有一个技巧来处理字寻址.
Word no 2
means bytes 4
, 5
, 6
, 7
for 32-bit
machine. In real physical memory is byte addressable only. So there is a trick to handle word addressing.
当MAR被放置在地址总线上时,它的32
位不会映射到32
地址行(分别为0-31
).相反,MAR bit 0
连接到地址总线 line 2
, MAR bit 1
连接到地址总线 line 3
等等.MAR的高位2 bits
被丢弃,因为只有2^32
以上的字地址需要它们这对我们的 32 位
机器是合法的.
使用这种映射,当MAR为1
时,address 4
放在总线上,当MAR是2
,address 8
放在总线等等.
When MAR is placed on the address bus, its 32
-bits do not map onto the 32
address lines(0-31
respectively). Instead, MAR bit 0
is wired to address bus line 2
, MAR bit 1
is wired to address bus line 3
and so on. The upper 2 bits
of MAR are discarded since they are only needed for word addresses above 2^32
none of which are legal for our 32 bit
machine.
Using this mapping, when MAR is 1
, address 4
is put on the bus, when MAR is 2
, address 8
is put on the bus and so forth.
一开始有点难理解.我从Andrew Tanenbaums 的结构化计算机组织.
It is a bit difficult in the beginning to understand. I learnt it from Andrew Tanenbaums's structured computer organisation.
这篇关于字可寻址和字节可寻址的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!