Digital Signal Processing Reference
In-Depth Information
9.1 Computer Programs and Instructions
A computer program is a sequence of instructions that perform a desired
operation. Instructions are stored in memory. For the following simple ΜP 3
computer design, an instruction consists of 16 bits. As seen in Figure 9.2 the
high eight bits of the instruction contain the opcode. The instruction operation
code or "opcode" specifies the operation, such as add or subtract, that will be
performed by the instruction. Typically, an instruction sends one set of data
values through the ALU to perform this operation. The low eight bits of each
instruction contain a memory address field. Depending on the opcode, this
address may point to a data location or the location of another instruction.
Some example instructions are shown in Figure 9.3.
Opcode Address
15 8 7 0
Figure 9.2 Simple ΜP 3 Computer Instruction Format.
Instruction Mnemonic
Operation Preformed
Opcode Value
ADD
address
AC <= AC + contents of memory address
00
STORE address
contents of memory address <= AC
01
LOAD
address
AC <= contents of memory address
02
JUMP
address
P C
< = a d d r e s s
03
JNEG
address
If AC < 0 Then PC <= address
04
Figure 9.3 Basic ΜP 3 Computer Instructions.
An example program to compute A = B + C is shown in Figure 9.4. This
program is a sequence of three instructions. Program variables such as A, B,
and C are typically stored in dedicated memory locations. The symbolic
representation of the instructions, called assembly language, is shown in the
first column. The second column contains the same program in machine
language (the binary pattern that is actually loaded into the computer's
memory).
The machine language can be derived using the instruction format in Figure
9.2. First, find the opcode for each instruction in the first column of Figure 9.3.
This provides the first two hexadecimal digits in machine language. Second,
assign the data values of A, B, and C to be stored in hexadecimal addresses
10,11, and 12 in memory. The address provides the last two hexadecimal digits
of each machine instruction.
Search WWH ::




Custom Search