Module 2 - Computer Instruction Set
Module 2 - Computer Instruction Set
❑ The operation code field of an instruction is a group of bits that define various processor
operations: add, subtract, complement, and shift.
❑ The bits that define the mode field of an instruction code specify a variety of alternatives for
choosing the operands from the given address.
❑ The various addressing modes that have been formulated for digital computers
❑ Operations specified by computer instructions are executed on some data stored in memory or
processor registers.
❑ Operands residing in memory are specified by their memory address.
❑ Operands residing in processor registers are specified with a register address.
❑ A register address is a binary number of k bits that defines one of 2k registers in the CPU.
❑ For example: CPU with 16 processor registers RO through R15 will have a register address field of
four bits.
❑ The binary number 0101, for example, will designate register R5.
• It is assumed that the computer has two processor registers, R 1 and R2.
• The symbol M [A] denotes the operand at memory address symbolized by A.
• Advantage: it results in short programs when evaluating arithmetic expressions
• Disadvantage: the binary-coded instructions require too many bits to specify three addresses
• The MOV instruction moves o r transfers the operands t o and from memory and processor
registers.
• The first symbol listed in an instruction is assumed to be both a source and the destination
where the result of the operation is transferred.
• 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.
• The name "zero-address“ is given to this type of computer because of the absence of an
address field in the computational instructions.
• Example:
• MOV A, 81H ; 8051 microcontroller instruction
• JMP 5000H
• MOV R1, @6000H
• Example:
• Example:
• MOV AX, [SI+2000H] ; 8086 instructions
Symbol Description
The INP instruction address the information from the INPR to AC which has 8 low order bits. It also
INP
clears the input flag to 0.
OUT It can send the 8 low order bits from AC into output register OUTPR. It also clears the output flag to 0.
Ans: We must determine if we have enough bits to create the desired number of bits
patterns
We have an exact match with no wasted patterns. So our instruction set is possible.
Dr. Bore Gowda S B, Additional Professor, Dept. of ECE, MIT, Manipal 45
Opcode/Instruction Encoding
❑ Expanding opcode technique
• Consider a machine with 16-bit instructions and 16 registers. We wish to encode the
following instructions:
✓ 15 instructions with 3 addresses; 14 instructions with 2 addresses
✓ 31 instructions with 1 address; 16 instructions with 0 addresses
Required bit patterns (4104) is more than what we have (4096), so this instruction set is not
possible with only 12 bits.
• Select the leaf nodes with least probability and create a new node and assign the weight