0% found this document useful (0 votes)
7 views5 pages

Step-by-Step AND Instruction Analysis

Uploaded by

Abdul Rasheed
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views5 pages

Step-by-Step AND Instruction Analysis

Uploaded by

Abdul Rasheed
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Solve this problem.

Let’s solve the problem step by step for the AND instruction, and then outline the end values
for the other instructions as requested.
First, let’s clarify the registers you must list at the end of execute phase (for each instruction):
PC (Program Counter)
AR (Address Register)
DR (Data Register)
AC (Accumulator)
IR (Instruction Register)

Initial Setup
Given:
Instruction at address 021: I=0, op-code=AND, address=083
Memory word at 083: B8F2
AC = A937

1. Fetch Cycle
At start (from address 021):
PC = 021
Memory = 0083 (with opcode for AND, I=0, address=083)
Fetch phases typically involve:
AR ← PC
IR ← M[AR]
PC ← PC + 1
So, after fetch:
AR = 021
IR = AND 083 (I=0)
PC = 022
2. Decode Phase
Decode IR:
I = 0 (direct addressing)
Opcode = AND
Address part = 083
AR ← Address part of IR → AR = 083

3. Execute Phase for AND


From the table:
AND: AC ← AC ∧ M[AR]
Also,
DR ← M[AR] (memory read)
So,
DR = M = B8F2
AC = A937 ∧ B8F2
Let's do the bitwise AND in hex:

A937: 1010 1001 0011 0111


B8F2: 1011 1000 1111 0010
Result: 1010 1000 0011 0010 = A832

4. Register values at end of execute


PC: 022 (incremented at fetch)
AR: 083 (holds address part for memory reference)
DR: B8F2 (value read from memory)
AC: A832 (result of A937 ∧ B8F2)
IR: AND 083
Repeat for the other six instructions
Keep AC reset to A937 and M=B8F2 for each. Only the operation changes (refer to the table):

2. ADD 083
AC = A937, DR = B8F2
ADD: AC ← AC + M[AR]
Calculate:
A937 + B8F2 = 16229 (in hex). But it's a 16-bit computer so ignore possible carry.
In hex:
A937 + B8F2 = 16229 (carry: 1)
So, discard carry:
6229
End registers:

3. LDA 083
LDA: AC ← M[AR]
So:
AC = B8F2

4. STA 083
STA: M[AR] ← AC
No change to AC, DR stays undefined (or previous). Let's assume DR is not used.
But now M = A937. For consistency, let's leave the DR as previous (B8F2).

5. BUN 083
BUN: PC ← AR
So:
PC = 083

6. BSA 083
BSA: M[AR] ← PC, PC ← AR + 1
Assume before execute:
PC = 022
So,
M ← 022
PC ← 084

7. ISZ 083
ISZ: M[AR] ← M[AR] + 1; If result = 0: PC ← PC + 1
M = B8F2 originally
M ← B8F2 + 1 = B8F3 (not zero, so PC unchanged)
Summary Table
Instruction PC AR DR AC IR

AND 083 022 083 B8F2 A832 AND 083

ADD 083 022 083 B8F2 6229 ADD 083

LDA 083 022 083 B8F2 B8F2 LDA 083

STA 083 022 083 B8F2 A937 STA 083

BUN 083 083 083 A937 BUN 083

BSA 083 084 083 022 A937 BSA 083

ISZ 083 022 083 B8F3 A937 ISZ 083

If you need a detailed step-by-step for each instruction's microoperations, let me know!

You might also like