XC164-16 Derivatives
System Units (Vol. 1 of 2)
Central Processing Unit (CPU)
User’s Manual 4-2 V2.1, 2004-03
CPUSV2_X, V2.2
the CPU within a programmable period of time, otherwise it will reset the chip. Thus, the
watchdog timer is able to prevent the CPU from going astray when executing erroneous
code. After reset, the watchdog timer starts counting automatically but, it can be disabled
via software, if desired.
In addition to its normal operation state, the CPU has the following particular states:
•Reset state: Any reset (hardware, software, watchdog) forces the CPU into a
predefined active state.
•IDLE state: The clock signal to the CPU itself is switched off, while the clocks for the
on-chip peripherals keep running.
•SLEEP state: All of the on-chip clocks are switched off (RTC clock selectable),
external interrupt inputs are enabled.
•POWER DOWN state: All of the on-chip clocks are switched off (RTC clock
selectable), all inputs are disregarded.
Transition to an active CPU state is forced by an interrupt (if in IDLE or SLEEP mode) or
by a reset (if in POWER DOWN mode).
The IDLE, SLEEP, POWER DOWN, and RESET states can be entered by specific
XC164 system control instructions.
A set of Special Function Registers is dedicated to the CPU core (CSFRs):
• CPU Status Indication and Control: PSW, CPUCON1, CPUCON2
• Code Access Control: IP, CSP
• Data Paging Control: DPP0, DPP1, DPP2, DPP3
• Global GPRs Access Control: CP
• System Stack Access Control: SP, SPSEG, STKUN, STKOV
• Multiply and Divide Support: MDL, MDH, MDC
• Indirect Addressing Offset: QR0, QR1, QX0, QX1
• MAC Address Pointers: IDX0, IDX1
• MAC Status Indication and Control: MCW, MSW, MAH, MAL, MRW
• ALU Constants Support: ZEROS, ONES
The CPU also uses CSFRs to access the General Purpose Registers (GPRs). Since all
CSFRs can be controlled by any instruction capable of addressing the SFR/CSFR
memory space, there is no need for special system control instructions.
However, to ensure proper processor operation, certain restrictions on the user access
to some CSFRs must be imposed. For example, the instruction pointer (CSP, IP) cannot
be accessed directly at all. These registers can only be changed indirectly via branch
instructions. Registers PSW, SP, and MDC can be modified not only explicitly by the
programmer, but also implicitly by the CPU during normal instruction processing.
Note: Note that any explicit write request (via software) to an CSFR supersedes a
simultaneous modification by hardware of the same register.