After fetch and decode, the execute step does the actual work. It's the only part of the fetch decode execute cycle that differs between instructions.
In Tiny8, execute takes one or two clock cycles:
- LOAD: E1
MDR ← M[MAR]; E2ACC ← MDR. - ADD: E1
MDR ← M[MAR]; E2ACC ← ACC + MDR. - SUB: E1
MDR ← M[MAR]; E2ACC ← ACC − MDR. - STORE: E1
MDR ← ACC; E2M[MAR] ← MDR. - JMP: E1
PC ← IR[3:0]. - JZ: E1 if Z = 1 then
PC ← IR[3:0]. - HALT: E1 stop.
Why do memory instructions need two steps? The operand isn't inside the CPU until E1's edge loads it into the MDR, so it can't reach the ACC in the same cycle. Likewise STORE must first move the ACC into the MDR before memory can be written.
So LOAD, STORE, ADD and SUB take 6 cycles in total; JMP, JZ and HALT take 5.