Memory units are addressable. That is the only way we can use memory.
In reality, memory is only byte addressable. It means:
A binary address always points to a singlebyte only.
A word is just a group ofbytes – 2, 4, 8 depending upon the data bus size of the CPU.
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:
MAR(memory address register)
MDR(memory data register)
PC(program counter register)
MBR(memory buffer register)
RAM has two kinds of memory ports:
32-bits for data/addresses
8-bit for OPCODE.
Suppose CPU wants to read aword (say 4bytes) from the addressxyz 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-bitport and 4 bytes starting from the addressxyz would flow out of the port to the 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 longopcode located at the address received would flow out of the RAM into the CPU's MDR.
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 word2, not (byte no 2)?
Word no 2 means bytes4, 5, 6, 7 for 32-bit machine. In real physical memory is byte addressable only. So there is a trick to handle word addressing.
When MAR is placed on the address bus, its 32-bits do not map onto the 32address lines(0-31 respectively). Instead, MARbit 0 is wired to address busline 2, MARbit 1 is wired to address busline 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.
It is a bit difficult in the beginning to understand. I learnt it from Andrew Tanenbaums's structured computer organisation.
Memory units are addressable. That is the only way we can use memory.
In reality, memory is only byte addressable. It means:
a single
byte only.a group of
bytes –2
,4
,8
depending upon the data bussize of
the CPU.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 has
two
kinds of memory ports:32-bits
for data/addresses8-bit
for OPCODE.Suppose CPU wants to read
a
word (say4
bytes) from the addressxyz
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 to32-bit
port and4 bytes
starting from the addressxyz
would flow out of the port to the 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 anda single
byte long opcode located at the address received would flow out of the RAM into the CPU's MDR.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
inbinary
on the MAR with an intention to read the word2
, not (byte no2
)?Word no
2
means bytes4
,5
,6
,7
for32-bit
machine. In real physical memory is byte addressable only. So there is a trick to handle word addressing.When MAR is placed on the address bus, its
32
-bits do not map onto the32
address lines(0-31
respectively). Instead, MARbit 0
is wired to address busline 2
, MARbit 1
is wired to address busline 3
and so on. The upper2 bits
of MAR are discarded since they are only needed for word addresses above2^32
none of which are legal for our32 bit
machine.Using this mapping, when MAR is
1
,address 4
is put on the bus, when MAR is2
,address 8
is put on the bus and so forth.It is a bit difficult in the beginning to understand. I learnt it from Andrew Tanenbaums's structured computer organisation.
First, some EE. Horowitz & Hill's "The Art of Electronics" is the gold standard.
https://www.amazon.com/Computer-Organization-Design-ARM-Arch...
...or Tannenbaum's "Stuctured Computer Organization"
https://www.amazon.com/Structured-Computer-Organization-Andr...