In 8085 microprocessor, we have conditional jump instructions. If condition is not met, it requires 2 machines cycles to execute the instruction. One machine cycle is for opcode fetch and why do we require another machine cycle?
Conditional Jump instruction normally requires 3 machine cycles(10T), if the condition is true. 1st machine cycle is for opcode fetch another 2machine cycles are for memory read.
If the condition is false it requires 2 machine cycles(7T). One machine cycle is for opcode fetch, another one is for memory read.
I hope you have your answer by now from Saranya Madam and Aparna Madam.
I still am trying to explain the reason for conditional branching instruction to follow only 2 machine cycles instead of 3 if condition is not met. Why isn’t it 3 instead?
The explanation:
First of all we need to keep two things in mind
1. Each instruction has opcode fetch cycle where in first two clock pulses the memory is fetched for the opcode and it is placed on the data bus and in next clock pulses it is loaded into instruction register and subsequently to instruction decoder for interpreting the instruction.
2. The program counter always points to the next memory location from where an 8 bit data will be fetched. Processor always fetch the program counter value either as opcode fetch or normal memory read as per the previous fetching and the program counter value will automatically be incremented by 1.
Now in connection with the answer of the question:
When the opcode for a conditional jump is being fetched the PC value is pointing to the higher byte of jump address. After the 4th CP the processer automatically starts fetching the memory location pointed by the PC (Lower byte ) as a simple memory read and PC is auto incremented by 1 but as soon as the instruction decoder completes the interpretation of the conditional jump and finds the condition to be false then processor finds it unnecessary to fetch the Higher byte of address which is currently pointed by the program counter and the PC value is incremented by 1 again to point next instruction (i.e. an opcode instead of Higher byte). So at false condition there are two machine cycles, i.e. OFC + Mem read (unnecessary but have to wait to finish the cycle)