William Stallings
Computer Organization
and Architecture
Chapter 9
Instruction Sets:
Characteristics
and Functions
What is an instruction set?
§ The complete collection of instructions that are understood by a
CPU
§ Machine Code
§ Binary
§ Usually represented by assembly codes
• Assembly language is a symbolic representation of machine L.
Elements of an Instruction
§ Operation code (Op code)
• specifies operation to be performed
• Represented by mnemonics (SUB, ADD)
§ Source Operand reference
• Input to the operation
• 1 or 2 (can be constant, in a reg, mem, I/O)
§ Result Operand reference
• Put the answer here (Reg, Mem, I/O)
§ Next Instruction Reference
• Tells CPU where to fetch next instruction
• On most case, next instruction to be fetched immediately
follows current instruction
Instruction Representation
§ In machine code each instruction has a unique bit pattern
§ For human consumption (well, programmers anyway) a symbolic
representation is used
• Reduces length of instruction
• Requires some extra work
üTemporary storage to hold some results
Number of Addresses (c)
§ 1 address
• Implicit second address
• Usually a register (accumulator)
• Common on early machines
§ Adv.
• Minimize internal state of machine
• Short inst.
§ Dis.
• One register (A) à high memory traffic
Number of Addresses (d)
§ 0 (zero) addresses
• All addresses implicit
• Uses a stack
üOperands are on top of stack
• e.g. push a
• push b
• add
• pop c
• c = a + b
Dis, stack can not be accessed randomly
-> difficult to generate efficient code
à longer program
Ad. Short instruction
example
§ D = A + B + C
(stack) ACCUMULATOR 2-ADDRESS 3-ADDRESS