Lecture 03 - Instructions Language of The Computer
Lecture 03 - Instructions Language of The Computer
Instructions: Language
of the Computer
§2.1 Introduction
Instruction Set
n The repertoire of instructions of a
computer
n Different computers have different
instruction sets
n But with many aspects in common
n Early computers had very simple
instruction sets
n Simplified implementation
n Many modern computers also have simple
instruction sets
n Range: 0 to +2n – 1
n Example
n 0000 0000 0000 0000 0000 0000 0000 10112
= 0 + … + 1×23 + 0×22 +1×21 +1×20
= 0 + … + 8 + 0 + 2 + 1 = 1110
n Using 32 bits
n 0 to +4,294,967,295
x + x = 1111...1112 = -1
x + 1 = -x
n Example: negate +2
n +2 = 0000 0000 … 00102
n –2 = 1111 1111 … 11012 + 1
= 1111 1111 … 11102
n Instruction fields
n op: operation code (opcode)
n rs: first source register number
n rt: second source register number
n rd: destination register number
n shamt: shift amount (00000 for now)
n funct: function code (extends opcode)
0 17 18 8 0 32
000000100011001001000000001000002 = 0232402016
op rs rt rd shamt funct
6 bits 5 bits 5 bits 5 bits 5 bits 6 bits