Information Technology Reference
In-Depth Information
TABLE 3.1
Instruction Set of the Simple Processor
Operation code
Operand
Meaning of instruction
0000
Stop execution
0001
adr
Load operand from memory (location adr) into AC
0010
adr
Store contents of AC in memory (location adr)
0011
Copy the contents AC to DR
0100
Copy the contents of DR to AC
0101
Add DR to AC
0110
Subtract DR from AC
0111
And bitwise DR to AC
1000
Complement contents of AC
1001
adr
Jump to instruction with address adr
1010
adr
Jump to instruction adr if AC ΒΌ 0
We assume that our simple processor supports three types of instructions: data
transfer, data processing, and program control. The data transfer operations are
load, store, and move data between the registers AC and DR. The data processing
instructions are add, subtract, and, and not. The program control instructions are
jump and conditional jump. The instruction set of our processor is summarized in
Table 3.1. The instruction size is 16 bits, 4 bits for the operation code and 12 bits
for the address (when appropriate).
Example 1 Let us write a machine language program that adds the contents of
memory location 12 (00C-hex), initialized to 350 and memory location 14 (00E-hex),
initialized to 96, and store the result in location 16 (010-hex), initialized to 0.
The program is given in binary instructions in Table 3.2. The first column gives
the memory location in binary for each instruction and operand. The second column
TABLE 3.2 Simple Machine Language Program in Binary (Example 1)
Memory location
(bytes)
Binary instruction
Description
0000 0000 0000
0001 0000 0000 1100
Load the contents of location 12 in AC
0000 0000 0010
0011 0000 0000 0000
Move contents of AC to DR
0000 0000 0100
0001 0000 0000 1110
Load the contents of location 14 into AC
0000 0000 0110
0101 0000 0000 0000
Add DR to AC
0000 0000 1000
0010 0000 0001 0000
Store contents of AC in location 16
0000 0000 1010
0000 0000 0000 0000
Stop
0000 0000 1100
0000 0001 0101 1110
Data value 350
0000 0000 1110
0000 0000 0110 0000
Data value is 96
0000 0001 0000
0000 0000 0000 0000
Data value is 0
Search WWH ::




Custom Search