![](http://datasheet.mmic.net.cn/290000/HMS77C2000_datasheet_16134699/HMS77C2000_20.png)
HMS77C2000/2001
Nov. 2002 Ver 1.1
17
8.2 CLOCKING SCHEME/INSTRUCTION
CYCLE
The clock input (X
IN
pin) is internally divided by four to
generate four non-overlapping quadrature clocks namely
Q1, Q2, Q3 and Q4. Internally, the program counter is in-
cremented every Q1, and the instruction is fetched from
program memory and latched into instruction register in
Q4. It is decoded and executed during the following Q1
through Q4. The clocks and instruction execution flow is
shown in Figure 8-2 and Figure 8-3.
8.3 INSTRUCTION FLOW/PIPELINING
An Instruction Cycle consists of four Q cycles (Q1, Q2, Q3
and Q4). The instruction fetch and execute are pipelined
such that fetch takes one instruction cycle while decode
and execute takes another instruction cycle. However, due
to the pipelining, each instruction effectively executes in
one cycle. If an instruction causes the program counter to
change (e.g.,
GOTO
) then two cycles are required to com-
plete the instruction (Figure 8-3).
A fetch cycle begins with the program counter (PC) incre-
menting in Q1.
In the execution cycle, the fetched instruction is latched
into the Instruction Register (IR) in cycle Q1. This instruc-
tion is then decoded and executed during the Q2, Q3, and
Q4 cycles. Data memory is read during Q2 (operand read)
and written during Q4 (destination write).
FIGURE 8-2 CLOCK/INSTRUCTION CYCLE
Internal
Phase
clock
Q1
Q2
Q3
Q4
Q1
Q2
Q3
Q4
Q1
Q2
Q3
Q4
Fetch INST(PC)
Execute INST(PC-1)
Fetch INST(PC+1)
Execute INST(PC)
Fetch INST(PC+2)
Execute INST(PC+1)
PC
PC+1
PC+2
PC
Q4
Q3
Q2
Q1
X
IN
FIGURE 8-3 INSTRUCTION PIPELINE FLOW
All instructions are single cycle, except for any program branches. These take two cycles since the fetch instruction is “flushed”
from the pipeline while the new instruction is being fetched and then executed.
1. MOVLW 03H
2. MOVWF UPIO
3. CALL SUB_1
4. BSF UPIO, BIT1
Fetch 1
Execute 1
Fetch 2
Execute 2
Fetch 3
Execute 3
Fetch 4
Flush
Fetch SUB 1
Execute SUB 1