MCS-012 Computer Organisation and Assembly Language Programming

First year, Semester 1

Instruction Execution : An Example

"Instruction Execution" refers to the process by which a computer's central processing unit (CPU) carries out the instructions of a program. This process involves several stages, each crucial for the successful execution of an instruction. Here's an example to illustrate the concept:

Example: Executing a Simple Instruction

Step 1: Fetch

The CPU fetches the instruction from the memory. Suppose the instruction is to add two numbers stored in memory. The instruction might look something like this in assembly language: ADD R1, R2, R3, which means "add the contents of registers R2 and R3, and store the result in register R1."

Step 2: Decode

The CPU decodes the fetched instruction to understand what action is required. The decoding unit translates the assembly instruction into a set of signals that can control other parts of the CPU. This step involves determining that the operation is an addition and identifying the registers involved (R1, R2, and R3).

Step 3: Execute

The execution unit performs the operation specified by the decoded instruction. In this case, the CPU adds the contents of registers R2 and R3. For instance, if R2 contains the value 5 and R3 contains the value 10, the execution unit will compute 5 + 10.

Step 4: Memory Access (if needed)

Some instructions require accessing the memory for reading or writing data. In our example, since the instruction only involves registers, this step is skipped. If it were an instruction that required fetching or storing data in memory, the CPU would interact with the memory unit here.

Step 5: Write Back

The result of the executed instruction is written back to the destination register or memory location. In our example, the result of the addition (15) is written back to register R1.


Report an issue

Reporting: Instruction Execution : An Example (topic)

Related Posts