Let us start, first of all what is a bit?
As we studied computers understand only 0 and 1 so both of these are known as bits.
So, a bit can be 0 or 1. Now , when we combine 8 bits together it becomes a byte.
Next is word .It is smallest unit that can be addressed. Its size depends upon the processor.
It can be 8 bit,16 bit,32 bit and so on…. As we know, computer works as we give instructions to it…..
The instructions and the data needed by a program are stored in memory. The processor reads the next instruction to be executed from memory.
It is placed in an Instruction Register (IR).
It is the task of the control circuitry in the control unit to translate the instruction
into the sequence of micro operations. Because, these instructions taken by computer in the form of 0 and 1.
A computer instruction has three parts:
An opcode (Operation Code): It specifies the operation for that instruction.
The opcode field in an instruction format is a group of bits to define operations, such as add, subtract, complement, and bitwise-shift.
As the memory words are 16 bits long, the 3-bits are used for the instruction's opcode. Various addressing modes used by digital computers will be discussed in next section.
An address: This specifies the registers or the memory locations to be use for that operation. In a 16-bit computer, 12-bits are used to specify the memory address that instruction will use.
A Mode : It specifies the way the operand or effective address is to be computed .
In 16-bit computer,15th bit of the instruction is used to specify the addressing mode (0 for direct addressing and 1 for indirect addressing, we'll study later).
It specifies how the address field of the instruction will be decoded to get the address of the location to be accessed.
Now these instructions are further categorized.
1) Classification of Instructions based on CPU Organizations.
2) Classification of instructions based on number of addresses required,
3) Classification of instructions based on type of data they can access or the type of data they can refer to,
First we discuss, Classification of Instructions based on CPU Organizations.
Most computer instructions fall into the following three types of CPU organizations:
Single accumulator instructions, General register instructions and Stack instructions.
Now, move toward Accumulator-type organization In this organization, all operations are performed in the accumulator register.
For example, an arithmetic addition instruction and the corresponding operation of an assembly language instruction is:
ADD AC arrow AC +M[X] Where AC is the accumulator register that has one of the operands Band M[X] symbolizes the memory word located at address X, A.
So in this instruction add two operands(A and B) and store result in AC. All arithmetic, logic, load and store instructions use the accumulator register.
General register-type, Each address field may specify a CPU register or a memory word. For example:
ADD R1 and Y This instruction means add two numbers, one in register and another at some memory location.
And result will be stored into R1 register.
Rl<--Rl + M[Y] It contains two address fields, one for register R1 and the other for the memory address Y.
Next is Stack instructions. First of all what is a Stack? It is a kind of memory that is used to store data.
It has a specific property last in first out, means, which data stored at last is retrieved first.
Like a stack of bowls, here we pick that bowl first which we kept at the last.
Process of inserting data in a stack is called push (put a bowl on the stack)
And the Process of deleting data from stack is called pop(remove a bowl from stack)
So, generally stack instructions are PUSH and POP .
Example: PUSH Y, This instruction pushes the word Y to the top of the stack. Updating of the stack pointer is automatically done .
Operation-type instructions do not need an address field in stack-organization.
Next Classification of instructions based on number of addresses required.
Three address instructions, Two address instructions , One address instructions, Zero address instructions.
First let's discuss THREE-ADDRESS INSTRUCTIONS.
Three-address instruction formats can use three address field that specify either a processor register or a memory operand.
ADD R1, A, B R1 ← M [A] + M [B]
Where R1 is processor register and M[A] denotes the operand at memory address specified by A that has value 10 and M[B] that has value 15.
So after calculation 25 is stored into register R1
TWO-ADDRESS INSTRUCTIONS.
These instruction formats are most common in computers in which 2 addresses filed exist.
Each address field can specify either a processor register or a memory word. The two address code is: MOV R1, A R1 ← M [A]
The MOV instruction moves/transfers the operands to and from the memory and processor registers.
Here instructions meaning is to move data from memory location A to register R1.
Next is, ONE-ADDRESS INSTRUCTIONS
One-address instructions are instructions that have one address field.
LOAD A AC ← M [A] STORE T M [T] ← AC
LOAD C AC ← M [C] These all are examples of one address instructions.
All operations are done between the AC register and a memory operand. T is the address of a temporary memory location required for storing the intermediate result.
Next is ZERO-ADDRESS INSTRUCTIONS The stack is included in the CPU for performing
arithmetic and logic instructions with no addresses. The operands are pushed onto the
stack from memory and ALU operations are implicitly performed on the top elements of the stack.
The address of the next instruction is held in a CPU register called program counter.
A stack-organized computer does not use an address field for the instructions ADD and MUL.
PUSH A TOS ← A
ADD TOS ← (A + B) POP X M [X] ← TOS
Where TOS stands for top of the stack. To evaluate arithmetic expressions in a stack computer,
It is necessary to convert the expression into reverse Polish notation.
The term "zero-address" is given because of the absence of an address field in the computational instructions.
3rd one is: Classification of instructions based on type of data they can access or the type of data they can refer to.
According to this ,instructions are divided further into 3 categories.
Memory Reference instructions, Register Reference instructions,
Input output instructions, Memory reference instructions are instruction that contain such operations which are performed on data that stored in memory.
Similarly register reference instructions have operations on register's data.
And last one input output instructions are those instructions that perform operations with input and output devices. Thank you.
Không có nhận xét nào:
Đăng nhận xét