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.
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 answerHide 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 Cycle | Type | T-States | Operation |
|---|---|---|---|
| MC1 | Opcode Fetch (OF) | T1-T4 | Fetch opcode 3AH from memory (PC address) |
| MC2 | Memory Read (MR) | T1-T3 | Read low byte of address (00H) from PC+1 |
| MC3 | Memory Read (MR) | T1-T3 | Read high byte of address (50H) from PC+2 |
| MC4 | Memory Read (MR) | T1-T3 | Read 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.
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]
2079 · 10 marks
What is instruction cycle? Draw timing diagram of MOV A, B. Make necessary assumptions.[10]
Show solved answerHide 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
| Component | Description |
|---|---|
| Fetch Cycle | CPU 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 Cycle | CPU 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
- Microprocessor used: Intel 8085
- Clock frequency: f (each T-state = 1 clock period = 1/f seconds)
- The instruction MOV A, B copies the content of register B into register A.
- Opcode of MOV A, B = 78H (1 byte instruction)
- The instruction is stored at memory address 2050H (assumption)
- 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 Cycle | Type | T-States | Operation |
|---|---|---|---|
| M1 | Opcode Fetch | T1, T2, T3, T4 | Fetch 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-State | Activity |
|---|---|
| T1 | PC 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). |
| T2 | ALE 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. |
| T3 | Opcode 78H is read from memory and placed on the data bus. CPU reads the data into the Instruction Register (IR). RD goes HIGH. |
| T4 | CPU 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.
2078 · 10 marks
Explain instruction cycle, machine cycle and T-states. Draw timing diagram of IN instruction with brief description.[10]
2075 · 10 marks
Explain instruction cycle, machine cycle and T-States. Draw timing diagram of STA instruction. Make necessary assumptions.[10]
2080.1 · 5 marks
Difference between instruction cycle and machine cycle. Draw timing diagram of MVI A, 32 H. [5]
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]
Make Unit 3 stick
Practice CSC167 with flashcards & quizzes