All Exams Test series for 1 year @ ₹349 only
Question

The following program is stored in memory unit of the basic computer. What is the content of the accumulator after the execution of program? (All location numbers listed below are in hexadecimal).

Location

Instruction

210

CLA

211

ADD 217

212

INC

213

STA 217

214

LDA 218

215

CMA

216

AND 217

217

1234H

218

9CE2H

The correct answer is

0215H

Analyzing the Basic Computer Program

The question asks for the final content of the accumulator (AC) after executing a small program stored in the memory of a basic computer. The program consists of several instructions, and we need to simulate their execution sequence. All memory locations and values are given in hexadecimal format.

Let's first list the program instructions and initial memory contents:

Program Instructions and Initial Memory Content
Location (Hex) Instruction/Content (Hex) Instruction Type Operand/Value
210 CLA Memory Reference / Register Reference Clear Accumulator
211 ADD 217 Memory Reference Add content of location 217H to AC
212 INC Register Reference Increment Accumulator
213 STA 217 Memory Reference Store content of AC into location 217H
214 LDA 218 Memory Reference Load content of location 218H into AC
215 CMA Register Reference Complement Accumulator
216 AND 217 Memory Reference Bitwise AND content of location 217H with AC
217 1234H Data Initial value at 217H
218 9CE2H Data Initial value at 218H

Step-by-Step Program Execution

We will trace the execution of the program starting from location $210H$ and observe how the accumulator (AC) and relevant memory locations change. Assume the AC is initialized to an unknown state; the first instruction will handle its initial value.

Tracing Program Execution
Step Location (Hex) Instruction Operation Accumulator (AC) Content (Hex) Memory[217H] Content (Hex)
Start - - Initial State (AC unknown) ? 1234
1 210 CLA Clear AC 0000 1234
2 211 ADD 217 AC $\leftarrow$ AC + Memory[217H]. AC $\leftarrow$ $0000H + 1234H$ 1234 1234
3 212 INC AC $\leftarrow$ AC + 1. AC $\leftarrow$ $1234H + 1H$ 1235 1234
4 213 STA 217 Memory[217H] $\leftarrow$ AC. Memory[217H] $\leftarrow$ $1235H$ 1235 1235
5 214 LDA 218 AC $\leftarrow$ Memory[218H]. AC $\leftarrow$ $9CE2H$ (Memory[218H] initially $9CE2H$) 9CE2 1235
6 215 CMA AC $\leftarrow$ Complement of AC. Complement of $9CE2H$.
$9CE2H = 1001\ 1100\ 1110\ 0010_2$
Complement = $0110\ 0011\ 0001\ 1101_2 = 631DH$
631D 1235
7 216 AND 217 AC $\leftarrow$ AC AND Memory[217H]. AC $\leftarrow$ $631DH\ \text{AND}\ 1235H$.
$631DH = 0110\ 0011\ 0001\ 1101_2$
$1235H = 0001\ 0010\ 0011\ 0101_2$
Bitwise AND: $0000\ 0010\ 0001\ 0101_2 = 0215H$
0215 1235
End - - Program finishes 0215 1235

After executing the last instruction at location $216H$, the program halts (implicitly, as no further instructions are shown). The content of the accumulator at this point is $0215H$.

Revision Table: Basic Computer Instructions

Understanding the basic operations is crucial for tracing program execution. Here is a summary of the instructions used in this program:

Key Basic Computer Instructions
Instruction Description Effect on AC
CLA Clear Accumulator AC $\leftarrow$ 0
ADD M Add Memory to AC AC $\leftarrow$ AC + Memory[M]
INC Increment Accumulator AC $\leftarrow$ AC + 1
STA M Store AC in Memory Memory[M] $\leftarrow$ AC
LDA M Load AC from Memory AC $\leftarrow$ Memory[M]
CMA Complement Accumulator AC $\leftarrow$ Bitwise NOT of AC
AND M AND Memory with AC AC $\leftarrow$ AC AND Memory[M] (bitwise AND)

Additional Information on Basic Computer Architecture

The basic computer, as described in many computer architecture textbooks, is a simplified model used to illustrate fundamental concepts. Key components include:

  • Memory Unit: Stores instructions and data. Locations are addressed sequentially.
  • Accumulator (AC): A general-purpose register used in most arithmetic and logic operations.
  • Program Counter (PC): Holds the address of the next instruction to be executed. Initially loaded with the starting address of the program ($210H$ in this case).
  • Instruction Register (IR): Holds the instruction currently being executed.
  • Data Register (DR): Holds data read from or written to memory.
  • Address Register (AR): Holds the address of the memory location being accessed.

Execution follows a fetch-decode-execute cycle for each instruction pointed to by the PC. Instructions are typically 16 bits long. The basic computer supports different instruction formats, including memory-reference instructions (like ADD, STA, LDA, AND), register-reference instructions (like CLA, INC, CMA), and input-output instructions. This program primarily uses memory-reference and register-reference instructions. Hexadecimal notation is commonly used to represent memory addresses and data for brevity.

Was this answer helpful?

Important Questions from Data-Path and Control Unit

  1. Given below are two statements:

    Statement I: Hardwired control unit can be optimized to produce fast mode of operation.

    Statement II: Indirect addressing mode needs two memory reference to fetch the operand.

    In the light of the above statements. choose the correct answer from the options given below

  2. Which of the following statements with respect to multiprocessor system are true?

    (A) Multiprocessor system is controlled by one operating system.

    (B) In Multiprocessor system, multiple computers are connected by the means of communication lines.

    (C) Multiprocessor system is classified as multiple instruction stream and multiple data stream system.

    Choose the correct answer from the options given below:

  3. A partial data path of a processor is given in the figure, where RA, RB, and RZ are 32-bit registers. Which option(s) is/are CORRECT related to arithmetic operations using the data path as shown?

  4. Given below are two statements: one is labelled as Assertion A and the other is labelled as Reason R 

    Assertion A: Instruction pipelining improves CPU throughput. 

    Reason R: Pipelining decreases the execution time of each individual instruction. 

    In the light of the above statements, choose the most appropriate answer from the options given below

Need Expert Advice?

Start Your Preparation with Prepp Mobile App

Download the app from Google Play & App Store
Download the app from Google Play & App Store
Prepp Mobile App