Professional Documents
Culture Documents
Instructions: Language of The Computer: Omputer Rganization and Esign
Instructions: Language of The Computer: Omputer Rganization and Esign
Instructions: Language of The Computer: Omputer Rganization and Esign
Edition
The Hardware/Software Interface
Chapter 2
Instructions: Language
of the Computer
Chapter 2
◼ Introduction and computer operations
◼ Instruction Operands
◼ Signed and Unsigned numbers
◼ Representing Instructions (Instruction Format)
◼ C code:
◼ f = (g + h) - (i + j);
◼ C code:
f = (g + h) - (i + j);
◼ f, g, h, i, j in $s0, $s1, $s2, $s3, $s4
◼ C code:
f = (g +3) - (i + j);
◼ f, g , , i, j in $s0, $s1, , $s3, $s4
Example:
$S0=0000 0000 0000 0000 0000 0000 0000 1001 two= 9ten
After instruction:
sll $t2,$s0,4 # reg $t2 = reg $s0 << 4 bits
$t2= 0000 0000 0000 0000 0000 0000 1001 0000two
= 144ten
Chapter 2 — Instructions: Language of the Computer — 17
AND Operations
◼ Useful to mask bits in a word
◼ Select some bits, clear others to 0
and $t0, $t1, $t2
Memory
◼ Example
◼ 0000 0000 0000 0000 0000 0000 0000 1011 2