Computer Science 230H
Instructions:
Language of the Computer
(Using MIPS)
Prepared by Michael Jack - Fall 2007
ISA
2
References
•
The information and figures for the following slides were prepared from the
following source:
– Patterson, D., and Hennessy J., Computer Organization and Design,
3rd edition, 2005
ISA
3
Introduction
•
To command a computer’s hardware, you must speak its language.
•
The words of a computer language are called
instructions
, and its vocabulary
is called an
instruction set
.
•
Computer languages are fairly similar – once you learn one, it is easy to pick
up others.
– All computers are constructed from hardware technologies based on similar
underlying principles.
– There are a few basic operations that all computers must provide.
•
By learning how to represent instructions, you will also discover the secret of
computing:
the stored-program concept
.
– Stored-program concept is the idea that instructions and data of many types can
be stored in memory as numbers, leading to stored program computer.
•
The chosen instruction set comes from MIPS.
– MIPS microprocessors are found in products from ATI Technologies, Broadcom,
Cisco, NEC, Nintendo, Silicon Graphics, Sony, Texas Instruments, and Toshiba,
among many others.
ISA
4
Operations of the Computer Hardware
•
Every computer must be able to perform arithmetic.
•
The following MIPS assembly language notation instructs the computer to add the two
variables
b
and
c
and to put their sum in
a
.
add
a, b, c
•
This notation is rigid in that MIPS arithmetic instruction:
–
Performs only one operation
–
Must always have exactly three operands
–
Operand order is fixed (destination first)
•
E.g. suppose we want to place the sum of variables
b
,
c
,
d
, and
e
, into variable
a
.
The following sequence of instructions adds the four variables:
add
a, b, c
// The sum of b and c is placed in a.
add
a, a, d
// The sum of b, c, and d is now in a.
add
a, a, e
// The sum of b, c, d, and e is now in a.
•
It takes 3 instructions to take the sum of four variables.