3 Instruction Cycle

Microprocessor · Unit 3 · 3 hrs

Instruction Cycle

Exam-focused notes for Instruction Cycle (Microprocessor, CSC167): what the TU syllabus asks and how it has actually been tested, with 7 solved past questions from this unit.

Instruction Cycle in short

This chapter looks inside a single instruction's execution: the fetch and execute operations that make it up, the machine cycles and T-states used to measure it, and how the microprocessor is wired to memory in the first place to make all of this possible.

Instruction Cycle: notes

Fetch Operation and Timing Diagram

The fetch operation retrieves the opcode of the next instruction from the memory location addressed by the program counter, places it in the instruction register, and increments the program counter to point at the following byte. The fetch, or opcode fetch, machine cycle is identified by the status combination $IO/\overline{M}=0$, $S_1=1$, $S_0=1$, and normally takes four T-states, $T_1$ to $T_4$ (some instructions extend it to six). Through $T_1$ and into $T_2$, the address is held stable on the address bus while ALE pulses high briefly in $T_1$ to latch the lower-order address; $\overline{RD}$ then goes low from the middle of $T_2$ through $T_3$ to enable the memory chip's output, and the opcode appears on AD0-AD7 and is read into the instruction register by the end of $T_3$; $T_4$ is used internally to begin decoding.

Execute Operation and Timing Diagram

The execute operation decodes the fetched opcode and carries out the action it specifies. Many instructions need additional bus cycles beyond the initial fetch: MVI needs one more memory read to bring in its immediate data byte, while LDA needs two more memory read cycles to fetch its 16-bit address and a further memory read cycle to fetch the addressed byte. Each of these additional cycles, memory read, memory write, I/O read or I/O write, is a separate machine cycle, identified by its own $IO/\overline{M}$, $S_1$, $S_0$ combination, and normally takes three T-states, $T_1$ to $T_3$. In each case the address is held stable while the appropriate control line, $\overline{RD}$ for a read or $\overline{WR}$ for a write, pulses low across $T_2$ and $T_3$ to move the byte in the required direction.

What this unit covers

  • Fetch Operation and Timing Diagram
  • Execute Operation and Timing Diagram
  • Instruction Cycle
  • Machine Cycle
  • T-States
  • T-States
  • Memory Interfacing

Machine Cycle

2081 · 10 marks

What is ALE signal? Draw a timing diagram for LDA 5000H instruction and explain the machine cycles involved.[10]

Show solved answer

ALE Signal and Timing Diagram for LDA 5000H Instruction


Part 1: ALE Signal (Address Latch Enable)

ALE (Address Latch Enable) is a control signal generated by the 8085 microprocessor. It is an active HIGH output signal that is used to demultiplex the lower-order address bus from the data bus.

Why ALE is Needed:

The 8085 has a multiplexed address/data bus. The lower 8 bits of the address (A0-A7) share the same physical pins as the 8-bit data bus (AD0-AD7). To separate the address from the data, the ALE signal is used.

How ALE Works:

  • ALE goes HIGH at the beginning of the first T-state (T1) of every machine cycle.
  • During T1, when ALE is HIGH, the lower 8-bit address (A0-A7) is present on the AD0-AD7 lines.
  • An external latch (e.g., 74LS373) captures and holds this lower address when ALE goes LOW.
  • After ALE goes LOW (from T2 onwards), the AD0-AD7 lines are used as the data bus.
  • The higher-order address bits (A8-A15) remain on the dedicated address bus throughout the machine cycle.

In short: ALE = 1 means address is on AD0-AD7; ALE = 0 means data is on AD0-AD7.


Part 2: LDA 5000H Instruction

Meaning:

LDA 5000H means Load Accumulator Direct from memory address 5000H.

  • The contents of memory location 5000H are loaded into the Accumulator (A).
  • It is a 3-byte instruction: Opcode (3AH) + Low byte of address (00H) + High byte of address (50H).

Machine Cycles Involved:

LDA 5000H consists of 4 machine cycles and a total of 13 T-states:

Machine CycleTypeT-StatesOperation
MC1Opcode Fetch (OF)T1-T4Fetch opcode 3AH from memory (PC address)
MC2Memory Read (MR)T1-T3Read low byte of address (00H) from PC+1
MC3Memory Read (MR)T1-T3Read high byte of address (50H) from PC+2
MC4Memory Read (MR)T1-T3Read data from address 5000H into Accumulator

Part 3: Timing Diagram for LDA 5000H

Assume the instruction starts at memory address 2050H.

         MC1 (Opcode Fetch)      MC2 (Mem Read)    MC3 (Mem Read)    MC4 (Mem Read)
         T1   T2   T3   T4       T1   T2   T3       T1   T2   T3      T1   T2   T3
          |    |    |    |        |    |    |         |    |    |       |    |    |
CLK    __| |__| |__| |__| |____| |__| |__| |_______| |__| |__| |_____| |__| |__| |__

ALE    _____|   |_________________|   |_______________|   |_____________|   |________
       HIGH at T1 of each MC

A8-A15 --[  20H  ]---------------[  20H  ]----------[  20H  ]--------[  50H  ]------
       (High order address, stable throughout each MC)

AD0-A7 -[2050H lo]-[  3AH  ]-----[2051H lo]-[00H]---[2052H lo]-[50H]-[00H lo]-[data]
        addr(T1)   data(T2-T4)    addr(T1)  data     addr(T1)  data   addr(T1) data

IO/M   ___________________________________________  LOW (Memory operation throughout)

RD     ________|___________________|_______________|_______________|________________
               LOW during read     LOW             LOW             LOW
               (T2-T3)

Cleaner Representation:

CLK:    _|-|_|-|_|-|_|-|_  _|-|_|-|_|-|_  _|-|_|-|_|-|_  _|-|_|-|_|-|_
        T1  T2  T3  T4      T1  T2  T3      T1  T2  T3      T1  T2  T3

        |<---- MC1 ------->|<--- MC2 ---->|<--- MC3 ---->|<--- MC4 ---->|

ALE:    |HIGH|_____________|HIGH|_________|HIGH|_________|HIGH|_________|

A8-A15: |  20H (high byte of 2050H)  |20H |     |20H |     |  50H      |

AD0-AD7:|2050H|  3AH (opcode) |2051H|00H |2052H|50H  |5000H| DATA(Acc) |
        |addr | data          |addr |data |addr |data |addr | data      |

IO/M:   |___________ LOW (Memory) ___________________________________|

RD:     |    |___|   |    |___|    |    |___|    |    |___|           |
              active        active        active        active
              LOW           LOW           LOW           LOW

Part 4: Explanation of Each Machine Cycle

Machine Cycle 1 - Opcode Fetch (4 T-states):

  • T1: PC (2050H) is placed on address bus. ALE goes HIGH. Lower address (50H) latched externally.
  • T2: ALE goes LOW. RD goes LOW.
Open this answer on its own page →

Instruction Cycle

2080 · 10 marks

Explain instruction cycle, machine cycle and T-states. Draw timing diagram of fetch and execute of LDA instruction with brief description.[10]

--- The instruction cycle is defined as the total time required to fetch and execute an entire instruction. An instruction cycle consists of two parts: - Fetch Cycle (FC): The CPU fetches the opcode from memory. The address stored in the Program Counter (PC) is used to locate the instruction in m...

Open this answer on its own page →

2079 · 10 marks

What is instruction cycle? Draw timing diagram of MOV A, B. Make necessary assumptions.[10]

Show solved answer

Instruction Cycle and Timing Diagram of MOV A, B


1. Instruction Cycle (Definition and Structure)

Instruction Cycle is defined as the total time required to fetch and execute an entire instruction.

From the notes:

"The time required to execute and fetch an entire instruction is called instruction cycle."

The instruction cycle is given by:

$$IC = FC + EC$$

Where:

  • FC = Fetch Cycle time
  • EC = Execute (Execution) Cycle time

Components of Instruction Cycle

ComponentDescription
Fetch CycleCPU fetches the opcode from memory using the address stored in the Program Counter (PC) and stores it in the Instruction Register (IR). Takes 4 T-states.
Execute CycleCPU decodes the instruction and performs the specific operation (data transfer, arithmetic, etc.). Takes 3 T-states (varies by instruction).

Key Terms

  • Machine Cycle: The time required by the microprocessor to complete one operation of accessing memory or I/O device. Consists of 3 to 6 T-states.
  • T-State: One time period (clock period) of the microprocessor frequency. It is measured from the falling edge of one clock pulse to the falling edge of the next clock pulse.
  • The 8085 microprocessor consists of 1 to 6 machine cycles per instruction.

2. Timing Diagram of MOV A, B

Assumptions

  1. Microprocessor used: Intel 8085
  2. Clock frequency: f (each T-state = 1 clock period = 1/f seconds)
  3. The instruction MOV A, B copies the content of register B into register A.
  4. Opcode of MOV A, B = 78H (1 byte instruction)
  5. The instruction is stored at memory address 2050H (assumption)
  6. Since MOV A, B is a register-to-register operation, it requires:
    • 1 Machine Cycle (Opcode Fetch / M1) = 4 T-states
    • No memory read/write is needed in execution (register operation is internal)
    • Total T-states = 4

Machine Cycle Details

Machine CycleTypeT-StatesOperation
M1Opcode FetchT1, T2, T3, T4Fetch opcode 78H from memory address 2050H; decode and execute internally

Note: For MOV A, B, the execution (moving data from B to A) happens internally during T4 of the opcode fetch cycle itself. No separate execution machine cycle is needed.


Timing Diagram

Clock:
       ___     ___     ___     ___
      |   |   |   |   |   |   |   |
______|   |___|   |___|   |___|   |______
      T1      T2      T3      T4

       |<----------  M1 (Opcode Fetch) ---------->|

ALE:
      ___
     |   |
_____|   |_________________________________________
      T1
      (Address Latch Enable -- high during T1)

Address Bus (A15-A8) / AD7-AD0:
      |--2050H--|
      <valid>   |
      T1        |
                (address lines go high-Z / data phase)

AD7-AD0 (Data Bus -- lower 8 bits multiplexed):
               |--- 78H (Opcode) ---|
               T2        T3
               (Data valid on bus)

RD (Memory Read) -- Active LOW:
              ____________________
_____________|                    |_______________
      T1     T2         T3        T4
             (RD goes LOW -- memory read active)
             (RD goes HIGH after T3)

IO/M (LOW = Memory operation):
_____________________________________________
(stays LOW throughout M1 -- memory operation)

S1, S0 (Status signals for Opcode Fetch = 1,0):
      <S1=1, S0=0 during M1>

Internal Operation (T4):
      Content of Register B is transferred to Register A
      (No external bus activity)

Detailed Description of Each T-State

T-StateActivity
T1PC content (2050H) is placed on the address bus. ALE goes HIGH to latch the lower 8-bit address. IO/M is set LOW (memory operation).
T2ALE goes LOW. RD signal goes LOW (active). The lower 8 address lines (AD0-AD7) switch to data bus mode. CPU waits for memory to respond.
T3Opcode 78H is read from memory and placed on the data bus. CPU reads the data into the Instruction Register (IR). RD goes HIGH.
T4CPU decodes the instruction internally. Content of register B is copied to register A. No external bus activity occurs.

Summary

Instruction : MOV A, B
Opcode      : 78H  (1 byte)
Machine Cycles : 1 (Opcode Fetch)
T-States    : 4
Operation   : (A) <-- (B)

The timing diagram shows that MOV A, B completes in 4 T-states within a single machine cycle (M1). Since both source (B) and destination (A) are internal CPU registers, no additional memory access machine cycle is required, making it one of the fastest instructions in the 8085 instruction set.

Open this answer on its own page →

2078 · 10 marks

Explain instruction cycle, machine cycle and T-states. Draw timing diagram of IN instruction with brief description.[10]

--- The time required to fetch and execute an entire instruction is called the instruction cycle. An instruction cycle consists of two parts: - The CPU fetches the opcode from memory using the address stored in the Program Counter (PC). - The fetched opcode is stored in the Instruction Register (...

Open this answer on its own page →

2075 · 10 marks

Explain instruction cycle, machine cycle and T-States. Draw timing diagram of STA instruction. Make necessary assumptions.[10]

--- The time required to fetch and execute an entire instruction is called an instruction cycle. An instruction cycle consists of two parts: - The CPU fetches the opcode from the memory location pointed to by the Program Counter (PC). - The fetched opcode is stored in the Instruction Register (IR...

Open this answer on its own page →

2080.1 · 5 marks

Difference between instruction cycle and machine cycle. Draw timing diagram of MVI A, 32 H. [5]

--- Basis Instruction Cycle Machine Cycle --------- Definition Time required to fetch and execute an entire instruction Time required to access memory or I/O device once Composition Consists of one or more machine cycles Consists of 3 to 6 T-states Formula IC = Fetch Cycle + Execute Cycle MC = 3 ...

Open this answer on its own page →

Memory Interfacing

2075 · 5 marks

What is mean by memory interfacing? Explain the address decoding process in the 8085 microprocessor with 3 to 8 decoder. [5]

Memory interfacing refers to the process of connecting memory chips (RAM/ROM) to the microprocessor so that the CPU can read from and write to those memory locations correctly. It involves properly connecting the address bus, data bus, and control bus of the microprocessor to the corresponding pi...

Open this answer on its own page →