GATE / CS ARCHIVE

SIMILAR QUESTIONS / COMPUTER ORGANIZATION & ARCHITECTURE

Count instruction cycles including memory wait states

2 questions solved the same way, newest first. Back to Computer Organization & Architecture

How these are solved

Enumerate instruction fetch and data machine cycles, add one wait for each ROM access but none for RAM, and convert T states using the 6 MHz crystal and CPU divider. Independent initial register states and PC=0200H apply to each instruction.

Descriptive
Report issue

8085 immediate OR timing

Instructions & Addressing Modes

Question 8(a.i), GATE 1991: 8085 system: crystal 6 MHz; ROM 0000H–07FFH needs one wait state per access; RAM 1000H–17FFH needs none. Initially A=55H,B=AAH,C=F7H,D=10H,H=10H,L=FFH,PC=0200H,SP=17F0H, separately for each instruction. Find the instruction time for printed “ORI A,22”.
Question 8(a.i), GATE 1991: 8085 system: crystal 6 MHz; ROM 0000H–07FFH needs one wait state per access; RAM 1000H–17FFH needs none. Initially A=55H,B=AAH,C=F7H,D=10H,H=10H,L=FFH,PC=0200H,SP=17F0H, separately for each instruction. Find the instruction time for printed “ORI A,22”.
Question 8(a.i), GATE 1991: 8085 system: crystal 6 MHz; ROM 0000H–07FFH needs one wait state per access; RAM 1000H–17FFH needs none. Initially A=55H,B=AAH,C=F7H,D=10H,H=10H,L=FFH,PC=0200H,SP=17F0H, separately for each instruction. Find the instruction time for printed “ORI A,22”.
Tap to enlarge
Answer & solution

Answer: 9 T-states = 3 μs, interpreting the printed mnemonic as 8085 ORI immediate. (no official key was published)

The 8085 divides the external crystal frequency by two, giving a 3 MHz processor clock. Therefore one T-state lasts 1/3 μs, not 1/6 μs.

8085 ORI immediate is a two-byte instruction: an opcode-fetch cycle of 4 T-states and an immediate-data memory-read cycle of 3 T-states. With PC=0200H, both bytes, at 0200H and 0201H, lie in ROM. Each access adds one wait state. Total time is (4+1)+(3+1)=9 T-states, or 9/(3 MHz)=3 μs.

The accumulator’s original value affects the logical result but not this timing. The other general-purpose registers and the stack pointer are unused. The printed “ORI A,22” is not the conventional 8085 syntax, which writes only the immediate operand, e.g. ORI 22H. The implicit destination is always A. Whether the literal 22 is decimal or hexadecimal does not alter the cycle count. Treating it as register ORA A would incorrectly discard the immediate-byte read.

Original paper, page 6

Report issue

8085 memory decrement timing

Instructions & Addressing Modes

Question 8(a.ii), GATE 1991: 8085 system: crystal 6 MHz; ROM 0000H–07FFH needs one wait state per access; RAM 1000H–17FFH needs none. Initially A=55H,B=AAH,C=F7H,D=10H,H=10H,L=FFH,PC=0200H,SP=17F0H, separately for each instruction. Find the instruction time for DCR M.
Question 8(a.ii), GATE 1991: 8085 system: crystal 6 MHz; ROM 0000H–07FFH needs one wait state per access; RAM 1000H–17FFH needs none. Initially A=55H,B=AAH,C=F7H,D=10H,H=10H,L=FFH,PC=0200H,SP=17F0H, separately for each instruction. Find the instruction time for DCR M.
Question 8(a.ii), GATE 1991: 8085 system: crystal 6 MHz; ROM 0000H–07FFH needs one wait state per access; RAM 1000H–17FFH needs none. Initially A=55H,B=AAH,C=F7H,D=10H,H=10H,L=FFH,PC=0200H,SP=17F0H, separately for each instruction. Find the instruction time for DCR M.
Tap to enlarge
Answer & solution

Answer: 11 T-states = 11/3 μs ≈3.667 μs. (no official key was published)

The processor clock is 6 MHz/2=3 MHz, so a T-state is 1/3 μs. DCR M decrements the memory byte addressed by HL. It performs a 4-T opcode fetch, a 3-T memory read, and a 3-T memory write, for a nominal 10 T-states.

The opcode address PC=0200H is in ROM, adding one wait state. The operand address is HL=10FFH, obtained by concatenating H=10H and L=FFH. This lies in RAM’s 1000H–17FFH range, so neither the operand read nor the write adds a wait. Thus the total is (4+1)+3+3=11 T-states, or 11/3 μs≈3.667 μs.

“M” does not mean an immediate byte following the opcode; it is the indirect-memory operand at HL. The byte’s value was not specified, but every value uses the same timing. Nor is the ROM wait charged to every machine cycle merely because the program executes from ROM: each cycle’s addressed memory device determines its own wait requirement. The instruction changes arithmetic flags except carry, which is immaterial to the timing calculation.

Original paper, page 6