This publication is subject to replacement by a later edition. To determine whether a later edition
exists, or to request copies of publications, contact
ZiLOG Worldwide Headquarters
532 Race Street
San Jose, CA 95126-3432
Telephone: 408.558.8500
Fax: 408.558.8300
www.ZiLOG.com
Windows is a registered trademark of Microsoft Corporation.
This user manual describes the features of the Z8018x MPUs.This manual
provides basic programming information for the Z80180/Z8S180/
Z8L180. These cores and base peripheral sets are used in a large family of
ZiLOG products. Below is a list of ZiLOG products that use this class of
processor, along with the associated processor family. This document is
also the core user manual for the following products:
PartFamily
Z80180Z80180
Z8S180Z8S180
Z8L180Z8L180
Z8018x
Family MPU User Manual
iii
Z80181Z80180
Z80182Z80180, Z8S180*
Z80S183Z8S180
Z80185/195Z8S180
Z80189Z8S180
* Part number-dependant
Intended Audience
This manual is written for those who program the Z8018x.
Manual Organization
The Z8018x User Manual is divided into five sections, seven appendices,
and an index.
UM005003-0703
Z8018x
Family MPU User Manual
iv
Sections
Z8018X MPU Operation
Presents features, a general description, pins descriptions, block
diagrams, registers, and details of operating modes for the Z8018x MPUs.
Software Architecture
Provides instruction sets and CPU registers for the Z8018x MPUs.
DC Characteristics
Presents the DC parameters and absolute maximum ratings for the
Z8X180 MPUs.
AC Characteristics
Presents the AC parameters for the Z8018x MPUs.
Timing Diagrams
Contains timing diagrams and standard test conditions for the Z8018x
MPUs.
Appendices
The appendixes in this manual provide additional information applicable
to the Z8018x family of ZiLOG MPUs:
•
Instruction set
•
Instruction summary table
•
Op Code map
•
Bus Control signal conditions in each machine cycle and interrupt
conditions
Two Universal Asynchronous Receiver/Transmitter (UART) Channels
•
Two 16-Bit Timer Channels
Z8018x
1
•
On-Chip Interrupt Controller
•
On-Chip Clock Oscillator/Generator
•
Clocked Serial I/O Port
•
Code Compatible with ZiLOG Z80 CPU
•
Extended Instructions
GENERAL DESCRIPTION
Based on a microcoded execution unit and an advanced CMOS
manufacturing technology, the Z80180, Z8S180, Z8L180 (Z8X180) is an
8-bit MPU which provides the benefits of reduced system costs and low
power operation while offering higher performance and maintaining
compatibility with a large base of industry standard software written
around the ZiLOG Z8X CPU.
Higher performance is obtained by virtue of higher operating frequencies,
reduced instruction execution times, an enhanced instruction set, and an
UM005003-0703
Z8018x
Family MPU User Manual
2
on-chip memory management unit (MMU) with the capability of
addressing up to 1 MB of memory.
Reduced system costs are obtained by incorporating several key system
functions on-chip with the CPU. These key functions include I/O devices
such as DMA, UART, and timer channels. Also included on-chip are
several glue functions such as dynamic RAM refresh control, wait state
generators, clock oscillator, and interrupt controller.
Not only does the Z8X180 consume a low amount of power during
normal operation, but processors with Z8S180 and Z8L180 class
processors also provides two operating modes that are designed to
drastically reduce the power consumption even further. The SLEEP mode
reduces power by placing the CPU into a stopped state, thereby
consuming less current, while the on-chip I/O device is still operating.
The SYSTEM STOP mode places both the CPU and the on-chip
peripherals into a stopped state, thereby reducing power consumption
even further.
When combined with other CMOS VLSI devices and memories, the
Z8X180 provides an excellent solution to system applications requiring
high performance, and low power operation.
Figures 1 through 3 illustrate the three pin packages in the Z8X180 MPU
family:
Pin out package descriptions for other Z8X180-based products are
covered in their respective product specifications.
Figure 4 depicts the block diagram that is shared throughout all
configurations of the Z8X180.
UM005003-0703
V
XTAL
EXTAL
WAIT
BUSACK
BUSREQ
RESET
NMI
INT0
INT1
INT2
ST
A0
A1
A2
A3
A4
A5
A6
A7
A8
A9
A10
A11
A12
A13
A14
A15
A16
A17
A18/TOUT
V
CC
Z8018x
Family MPU User Manual
3
1
SS
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Z8X180
64
Phi
RD
63
62
WR
61
MI
E
60
59
MREQ
58
IORQ
57
RFSH
56
HALT
55
TEND1
54
DREQ1
53
CKS
52
RXS/CTS1
51
TXS
50
CKA1/TEND0
RXA1
49
48
TXA1
CKA0/DREQ0
47
46
RXA0
45
TXA0
44
DCO0
CTS0
43
RTS0
42
D7
41
40
D6
D5
39
38
D4
37
D3
36
D2
D1
35
34
D0
33
V
SS
Figure 1.64-Pin DIP
UM005003-0703
Z8018x
Family MPU User Manual
4
10
INT0
INT1
11
INT2
12
ST
13
A0
14
A1
15
A2
16
17
A3
18
V
SS
A4
19
20
A5
A6
21
A7
22
A8
23
A9
24
A10
25
26
A11
NMI
9
27
A12
RESET
8
28
A13
BUSREQ
7
29
A14
BUSACK
6
30
A15
WAIT
5
A16
EXTAL
XTAL
432
Z8X180
33
32
A17
VSS
VLS
PhiRDWRMIE
1
68676665646362
35
34
363137383940414243
SS
CC
D0
D2
D1
V
A19
V
D3
D4
MREQ
IORQ
RFSH
61
60
HALT
TEND1
59
58
DREQ1
57
CKS
RXS/CTS1
56
55
TXS
54
CKA1/TEND0
53
RXA1
52
TEST
51
TXA1
50
CKA0/DREQ0
49
RXA0
48
TXA0
47
DCD0
46
CTS0
RTS0
45
44
D7
D6
D5
A18/TOUT
Figure 2.68-Pin PLCC
UM005003-0703
SSVSS
K
RESET
BUSREQBUSAC
8079787776757473727170
EXTALNCWAIT
XTAL
V
Phi
RD
WR
69
Family MPU User Manual
MREQ
MI
686766
IORQ
E
65
Z8018x
5
NMI
NC
NC
INT0
INT1
INT2
ST
A0
A1
A2
A3
V
SS
A4
NC
A5
A6
A7
A8
A9
A10
A11
NC
NC
A12
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
10111213141516
A13
A14
A15
A16
Z8X180
NC
A17
17
CC
V
181920
SS
A19
V
D0
21
D1
222324
D2D3D4
64
63
62
61
60
59
58
57
56
55
54
53
52
51
50
49
48
47
46
45
44
43
42
41
25
D5
RFSH
NC
NC
HALT
TEND1
DREQ1
CKS
RXS/CTS1
TXS
CKA1/TEND0
RXA1
TEST
TXA1
NC
CKA0/DREQ0
RXA0
TXA0
DCD0
CTS
RTS0
D7
NC
NC
D6
Figure 3.80-Pin QFP
A18/TOUT
UM005003-0703
Z8018x
Family MPU User Manual
6
XTAL
EXTAL
RESETRDWRMIMREQ
IORQ
HALT
WAIT
BUSREQ
BUSACK
RFSH
STENMI
INT0
INT1
INT2
Phi
A18/TOUT
TXS
RXS/CTS1
CKS
Timing
Generator
16-bit
Programmable
Reload
Timers
Clocked
Serial I/O
Port
MMU
(16-bit)
Address Bus
Bus State Control
CPU
Data Bus (8-bit)
DMACs
(2)
Asynchronous
SCI
(Channel 0)
Asynchronous
SCI
(channel 1)
Interrupt
DREQ1
TEND1
TXA0
CKA0/DREQ0
RXA0
RTS0
CTS0
DCD0
TXA1
CKA1/TEND0
RXA1
Address
Buffer
–
A0
A19
Data
Buffer
D0
–
DF
Figure 4.Z80180/Z8S180/Z8L180 Block Diagram
UM005003-0703
V
CC
V
SS
PIN DESCRIPTION
A0–A19.Address Bus (Output, Active High, 3-state). A0–A19 form a 20-
bit address bus. The Address Bus provides the address for memory data
bus exchanges, up to 1 MB, and I/O data bus exchanges, up to 64K. The
address bus enters a high impedance state during RESET and external bus
acknowledge cycles. Address line A18 is multiplexed with the output of
PRT channel 1 (TOUT, selected as address output on RESET) and address
line A19 is not available in DIP versions of the Z8X180.
Z8018x
Family MPU User Manual
7
BUSACK
that the requesting device, the MPU address and data bus, and some
control signals, have entered their high impedance state.
BUSREQ
external devices (such as DMA controllers) to request access to the
system bus. This request has a higher priority than NMI
recognized at the end of the current machine cycle. This signal stops the
CPU from executing further instructions and places the address and data
buses, and other control signals, into the high impedance state.
CKA0, CKA1.Asynchronous Clock 0 and 1 (Bidirectional, Active High).
These pins are the transmit and receive clocks for the ASCI channels.
CKA0, is multiplexed with DRE
TEND
CKS.Serial Clock (Bidirectional, Active High). This line is the clock for
the CSIO channel.
CLOCK (PHI).System Clock (Output, Active High). The output is used
as a reference clock for the MPU and the external system. The frequency
of this output is equal to one-half that of the crystal or input clock
frequency.
CTS
modem control signals for the ASCI channels. CTS
. Bus Acknowledge (Output, Active Low). BUSACK indicates
. Bus Request (Input, Active Low). This input is used by
and is always
Q0 and CKA1 is multiplexed with
0.
0, CTS1.Clear to Send 0 and 1 (Inputs, Active Low). These lines are
1 is multiplexed with RXS.
UM005003-0703
Z8018x
Family MPU User Manual
8
D0–D7.Data Bus (Bidirectional, Active High, 3-state). D0-D7 constitute
an 8-bit bidirectional data bus, used for the transfer of information to and
from I/O and memory devices. The data bus enters the high impedance
state during RESET and external bus acknowledge cycles.
DCD
programmable modem control signal for ASCI channel 0.
0. Data Carrier Detect 0 (Input, Active Low). This input is a
DREQ
0, DREQ1. DMA Request 0 and 1 (Input, Active Low). DREQ is
used to request a DMA transfer from one of the on-chip DMA channels.
The DMA channels monitor these inputs to determine when an external
device is ready for a read or write operation. These inputs can be
programmed to be either level- or edge-sensed. DREQ
0 is multiplexed
with CKA0.
E.Enable Clock (Output, Active High). Synchronous machine cycle clock
output during bus transactions.
EXTAL.External Clock/Crystal (Input, Active High). Crystal oscillator
connection. An external clock can be input to the Z8X180 on this pin
when a crystal is not used. This input is Schmitt-triggered.
HALT
after the CPU has executed either the HALT
. Halt/Sleep Status (Output, Active Low). This output is asserted
or SLP instruction, and is
waiting for either non-maskable or maskable interrupt before operation
can resume. HALT
is also used with the M1 and ST signals to decode
status of the CPU machine cycle.
0. Maskable Interrupt Request 0 (Input, Active Low). This signal is
INT
generated by external I/O devices. The CPU honors this request at the end
of the current instruction cycle as long as the NMI
and BUSREQ signals
are inactive. The CPU acknowledges this interrupt request with an
interrupt acknowledge cycle. During this cycle, both the M
1 and IORQ
signals become Active.
1, INT2. Maskable Interrupt Requests 1 and 2 (Inputs, Active Low).
INT
This signal is generated by external I/O devices. The CPU honors these
requests at the end of the current instruction cycle as long as the NMI
UM005003-0703
,
Z8018x
Family MPU User Manual
BUSREQ, and INT0 signals are inactive. The CPU acknowledges these
interrupt requests with an interrupt acknowledge cycle. Unlike the
acknowledgment for INT
0, during this cycle neither the M1 or IORQ
signals become Active.
. I/O Request (Output, Active Low, 3-state). IORQ indicates that the
IORQ
address bus contains a valid I/O address for an I/O read or I/O write
operation. IORQ
acknowledgment of the INT
is also generated, along with M1, during the
0 input signal to indicate that an interrupt
response vector can be placed onto the data bus. This signal is analogous
to the IOE
1. Machine Cycle 1 (Output, Active Low). Together with MR EQ , M1
M
signal of the Z64180.
indicates that the current cycle is the Op Code fetch cycle of an
instruction execution. Together with IORQ
cycle is for an interrupt acknowledge. It is also used with the HALT
, M1 indicates that the current
and
ST signal to decode status of the CPU machine cycle. This signal is
analogous to the LIR
signal of the Z64180.
9
MREQ
. Memory Request (Output, Active Low, 3-state). MREQ indicates
that the address bus holds a valid address for a memory read or memory
write operation. This signal is analogous to the ME
. Non-maskable Interrupt (Input, negative edge triggered). NMI has
NMI
a higher priority than INT
and is always recognized at the end of an
signal of the Z64180.
instruction, regardless of the state of the interrupt enable flip-flops. This
signal forces CPU execution to continue at location
. Read (Output active Low, 3-state). RD indicates that the CPU wants
RD
0066H.
to read data from memory or an I/O device. The addressed I/O or memory
device must use this signal to gate data onto the CPU data bus.
. Refresh (Output, Active Low). Together with MREQ, RFSH
RFSH
indicates that the current CPU machine cycle and the contents of the
address bus must be used for refresh of dynamic memories. The low order
8 bits of the address bus (A7–A0) contain the refresh address.
This signal is analogous to the REF
signal of the Z64180.
UM005003-0703
10
Z8018x
Family MPU User Manual
RTS0.Request to Send 0 (Output, Active Low). This output is a
programmable modem control signal for ASCI channel 0.
RXA0, RXA1.Receive Data 0 and 1 (Inputs, Active High). These signals
are the receive data to the ASCI channels.
RXS.Clocked Serial Receive Data (Input, Active High). This line is the
receiver data for the CSIO channel. RXS is multiplexed with the CTS
signal for ASCI channel 1.
1
ST.Status (Output, Active High). This signal is used with the M1
HALT
output to decode the status of the CPU machine cycle. Table 1
and
provides status summary.
Table 1. Status Summary
STHALT
010CPU operation (1st Op Code fetch)
110CPU operation (2nd Op Code and 3rd Op Code fetch)
111CPU operation (MC
0X
000HALT mode
101SLEEP mode (including SYSTEM STOP mode)
1
M1Operation
1DMA operation
2
except for Op Code fetch)
1. X = Don't care
2. MC = Machine cycle
TEND
0, TEND1. Transfer End 0 and 1 (Outputs, Active Low). This
output is asserted active during the last write cycle of a DMA operation. It
is used to indicate the end of the block transfer. TEND
0 in multiplexed
with CKA1.
TEST.Test (Output, not on DIP version). This pin is for test and must be
left open.
UM005003-0703
Z8018x
Family MPU User Manual
TOUT.Timer Out (Output, Active High). TOUT is the pulse output from
PRT channel 1. This line is multiplexed with A18 of the address bus.
TXA0, TXA1.Transmit Data 0 and 1 (Outputs, Active High). These
signals are the transmitted data from the ASCI channels. Transmitted data
changes are with respect to the falling edge of the transmit clock.
TXS.Clocked Serial Transmit Data (Output, Active High). This line is
the transmitted data from the CSIO channel.
. Wait (Input; Active Low). WAIT indicates to the CPU that the
WAIT
addressed memory or I/O devices are not ready for a data transfer. This
input is used to induce additional clock cycles into the current machine
cycle. The WAIT
input is sampled on the falling edge of T2 (and
subsequent Wait States). If the input is sampled Low, then additional Wait
States are inserted until the WAIT
input is sampled High, at which time
execution continues.
11
. Write (Output, Active Low, 3-state). WR indicates that the CPU data
WR
bus holds valid data to be stored at the addressed I/O or memory location.
XTAL.Crystal (Input, Active High).Crystal oscillator connection. This
pin must be left open if an external clock is used instead of a crystal. The
oscillator input is not a TTL level (reference DC characteristics).
Multiplexed pins are described in Table 2.
UM005003-0703
12
Z8018x
Family MPU User Manual
Table 2. Multiplexed Pin Descriptions
Multiplexed
PinsDescriptions
A18/TOUT
CKA0/
DREQ0
TEND0
CKA1/
During RESET, this pin is initialized as A18 pin. If either
TOC1 or TOC0 bit of the Timer Control Register (TCR) is set
to 1, TOUT function is selected. If TOC1 and TOC0 bits are
cleared to 0, A18 function is selected.
During RESET, this pin is initialized as CKA0 pin.
If either DM1 or SM1 in DMA Mode Register (DMODE) is
set to 1,
During RESET, this pin is initialized as CKA1 pin. If
CKA1D bit in ASCI control register ch 1 (CNTLA1) is set to
1,
CKA1 function is selected.
DREQ0 function is always selected.
TEND0 function is selected. If CKA1D bit is set to 0,
During RESET, this pin is initialized as RXS pin. If CTS1E bit
RXS/
CTS1
in ASCI status register ch 1 (STAT1) is set to 1,
is selected. If CTS1E bit is 0, RXS function is selected.
ARCHITECTURE
The Z8X180 combines a high performance CPU core with a variety of
system and I/O resources useful in a broad range of applications. The CPU
core consists of five functional blocks: clock generator, bus state controller
(including dynamic memory refresh), interrupt controller, memory
management unit (MMU), and the central processing unit (CPU). The
integrated I/O resources make up the remaining four functional blocks:
•
Direct Memory Access (DMA) Control (2 channels)
•
Asynchronous Serial Communications Interface (ASCI, 2 channels),
UM005003-0703
CTS1 function
Z8018x
Family MPU User Manual
•
Programmable Reload Timers (PRT, 2 channels)
•
Clock Serial I/O (CSIO) channel.
Other Z8X180 family members (such as Z80183, Z80S183, Z80185/195)
feature, in addition to these blocks, additional peripherals and are covered
in their associated Product Specification
Clock Generator
This logic generates the system clock from either an external crystal or
clock input. The external clock is divided by two and provided to both
internal and external devices.
Bus State Controller
13
This logic performs all of the status and bus control activity associated
with both the CPU and some on-chip peripherals. This includes Wait State
timing, RESET cycles, DRAM refresh, and DMA bus exchanges.
Interrupt Controller
This block monitors and prioritizes the variety of internal and external
interrupts and traps to provide the correct responses from the CPU. To
remain compatible with the Z80 CPU, three different interrupt modes are
supported.
Memory Management Unit
The MMU allows the user to map the memory used by the CPU (logically
only 64K) into the 1MB addressing range supported by the Z8X180. The
organization of the MMU object code features compatibility with the Z80
CPU while offering access to an extended memory space. This capability
is accomplished by using an effective common area - banked area
scheme.
UM005003-0703
14
Z8018x
Family MPU User Manual
Central Processing Unit
The CPU is microcoded to provide a core that is object code compatible
with the Z80 CPU. It also provides a superset of the Z80 instruction set,
including 8-bit multiply and divide. This core has been enhanced to allow
many of the instructions to execute in fewer clock cycles.
DMA Controller
The DMA controller provides high speed transfers between memory and
I/O devices. Transfer operations supported are memory-to-memory,
memory to/from I/O and I/O to I/O. Transfer modes supported are
REQUEST, BURST, and CYCLE STEAL. DMA transfers can access the
full 1MB addressing range with a block length up to 64KB, and can cross
over 64K boundaries.
Asynchronous Serial Communications Interface (ASCI)
The ASCI logic provides two individual full-duplex UARTs. Each
channel includes a programmable baud rate generator and modem control
signals. The ASCI channels can also support a multiprocessor
communications format.
Programmable Reload Timer (PRT)
This logic consists of two separate channels, each containing a 16-bit
counter (timer) and count reload register. The time base for the counters is
derived from the system clock (divided by 20) before reaching the
counter. PRT channel 1 provides an optional output to allow for
waveform generation.
Clocked Serial I/O (CSIO)
The CSIO channel provides a half-duplex serial transmitter and receiver.
This channel can be used for simple high-speed data connection to
another microprocessor or microcomputer.
UM005003-0703
Z8018x
Family MPU User Manual
OPERATION MODES
The Z8X180 can be configured to operate like the Hitachi HD64180. This
functionality is accomplished by allowing user control over the M
IORQ
, WR, and RD signals. The Operation Mode Control Register
(OMCR), illustrated in Figure 5, determines the M
the IORQ
, RD, and WR signals, and the RETI operation.
1 options, the timing of
Operation Mode Control Register
Bit76540
Bit/FieldM1EM1TE
R/WR/WWR/W–
Reset111–
Note: R = Read W = Write X = Indeterminate? = Not Applicable
IOC Reserved
1,
15
Figure 5.Operation Mode Control Register
M1E (M1 Enable): This bit controls the M1 output and is set to a 1 during
RESET.
When M1E is
1, the M1 output is asserted Low during the Op Code fetch
cycle, the INT0 acknowledge cycle, and the first machine cycle of the
acknowledge. This action also causes the M1 signal to be Active
NMI
during both fetches of the RETI instruction sequence, and may cause
corruption of the external interrupt daisy chain. Therefore, this bit must be
0 for the Z8X180. When M1E is 0 the M1 output is normally inactive and
asserted Low only during the refetch of the RETI instruction sequence
and the INT
0 acknowledge cycle (Figure 6).
UM005003-0703
16
Z8018x
Family MPU User Manual
Phi
WR
M1
T1
Write into OMCR
Figure 6.M1 Temporary Enable Timing
T2
T3
T1
Op Code Fetch
T2
T3
M1TE (M1 Temporary Enable): This bit controls the temporary assertion
of the M1
signal. It is always read back as a 1 and is set to 1 during
RESET. This function is used to arm the internal interrupt structure of the
Z80PIO. When a control word is written to the Z80PIO to enable
interrupts, no enable actually takes place until the PIO sees an active M
signal. When M1TE
signal and M1E controls its function. When M1TE
is 1, there is no change in the operation of the M1
is 0, the M1 output is
1
asserted during the next Op Code fetch cycle regardless of the state
programmed into the M1E bit. This situation is only momentary (one
time) and the user need not reprogram a
1 to disable the function (See
Figure 7).
: This bit controls the timing of the IORQ and RD signals. IOC is set
IOC
to
1 by RESET.
When IOC
is 1, the IORQ and RD signals function the same as the
HD64180.
UM005003-0703
Z8018x
Family MPU User Manual
17
T1
Phi
IORQ
RD
WR
T2
TW
T3
Figure 7.I/O Read and Write Cycles with IOC = 1 Timing Diagram
When IOC is 0, the timing of the IORQ and RD signals match the timing
required by the Z80 family of peripherals. The IORQ
and RD signals go
active as a result of the rising edge of T2. This timing allows the Z8X180
to satisfy the setup times required by the Z80 peripherals on those two
signals (Figure ).
T1
Phi
T2
TW
T3
IORQ
RD
WR
Figure 8.I/O Read and Write cycles with IOC = 0 Timing Diagram
For the remainder of this document, assume that M1E is 0 and IOC is 0.
UM005003-0703
18
Z8018x
Family MPU User Manual
Note:
The user must program the Operation Mode Control Register
before the first I/O instruction is executed.
CPU Timing
This section explains the Z8X180 CPU timing for the following operations:
•
Instruction (Op Code) fetch timing
•
Operand and data read/write timing
•
I/O read/write timing
•
Basic instruction (fetch and execute) timing
•
RESET timing
•
BUSREQ/BUSACK bus exchange timing
The basic CPU operation consists of one or more Machine Cycles (MC).
A machine cycle consists of three system clocks, T1, T2, and T3 while
accessing memory or I/O, or it consists of one system clock (T1) during
CPU internal operations. The system clock is half the frequency of the
Crystal oscillator (that is, an 8-MHz crystal produces 4 MHz or 250 nsec).
For interfacing to slow memory or peripherals, optional Wait States (TW)
may be inserted between T2 and T3.
Instruction (Op Code) Fetch Timing
Figure 9 illustrates the instruction (Op Code) fetch timing with no Wait
States. An Op Code fetch cycle is externally indicated when the M
output pin is Low.
In the first half of T1, the address bus (A0–A19) is driven from the
contents of the Program Counter (PC). This address bus is the translated
address output of the Z8X180 on-chip MMU.
In the second half of T1, the MREQ
signals are asserted Low, enabling the memory.
UM005003-0703
. (Memory Request) and RD (Read)
1
Z8018x
Family MPU User Manual
The Op Code on the data bus is latched at the rising edge of T3 and the
bus cycle terminates at the end of T3.
Figure 10 illustrates the insertion of Wait States (TW) into the Op Code
fetch cycle. Wait States (TW) are controlled by the external WAIT
input
combined with an on-chip programmable Wait State generator.
At the falling edge of T2 the combined WAIT
input is sampled. If WAIT
input is asserted Low, a Wait State (TW) is inserted. The address bus,
MREQ
, RD and M1 are held stable during Wait States. When WAIT is
sampled inactive High at the falling edge of TW, the bus cycle enters T3
and completes at the end of T3.
The instruction operand and data read/write timing differs from Op Code
fetch timing in two ways:
•
The M1 output is held inactive
•
The read cycle timing is relaxed by one-half clock cycle because data
is latched at the falling edge of T3
Instruction operands include immediate data, displacement, and extended
addresses, and contain the same timing as memory data reads.
During memory write cycles the MREQ
signal goes active in the second
half of T1. At the end of T1, the data bus is driven with the write data.
At the start of T2, the WR
MREQ
and WR go inactive in the second half of T3 followed by
signal is asserted Low enabling the memory.
disabling of the write data on the data bus.
UM005003-0703
Z8018x
Family MPU User Manual
Wait States (TW) are inserted as previously described for Op Code fetch
cycles. Figure 11 illustrates the read/write timing without Wait States
(Tw), while Figure 12 illustrates read/write timing with Wait States (TW).
I/O Read/Write operations differ from memory Read/Write operations in
the following three ways:
•
The IORQ (I/O Request) signal is asserted Low instead of the MREQ
signal
•
The 16-bit I/O address is not translated by the MMU
•
A16–A19 are held Low
At least one Wait State (TW) is always inserted for I/O read and write
cycles (except internal I/O cycles).
Figure 13 illustrates I/O read/write timing with the automatically inserted
Wait State (TW).
UM005003-0703
Z8018x
Family MPU User Manual
23
A0
D0
Phi
–
A19
–
D7
WAIT
IORQ
RD
WR
I/O Read Cycle
T1T1T2TWT3T2T3
I/O address
Read data
I/O Write Cycle
TW
I/O address
Write data
Figure 13.I/O Read/Write Timing Diagram
Basic Instruction Timing
An instruction may consist of a number of machine cycles including Op
Code fetch, operand fetch, and data read/write cycles. An instruction may
also include cycles for internal processes which make the bus IDLE. The
example in Figure 14 illustrates the bus timing for the data transfer
instruction LD (IX+d),g.
UM005003-0703
24
Z8018x
Family MPU User Manual
Phi
–
A19
A0
D0–D7
M1
MREQ
RD
WR
Machine Cycle
1st Op Code
Fetch Cycle
2nd Op Code
Fetch Cycle
Displacement
Read Cycle
CPU internal
Operation
Memory
Write Cycle
T1 T2 T3 T1T3 T1T2T2 T3 T1 T1 T1 T1T1T2 T3T2
PC
(DDH)
MC1MC2MC3MC4 MC5 MC6MC7
NOTE: d = displacement
g = register contents
PC+1
(7OH
–
77H)
PC+2
d
IX+d
Next instruction
Fetch Cycle
PC+3
g
Figure 14.Instruction Timing Diagram
This instruction moves the contents of a CPU register (g) to the memory
location with address computed by adding a signed 8-bit displacement (d)
to the contents of an index register (IX).
The instruction cycle begins with the two machine cycles to read the two
byte instruction Op Code as indicated by M
operand (d) is fetched.
UM005003-0703
1 Low. Next, the instruction
Z8018x
Family MPU User Manual
The external bus is IDLE while the CPU computes the effective address.
Finally, the computed memory location is written with the contents of the
CPU register (g).
RESET Timing
25
Figure 15 depicts the Z8X180 hardware RESET timing. If the RESET
is Low for six or more clock cycles, processing is terminated and the
Z8X180 restarts execution from (logical and physical) address
RESET
T1T2
Phi
RESET
–
A19
A0
Figure 15.RESET Timing Diagram
6 or more clocks
High impedance
RESET Start
Op Code Fetch Cycle
Restart address (00000H)
00000H.
BUSREQ/BUSACK Bus Exchange Timing
The Z8X180 can coordinate the exchange of control, address and data bus
ownership with another bus master. The alternate bus master can request
the bus release by asserting the BUSREQ
(Bus Request) input Low. After
the Z8X180 releases the bus, it relinquishes control to the alternate bus
master by asserting the BUSACK
(Bus Acknowledge) output Low.
pin
The bus may be released by the Z8X180 at the end of each machine cycle.
In this context, a machine cycle consists of a minimum of three clock
cycles (more if wait states are inserted) for Op Code fetch, memory read/
write, and I/O read/write cycles. Except for these cases, a machine cycle
corresponds to one clock cycle.
UM005003-0703
26
Z8018x
Family MPU User Manual
When the bus is released, the address (A0–A19), data (D0–D7), and
control (MREQ
impedance state.
Dynamic RAM refresh is not performed when the Z8X180 has released
the bus. The alternate bus master must provide dynamic memory
refreshing if the bus is released for long periods of time.
, IORQ, RD, and WR) signals are placed in the high
Figure 16 illustrates BUSREQ
/BUSACK bus exchange during a memory
read cycle. Figure 17 illustrates bus exchange when the bus release is
requested during a Z8X180 CPU internal operation. BUSREQ
at the falling edge of the system clock prior to T3, T1 and Tx (BUS
RELEASE state). If BUSREQ
is asserted Low at the falling edge of the
clock state prior to Tx, another Tx is executed.
CPU memory read cycleBus release cycleCPU cycle
T1T1TXTXT3TWT2T1
Phi
A0
–
A19
D0–D7
MREQ
IORQ
, WR
RD
BUSREQ
BUSACK
is sampled
Figure 16.Bus Exchange Timing During Memory Read
UM005003-0703
Phi
A0
–
A19
D0–D7
MREQ
IORQ
RD
, WR
BUSREQ
BUSACK
Z8018x
Family MPU User Manual
27
CPU Internal OperationBus Release Cycle CPU Cycle
T1T1T1TXT1TXT1TX
Figure 17.Bus Exchange Timing During CPU Internal Operation
Wait State Generator
To ease interfacing with slow memory and I/O devices, the Z8X180 uses
Wait States (TW) to extend bus cycle timing. A Wait State(s) is inserted
based on the combined (logical OR) state of the external WAIT
an internal programmable wait state (TW) generator. Wait States (TW)
can be inserted in both CPU execution and DMA transfer cycles.
When the external WAIT
inserted between T2 and T3 to extend the bus cycle duration. The WAIT
input is sampled at the falling edge of the system clock in T2 or TW. If the
WAIT
input is asserted Low at the falling edge of the system clock in TW,
another TW is inserted into the bus cycle.
Note:
WAI T
input transitions must meet specified setup and hold
times. This specification can easily be accomplished by
input is asserted Low, Wait State(s) (TW) are
UM005003-0703
input and
28
Z8018x
Family MPU User Manual
externally synchronizing WAIT input transitions with the rising
edge of the system clock.
Dynamic RAM refresh is not performed during Wait States (TW) and thus
system designs which use the automatic refresh function must consider
the affects of the occurrence and duration of wait states (TW). Figure 18
depicts WAIT
timing.
T1
Phi
WAIT
Figure 18.WAIT Timing Diagram
T2TWTWT3T1
Programmable Wait State Insertion
In addition to the WAIT
input, Wait States (TW) can also be inserted by
program using the Z8X180 on-chip Wait State generator (see Figure 19.
Wait State (TW) timing applies for both CPU execution and on-chip
DMAC cycles.
By programming the four significant bits of the DMA/Wait Control
Register (DCNTL) the number of Wait States, (TW) automatically
inserted in memory and I/O cycles, can be separately specified. Bits 4 and
5 specify the number of Wait States (TW) inserted for I/O access and bits
6 and 7 specify the number of Wait States (TW) inserted for memory
access. These bit pairs all 0–3 programmed Wait States for either I/O or
memory access.
UM005003-0703
Z8018x
Family MPU User Manual
Bit7654
MWI1MWI0MWI1MWI0
R/WR/WR/WR/W
Figure 19. Memory and I/O Wait State Insertion (DCNTL – DMA/Wait
Control Register)
The number of Wait States (TW) inserted in a specific cycle is the
maximum of the number requested by the WAIT
input, and the number
automatically generated by the on-chip Wait State generator.
Bit 7, 6: MWI1 MWI0, (Memory Wait Insertion)
29
For CPU and DMAC cycles which access memory (including memory
mapped I/O), zero to three Wait States may be automatically inserted
depending on the programmed value in MWI1 and MWI0 as depicted in
Table 3
Table 3. Memory Wait States
MW11MWI0The Number of Wait States
000
011
102
113
Bit 5, 4: IWI1, IWI0 (I/O Wait Insertion)
For CPU and DMA cycles which access external I/O (and interrupt
acknowledge cycles), one to six Wait States (TW) may be automatically
UM005003-0703
Z8018x
Family MPU User Manual
30
inserted depending on the programmed value in IWI1 and IWI0. Refer to
Table 4.
Table 4. Wait State Insertion
For external
I/O registers
IWI1IWI0
accesses
The Number of Wait States
For internal
I/0
registers
accesses
For INT0
interrupt
acknowledge
cycles when
M1
is Low
For INT1
INT2
,
and
internal
interrupts
acknowledge
cycles
(Note 2)
For NMI
interrupt
acknowledge
cycles
when M1
is
Low
(Note 2)
0010
0124
(Note 1)
22 0
1035
1146
Note:
1.For Z8X180 internal I/O register access (I/O addresses
determine wait state (TW) timing. For ASCI, CSI/O and PRT Data Register accesses, 0 to 4 Wait States
(TW) are generated. The number of Wait States inserted during access to these registers is a function of
internal synchronization requirements and CPU state. All other on-chip I/O register accesses (that is,
MMU, DMAC, ASCI Control Registers, for instance.) have no Wait States inserted and thus require only
three clock cycles.
2.For interrupt acknowledge cycles in which M
stacking cycle, memory access timing applies.
1 is High, such as interrupt vector table read and PC
0000H-003FH), IWI1 and IWI0 do not
WAIT Input and RESET
During RESET, MWI1, MWI0 IWI1 and IWI0, are all
1, selecting the
maximum number of Wait States (TW) (three for memory accesses, four
for external I/O accesses).
UM005003-0703
Z8018x
Family MPU User Manual
Also, the WAIT input is ignored during RESET. For example, if RESET
is detected while the Z8X180 is in a Wait State (TW), the Wait Stated
cycle in progress is aborted, and the RESET sequence initiated. Thus,
RESET
has higher priority than WAIT.
HALT and Low Power Operation Modes (Z80180-Class
Processors Only)
The Z80180 can operate in two different modes:
•
HALT mode
•
IOSTOP mode
31
and two low-power operation modes:
•
SLEEP
•
SYSTEM STOP
In all operating modes, the basic CPU clock (XTAL, EXTAL) must
remain active.
HALT Mode
HALT mode is entered by execution of the HALT instruction (Op Code
76H) and has the following characteristics:
•
The internal CPU clock remains active
•
All internal and external interrupts can be received
•
Bus exchange (BUSREQ and BUSACK) can occur
•
Dynamic RAM refresh cycle (RFSH) insertion continues at the
programmed interval
•
I/O operations (ASCI, CSI/O and PRT) continue
•
The DMAC can operate
UM005003-0703
32
Z8018x
Family MPU User Manual
•
The HALT output pin is asserted Low
•
The external bus activity consists of repeated dummy fetches of the
Op Code following the HALT instruction.
Essentially, the Z80180 operates normally in HALT mode, except that
instruction execution is stopped.
HALT mode can be exited in the following two ways:
•
RESET Exit from HALT Mode
If the RESET
HALT mode is exited and the normal RESET
address
•
Interrupt Exit from HALT mode
When an internal or external interrupt is generated, HALT mode is
exited and the normal interrupt response sequence is initiated.
00000H) is initiated.
input is asserted Low for at least six clock cycles,
sequence (restart at
If the interrupt source is masked (individually by enable bit, or globally
by IEF1 state), the Z80180 remains in HALT mode. However, NMI
interrupt initiates the normal NMI
independent of the state of IEF1.
HALT timing is illustrated in Figure 20.
UM005003-0703
interrupt response sequence
Z8018x
Family MPU User Manual
33
.
HALT Op Code
Fetch Cycle
HALT mode
Interrupt
acknowledge cycle
T1
Phi
, NMI
INT1
–
A19
A0
HALT
MREQ
Figure 20.HALT Timing Diagram
HALT Op Code addressHALT Op Code address + 1
M1
RD
T3T1T2T3T1T2
SLEEP Mode
SLEEP mode is entered by execution of the 2-byte SLP instruction.
SLEEP mode contains the following characteristics:
•
The internal CPU clock stops, reducing power consumption
•
The internal crystal oscillator does not stop
•
Internal and external interrupt inputs can be received
•
DRAM refresh cycles stop
•
I/O operations using on-chip peripherals continue
•
The internal DMAC stop
•
BUSREQ can be received and acknowledged
•
Address outputs go High and all other control signal outputs become
inactive High
UM005003-0703
34
Z8018x
Family MPU User Manual
•
Data Bus, 3-state
SLEEP mode is exited in one of two ways as described below.
•
RESET Exit from SLEEP mode. If the RESET input is held Low for
at least six clock cycles, it exits SLEEP mode and begins the normal
RESET sequence with execution starting at address (logical and
physical)
•
Interrupt Exit from SLEEP mode. The SLEEP mode is exited by
detection of an external (NMI
CSI/O, PRT) interrupt.
00000H.
, INT0, INT2) or internal (ASCI,
In case of NMI
NMI
interrupt response sequence.
In the case of all other interrupts, the interrupt response depends on the
state of the global interrupt enable flag IEF1 and the individual interrupt
source enable bit.
If the individual interrupt condition is disabled by the corresponding
enable bit, occurrence of that interrupt is ignored and the CPU remains in
the SLEEP mode.
Assuming the individual interrupt condition is enabled, the response to
that interrupt depends on the global interrupt enable flag (IEF1). If
interrupts are globally enabled (IEF1 is
interrupt occurs, SLEEP mode is exited and the appropriate normal
interrupt response sequence is executed.
If interrupts are globally disabled (IEF1 is
interrupt occurs, SLEEP mode is exited and instruction execution begins
with the instruction following the SLP instruction. This feature provides a
technique for synchronization with high speed external events without
incurring the latency imposed by an interrupt response sequence.
Figure 21 depicts SLEEP timing.
, SLEEP mode is exited and the CPU begins the normal
1) and an individually enabled
0) and an individually enabled
UM005003-0703
Z8018x
t
Family MPU User Manual
35
Op Code Fetch or Interrup
Acknowledge Cycle
Phi
INT1, NMI
A0
–
A19
HALT
M1
SLP 2nd Op Code
Fetch Cycle
T2
T3
SLP 2nd Op Code address
SLEEP mode
T1T2TSTST1T2T3
FFFFFH
Figure 21. SLEEP Timing Diagram
IOSTOP Mode
IOSTOP mode is entered by setting the IOSTOP bit of the I/O Control
Register (ICR) to
1. In this case, on-chip I/O (ASCI, CSI/O, PRT) stops
operating. However, the CPU continues to operate. Recovery from
IOSTOP mode is by resetting the IOSTOP bit in ICR to
0.
SYSTEM STOP Mode
SYSTEM STOP mode is the combination of SLEEP and IOSTOP modes.
SYSTEM STOP mode is entered by setting the IOSTOP bit in ICR to
1
followed by execution of the SLP instruction. In this mode, on-chip I/O
and CPU stop operating, reducing power consumption. Recovery from
SYSTEM STOP mode is the same as recovery from SLEEP mode, noting
that internal I/O sources, (disabled by IOSTOP) cannot generate a
recovery interrupt.
UM005003-0703
36
Z8018x
Family MPU User Manual
Low Power Modes (Z8S180/Z8L180 only)
The following section is a detailed description of the enhancements to the
Z8S180/L180 from the standard Z80180 in the areas of STANDBY, IDLE
and STANDBY QUICK RECOVERY modes.
Add-On Features
There are five different power-down modes. SLEEP and SYSTEM STOP
are inherited from the Z80180. In SLEEP mode, the CPU is in a stopped
state while the on-chip I/Os are still operating. In I/O STOP mode, the onchip I/Os are in a stopped state while leaving the CPU running. In
SYSTEM STOP mode, both the CPU and the on-chip I/Os are in the
stopped state to reduce current consumption. The Z8S180 features two
additional power-down modes, STANDBY and IDLE, to reduce current
consumption even further. The differences in these power-down modes
are summarized in Table 5.
† IDLE and STANDBY modes are only offered in the Z8S180. The minimum recovery time can
be achieved if INTERRUPT is used as the Recovery Source.
StopStopRunning RunningRESET,
Interrupts
Interrupts,
BUSREQ
Interrupts,
BUSREQ
1.5 Clock
–
1.5 Clock
8 + 1.5 Clock
17
+ 1.5 Clock
2
(Normal
Recovery)
6
2
+ 1.5 Clock
(Quick Recovery)
STANDBY Mode
The Z8S180/Z8L180 is designed to save power. Two low-power
programmable power-down modes have been added:
•
STANDBY mode
•
IDLE mode
The STANDBY/IDLE mode is selected by multiplexing bits 1 and 3 of
the CPU Control Register (CCR, I/O Address =
1FH).
To enter STANDBY mode:
UM005003-0703
38
Z8018x
Family MPU User Manual
1. Set bits 6 and 3 to 1 and 0, respectively.
2. Set the I/O STOP bits (bit 5 of ICR, I/O Address =
3. Execute the SLEEP instruction.
When the device is in STANDBY mode, it performs similar to the
SYSTEM STOP mode as it exists on the Z80180-class processors, except
that the STANDBY mode stops the external oscillator, internal clocks and
reduces power consumption to 50 mA (typical).
Because the clock oscillator has been stopped, a restart of the oscillator
requires a period of time for stabilization. An 18-bit counter has been
added in the Z8S180Z8L180 to allow for oscillator stabilization. When
the part receives an external IRQ or BUSREQ during STANDBY mode,
the oscillator is restarted and the timer counts down 2
acknowledgment is sent to the interrupt source.
The recovery source must remain asserted for the duration of the 2
count, otherwise STANDBY restarts.
3FH) to 1.
17
counts before
STANDBY Mode Exit with BUS REQUEST
Optionally, if the BREXT bit (D5 of CPU Control Register) is set to 1, the
Z8S180 exits STANDBY mode when the BUSREQ
crystal oscillator is then restarted. An internal counter automatically
provides time for the oscillator to stabilize, before the internal clocking
and the system clock output of the Z8S180 are resumed.
input is asserted. The
17
The Z8S180 relinquishes the system bus after the clocking is resumed by:
•
3-State the address outputs A19–A0
•
3-State the bus control outputs MREQ, IORQ, RD, and WR
•
Asserting BUSACK
The Z8S180 regains the system bus when BUSREQ is deactivated. The
address outputs and the bus control outputs are then driven High. The
STANDBY mode is exited.
UM005003-0703
Family MPU User Manual
If the BREXT bit of the CPU Control Register (CCR) is cleared, asserting
the BUSREQ
STANDBY mode.
If STANDBY mode is exited because of a reset or an external interrupt,
the Z8S180/Z8L180-class processors remains relinquished from the
system bus as long as BUSREQ
does not cause the Z8S180/Z8L180-class processors to exit
is active.
STANDBY Mode EXit with External Interrupts
STANDBY mode can be exited by asserting input NMI. The STANDBY
mode may also exit by asserting INT0
conditions specified in the following paragraphs.
INT0
wake-up requires assertion throughout duration of clock
stabilization time (2
17
clocks).
. INT1 or INT2, depending on the
Z8018x
39
If exit conditions are met, the internal counter provides time for the
crystal oscillator to stabilize, before the internal clocking and the system
clock output within the Z8S180/Z8L180-class processors resume.
•
Exit with Non-Maskable Interrupts
If NMI
acknowledge sequence after clocking resumes.
•
Exit with External Maskable Interrupts
If an External Maskable Interrupt input is asserted, the CPU responds
according to the status of the Global Interrupt Enable Flag IEF1
(determined by the ITE1 bit) and the settings of the corresponding
interrupt enable bit in the Interrupt/Trap Control Register (ITC: I/O
Address =
If an interrupt source is disabled in the ITC, asserting the corresponding
interrupt input does not cause the Z8S180/Z8L180-class processors to
exit STANDBY mode. This condition is true regardless of the state of the
Global Interrupt Enable Flag IEF1.
is asserted, the CPU begins a normal NMI interrupt
34H).
UM005003-0703
40
Z8018x
Family MPU User Manual
If the Global Interrupt Enable Flag IEF1 is set to 1, and if an interrupt
source is enabled in the ITC, asserting the corresponding interrupt input
causes the Z8S180/Z8L180-class processors to exit STANDBY mode.
The CPU performs an interrupt acknowledge sequence appropriate to the
input being asserted when clocking is resumed if:
•
The interrupt input follows the normal interrupt daisy-chain protocol
•
The interrupt source is active until the acknowledge cycle is complete
If the Global Interrupt Enable Flag IEF1 is disabled (reset to 0) and if an
interrupt source is enabled in the ITC, asserting the corresponding
interrupt input still causes the Z8S180/Z8L180-class processors to exit
STANDBY mode. The CPU proceeds to fetch and execute instructions
that follow the SLEEP instruction when clocking resumes.
If the Extend Maskable Interrupt input is not active until clocking
resumes, the Z8S180/Z8L180-class processors do not exit STANDBY
mode. If the Non-Maskable Interrupt (NMI
resumes, the Z8S180/Z8L180-class processors still exits the STANDBY
mode even if the interrupt sources go away before the timer times out,
because NMI
NMI
is asserted Low.
) is not active until clocking
is edge-triggered. The condition is latched internally when
IDLE Mode
IDLE mode is another power-down mode offered by the Z8S180/
Z8L180-class processors.
1. Set bits 6 and 3 to
2. Set the I/O STOP bit (bit 5 of ICR, I/O Address =
3. Execute the SLEEP instruction
When the part is in IDLE mode, the clock oscillator is kept oscillating, but
the clock to the rest of the internal circuit, including the CLKOUT, is
stopped completely. IDLE mode is exited in a similar way as STANDBY
mode, using RESET, BUS REQUEST or EXTERNAL INTERRUPTS,
UM005003-0703
0 and 1, respectively.
3FH to 1.
Family MPU User Manual
except that the 217 bit wake-up timer is bypassed. All control signals are
asserted eight clock cycles after the exit conditions are gathered.
STANDBY-QUICK RECOVERY Mode
STANDBY-QUICK RECOVERY mode is an option offered in
STANDBY mode to reduce the clock recovery time in STANDBY mode
17
from 2
MHz). This feature can only be used when providing an oscillator as
clock source.
To enter STANDBY-QUICK RECOVERY mode:
clock cycles (4 ms at 33 MHz) to 26 clock cycles (1.9 ms at 33
Z8018x
41
1. Set bits 6 and 3 to
2. Set the I/O STOP bit (bit 5 of ICR, I/O Address =
1 and 1, respectively.
3FH) to 1.
3. Execute the SLEEP instruction
When the part is in STANDBY-QUICK RECOVERY mode, the operation
is identical to STANDBY mode except when exit conditions are gathered,
using RESET, BUS REQUEST or EXTERNAL INTERRUPTS. The
clock and other control signals are recovered sooner than the STANDBY
mode.
Note:
If STANDBY-QUICK RECOVERY is enabled, the user must
ensure stable oscillation is obtained within 64 clock cycles
Internal I/O Registers
The Z8X180 internal I/O Registers occupy 64 I/O addresses (including
reserved addresses). These registers access the internal I/O modules
(ASCI, CSI/O, PRT) and control functions (DMAC, DRAM refresh,
interrupts, wait state generator, MMU and I/O relocation).
UM005003-0703
Z8018x
Family MPU User Manual
42
To avoid address conflicts with external I/O, the Z8X180 internal I/O
addresses can be relocated on 64-byte boundaries within the bottom 256
bytes of the 64KB I/O address space.
I/O Control Register (ICR)
ICR allows relocating of the internal I/O addresses. ICR also controls
enabling/disabling of the IOSTOP mode.
I/O Control Register (ICR: 3FH)
Bit76543210
Bit/FieldIOA7IOA6IOSTP—————
R/W R/WR/WR/W
Reset 0 0 0
R = Read W = Write X = Indeterminate ? = Not Applicable
Bit
Position Bit/Field R/WValueDescription
7
–6IOA7:6R/WIOA7 and IOA6 relocate internal I/O as depicted in
Figure . The high-order 8 bits of 16-bit internal I/O
addresses are always 0. IOA7 and IOA6 are cleared to 0
during RESET.
5IOSTPR/WIOSTOP mode is enabled when IOSTP is set to 1.
Normal. I/O operation resumes when IOSTP is reset to 0.
UM005003-0703
Z8018x
Family MPU User Manual
00FFH
43
IOA7 — IOA6 = 1 1
IOA7 — IOA6 = 1 0
IOA7 — IOA6 = 0 1
IOA7 — IOA6 = 0 0
Figure 22.I/O Address Relocation
00C0H
00BFH
0080H
007FH
0040H
003FH
0000H
Internal I/O Registers Address Map
The internal I/O register addresses are described in Table 6 and Table 7.
These addresses are relative to the 64-byte boundary base address specified
in ICR.
I/O Addressing Notes
The internal I/O register addresses are located in the I/O address space
from
0000H to 00FFH (16-bit I/O addresses). Thus, to access the internal
I/O registers (using I/O instructions), the high-order 8 bits of the 16-bit
I/O address must be
0.
The conventional I/O instructions (OUT (m), A/IN A, (m) / OUTI/INI,
for example) place the contents of a CPU register on the high-order 8 bits
of the address bus, and thus may be difficult to use for accessing internal
I/O registers.
For efficient internal I/O register access, a number of new instructions
have been added, which force the high-order 8 bits of the 16-bit I/O
UM005003-0703
Z8018x
Family MPU User Manual
44
address to 0. These instructions are IN0, OUT0, OTIM, OTIMR, OTDM,
OTDMR and TSTIO (see Instruction Set).
When writing to an internal I/O register, the same I/O write occurs on the
external bus. However, the duplicate external I/O write cycle exhibits
internal I/O write cycle timing. For example, the WAIT
programmable Wait State generator are ignored. Similarly, internal I/O
read cycles also cause a duplicate external I/O read cycle. However, the
external read data is ignored by the Z8X180.
Normally, external I/O addresses should be chosen to avoid overlap with
internal I/O addresses and duplicate I/O accesses.
Table 6. I/O Address Map for Z80180-Class Processors Only
input and
Address
RegisterMnemonic
ASCIASCI Control Register A Ch 0CNTLA0XX00000000H125
ASCI Control Register A Ch 1CNTLA1XX00000101H128
ASCI Control Register B Ch 0CNTLB0XX00001002H132
ASCI Control Register B Ch 1CNTLB1XX00001103H132
ASCI Status Register Ch 0STAT0XX00010004H120
ASCI Status Register Ch 1STAT1XX00010105H123
ASCI Transmit Data Register Ch 0TDR0XX00011006H118
ASCI Transmit Data Register Ch 1TDR1XX00011107H118
ASCI Receive Data Register Ch 0RDR0XX00100008H119
ASCI Receive Data Register Ch 1RDR1XX00100109H119
CSI/O CSI/O Control RegisterCNTRXX0010100AH147
CSI/O Transmit/Receive Data Register TRDXX10110BH149
UM005003-0703
BinaryHexPage
Family MPU User Manual
Table 6. I/O Address Map for Z80180-Class Processors Only (Continued)
Address
Z8018x
45
RegisterMnemonic
TimerData Register Ch 0 LTMDR0LXX0011000CH159
Data Register Ch 0 HTMDR0HXX0011010DH159
Reload Register Ch 0 LRLDR0LXX0011100EH159
Reload Register Ch 0 HRLDR0HXX0011110FH159
Timer Control RegisterTCRXX01000010H161
ReservedXX01000111H
Data Register Ch 1 LTMDR1LXX01010014H160
Data Register Ch 1 HTMDR1HXX01010115H160
Reload Register Ch 1 LRLDR1LXX01011016H159
Reload Register Ch 1 HRLDR1HXX01011117H159
Others Free Running Counter
Reserved
FRCXX01100018H172
BinaryHexPage
XX01001113H
XX01100119H
XX0111111FH
UM005003-0703
Z8018x
Family MPU User Manual
46
Table 6. I/O Address Map for Z80180-Class Processors Only (Continued)
Note: R = Read W = Write X = Indeterminate ? = Not Applicable
Bit
Position Bit/Field R/WValueDescription
7X2 Clock
Multiplier
Mode
6
–0Reserved??Reserved
R/W
X2 Clock Multiplier Mode
0
Disable
1
Enable
UM005003-0703
Z8018x
Family MPU User Manual
CPU Control Register (CCR: 1FH) (Z8S180/L180-Class Processors Only)
Bit76543210
Bit/FieldClock
Divide
R/WR/WR/WR/WR/WR/WR/WR/WR/W
Reset 0000 0000
Note: R = Read W = Write X = Indeterminate ? = Not Applicable
Bit
Position Bit/FieldR/WValue Description
STAND
BY/
IDLE
Enable
BREXTLNPHISTAND
BY/
IDLE
Enable
LNIOLNCPU
CTL
LNAD/
DATA
53
7Clock
Divide
6STANDBY
/IDLE Mode
5BREXTR/W01Ignore BUSREQ in STANDBY/IDLE
4LNPHIR/W01Standard Drive
3STANDBY
/IDLE Mode
R/W01XTAL/2
XTAL/1
R/W
R/W
In conjunction with Bit 3
No STANDBY
00
IDLE after SLEEP
01
STANDBY after SLEEP
10
STANDBY after SLEEP 64 Cycle Exit (Quick
11
Recovery)
STANDBY/IDLE exit on BUSREQ
33% Drive on EXTPHI Clock
In conjunction with Bit 6
No STANDBY
00
IDLE after SLEEP
01
STANDBY after SLEEP
10
STANDBY after SLEEP 64 Cycle Exit (Quick
11
Recovery)
UM005003-0703
Z8018x
Family MPU User Manual
54
Bit
Position Bit/FieldR/WValue Description
2LNIOR/W0
1LNCPUCTLR/W0
0LNAD/
DATA
R/W01Standard Drive
Standard Drive
1
33% Drive on certain external I/O
Standard Drive
1
33% Drive on CPU control signals
33% drive on A10–A0, D7–D0
Memory Management Unit (MMU)
The Z8X180 features an on-chip MMU which performs the translation of
the CPU 64KB (16-bit addresses
address space into a 1024KB (20-bit addresses
physical memory address space. Address translation occurs internally in
parallel with other CPU operation.
Logical Address Spaces
The 64KB CPU logical address space is interpreted by the MMU as
consisting of up to three separate logical address areas, Common Area 0,
Bank Area, and Common Area 1.
As depicted in Figure 23, a variety of logical memory configurations are
possible. The boundaries between the Common and Bank Areas can be
programmed with 4KB resolution.
0000H to FFFFH) logical memory
00000H to FFFFFH)
UM005003-0703
Z8018x
Family MPU User Manual
55
Common
Area 1
Bank Area
Common
Area 0
Common
Area 1
Bank
Area
Common
Area 1
Common
Area 0
Common
Area 1
Figure 23. Logical Address Mapping Examples
Logical to Physical Address Translation
Figure 24 illustrates an example in which the three logical address space
portions are mapped into a 1024KB physical address space. The
important points to note are that Common and Bank Areas can overlap
and that Common Area 1 and Bank Area can be freely relocated (on 4KB
physical address boundaries). Common Area 0 (if it exists) is always
based at physical address
00000H.
UM005003-0703
56
Z8018x
Family MPU User Manual
FFFFH
Common Area 1
Common Base
+
FFFFFH
z
x y z
+
+
Bank Base
y
0
x
Physical Address Space
Bank Area
Common Area 0
0000H
Logical Address Space
Figure 24. Physical Address Transition
MMU Block Diagram
The MMU block diagram is depicted in Figure 25. The MMU translates
internal 16-bit logical addresses to external 20-bit physical addresses.
Internal Address/Data Bus
4
LA12—LA15
MMU Common/Bank Area
Register; CBAR (8)
Memory
Management
Unit
8
PA12—PA19
MMU Common Base
Register; CBR (8)
MMU Bank Base
Register; BBR (8)
LA: Logical Address
PA: Physical Address
00000H
Figure 25.MMU Block Diagram
UM005003-0703
Z8018x
Family MPU User Manual
Whether address translation (Figure 26) takes place depends on the type
of CPU cycle as follows.
•
Memory Cycles
Address Translation occurs for all memory access cycles including
instruction and operand fetches, memory data reads and writes,
hardware interrupt vector fetch, and software interrupt restarts.
•
I/O Cycles
The MMU is logically bypassed for I/O cycles. The 16-bit logical I/O
address space corresponds directly with the 16-bit physical I/O
address space. The four high-order bits (A16–A19) of the physical
address are always
0 during I/O cycles.
57
LA15
“0000”
PA19
Figure 26. I/O Address Translation
•
DMA Cycles
PA16 PA15PA0
LA0
Logical Address
Physical Address
When the Z8X180 on-chip DMAC is using the external bus, the
MMU is physically bypassed. The 20-bit source and destination
registers in the DMAC are directly output on the physical address bus
(A0–A19).
MMU Registers
Three MMU registers are used to program a specific configuration of
logical and physical memory.
UM005003-0703
58
Z8018x
Family MPU User Manual
•
MMU Common/Bank Area Register (CBAR)
•
MMU Common Base Register (CBR)
•
MMU Bank Base Register (BBR)
CBAR is used to define the logical memory organization, while CBR and
BBR are used to relocate logical areas within the 1024KB physical
address space. The resolution for both setting boundaries within the
logical space and relocation within the physical space is 4KB.
The CA field of CBAR determines the start address of Common Area 1
(Upper Common) and by default, the end address of the Bank Area. The
BA field determines the start address of the Bank Area and by default, the
end address of Common Area 0 (Lower Common).
The CA and BA fields of CBAR may be freely programmed subject only
to the restriction that CA may never be less than BA. Figures 27 and 28
illustrate examples of logical memory organizations associated with
different values of CA and BA.
Common
Area 1
Bank Area
Common
Area 0
Common Area 1
Lower Limit Address
>
Bank Area
Lower Limit Address
>
0000H
Common
Area 1
Bank Area
Common Area 1
Lower lImit Address
>
Bank Area
Lower lImit Address
=
0000H
(RESET Condition)
Common
Area 1
Common
Area 0
Common Area 1
Lower Limit Address
Bank Area
Lower Limit Address
0000H
Figure 27.Logical Memory Organization
UM005003-0703
Common
Area 1
Common Area 1
=
Lower Limit Address
Lower Limit Address
>
=
Bank Area
=
0000H
MMU Common/Bank Area Register
Z8018x
Family MPU User Manual
59
FFFFH
Common Area 1
1101
D6D5D4
D7
MMU Common/Bank Area Register
D3 D2 D1 D0
D5
0100
D
4
D000H
CFFFH
4000H
3FFFH
0000H
Figure 28.Logical Space Configuration (Example)
Bank Area
Common Area 0
UM005003-0703
Z8018x
Family MPU User Manual
60
MMU Register Description
MMU Common/Bank Area Register (CBAR)
CBAR specifies boundaries within the Z8X180 64KB logical address
space for up to three areas; Common Area 0, Bank Area and Common
Area 1.
MMU Common/Bank Area Register (CBAR: 3AH)
Bit76543210
Bit/FieldCA3CA2CA1CA0BA3BA2BA1BA0
R/WR/WR/WR/WR/WR/WR/WR/WR/W
Reset 1 1 1 1 0000
Note: R = Read W = Write X = Indeterminate ? = Not Applicable
Bit
Position Bit/Field R/WValueDescription
7
–4CA7–4R/WCA specifies the start (low) address (on 4KB boundaries)
for the Common Area 1. This also determines the last
address of the Bank Area.
3
–0BA3–0R/WBA specifies the start (low) address (on 4KB boundaries)
for the Bank Area. This also determines the last address
of the Common Area 0.
UM005003-0703
Z8018x
Family MPU User Manual
MMU Common Base Register (CBR)
CBR specifies the base address (on 4K boundaries) used to generate a 20bit physical address for Common Area 1 accesses. All bits of CBR are
reset to 0 during RESET.
MMU Common Base Register (CBR: 38H)
Bit765432 10
Bit/FieldCB7CB6CB5CB4CB3CB2CB1CB0
R/WR/WR/WR/WR/WR/WR/WR/WR/W
Reset 0 0 0 0 0 0 0 0
Note: R = Read W = Write X = Indeterminate ? = Not Applicable
Bit
Position Bit/Field R/WValueDescription
61
7
–0CB7–0R/WCBR specifies the base address (on 4KB boundaries) used
to generate a 20-bit physical address for Common Area 1
accesses.
UM005003-0703
Z8018x
Family MPU User Manual
62
MMU Bank Base Register (BBR)
BBR specifies the base address (on 4KB boundaries) used to generate a
20-bit physical address for Bank Area accesses. All bits of BBR are reset
to
0 during RESET.
MMU Bank Base Register (BBR: 39H)
Bit76543210
Bit/FieldBB7BB6BB5BB4BB3BB2BB1BB0
R/WR/WR/WR/WR/WR/WR/WR/WR/W
Reset 0 0 0 0 0 0 0 0
Note: R = Read W = Write X = Indeterminate ? = Not Applicable
Bit
PositionBit/FieldR/WValue Description
7
–0BB7–0R/WBBR specifies the base address (on 4KB boundaries) used
to generate a 20-bit physical address for Bank Area
accesses.
Physical Address Translation
Figure 29 illustrates the way in which physical addresses are generated
based on the contents of CBAR, CBR and BBR. MMU comparators
classify an access by logical area as defined by CBAR. Depending on
which of the three potential logical areas (Common Area 1, Bank Area, or
Common Area 0) is being accessed, the appropriate 8- or 7-bit base
address is added to the high-order 4 bits of the logical address, yielding a
19- or 20-bit physical address. CBR is associated with Common Area 1
accesses. Common Area 0, if defined, is always based at physical address
00000H.
UM005003-0703
MMU and RESET
Z8018x
Family MPU User Manual
63
During RESET, all bits of the CA field of CBAR are set to
of the BA field of CBAR, CBR and BBR are reset to
address space corresponds directly with the first 64KB
of the 1024KB
00000H. to FFFFFH) physical address space. Thus, after
1 while all bits
0. The logical 64KB
0000H to FFFFH)
RESET, the Z8X180 begins execution at logical and physical address 0.
MMU Register Access Timing
When data is written into CBAR, CBR or BBR, the value is effective
from the cycle immediately following the I/O write cycle which updates
these registers.
During MMU programming insure that CPU program execution is not
disrupted. The next cycle following MMU register programming is
normally an Op Code fetch from the newly translated address. One
technique is to localize all MMU programming routines in a Common
Area that is always enabled.
UM005003-0703
64
Z8018x
Family MPU User Manual
MMU Common/
Bank Area
Register
D7 — D4
MMU Common/
Bank Area
Register
D3 — D0
MMU Common Base Reg.
MMU Bank Base Reg.
00000000
(512 k or 1 M)
Figure 29.Physical Address Generation
4
Comparator
4
Physical
Address
Logical
Address
(64 k)
(19) 18
4
8
15
Adder
12
11
0
Logical
Address
(64K)
4
8
110
12
11
1215
0
Base Register
(7)4 30
(8 bit)
(1 M)
Physical
Address
(19) 18 16 1512 11
Figure 30.Physical Address Generation 2
UM005003-0703
0
Z8018x
Family MPU User Manual
65
Note:
Packages not containing an A19 pin or situations using TOUT
instead of A18 yield an address capable of only addressing 512K
of physical space.
Interrupts
The Z8X180 CPU has twelve interrupt sources, 4 external and 8 internal,
with fixed priority. (Reference Figure 31.)
This section explains the CPU registers associated with interrupt
processing, the TRAP interrupt, interrupt response modes, and the
external interrupts. The detailed discussion of internal interrupt
generation (except TRAP) is presented in the appropriate hardware
section (that is, PRT, DMAC, ASCI, and CSI/O).
(1)
Higher
Priority
Lower
Priority
TRAP (Undefined Op Code Trap)
(2)
NMI (Non Maskable Interrupt)
(3)
INT0 (Maskable Interrupt Level 0)
(4)
INT1 (Maskable Interrupt Level 1)
(5)
INT2 (Maskable Interrupt Level 2)
(6)
Timer 0
(7)
Timer 1
(8)
DMA channel 0
(9)
DMA channel 1
(10)
Clocked Serial I/O Port
(11)
Asynchronous SCI channel 0
(12)
Asynchronous SCI channel 1
Internal Interrupt
External Interrupt
Internal Interrupt
Figure 31.Interrupt Sources
Interrupt Control Registers and Flags. The Z8X180 has three registers and
two flags which are associated with interrupt processing.
UM005003-0703
66
Z8018x
Family MPU User Manual
FunctionNameAccess Method
Interrupt Vector HighILD A,I and LD I, A instructions
Mode 2 for INT0 external interrupt, INT1 and INT2 external interrupts,
and all internal interrupts (except TRAP) use a programmable vectored
technique to determine the address at which interrupt processing starts. In
response to the interrupt a 16-bit address is generated. This address
accesses a vector table in memory to obtain the address at which
execution restarts.
While the method for generation of the least significant byte of the table
address differs, all vectored interrupts use the contents of I as the most
significant byte of the table address. By programming the contents of I,
vector tables can be relocated on 256 byte boundaries throughout the
64KB logical address space.
Note:
I is read/written with the LD A, I and LD I, A instructions rather
than I/O (IN, OUT) instructions. I is initialized to
RESET.
Interrupt Vector Low Register
This register determines the most significant three bits of the low-order
byte of the interrupt vector table address for external interrupts INT1
INT2
and all internal interrupts (except TRAP). The five least significant
bits are fixed for each specific interrupt source. By programming IL, the
UM005003-0703
00H during
and
Z8018x
Family MPU User Manual
vector table can be relocated on 32 byte boundaries. IL is initialized to
00H during RESET.
Interrupt Vector Low Register (IL: 33H)
Bit76543210
Bit/FieldIL7IL6IL5?
R/WR/WR/WR/W
Reset00H 00H 00H ?
Note: R = Read W = Write X = Indeterminate ? = Not Applicable
Bit
PositionBit/FieldR/WValue Description
–5IL7–5R/WThe IL register is an internal I/O register which is
7
programmed with the OUT0 instruction and can be read
using the IN0 instruction.
?
67
4
–0?N/AInterrupt source dependent code
INT/TRAP Control Register (ITC)
ITC is used to handle TRAP interrupts and to enable or disable the
external maskable interrupt inputs INT0
, INT1 and INT2.
UM005003-0703
Z8018x
Family MPU User Manual
68
INT/TRAP Control Register (ITC: 34H)
Bit76543210
Bit/FieldTRAPUFO?ITE2ITE1ITE0
R/WR/WR
Reset 000001
Note: R = Read W = Write X = Indeterminate ? = Not Applicable
Bit
PositionBit/FieldR/WValue Description
7TRAPR/WThis bit is set to 1 when an undefined Op Code is fetched.
TRAP can be reset under program control by writing it
with 0, however, it cannot be written with 1 under
program control.
N/AR/WR/WR/W
6UFORUndefined Fetch Object (bit 6).
When a TRAP interrupt occurs the contents of UFO allow
determination of the starting address of the undefined
instruction. This action is necessary since the TRAP may
occur on either the second or third byte of the Op Code.
UFO allows the stacked PC value to be correctly adjusted.
If UFO = 0, the first Op Code should be interpreted as the
stacked PC-1. If UFO = 1, the first Op Code address is
stacked PC-2.
2
–0ITE2–0R/WInterrupt Enable — ITE2, ITE1 and ITE0 enable and
disable the external interrupt inputs INT2
INT0
, respectively. If reset to 0, the interrupt is masked.
, INT1 and
Interrupt Enable Flag 1,2 (IEF1, IEF2)
IEF1 controls the overall enabling and disabling of all internal and
external maskable interrupts (that is, all interrupts except NMI
UM005003-0703
and TRAP.
Z8018x
Family MPU User Manual
If IEF1 is 0, all maskable interrupts are disabled. IEF1 can be reset to 0 by
the DI (Disable Interrupts) instruction and set to
1 by the El (Enable
Interrupts) instruction.
69
The purpose of IEF2 is to correctly manage the occurrence of NMI
During NMI
, the prior interrupt reception state is saved and all maskable
.
interrupts are automatically disabled (IEF1 copied to IEF2 and then IEF1
cleared to
0). At the end of the NMI interrupt service routine, execution of
the RETN (Return from Non-maskable Interrupt) automatically restores
the interrupt receiving state (by copying IEF2 to IEF1) prior to the
occurrence of NMI
.
Table 8 describes how the IEF2 state can be reflected in the P/V bit of the
CPU Status Register by executing LD A, I or LD A, R instructions.
Table 8. State of IEF1 and IEF2
CPU
OperationIEF1IEF2REMARKS
RESET00Inhibits the interrupt except NMI
and TRAP.
NMI0IEF1Copies the contents of IEF1 to
IEF2
RETNIEF2not affected Returns from the NMI
routine.
Interrupt except
NMI
end TRAP
00Inhibits the interrupt except NMI
end TRAP
service
RETInot affected not affected
TRAPnot affected not affected
EI11
UM005003-0703
70
Z8018x
Family MPU User Manual
Table 8. State of IEF1 and IEF2 (Continued)
CPU
OperationIEF1IEF2REMARKS
DI00
LD A, Inot affected not affected Transfers the contents of IEF1 to
LID A, Rnot affected not affected Transfers the contents of IEF1 to
TRAP Interrupt
The Z8X180 generates a non-maskable (not affected by the state of IEF1)
TRAP interrupt when an undefined Op Code fetch occurs. This feature
can be used to increase software reliability, implement an extended
instruction set, or both. TRAP may occur during Op Code fetch cycles
and also if an undefined Op Code is fetched during the interrupt
acknowledge cycle for INT
P/V
P/V
0 when Mode 0 is used.
When a TRAP interrupt occurs the Z8X180 operates as follows:
1. The TRAP bit in the Interrupt TRAP/Control (ITC) register is set to
2. The current PC (Program Counter) value, reflecting location of the
undefined Op Code, is saved on the stack.
3. The Z8X180 vectors to logical address 0. Note that if logical address
0000H is mapped to physical address 00000H. the vector is the same
as for RESET. In this case, testing the TRAP bit in ITC reveals
whether the restart at physical address
00000H was caused by
RESET or TRAP.
The state of the UFO (Undefined Fetch Object) bit in ITC allows TRAP
manipulation software to correctly adjust the stacked PC, depending on
whether the second or third byte of the Op Code generated the TRAP. If
UFO is
UM005003-0703
0, the starting address of the invalid instruction is equal to the
1.
Z8018x
Family MPU User Manual
stacked PC-1. If UFO is 1, the starting address of the invalid instruction is
equal to the stacked PC-2.
71
–
A19
A0
D0–D7
MREQ
WR
Phi
MI
RD
Bus Release cycle, Refresh cycle, DMA cycle, and WAIT
cycle cannot be
inserted just after TTP state which is inserted for TRAP interrupt
sequence. Figure depicts TRAP Timing - 2nd Op Code undefined and
Figure illustrates Trap Timing - 3rd Op Code undefined.
Restart from 0000H
2nd Op Code
Fetch Cycle
Undefined
Op Code
TiTiTiT1Ti TiT1 T2 T3T2 T3 T1 T2 T3 T1 T2 T3
PC
PC Stacking
SP-1
PCH
SP-2
Figure 32.TRAP Timing Diagram -2nd Op Code Undefined
PCL
Op Code
Fetch Cycle
0000H
UM005003-0703
72
Z8018x
Family MPU User Manual
–
A19
A0
D0–D7
MREQ
Phi
MI
RD
WR
3rd Op Code
Fetch Cycle
PC
Undefined
Op Code
Memory
Read Cycle
IX+d, IY+d
PC stacking
TiT1TiTiT1 T2 T3T2T3T1T3T1 T2T3T1 T2 TTPT1 T2 T3
SP-1
SP-2
PCLPCH
Figure 33.TRAP Timing - 3rd Op Code Undefined
External Interrupts
The Z8X180 features four external hardware interrupt inputs:
•
NMI–Non-maskable interrupt
•
INT0–Maskable Interrupt Level 0
Restart from 0000H
Op Code
fetch cycle
0000H
•
INT1–Maskable Interrupt Level 1
•
INT2–Maskable Interrupt Level 2
NMI
, INT1, and INT2 feature fixed interrupt response modes. INT0 has 3
different software programmable interrupt response modes—Mode 0,
Mode 1 and Mode 2.
- Non-Maskable Interrupt
NMI
The
NMI interrupt input is edge-sensitive and cannot be masked by
software. When
UM005003-0703
NMI is detected, the Z8X180 operates as follows:
Z8018x
Family MPU User Manual
1. DMAC operation is suspended by the clearing of the DME (DMA
Main Enable) bit in DCNTL.
2. The PC is pushed onto the stack.
3. The contents of IEF1 are copied to IEF2. This saves the interrupt
reception state that existed prior to NMI
.
73
4. IEF1 is cleared to
interrupts (that is, all interrupts except NMI
5. Execution commences at logical address
The last instruction of an NMI
0. This disables all external and internal maskable
and TRAP).
0066H.
service routine must be RETN (Return
from Non-maskable Interrupt). This restores the stacked PC, allowing the
interrupted program to continue. Furthermore, RETN causes IEF2 to be
copied to IEF1, restoring the interrupt reception state that existed prior to
NMI
.
Note:
NMI
, because it can be accepted during Z8X180 on-chip
DMAC operation, can be used to externally interrupt DMA
transfer. The NMI
service routine can reactivate or abort the
DMAC operation as required by the application.
For NMI
the NMI
, take special care to insure that interrupt inputs do not overrun
service routine. Unlimited NMI inputs without a corresponding
number of RETN instructions eventually cause stack overflow.
Figure 34 depicts the use of NMI
response timing. NMI
is edge sensitive and the internally latched NMI
falling edge is held until it is sampled. If the falling edge of NMI
and RETN while Figure 35 details NMI
is
latched before the falling edge of the clock state prior to T3 or T1 in the
last machine cycle, the internally latched NMI
is sampled at the falling
edge of the clock state prior to T3 or T1 in the last machine cycle and
NMI
acknowledge cycle begins at the end of the current machine cycle.
UM005003-0703
74
Z8018x
Family MPU User Manual
NMI
Main
Program
EF1
0
PCH
PCL
EF1
PCL
PCH
®
®
®
®
¬
¬
¬
EF2
EF1
(SP-1)
(SP-2)
EF2
(SP)
(SP+1)
0066H
NMI
Interrupt Service
Program
RETN
NMI
–
A0
D0–D7
MREQ
Phi
A19
MI
RD
WR
Figure 34.NMI
Last MC
T1T3 Ti T1 T1 T2 T3 T1 T2 T3T1T1 T2 T3
Use
NMI
acknowledge cycle
PC
PC is pushed onto stack
SP-1
PCH
SP-2
Restart from 0066H
Op Code fetch
0066H
Instruction
PCL
UM005003-0703
Z8018x
Family MPU User Manual
Figure 35.NMI Timing
INT0 - Maskable Interrupt Level 0
The next highest priority external interrupt after NMI is INT0. INT0 is
sampled at the falling edge of the clock state prior to T3 or T1 in the last
machine cycle. If INT0
state prior to T3 or T1 in the last machine cycle, INT0
interrupt is masked if either the IEF1 flag or the ITEO (Interrupt Enable
0) bit in ITC are reset to
is asserted LOW at the falling edge of the clock
is accepted. The
0. After RESET the state is as follows:
75
1. IEF1 is
2. ITE0 is
Interrupts) instruction
The INT0 interrupt is unique in that 3 programmable interrupt response
modes are available - Mode 0, Mode 1 and Mode 2. The specific mode is
selected with the IM 0, IM 1 and IM 2 (Set Interrupt Mode) instructions.
During RESET
interrupt response modes for INT0
•
Mode 0–Instruction fetch from data bus
•
Mode 1–Restart at logical address 0038H
•
Mode 2–Low-byte vector table address fetch from data bus
0, so INT0 is masked
1, so INT0 is enabled by execution of the El (Enable
, the Z8X180 is initialized to use Mode 0 for INT0. The 3
are:
INT0 Mode 0
During the interrupt acknowledge cycle, an instruction is fetched from the
data bus (DO–D7) at the rising edge of T3. Often, this instruction is one
of the eight single byte RST (RESTART) instructions which stack the PC
and restart execution at a fixed logical address. However, multibyte
instructions can be processed if the interrupt acknowledging device can
provide a multibyte response. Unlike all other interrupts, the PC is not
automatically stacked:
UM005003-0703
76
d
Z8018x
Family MPU User Manual
INT0
–
A0
MREQ
IORQ
D0–D7
Phi
A19
M1
RD
WR
Last MC
T1
MC: Machine Cycle
INT0 acknowledge cycle
*
*
TW
T2
TW
T3
PC
RST instruction
RST instruct ion execution
PC is pushed onto stack
Ti
*Two Wait States are automatically inserte
T1
Ti
T3
T2T3
SP-1
PCH
T2
T1
SP-2
PCL
Note:
The TRAP interrupt occurs if an invalid instruction is fetched
during Mode 0 interrupt acknowledge. (Reference Figure 36.)
Figure 36.INT0 Mode 0 Timing Diagram
INT0 Mode 1
When INT0 is received, the PC is stacked and instruction execution
restarts at logical address
UM005003-0703
0038H. Both IEF1 and IEF2 flags are reset to 0,
Z8018x
Family MPU User Manual
disabling all maskable interrupts. The interrupt service routine normally
terminates with the EI (Enable Interrupts) instruction followed by the
RETI (Return from Interrupt) instruction, to reenable the interrupts.
Figure 37 depicts the use of INT0
(Mode 1) and RETI for the Mode 1
interrupt sequence.
Figure 37.INT0 Mode 1 Interrupt Sequence
0
®
Main
Program
PCH
PCL
®
®
EF1, EF2
(SP-1)
(SP-2)
0038H
77
INT0
(Mode 1)
PCL
¬
¬
(SP)
(SP+1)
PCH
Figure 38 illustrates INT0 Mode 1 Timing.
INT0 (Mode 1)
Interrupt Service
Program
®
E1 (1
RETI
1EF1, 1EF2)
UM005003-0703
78
Z8018x
Family MPU User Manual
Last MC
Phi
INT0
–
A19
A0
M1
MREQ
IORQ
INT0
Acknowledge Cycle
T1T3TW*T2T1T2T3T1T2 T3T1T2 T3TW*
PC
PC is pushed onto stack
SP-1
SP-2
Op Code Fetch Cycle
0038H
RD
WR
D0–D7
PCH
ST
*Two Wait States are automatically inserted
Figure 38.INT0
Mode 1 Timing
INT0 Mode 2
This method determines the restart address by reading the contents of a
table residing in memory. The vector table consists of up to 128 two-byte
restart addresses stored in low byte, high byte order.
UM005003-0703
PCL
Z8018x
Family MPU User Manual
The vector table address is located on 256 byte boundaries in the 64KB
logical address space programmed in the 8-bit Interrupt Vector Register
(1). Figure 39 depicts the INT0
16-bit Vector
Mode 2 Vector acquisition.
Memory
79
Interrupt Vector
Register I
Figure 39.INT0 Mode 2 Vector Acquisition
8-bit on
Data Bus
Offset
Vector + 1
Vector
High-order 8 bits
of starting address
Low-order 8 bits
of starting address
256 Bytes
Vector
Table
During the INT0 Mode 2 acknowledge cycle, the low-order 8 bits of the
vector is fetched from the data bus at the rising edge of T3 and the CPU
acquires the 16-bit vector.
Next, the PC is stacked. Finally, the 16-bit restart address is fetched from
the vector table and execution begins at that address.
Note:
External vector acquisition is indicated by both MI
and IORQ
LOW. Two Wait States (TW) are automatically inserted for
external vector fetch cycles.
During RESET the Interrupt Vector Register (I) is initialized to
00H and,
if necessary, should be set to a different value prior to the occurrence of a
Mode 2 INT
The operation of external interrupts INT1 and INT2 is a vector mode
similar to INT0
the low-order byte of vector table address using the IL (Interrupt Vector
Low) register rather than fetching it from the data bus. This difference is
UM005003-0703
Mode 2. The difference is that INT1 and INT2 generate
Z8018x
Family MPU User Manual
also the interrupt response sequence used for all internal interrupts
(except TRAP).
As depicted in Figure 41, the low-order byte of the vector table address
has the most significant three bits of the software programmable IL
register while the least significant five bits are a unique fixed value for
each interrupt (INT1
16-bit Vector
, INT2 and internal) source:
Memory
81
IIL
Figure 41.INT1, INT2 Vector Acquisition
Fixed Code
(5 bits)
Vector + 1
Vector
High-order 8 bits
of starting address
Low-order 8 bits
of starting address
32 Bytes
Vector
Table
INT1 and INT2 are globally masked by IEF1 is 0. Each is also
individually maskable by respectively clearing the ITE1 and ITE2 (bits
1,2) of the INT/TRAP control register to
During RESET, IEF1, ITE1 and ITE2 bits are reset to
0.
0.
Internal Interrupts
Internal interrupts (except TRAP) use the same vectored response mode
as INT1 and INT2. Internal interrupts are globally masked by IEF1 is 0.
Individual internal interrupts are enabled/disabled by programming each
UM005003-0703
82
Z8018x
Family MPU User Manual
individual I/O (PRT, DMAC, CSI/O, ASCI) control register. The lower
vector of INT1
Table 9. Vector Table
INT2 and internal interrupt are summarized in Table 9.
ILFixed Code
Interrupt SourcePriority
INT1
INT2
PRT channel 0———00100
PRT channel 1———00110
DMA channel 0———01000
DMA channel 1———01010
CSI/O———01100
ASCI channel 0———01110
ASCI channel 1———10000
Highest
Lowest
b7b6b5b4b3b2b1b0
———00 0 00
———00 0 10
Interrupt Acknowledge Cycle Timings
Figure 43 illustrates INT1, INT2, and internal interrupts timing. INT1 and
INT2
are sampled at the falling edge of the clock state prior to T2 or T1 in
the last machine cycle. If INT1
edge of clock state prior to T3 or T1 in the last machine cycle, the
interrupt request is accepted.
or INT2 is asserted Low at the falling
UM005003-0703
Interrupt Sources During RESET
Interrupt Vector Register (I)
Z8018x
Family MPU User Manual
83
All bits are reset to
logical address
0. Because I = 0 locates the vector tables starting at
and internal interrupts) overlap with fixed restart interrupts like RESET
(0), NMI
(0066H), INT0 Mode 1 (0038H) and RST (0000H-0038H). The
vector table(s) are built elsewhere in memory and located on 256 byte
boundaries by reprogramming I with the LD I, A instruction.
IL Register
Bits 7 - 5 are reset to
0
The IL Register can be programmed to locate the vector table for INT1,
INT2
and internal interrupts on 32-byte subboundaries within the 256
byte area specified by I.
IEF1, IEF2 Flags
Reset to
0. Interrupts other than NMI and TRAP are disabled.
ITC Register
ITE0 set to 1. ITE1, ITE2 reset to
instruction, which sets IEF1 to
that the ITE1 and ITE2 bits be respectively set to
0. INT0 can be enabled by the EI
1. Enabling INT1 and INT2 also requires
1 by writing to ITC.
I/O Control Registers
Interrupt enable bits reset to
0. All Z8X180 on-chip I/O (PRT, DMAC,
CSI/O, ASCI) interrupts are disabled and can be individually enabled by
writing to each I/O control register interrupt enable bit.
UM005003-0703
84
Z8018x
Family MPU User Manual
Return from Subroutine (RETI) Instruction Sequence
When the EDH/4DH sequence is fetched by the Z8X180, it is recognized as
the RETI instruction sequence. The Z8X180 then refetches the RETI
instruction with four T-states in the
peripherals time to decode that cycle (See Figure 42). This procedure
allows the internal interrupt structure of the peripheral to properly decode
the instruction and behave accordingly.
The M1E bit of the Operation Mode Control Register (OMCR) must be
set to
0 so that M1 signal is active only during the refetch of the RETI
instruction sequence. This condition is the desired operation when Z80
peripherals are connected to the Z8018X.
EDH cycle allowing the Z80
T1
Phi
A0
–
A18 (A19)
D0–D7
(M1E = 1)
M1
M1 (M1E = 0)
MREQ
RD
ST
Note: RETI machine cycles 9 and 10 not shown.
PC
EDH
T3 TiTi TiT1 T2 T3 TiT1 T2 T3 T1T3 T1 T2T2
PC + 1
4DH
Figure 42.RETI Instruction Sequence
The RETI instruction takes 22 T-states and 10 machine cycles. Table 10
lists the conditions of all the control signals during this sequence for the
PC
EDH
PC + 1
4DH
UM005003-0703
Z8X180. Figure 43 illustrates the INT1, INT2 and internal interrupts
timing.
Table 10. RETI Control Signal States
Machine
CycleStates Address Data
RD WR MREQ IORQ M1E=1 M1E=0 HALT ST
Z8018x
Family MPU User Manual
85
MI
1T1-T3 1st
Op Code
2TI-T32nd
Op Code
3T1Don't
Care
4T1Don't
Care
5T1Don't
Care
6T1-T3 1st
Op Code
7T1Don't
Care
8T1-T3 2nd
Op Code
9T1-T3SPdata01011111
10T1-T3 SP+1data01011111
IOC affects the IORQ/RD signals. M1E affects the assertion of M1. One state also reflects a 1 while
the other reflects a 0
EDH01010110
4DH01010111
3-state11111111
3-state11111111
3-state11111111
EDH01010011
3-state11111111
4DH01010111
UM005003-0703
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.