Memory Locations, Addresses & Information Encoding: Fig 2.1 Main Memory Address
Memory Locations, Addresses & Information Encoding: Fig 2.1 Main Memory Address
0 word 0
2.1.1 1 word 1
.
.
.
.
i bn-1 . . . . . . b1 b0 word i
.
.
.
.
32 bits
b31 b30 b1 b0
Fig 2.3
8 bits 24 bits
Fig 2.4
Here the 8 bit operation field can encode 28 (256) distinct instructions.
Addressing information is given in a variety of ways. The different ways in which
operands can be named in machine instructions are called addressing modes.
Memory words whose addresses are specified by the instructions are interpreted as
operands. Whether an operand is a character or a numeric data item is determined by the
operation field of the instruction.
An operand may be either shorter or longer than one word. An operand length of 8 bit
is convenient, because this size is used to encode character data. An 8 bit data is called a
byte.
0 0 1 2 3 0 3 2 1 0
4 4 5 6 7 4 7 6 5 4
. .
. .
. .
2k - 4 2k - 4 2k - 3 2k - 2 2k - 1 2k - 4 2k - 1 2k - 2 2k - 3 2k - 4
Word alignment
Words are said to be aligned in memory if they begin at a byte addr.
that is a multiple of the num of bytes in a word.
• 16-bit word: word addresses: 0, 2, 4,….
• 32-bit word: word addresses: 0, 4, 8,….
• 64-bit word: word addresses: 0, 8, 16,….
2.3 MAIN MEMORY OPERATIONS
To execute an instruction, the instructions must be transferred from the main memory to the
CPU. This is done by the CPU control circuits.
Operands and results must also be moved between the main memory and the CPU. Thus two
basic operations involving the main memory are needed namely
Load (or Fetch or Read)
Store (or Write)
Load operation: Transfers a copy of the contents of a specific memory location to the CPU.
Word in the main memory remains unchanged. To start a Load or Fetch operation, CPU
sends the address of the desired location to the main memory and requests to read its
contents. The main memory reads the data stored at that address and sends them to the CPU.
Store operation: Transfers a word of information from the CPU to a specific main
memory location, destroying the former contents of that location. Here the CPU sends the
address of the desired location to the main memory, together with the data to be written to
that location.
Notations used:-