Memory Location & Addresses - 2
Memory Location & Addresses - 2
Memory refers to the electronic components that store and retrieve data for later
use by a computer's processor (CPU). It is a crucial element in the overall
computer architecture and is used to store both program instructions and data.
Bits = 0 or 1
1Byte = 8 bits
Word depends upon the machine, if machine is 8-bit like 8085, word length will
be 8, for 32-bit machine word length will be 32. It could be anything from 8,
16,32 to 64 bit.
Word Alignment
Words are said to be Aligned in memory if they begin at a byte-address
that is a multiple of the number of bytes in a word.
Example,
o If the word length is 16(2 bytes), aligned words begin at byte
addresses 0,2,4,….
o If the word length is 64(8 bytes), aligned words begin at byte
addresses 0,8,16,….
Words are said to have Unaligned Addresses, if they begin at an arbitrary
byte-address.
MEMORY OPERATIONS
Two memory operations are:
1. Load (Read/Fetch)
2. Store (Write)
The Load operation transfers a copy of the contents of a specific memory-
location to the processor, The memory content remain unchanged.
Steps for Load Operation:
o Processor sends the address of the desired location to the memory.
o Processor issues “read signal to memory to fetch the data
o Memory reads the data stored at that address.
o Memory sends the read data to the processor.
The store operation transfers the information from the register to the
specified memory-location. This will destroy the original contents of that
memory-location.
Steps for Store operation are:
o Processor sends the address of the memory-location where it wants
to store data,
o Processor issues “write” signal to memory to store the data.
o Content of register (MDR) is written into the specified memory-
location.
INSTRUCTIONS
Instructions are the basic operations that a computer's central processing unit
(CPU) can execute. Each instruction represents a specific action or operation that
the computer should perform.
A computer must have instructions capable of performing four types of
operations:
I. Data Transfer Instructions: Move data between registers, memory, and
input/output devices.
II. Arithmetic and Logical Instructions: Perform basic arithmetic operations
like addition, subtraction, multiplication, AND,OR,NOT and XOR.
III. Program sequencing and control: Direct the flow of execution, including
branching (jumping) and conditional branching like CALL, RET, LOOP,
INT, etc.
IV. Input and Output transfers: IN, OUT
Instruction Format: Instructions are typically represented in a binary format and
have a specific structure or format. Common components include an opcode
(operation code) specifying the operation to be performed, operands providing
data or addresses, and sometimes addressing modes.
Addressing Modes: Addressing modes determine how operands are specified in
instructions. Common addressing modes include immediate, direct, register,
indexed, and indirect.
Effective Address of operand is contents of a register specified in the
instruction.
ADDRESSING MODES
The different ways in which the location of an operand is specified in an
instruction are referred to as Addressing Modes. These addressing modes provide
flexibility and enable programmers to write more versatile and efficient code.
Here are some generic addressing modes: