2. What is an Instruction Set?
• The complete collection of instructions that are
understood by a CPU
• Machine language: binary representation of
operations and (addresses of) arguments
• Assembly language: mnemonic
representation for humans, e.g.,
OP A,B,C (meaning A <- OP(B,C))
3. Elements of an Instruction
Operation code (opcode)
Do this: ADD, SUB, MPY, DIV, LOAD, STOR
Source operand reference
To this: (address of) argument of op, e.g.
register, memory location
Result operand reference
Put the result here (as above)
Next instruction reference (often implicit)
When you have done that, do this: BR
5. Instruction Types
Data transfer: registers, main memory, stack or
I/O
Data processing: arithmetic, logical
Control: systems control, transfer of control
6. Data Transfer
• Store, load, exchange, move, clear, set, push, pop
• Specifies: source and destination (memory,
register, stack), amount of data
• May be different instructions for different (size,
location) movements.
7. Input/Output
May be specific instructions, e.g. INPUT, OUTPUT
May be done using data movement instructions
(memory mapped I/O)
May be done by a separate controller (DMA): Start
I/O, Test I/O
8. Instruction format
An instruction is normally made up of a combination of an operation code
and some way of specifying an operand, most commonly by its location or
address in memory. A computer has a variety of instruction code formats.
The control unit in CPU interprets each instruction code and provides the
necessary control functions needed to process the instruction. There are 5
types of computer instructions. They are:
Four address instruction
Three address instruction
Two address instruction
One address instruction
Zero address instruction
9. Complex Instruction Set
Computer [CISC]
A computer with a large number of instructions is called Complex
Instruction Set Computer. In CSIC architecture it is very essential that a
single machine instruction for each statement that is written in a high
level language must be provided.
FEATURES:
Variable length instruction formats are used.
The instructions provide direct manipulation of operands residing in
memory.
A large number of instructions about 100 to 200 are provided.
A large variety of addressing modes about 5 to 20 are provided
Instructions performing specialized tasks are used infrequently
10. Reduce Instruction Set
Computer
Computer that uses fewer instructions with simple constructs so that
they can be executed much faster within the CPU without having to
use memory often is called RISC.
FEATURES:
It has relatively fewer instructions.
There are relatively fewer and simple addressing modes.
Memory access is limited only to load and store instructions.
All instructions are carried out using the registers of the CPU.
Instructions are easily decodable.
Instruction format is of fixed length.
11. Logical
Bitwise operations: AND, OR, NOT, XOR, TEST,
CMP, SET
Shifting and rotating functions, e.g.
logical right shift for unpacking: send 8-bit
character from 16-bit word
arithmetic right shift: division and truncation for
odd numbers
arithmetic left shift: multiplication without
overflow
12.
13. Types of Operand
Addresses: immediate, direct, indirect, stack
Numbers: integer or fixed point (binary, twos
complement), floating point (sign, significand,
exponent), (packed) decimal (246 = 0000 0010
0100 0110)
Characters: ASCII (128 printable and control
characters + bit for error detection)
Logical Data: bits or flags, e.g., Boolean 0 and 1