0% found this document useful (0 votes)
20 views

Memory Location & Addresses - 2

The document discusses memory locations and addresses, including that memory stores data and instructions for the CPU to use. It defines bits, bytes, and word lengths which can vary by machine architecture. Words are aligned if they begin at byte address multiples of the word length. The two main memory operations are load, which transfers data from memory to the CPU, and store, which writes from the CPU to memory. Instructions represent operations the CPU can perform, including data transfer, arithmetic, program flow, and I/O. Instructions have an opcode and operands, and addressing modes specify how operands are addressed.

Uploaded by

Swati
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Memory Location & Addresses - 2

The document discusses memory locations and addresses, including that memory stores data and instructions for the CPU to use. It defines bits, bytes, and word lengths which can vary by machine architecture. Words are aligned if they begin at byte address multiples of the word length. The two main memory operations are load, which transfers data from memory to the CPU, and store, which writes from the CPU to memory. Instructions represent operations the CPU can perform, including data transfer, arithmetic, program flow, and I/O. Instructions have an opcode and operands, and addressing modes specify how operands are addressed.

Uploaded by

Swati
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

MEMORY LOCATION AND ADDRESSES

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:

1. Immediate Addressing Mode:


- Operand value is directly specified in the instruction.
- Example: `MOV R1, #10` (Move the immediate value 10 into register R1).
- No effective address calculation is needed; the operand is the immediate value.

2. Register Addressing Mode:


- Operand is located in a register.
- Example: `ADD R1, R2` (Add the contents of registers R1 and R2).
- The effective address is the content of the register specified in the instruction.
3. Direct Addressing Mode:
- Operand is located at a fixed memory address.
- Example: `LOAD R1, 1000` (Load the value at memory address 1000 into
register R1).
- The effective address is the fixed memory address specified in the instruction.
4. Indirect Addressing Mode:
- Operand address is stored in a register or memory location, and the actual
operand is at that address.
- Example: `LOAD R1, (R2)` (Load the value at the memory address stored in
register R2 into register R1).
- The effective address is the contents of the memory location specified by the
register or memory location in the instruction.
5. Indexed Addressing Mode:
- Operand address is calculated by adding a constant offset or index to a base
register.
- Example: `LOAD R1, 200(R2)` (Load the value at memory address (contents
of R2 + 200) into register R1).
- The effective address is calculated by adding a constant offset or index to the
contents of a base register.
6. Base-Register Addressing Mode:
- Similar to indexed addressing, but the index is implicitly zero, and the operand
address is simply the contents of a base register.
- Example: `LOAD R1, (R2)` (Load the value at the memory address stored in
register R2 into register R1).
- Similar to indexed addressing, but the index is implicitly zero, and the effective
address is simply the contents of the base register.
7. Relative Addressing Mode:
- Operand address is calculated relative to the current instruction's address.
- Example: `JUMP 10` (Jump to the instruction 10 addresses away from the
current instruction).
- The effective address is calculated relative to the current instruction's address.
8. Stack Addressing Mode:
- Operand is implicitly at the top of the stack.
- Example: `POP R1` (Pop the value from the top of the stack into register R1).
- The effective address is the top of the stack.
9. Base-Plus-Index Addressing Mode:
- Operand address is calculated by adding an index to a base register, similar to
indexed addressing.
- Example: `LOAD R1, 200(R2, R3)` (Load the value at memory address
(contents of R2 + contents of R3 + 200) into register R1).
- The effective address is calculated by adding an index to the contents of a base
register.

You might also like