Question: Arithmetic / Logic Instruction The instruction format of the machine ( except LOAD, STORE and BRANCH ) : Opcode Source Source Destination Operand 1 Operand

Arithmetic/Logic Instruction
The instruction format of the machine (except LOAD, STORE and BRANCH):
Opcode Source Source Destination
Operand 1 Operand 2 Operand
The instructions can be categorized into the following types:
Arithmetic Operations
ADD R1, R2, R3 ; R3<- R1+ R2
SUB R1, R2, R3 ; R3<- R1- R2
Logical Operations
AND R1, R2, R3 ; R3<- R1 and R2
OR R1, R2, R3 ; R3<- R1 or R2
NOT R1, R3 ; R3<- not R1
Data Movement Instruction
MOV R1, R3 ; R3<- R1
Note that in the NOT and MOV operation, source operand 2 field is not used and will be
set as 00000000.
2
Load/Store Instruction
Moving data from Memory to registers and vice versa.
LD A, R3 ; R3<- A, A is in memory
ST R1, A ; A <- R1, A is in memory
Load instruction:
Opcode 00000000 Addressing Destination
(Load) Mode Operand
Store instruction:
Opcode Source Addressing 00000000(Store) Operand Mode
where the addressing mode (how to find the target address) is specified in byte 2 of the
instruction. In this machine, only one addressing mode is used, where the target address
is given by the word following the LOAD or STORE instruction (Absolute Addressing). This
is specified as 11111111 in that byte.
Control Instruction
Control flow is by using BRANCH instruction. There are two types of branch instruction
conditional and unconditional Branch. Branch Instruction Format:
Opcode Condition Addressing 00000000(Branch) Code (cc) Mode
Conditional branch is based on the result of previous ALU operation, which is store in
a flag register. In this machine, we only use a ZERO flag, which will be set to 1 if the
ALU operation results in 0, and set to 0 otherwise. The target address is specified in
the same way as in memory operation. Similarly, the byte of Addressing Mode is set to
11111111.
The condition code is specified as
Condiation Code (cc) Instruction Description
00000000 BR Unconditaion Branch, always goto
00000001 BZ Branch if Zero flag is set
00000010 BNZ Branch if Zero flag is NOT set
Halt Instruction
The HLT instruction is used to stop the program. The other 3 bytes are all 0.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!