Unit Ii: Machine Instructions & Programmes

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 7

UNIT II

Machine Instructions & Programmes


Introduction
To execute a program, the program and data must be stored on memory.

Memory Locations and Addresses

Memory consists of a collection of storage locations each with a unique identifier called an
“address”. Data can be transferred to and fro as a group of bits called “word”. A word can be
of 8 bits or 16 bits or 32-bits and so on.

Address Space

Each word is identified by an address. The total number of uniquely identifiable locations in
memory is called “Address Space”.
Byte Addressability
• A computer in which each byte stored can be addressed individually is
called as byte addressability.

Big-Endian Assignment
• Lower byte addresses are used for the most significant bytes of the word.
• Little-Endian Assignment
• Lower byte addresses are used for the less significant bytes of the word.

Word Alignment
• The number of bytes in a word is power of 2.
• word length is 16-bit - byte addresses are 0,2,4,
• 32-bit - byte addresses are 0,4,8,
• 64-hit - byte addresses are 0,8,16,...
Accessing Numbers, Characters and Character Strings

• Numbers It occupies one word and can be accessed in the memory by using its word
address.

• Characters It can be accessed by their byte address.

• Character Strings It can be accessed by successive byte locations.

Memory Operations
 
• Both program instructions and data operands are stored in the memory.

The operations are


• Load: Transfers the contents of the memory into processor.

• Store: Transfers the contents from processor to memory location.


Instruction and Instruction Sequencing
• An instruction is a command to the processor to perform a given task.

Four categories of instructions types are,

1. Data Movement,

2. Data Storage,

3. Data Processing,

4. Program Sequencing and Control,


Register Transfer Notation
• The transfer of information from one location to another in the computer.
• The locations may be memory location processor registers.
• The contents of a location are denoted as.

R1  [LOC], R3  [R1]+[R2]

Assembly Language Notation

It is used to represent machine instructions and programs.

Move Loc, R1 - Transfers contents from memory location to R1.


Basic Instruction Types
Based upon the number of operands, the instruction types are,

1. Three-Address Instruction.

ADD R1, R2, R3 ie., R1  R2+R3

2. Two-Address Instruction.

ADD R1, R2 ie., R1  R1+R2

3. One-Address Instructions.

ADD M ie., AC  AC+M[AR]

4. Zero-Address Instructions.

ADD, Load, Store etc.

You might also like