Information Technology Reference
In-Depth Information
Opcode
Binary Description
Arithmetic
ADD
0000
Add memory word to AC
Logic
AND
0001
AND memory word to AC
CLA
0010
Clear (set to zero) the accumulator
CMA
0011
Complement AC
CIL
0100
Circulate AC left
Memory
LDA
0101
Load memory word into AC
STA
0110
Store AC into memory word
Jump
JZ
0111
Jump to address if AC zero
I/O
IN
1000
Load INR into AC
OUT
1001
Store AC into OUTR
Halt
HLT
1010 Halt computer
Figure 3.33 Instructions of the simple CPU.
tions could be added, including ones to simplify the execution of subroutines, handle loops,
and process interrupts. Each instruction has a mnemonic opcode, such as CLA, and a binary
opcode, such as 0010.
Many other operations can be performed using this set, including subtraction, which
can be realized through the use of ADD, CMA, and two's-complement arithmetic (see Prob-
lem 3.18 ). Multiplication is also possible through the use of CIL and ADD (see Problem 3.38 ).
Since multiple CILs can be used to rotate right one place, division is also possible. Finally, as
observed in Problem 3.39 , every two-input Boolean function can be realized through the use
of AND and CMA. This implies that every Boolean function can be realized by this machine
if it is designed to address enough memory locations.
Each of these instructions is a direct memory instruction , by which we mean that all
addresses refer directly to memory locations containing the operands (data) on which the pro-
gram operates. Most CPUs also have indirect memory instructions (and are said to support
indirection ). These are instructions in which an address is interpreted as the address at which
to find the address containing the needed operand.Tofindsuchanindirectoperand,theCPU
does two memory fetches, the first to find the address of the operand and the second to find
the operand itself. Often a single bit is added to an opcode to denote that an instruction is an
indirect memory instruction.
An instruction stored in the memory of our computer consists of sixteen binary digits, the
firstfourdenotingtheopcodeandthelasttwelvedenotinganaddress.Becauseitishardfor
humans to interpret such machine-language statements, mnemonic opcodes and assembly
languages have been devised.
3.10.4 Assembly-Language Programming
An assembly-language program consists of a number of lines each containing either a real or
pseudo-instruction. Real instructions correspond exactly to machine-language instructions ex-
cept that they contain mnemonics and symbolic addresses instead of binary sequences. Pseudo-
 
Search WWH ::




Custom Search