Information in this manual may be changed without prior notice.
Mitsubishi Electric Corporation
Mitsubishi Electric Semiconductor Systems Corporation
Keep safety first in your circuit designs!
●
Mitsubishi Electric Corporation puts the maximum effort into making semiconductor
products better and more reliable, but there is always the possibility that trouble may
occur with them. Trouble with semiconductors may lead to personal injury, fire or
property damage. Remember to give due consideration to safety when making your
circuit designs, with appropriate measures such as (i) placement of substitutive,
auxiliary circuits, (ii) use of non-flammable material or (iii) prevention against any
malfunction or mishap.
Notes regarding these materials
●
These materials are intended as a reference to assist our customers in the selection
of the Mitsubishi semiconductor product best suited to the customer's application;
they do not convey any license under any intellectual property rights, or any other
rights, belonging to Mitsubishi Electric Corporation or a third party.
●
Mitsubishi Electric Corporation assumes no responsibility for any damage, or
infringement of any third-party's rights, originating in the use of any product data,
diagrams, charts, programs, algorithms, or circuit application examples contained in
these materials.
●
All information contained in these materials, including product data, diagrams, charts,
programs and algorithms represents information on products at the time of publication
of these materials, and are subject to change by Mitsubishi Electric Corporation
without notice due to product improvements or other reasons. It is therefore
recommended that customers contact Mitsubishi Electric Corporation or an authorized
Mitsubishi Semiconductor product distributor for the latest product information before
purchasing a product listed herein.
The information described here may contain technical inaccuracies or typographical
errors. Mitsubishi Electric Corporation assumes no responsibility for any damage,
liability, or other loss rising from these inaccuracies or errors.
Please also pay attention to information published by Mitsubishi Electric Corporation
by various means, including the Mitsubishi Semiconductor home page (http://
www.mitsubishichips.com).
●
When using any or all of the information contained in these materials, including
product data, diagrams, charts, programs, and algorithms, please be sure to evaluate
all information as a total system before making a final decision on the applicability of
the information and products. Mitsubishi Electric Corporation assumes no
responsibility for any damage, liability or other loss resulting from the information
contained herein.
●
Mitsubishi Electric Corporation semiconductors are not designed or manufactured
for use in a device or system that is used under circumstances in which human life is
potentially at stake. Please contact Mitsubishi Electric Corporation or an authorized
Mitsubishi Semiconductor product distributor when considering the use of a product
contained herein for any specific purposes, such as apparatus or systems for
transportation, vehicular, medical, aerospace, nuclear, or undersea repeater use.
●
The prior written approval of Mitsubishi Electric Corporation is necessary to reprint
or reproduce in whole or in part these materials.
●
If these products or technologies are subject to the Japanese export control
restrictions, they must be exported under a license from the Japanese government
and cannot be imported into a country other than the approved destination.
Any diversion or reexport contrary to the export control laws and regulations of Japan
and/or the country of destination is prohibited.
●
Please contact Mitsubishi Electric Corporation or an authorized Mitsubishi Semicon
ductor product distributor for further details on these materials or the products con
tained therein.
PREFACE
This manual describes the hardware specifications of Mitsubishi’s 32170 group of 32-bit
CMOS microcomputers.
This manual was created to help you understand the hardware specifications of the
32170-group microcomputers so you can take
full advantage of the versatile performance capabilities of these microcomputers. The CPU
features and the functionality of each internal
peripheral circuit are described in detail, which
we hope will prove useful for your circuit design.
For details about the M32R-family software
products and development support tools,
please refer to the user’s manuals and related
other documentation included with your products and tools.
How to read internal I/O register tables
➀ Bit Numbers: Each register is connected with an internal bus of 16-bit
wide, so the bit numbers of the registers located at even
addresses are D0-D7, and those at odd addresses are
D8-D15.
➁ State of Register at Reset: Represents the initial state of each register
immediately after reset with hexadecimal numbers
(undefined bits after reset are indicated each in column ➂.)
➂ At read: ... read enabled
? ... read disabled (read value invalid)
0 ... Read always as 0
1 ... Read always as 1
④ At write:: Write enabled
: Write enable conditionally
(include some conditions at write)
- : Write disabled (Written value invalid)
<Example of representation>
Not implemented
in the shaded portion.
1
Bit nameFunction
D
0
Not assigned.
Abit
1
(...................)
2
Bbit
(...................)
3
Cbit
(...................)
1234D0
Abit
BbitCbit
0: ----1: -----
0: ----1: -----
0: ----1: -----
Registers represented with thick rectangles
are accessible only with halfwords or words
(not accessible with bytes).
<at reset: H'04>
2
WR
0
34
Contents
CHAPTER 1 OVERVIEW
1.1 Outline of the 32170..........................................................................................1-2
1.1.1 M32R Family CPU Core .............................................................................1-2
1.1.2 Built-in Multiply-Accumulate Operation Function ........................................1-3
1.1.3 Built-in Flash Memory and RAM .................................................................1-3
1.1.4 Built-in Clock Frequency Multiplier ............................................................. 1-4
10.5.1 Outline of TMS.................................................................................... 10-140
10.5.2 Outline of TMS Operation ...................................................................10-140
Operation in TIO Single-shot Output Mode (without Correction Function)..
Operation in TIO Delayed Single-shot Output Mode (without Correction Function)..
Operation in TIO Continuous Output Mode (Without Correction Function).
10-134
10-136
10-138
(6)
10.5.3 TMS Related Register Map ................................................................ 10-142
10.5.4 TMS Control Registers ....................................................................... 10-143
• The 32170 is a 32-bit RISC single-chip microcomputer which is built around the M32R family
CPU core (hereafter referred to as the M32R) and incorporates flash memory, RAM, and
various other peripheral functions-all integrated into a single chip.
• The M32R is based on RISC architecture. Memory access is performed using load and store
instructions, and various arithmetic operations are executed using register-to-register
operation instructions. The M32R internally contains sixteen 32-bit general-purpose registers
and has 83 distinct instructions.
• The M32R supports compound instructions such as Load & Address Update and Store &
Address Update, in addition to ordinary load and store instructions. These compound
instructions help to speed up data transfers.
OVERVIEW
1.1 Outline of the 32170
(2) 5-stage pipelined processing
• The M32R uses 5-stage pipelined instruction processing consisting of Instruction Fetch,
Decode, Execute, Memory Access, and Write Back. Not just load and store instructions or
register-to-register operation instructions, compound instructions such as Load & Address
Update and Store & Address Update also are executed in one cycle.
• Instructions are entered into the execution stage in the order they are fetched, but this does not
always mean that the first instruction entered is executed first. If the execution of a load or
store instruction entered earlier is delayed by one or more wait cycles inserted in memory
access, a register-to-register operation instruction entered later may be executed before said
load or store instruction. By using "out-of-order-completion" like this, the M32R controls
instruction execution without wasting clock cycles.
(3) Compact instruction code
• The M32R instructions come in two types: one consisting of 16 bits in length, and the other
consisting of 32 bits in length. Use of the 16-bit length instruction format especially helps to
suppress the program code size.
• Some 32-bit long instructions can branch directly to a location 32 Mbytes forward or backward
from the instruction address being executed. Compared to architectures where address space
is segmented, this direct jump allows for easy programming.
1-2Ver.0.10
1
1.1.2 Built-in Multiply-Accumulate Operation Function
(1) Built-in high-speed multiplier
• The M32R incorporates a 32-bit × 16-bit high-speed multiplier which enables it to execute a
32-bit × 32-bit integral multiplication instruction in three cycles (1 cycle = 25 ns when using a 40
MHz internal CPU clock).
(2) Supports Multiply-Accumulate operation instructions comparable to DSP
• The M32R supports the following four modes of Multiply-Accumulate operation instructions (or
multiplication instructions) using a 56-bit accumulator. Any of these operations can be
executed in one cycle.
• The M32R has instructions to round off the value stored in the accumulator to 16 or 32 bits, as
well as instructions to shift the accumulator value to adjust digits and store the digit-adjusted
value in a register. These instructions also can be executed in one cycle, so that when
combined with high-speed data transfer instructions such as Load & Address Update and
Store & Address Update, they enable the M32R to exhibit high data processing capability
comparable to that of DSP.
1.1.3 Built-in Flash Memory and RAM
• The 32170 contains flash memory and RAM which can be accessed with no wait states,
allowing you to build a high-speed embedded system.
• The internal flash memory allows for on-board programming (you can write to it while being
mounted on the printed circuit board). Use of flash memory means the chip engineered at the
development phase can be used directly in mass-production, so that you can smoothly
migrate from prototype to mass-production without changing the printed circuit board.
• The internal flash memory can be rewritten 100 times.
• The internal flash memory has a pseudo-flash emulation function, allowing the internal RAM to
be artificially mapped into part of the internal flash memory. This function, when combined with
the internal Real-Time Debugger (RTD), facilitates data tuning on ROM tables.
• The internal RAM can be accessed for read or rewrite from an external device independently
of the M32R by using RTD (real-time debugger). It is communicated with external devices by
RTD's exclusive clock-synchronized serial I/O.
1-3Ver.0.10
1
1.1.4 Built-in Clock Frequency Multiplier
• The 32170 internally multiplies the input clock signal frequency by 4 and the internal peripheral
clock by 2. If the input clock frequency is 10.0 MHz, the CPU clock frequency will be 40 MHz
and the internal clock frequency 20 MHz.
1.1.5 Built-in Powerful Peripheral Functions
(1) Built-in multijunction timer (MJT)
• The multijunction timer is configured with the following timers:
Each timer has multiple modes of operation, which can be selected according of the purpose of use.
• The multijunction timer has internal clock bus, input event bus, and output event bus, allowing
multiple timers to be combined for use internally. This provides a flexible way to make use of
timer functions.
• The output-related timers (TOP) have a correction function. This function allows the timer's
count value in progress to be increased or reduced as desired, thus materializing real-time
output control.
(2) Built-in 10-channel DMA
• The 10-channel DMA is built-in, supporting data transfers between internal peripheral I/Os or
between internal peripheral I/O and internal RAM. Not only can DMA transfer requests be
generated in software, but can also be triggered by a signal generated by an internal
peripheral I/O (e.g., A-D converter, MJT, or serial I/O).
• Cascaded connection between DMA channels (DMA transfer in a channel is started by
completion of transfer in another) is also supported, allowing for high-speed transfer
processing without imposing any extra load on the CPU.
(3) Built-in 16-channel A-D converters
• The 32170 contains two 16-channel A-D converters which can convert data in 10-bit
resolution. In addition to single A-D conversion in each channel, successive A-D conversion in
four, eight, or 16 channels combined into one unit is possible.
• In addition to ordinary A-D conversion, a comparator mode is supported in which the A-D
conversion result is compared with a given set value to determine the relative magnitudes of
two quantities.
• When A-D conversion is completed, the 32170 can generate not only an interrupt, but can also
generate a DMA transfer request.
• The 32170 supports two read out modes, so that A-D conversion results can be read out in 8
bits or 10 bits.
1-4Ver.0.10
1
(4) High-speed serial I/O
• The 32170 incorporates 6 channels of serial I/O, which can be set for clock-synchronized
serial I/O or UART.
• When set for clock-synchronized serial I/O, the data transfer rate is a high 2 Mbits per second.
• When data reception is completed or the transmit buffer becomes empty, the serial I/O can
generate a DMA transfer request signal.
(5) Built-in Real-Time Debugger (RTD)
• The Real-Time Debugger (RTD) provides a function for the M32R/E's internal RAM to be
accessed directly from an external device. The debugger communicates with external devices
through its exclusive clock-synchronized serial I/O.
• By using the RTD, you can read the contents of the internal RAM or rewrite its data from an
external device independently of the M32R.
• The debugger can generate an RTD interrupt to notify that RTD-based data transmission or
reception is completed.
OVERVIEW
1.1 Outline of the 32170
(6) Eight-level interrupt controller
• The interrupt controller manages interrupt requests from each internal peripheral I/O by
resolving interrupt priority in eight levels including an interrupt-disabled state. Also, it can
accept external interrupt requests due to power-down detection or generated by a watchdog
timer as a System Break Interrupt (SBI).
(7) Three operation modes
• The M32R/E has three operation modes-single-chip mode, extended external mode, and
processor mode. The address space and external pin functions of the M32R/E are switched
over according to a mode in which it operates. The MOD0 and MOD1 pins are used to set a
mode.
(8) Wait controller
• The wait controller supports access to external devices by the M32R. In all but single-chip
mode, the extended external area provides 4 Mbytes of space.
1-5Ver.0.10
1
1.1.6 Built-in Full-CAN Function
• The 32170 contains CAN Specification V2.0B-compliant CAN module, thereby providing 16
message slots.
1.1.7 Built-in Debug Function
• The 32170 supports JTAG interface. Boundary scan test can be performed using this JTAG
interface.
OVERVIEW
1.1 Outline of the 32170
1-6Ver.0.10
1
1.2 Block Diagram
1.2 Block Diagram
Figure 1.2.1 shows a block diagram of the 32170. Features of each block are shown in Tables 1.2.1
through 1.2.3.
• Capable of flexible timer configuration by mutual connection between each channel.
OVERVIEW
1.2 Block Diagram
A-D converter• 16-channel, 10-bit resolution A-D converter × 2 units
• Incorporates comparator mode
•
Can generate interrupt or start DMA transfer upon completion of A-D conversion.
• Can read out conversion results in 8 or 10 bits.
Serial I/O• 6-channel serial I/O
• Can be set for clock-synchronized serial I/O or UART.
• Capable of high-speed data transfer at 2 Mbits per second when clock synchronized or
156 Kbits per second during UART.
Real-time debugger • Can rewrite or monitor the internal RAM independently of the CPU by command input
from an external source.
• Has its exclusive clock-synchronized serial port.
Interrupt controller• Accepts and manages interrupt requests from internal peripheral I/O.
• Resolves interrupt priority in 8 levels including interrupt-disabled state.
Wait controller• Controls wait state for access to extended external areas.
• Can insert 1 to 4 wait cycles by setting in software and extend wait period by external
WAIT signal.
Clock PLL• Multiply-by-4 clock generator circuit
• Maximum 40 MHz of CPU clock (CPU, internal ROM, internal RAM access)
• Maximum 20 MHz of internal peripheral clock (peripheral module access)
• Maximum external input clock frequency=10 MHz
CAN• Sixteen message slots
JTAG• Capable of boundary scan
1-9Ver.0.10
1
1.3 Pin Function
Figure 1.3.1 shows a pin function diagram of the 32170 in 240QFP package. Figure 1.3.2
shows a pin function diagram of the 32170 in 255FBGA package. Table 1.3.1 explains the
function of each pin of the 32170. Table 1.3.2 explains the function of the dedicated debug pins
of the 32170 in 255FBGA package.
ClockXIN,ClockInputClock input/output pins. These pins contains a PLL-based
VCCIPower supply —Power supply to internal logic (3.3 V).
VDD
FVCC
VSSGround—Connect all VSS to ground (GND).
XOUTOutputfrequency multiplier circuit. Apply a clock whose frequency
BCLK/WR System clockOutputThis pin outputs a clock whose frequency is twice that of
OSC-VCC Power supply —Power supply for PLL circuit. Connect OSC-VCC to the
RAM power supply
FLASH power supply
Input/Output
—Power supply for internal RAM backup (3.3 V).
—Power supply for internal flash memory (3.3 V).
Function
is 1/4 the operating frequency. (When using 40 MHz CPU
clock, XIN input = 10.0 MHz)
external input clock. (When using 10 MHz external input
clock, BCLK output = 20 MHz). Use this output when
external operation needs to be synchronized.
power supply rail.
OSC-VSS Ground—
VCNTPLL controlInputThis pin controls the PLL circuit. Connect a resistor and
ResetRESETResetInputThis pin resets the internal circuit.
ModeMOD0ModeInputThese pins set operation mode.
MOD1MOD0 MOD1Mode
Address A11 – A30 AddressOutputThe device has 20 address lines (A11-A30) to allow two
BusBuschannels of up to 2 MB of memory space to be added
Note: For boot mode, refer to Chapter 6, "Internal Memory."
Connect OSC-VSS to ground.
capacitor to it. (For external circuits, refer to Section 18.1.1,
Table 1.3.1 Description of the 32170 Pin Function (2/6)
OVERVIEW
1.3 Pin Function
TypePin Name Signal Name
DataDB0-DB15 Data bus
bus
Bus
control
___
CS0,Chip selectOutputThese pins comprise external device chip select signal. For
___
CS1areas for which a chip select signal is output, refer to
__
RDReadOutputThis signal is output when reading an external device.
___ ___
BHW/BHE Byte highOutputIndicates the byte position to which valid data is transferred
write/enable
___
___
BLW/BLE Byte lowOutput
write/enablecorresponds to the lower address (D8-D15 is valid).
____
WAIT WaitInputWhen the M32R accesses an external device, a low on this
____
HREQ Hold requestInputThis pin is used by an external device to request control of
Multijunction
timer
____
HACK HoldOutputThis signal is used to notify that the M32R has entered a
acknowledgehold state and relinquished control of the external bus.
Input/Output
Input/Output
Function
These pins comprise 16-bit data bus to connect external devices. In write
cycles, the valid byte positions to be written on the 16-bit data bus are
output as BHW/BHE and BLW/BLE. In read cycles, data is always read
from the 16-bit data bus. However, when transferring to the internal circuit
of the M32R, only data at the valid byte positions are transferred.
Chapter 3, "Address Space."
when writing to an external device. BHW/BHE corresponds
___ ___
___
___
to the upper address (D0-D7 is valid); BLW/BLE
____
WAIT input extends the wait cycle.
the external bus. A low on this HREQ input causes the
____
M32R to enter a hold state.
TIN 0–TIN 33
TO 0– TO 44
TCLK 0– TCLK 3
A-DAVCC0,
converter
AVCC1is the power supply for the A-D1 converter. Connect AVCC0
AVSS0,
AVSS1 —analog ground for the A-D1 converter. Connect AVSS0 and
AD0IN0
– AD0IN15
AD1IN016-channel analog input pins for the A-D1 converter.
– AD1IN15
Timer inputInputInput pins for multijunction timer.
Timer outputOutputOutput pins for the multijunction timer.
Timer clockInputClock input pins for the multijunction timer.
Analog power supply
—AVCC0 is the power supply for the A-D0 converter. AVCC1
and 1 to the power supply rail.
Analog ground —AVSS0 is analog ground for the A-D0 converter. AVSS1 is
1 to the ground.
Analog inputInput16-channel analog input pins for the A-D0 converter.
1-13Ver.0.10
1
Table 1.3.1 Description of the 32170 Pin Function (3/6)
OVERVIEW
1.3 Pin Function
TypePin Name Signal Name
A-DVREF0, ReferenceInput
converter
Interrupt
controllerinterruptcontroller
Serial I/O SCLKI0 /
VREF1 voltage input
_____
ADTRG ConversionInputHardware trigger input pin to start A-D conversion.
trigger
___
SBISystem break InputSystem break interrupt (SBI) input pin for the interrupt
UART transmit/
SCLKO0
SCLKI1 /
SCLKO1
receive clock
output
or
transmit/receive
clock input/output
UART transmit/
receive clock
output
or
transmit/receive
clock input/output
CSIO
CSIO
Input/Output
Input/output
Input/output
Function
VREF0 is the reference voltage input pin for the A-D0 converter.
VREF1 is the reference voltage input pin for the A-D1 converter.
When channel 0 is in UART mode:
This pin outputs a clock derived from BRG output by halving it
When channel 0 is in CSIO mode:
This pin accepts as its input a transmit/receive clock when external clock
source is selected or outputs a transmit/receive clock when internal clock
source is selected.
When channel 1 is in UART mode:
This pin outputs a clock derived from BRG output by halving it
When channel 1 is in CSIO mode:
This pin accepts as its input a transmit/receive clock when external clock
source is selected or outputs a transmit/receive clock when internal clock
source is selected.
.
.
SCLKI4 /
SCLKO4
SCLKI5 /
SCLKO5
TXD0Transmit data outputTransmit data output pin for serial I/O channel 0
RXD0Receive dataInputReceive data input pin for serial I/O channel 0
UART transmit/
receive clock
output
or
transmit/receive
clock input/output
UART transmit/
receive clock
output
or
transmit/receive
clock input/output
Input/output
CSIO
Input/output
CSIO
When channel 4 is in UART mode:
This pin outputs a clock derived from BRG output by halving it
When channel 4 is in CSIO mode:
This pin accepts as its input a transmit/receive clock when external clock
source is selected or outputs a transmit/receive clock when internal clock
source is selected.
When channel 5 is in UART mode:
This pin outputs a clock derived from BRG output by halving it
When channel 5 is in CSIO mode:
This pin accepts as its input a transmit/receive clock when external clock
source is selected or outputs a transmit/receive clock when internal clock
source is selected.
.
.
1-14Ver.0.10
1
Table 1.3.1 Description of the 32170 Pin Function (4/6)
OVERVIEW
1.3 Pin Function
TypePin Name Signal Name
TXD1Transmit data OutputTransmit data output pin for serial I/O channel 1.
RXD1Receive dataInputReceive data input pin for serial I/O channel 1.
TXD2Transmit data OutputTransmit data output pin for serial I/O channel 2.
RXD2Receive dataInputReceive data input pin for serial I/O channel 2.
TXD3Transmit data OutputTransmit data output pin for serial I/O channel 3.
RXD3Receive dataInputReceive data input pin for serial I/O channel 3.
TXD4Transmit data OutputTransmit data output pin for serial I/O channel 4.
RXD4Receive dataInputReceive data input pin for serial I/O channel 4.
TXD5Transmit data OutputTransmit data output pin for serial I/O channel 5.
RXD5Receive dataInputReceive data input pin for serial I/O channel 5.
Real-time
debugger
RTDTXDTransmit data OutputSerial data output pin for the real-time debugger.
RTDRXD Receive dataInputSerial data input pin for the real-time debugger.
RTDCLKClock inputInputSerial data transmit/receive clock input pin for the
Input/Output
Function
real-time debugger.
RTDACKAcknowledge Output
FlashFPFlash ProtectInputThis mode pin has a function to protect the flash
-onlymemory against E/W in hardware.
CANCTXData outputOutputThis pin outputs data from the CAN module.
CRXData inputInputThis pin is used to input data to the CAN module.
JTAGJTMSTest modeInputTest mode select input to control state transition of the
JTCKclockInputClock input for the debug module and test circuit.
JTRSTTest resetInputTest reset input to initialize the test circuit
JTDISerial inputInputThis pin is used to input test instruction code or test
This pin outputs a low pulse synchronously with the beginning
clock of the real-time debugger's serial data output word. The
duration of this low pulse indicates the type of command/data
that the real-time debugger has received.
test circuit.
asynchronously.
data serially.
JTDOSerial outputOutputThis pin outputs test instruction code or test data
serially.
1-15Ver.0.10
1
Table 1.3.1 Description of the 32170 Pin Function (5/6)
OVERVIEW
1.3 Pin Function
TypePin Name Signal Name
Input/
output
port
(Note)
P00 – P07 Input/output
port 0
P10 – P17 Input/output
port 1
P20 – P27 Input/output
port 2
P30 – P37 Input/output
port 3
P41 – P47 Input/output
port 4
P61 – P67 Input/output
port 6(However, P64 is an input-only port.)
P70 – P77 Input/output
port 7
P82 – P87 Input/output
port 8
Input/Output
Input/output
Input/output
Input/output
Input/output
Input/output
Input/output
Input/output
Input/output
Function
Programmable input/output port.
Programmable input/output port.
Programmable input/output port.
Programmable input/output port.
Programmable input/output port.
Programmable input/output port.
Programmable input/output port.
Programmable input/output port.
P93 – P97 Input/output
port 9
P100Input/output
– P107port 10
P110Input/output
– P117port 11
P124Input/output
– P127port 12
P130Input/output
– P137port 13
P140Input/output
– P147port 14
P150Input/output
– P157port 15
P160Input/output
– P167port 16
Input/output
Input/output
Input/output
Input/output
Input/output
Input/output
Input/output
Input/output
Programmable input/output port.
Programmable input/output port.
Programmable input/output port.
Programmable input/output port.
Programmable input/output port.
Programmable input/output port.
Programmable input/output port.
Programmable input/output port.
Note: Input/output port 5 is reserved for future use.
1-16Ver.0.10
1
Table 1.3.1 Description of the 32170 Pin Function (6/6)
OVERVIEW
1.3 Pin Function
TypePin Name Signal Name
Input/
output
port
Note: Use caution when using P224 and P225 because they have a debug event function.
P172Input/output
– P177port 17
P180Input/output
– P187port 18
P190Input/output
– P197port 19
P200Input/output
– P203port 20
P210Input/output
– P217port 21
P220Input/output
– P225port 22(However, P221 is an input only port.)
Input/Output
Input/output
Input/output
Input/output
Input/output
Input/output
Input/output
Function
Programmable input/output port.
Programmable input/output port.
Programmable input/output port.
Programmable input/output port.
Programmable input/output port.
Programmable input/output port. (Note)
Table 1.3.2 Description of the Debug-only Pin Function of 255FBGA
TypePin Name Signal Name
DEBOG JDBI
JEVENT0, Event outputOutputOutput synchronously with TRCLK. When an event occurs,
JEVENT1this output is driven high for a 1 TRCLK period.
TRCLKTrace clockOutputClock output pin for trace operation. Trace data is output
TRSYNC
TRDATA0
-
TRDATA7
Note: 255FBGA is currently under development.
Debug interrupt
requestrequests a debug interrupt.
outputsynchronously with this clock.
Trace packet
output start signal
Trace packetOutputTrace packet output pin.
output
Input/Output
InputDebug interrupt request input pin. A low on this input
OutputThis is a trace packet output start signal. When the device
Function
starts outputting a trace packet, this signal is driven high for
a 1 TRCLK period.
1-17Ver.0.10
1
1.4 Pin Layout
Figure 1.4.1 shows a pin layout diagram of the 32170 in 240QFP package. Figure 1.4.2 shows
a pin layout diagram of the 32170 in 255FBGA package. Table 1.4.1 lists pin assignments of the
240QFP. Table 1.4.2 lists pin assignments of the 255FBGA.
Note 1: NC pins (W19, Y1) are not internally connected. Leave them open.
Note 2: Use caution when using P224/A11 and P225/A12 because they have a debug event
function.
Note 3: 255FBGA is currently under development.
Figure 1.4.2 Pin Layout Diagram of the 255FBGA (Top View)
The M32R has sixteen general-purpose registers, five control registers, an accumulator, and a
program counter. The accumulator is a 56-bit configuration, and all other registers are a 32-bit
configuration.
2.2 General-purpose Registers
General-purpose registers are 32 bits in width and there are sixteen of them (R0 to R15), which are
used to hold data and base addresses. Especially, R14 is used as a link register, and R15 is used
as a stack pointer. The link register is used to store the return address when executing a subroutine
call instruction. The stack pointer is switched between an interrupt stack pointer (SPI) and a user
stack pointer (SPU) depending on the value of the Processor Status Word register (PSW)'s stack
mode (SM) bit.
CPU
00
Note: The stack pointer is switched between an interrupt stack pointer (SPI) and a user stack pointer
2: Dedicated "MVTC" and "MVFC" instructions are used to set and read the control registers.
Figure 2.3.1 Control Registers
0 31
Control Registers
PSW
CBR
SPI
SPU
BPC
Processor status Word Register
Condition Bit Register
Interrupt Stack Pointer
User Stack Pointer
2-3Ver.0.10
2
2.3 Control Registers
2.3.1 Processor Status Word Register: PSW (CR0)
The Processor Status Word Register (PSW) is used to indicate the status of the M32R. It consists
of a regularly used PSW field and a special BPSW field which is used to save the PSW field when
an EIT occurs.
The PSW field consists of several bits labeled Stack Mode (SM), Interrupt Enable (IE), and
Condition bit (C). The BPSW field consists of backup bits of the foregoing, i.e., Backup SM bit
(BSM), Backup IE bit (BIE), and Backup C bit (BC).
BPSW fieldPSW field
CPU
0(MSB)
16 1723 24 25
1587
PSW
SMIECBCBSMBIE
(Note 1)
DBit NameFunctionInitialRW
16BSM (Backup SM)Holds the value of SM bit when EIT
is accepted.
17BIE (Backup IE)Holds the value of IE bit when EIT
is accepted.
23BC (Backup C)Holds the value of C bit when EIT
is accepted.
24SM (Stack Mode)0: Interrupt stack pointer is used.0
1: User stack pointer is used.
Indeterminate
Indeterminate
Indeterminate
31(LSB)
00000000000000000000000000
25IE (Interrupt Enable)0: No interrupt is accepted.0
1: Interrupt is accepted.
31C (Condition bit)
Notes 1: "Initial" shows the state immediately after reset, R = O means the register is readable, W = O
means the register is writable.
2: For changes of the state of each bit when an EIT event occurs, refer to Chapter 4, "EIT.”
Depending on instruction execution, it indicates
whether operation resulted in a carry, borrow, or overflow.
0
2-4Ver.0.10
2
2.3 Control Registers
2.3.2 Condition Bit Register: CBR (CR1)
The Condition Bit Register (CBR) is created as a separate register from the PSW by extracting the
Condition bit (C) from it. The value written to the PSW C bit is reflected in this register. This register
is a read-only register (writes to this register by "MVTC" instruction are ignored).
The Interrupt Stack Pointer (SPI) and User Stack Pointer (SPU) hold the current address of the
stack pointer. These registers can be accessed as general-purpose register R15. In this case,
whether R15 is used as SPI or as SPU depends on the PSW's Stack Mode (SM) bit.
SPI
SPU
0(MSB)
SPI
0(MSB)
SPU
31(LSB)
31(LSB)
2.3.4 Backup PC: BPC (CR6)
The Backup PC (BPC) is a register used to save the value of the Program Counter (PC) when an
EIT occurs. Bit 31 is fixed to 0.
When an EIT occurs, the value held in the PC immediately before the EIT occurred or the value of
the next instruction is set in this register. When the "RTE" instruction is executed, the saved value
is returned from the BPC to the PC. However, the two low-order bits of the PC when thus returned
are always fixed to "00" (control always returns to word boundaries.)
BPC
31(LSB)0(MSB)
BPC
0
2-5Ver.0.10
2
2.4 Accumulator
2.4 Accumulator
The accumulator (ACC) is a 56-bit register used by DSP function instructions. When read out or
written to, it is handled as a 64-bit register. When reading, the value of bit 8 is sign-extended. When
writing, bits 0--7 are ignored. Also, the accumulator is used by the multiplication instruction "MUL."
Note that when executing this instruction, the value of the accumulator is destroyed.
The "MVTACHI" and "MVTACLO" instructions are used to write to the accumulator. The
"MVTACHI" instruction writes data to the 32 high-order bits (bits 0-31), and the "MVTACLO"
instruction writes data to the 32 low-order bits (bits 32-63).
The "MVFACHI," "MVFACLO," and "MVFACMI" instructions are used to read data from the
accumulator. The "MVFACHI" instruction reads data from the 32 high-order bits (bits 0-31), the
"MVFACLO" instruction reads data from the 32 low-order bits (bits 32-63), and the "MVFACHI"
instruction reads data from the 32 middle bits (bits 16-47).
CPU
(Note)
ACC
Range of bits read/written to by
MVFACHI/MVTACHI instructions
Note: Bits 0-7 always show the sign-extended value of bit 8. Writes to this bit field are ignored.
Range of bits read by MVFACMI
instruction
324863(LSB)3116150(MSB)4778
Range of bits read/written to by
MVFACLO/MVTACLO instructions
2.5 Program Counter
The Program Counter (PC) is a 32-bit counter used to hold the address of the currently executed
instruction. Because M32R instructions each start from an even address, the LSB (bit 31) is always
0.
PC
31(LSB)0(MSB)
PC
0
2-6Ver.0.10
2
2.6 Data Formats
2.6 Data Formats
2.6.1 Data Types
There are several data types that can be handled by the M32R's instruction set. These include
signed and unsigned 8, 16, and 32-bit integers. Values of signed integers are represented by
2's complements.
CPU
Signed byte (8-bit)
integer
Unsigned byte (8-bit)
integer
Signed halfword (16-bit)
integer
Unsigned halfword
(16-bit) integer
Signed word (32-bit)
integer
Unsigned word (32-bit)
integer
0(MSB)
S
0(MSB)
0(MSB)
S
0(MSB)
0(MSB)
S
0(MSB)
7(LSB)
7(LSB)
15(LSB)
15(LSB)
31(LSB)
31(LSB)
Figure 2.6.1 Data Types
S : Sign bit
2-7Ver.0.10
2
2.6.2 Data Formats
(1) Data formats in register
Data sizes in M32R registers are always words (32 bits).
When loading byte (8-bit) or halfword (16-bit) data from memory into a register, the data is signextended (LDB, LDH instructions) or zero-extended (LDUB, LDUH instructions) into word (32-bit)
data before being stored in the register. When storing data from M32R register into memory, the
register data is stored in memory in different sizes depending on the instructions used. The ST
instruction stores the entire 32-bit data of the register, the STH instruction stores the least
significant 16-bit data, and the STB instruction stores the least significant 8-bit data.
CPU
2.6 Data Formats
<When loading>
0(MSB)31(LSB)
Rn
Sign-extended (LDH instruction) or
zero-extended (LDUH instruction)
0(MSB)31(LSB)
Rn
0(MSB)31(LSB)
Rn
<When storing>
0(MSB)31(LSB)
Rn
Sign-extended (LDB instruction) or
zero-extended (LDUB instruction)
From memory (LDH, LDUH instructions)
16
From memory (LD instructions)
Word
From memory (LDB,
LDUB instructions)
24
Halfword
24
Byte
Byte
0(MSB)31(LSB)
Rn
0(MSB)31(LSB)
Rn
To memory (ST instruction)
Figure 2.6.2 Data Formats in Register
To memory (STB instruction)
16
Halfword
To memory (STH instruction)
Word
2-8Ver.0.10
2
(2) Data formats in memory
Data sizes in memory are either byte (8 bits), halfword (16 bits), or word (32 bits). Byte data can
be located at any address. However, halfword data must be located at halfword boundaries
(where the LSB address bit = "0"), and word data must be located at word boundaries (where two
LSB address bits = "00"). If an attempt is made to access memory data across these halfword or
word boundaries, an address exception is generated.
CPU
2.6 Data Formats
Address
+ 0 address + 1 address+ 2 address + 3 address
031
Byte
Byte
(MSB)(LSB)
Halfword
(MSB)
Word
Figure 2.6.3 Data Formats in Memory
7 815 1623 24
Halfword
Byte
Byte
Byte
Halfword
(LSB)
Word
2-9Ver.0.10
2
CPU
2.6 Data Formats
(3) Endian
The following shows the generally used endian methods and the M32R family endian.
Bit endianByte endian
(H'01)(H'01234567)
MSBLSB
Big endian
Little endian
B'0000001
D0D7
MSBLSB
B'0000001
D7D0
Note: Even for bit big endian, H'01 is not B'10000000.
Figure 2.6.4 Endian Methods
MPU name
Endian
(Bit/Byte)
Address
Data
arrangement
7700 family
M16C family
Little/Little
+0+1+2+3+0+1+2+3+0+1+2+3
MSBLSBMSBLSBMSBLSB
LLLHHLHH
HHHLLHLL
MSBLSB
H'01
HHHLLHLL
MSBLSB
H'67
LLLHHLHH
Competition
Little/Big
H'23H'45H'67
H'45H'23H'01
M32R family
M16 family
HHHLLHLL
Big/Big
Bit number
Ex:0x01234567
Note: The M32R's endian method is big endian for both bit and byte.
Note: For the MVTC instruction, the condition bit C does not change unless CRdest is CR0 (PSW).
Figure 2.6.6 Transfer instructions
2-11Ver.0.10
2
(5) Memory (signed) to register transfer
CPU
2.6 Data Formats
• Signed 32 bits
MemoryRegister
LD24 Rsrc, #label
label
LDRdest, @Rsrc
+0+1+2+3
• Signed 16 bits
LD24 Rsrc, #label
label
LDHRdest, @Rsrc
+0+1+2+3
Check the MSB
0 = positive
1 = negative
• Signed 8 bits
label
LD24 Rsrc, #label
LDBRdest, @Rsrc
+0+1+2+3
Check the MSB
0 = positive
1 = negative
Figure 2.6.7 Memory (signed) to register transfer
Rdest
310
Rdest
0000
FFFF
310
Rdest
000000
FFFFFF
310
(6) Memory (unsigned) to register transfer
• Unsigned 32 bits
LD24 Rsrc, #label
LDRdest, @Rsrc
• Unsigned 16 bits
LD24 Rsrc, #label
LDUH Rdest, @Rsrc
• Unsigned 8 bits
LD24 Rsrc, #label
LDUB Rdest, @Rsrc
label
label
label
MemoryRegister
+0+1+2+3
+0+1+2+3
+0+1+2+3
Figure 2.6.8 Memory (unsigned) to register transfer
Rdest
310
Rdest
0000
310
Rdest
000000
310
2-12Ver.0.10
2
(7) Things to be noted for data transfer
Note that in data transfer, data arrangements in registers and those in memory are different.
CPU
2.6 Data Formats
Data in register
(R0-R15)
Word data (32 bits)
HHHLLHLL
D0D31
MSBLSB
(R0-R15)
Half-word data (16 bits)
D0D31
MSBLSB
(R0-R15)
Byte data (8 bits)
D0D31
MSBLSB
Figure 2.6.9 Difference in Data Arrangements
HL
Data in memory
+0+1+2+3
HHHLLHLL
D0D31
MSBLSB
+0+1+2+3
HL
D0D15
MSBLSB
+0+1+2+3
D0 D7
MSB LSB
2-13Ver.0.10
2
❊ This is a blank page. ❊
2-14Ver.0.10
CHAPTER 3CHAPTER 3
ADDRESS SPACE
3.1 Outline of Address Space
3.2 Operation Modes
3.3 Internal ROM Area and Extended
External Area
3.4 Internal RAM Area and SFR Area
3.5 EIT Vector Entry
3.6 ICU Vector Table
3.7 Note about Address Space
ADDRESS SPACE
3
3.1 Outline of Address Space
3.1 Outline of Address Space
The M32R's logical addresses are always handled in 32 bits, providing 4 Gbytes of linear address space. The M32R/E's address space consists of the following:
(1) User space
• Internal ROM area
• Extended external area
• Internal RAM area
• Special Function Register (SFR) area
(2) Boot program space
(3) System space (areas not open to the user)
(1) User space
A 2 Gbytes of address space from H'0000 0000 to H'7FFF FFFF is the user space. Located in
this space are the internal ROM area, extended external area, internal RAM area, and Special Function Register (SFR) area, an area containing a group of internal peripheral I/O registers. Of these, the internal ROM and extended external areas are located differently depending on mode settings which will be described later.
(2) Boot program space
A 1 Gbyte of address space from H'8000 0000 to H'BFFF FFFF is the boot program space.
This space stores a program (boot program) which enables on-board programming when the
internal flash area is blank.
(3) System space
A 1 Gbyte of address space from H'C000 0000 to H'FFFF FFFF is the system space. This
space is reserved for use by development tools such as an in-circuit emulator or a debug
monitor, and cannot be used by the user.
3-2Ver.0.10
3
A
A
ADDRESS SPACE
3.1 Outline of Address Space
<Logical address space of M32170F6>
Logical address
H'0000 0000
2 Gbytes
H'7FFF FFFF
H'8000 0000
1 Gbyte
H'BFFF FFFF
H'C000 0000
User space
Boot
program
space
(16 Mbytes)
BOOT ROM area
(8 Kbytes)
Reserved area
(8 Kbytes)
Extended external
Ghost area
in units of
16 Mbytes
H'8000 0000
H'8000 1FFF
H'8000 2000
H'8000 3FFF
H'8000 4000
Ghost area
in units of
16 Mbytes
H'BFFF FFFF
area
(4 Mbytes)
EIT vector entry
Internal ROM area
(768 Kbytes)
(Note 1)
Reserved area
(256 Kbytes)
CS0 area
CS1 area
SFR area
(16 Kbytes)
Internal RAM area
(40 Kbytes)
Reserved area
AA
(72 Kbytes)
AA
H'0000 0000
H'000B FFFF
H'000F FFFF
H'0010 0000
H'001F FFFF
H'0020 0000
H'003F FFFF
H'0040 0000
Ghost area in
4 Mbytes
H'007F FFFF
H'0080 0000
H'0080 3FFF
H'0080 4000
H'0080 DFFF
H'0080 E000
H'0081 FFFF
H'0082 0000
1 Gbyte
H'FFFF FFFF
Notes1: This location varies with chip mode settings.
System space
2: The boot program space can read out only when FP = 1, MOD0 = 1, and MOD1 = 0.
Figure 3.1.1 Address Space of the M32170F6
Ghost area in
units of 128
Kbytes
H'00FF FFFF
3-3Ver.0.10
3
A
A
ADDRESS SPACE
3.1 Outline of Address Space
<Logical address space of M32170F4>
Logical address
H'0000 0000
2 Gbytes
H'7FFF FFFF
H'8000 0000
1 Gbyte
H'BFFF FFFF
H'C000 0000
User space
Boot
program
space
(16 Mbytes)
BOOT ROM area
(8 Kbytes)
Reserved area
(8 Kbytes)
Extended external
Ghost area
in units of
16 Mbytes
H'8000 0000
H'8000 1FFF
H'8000 2000
H'8000 3FFF
H'8000 4000
Ghost area
in units of
16 Mbytes
H'BFFF FFFF
area
(4 Mbytes)
EIT vector entry
Internal ROM area
(512 Kbytes)
(Note 1)
Reserved area
(512 Kbytes)
CS0 area
CS1 area
SFR area
(16 Kbytes)
Internal RAM area
(32 Kbytes)
Reserved area
AA
(80 Kbytes)
AA
H'0000 0000
H'0007 FFFF
H'000F FFFF
H'0010 0000
H'001F FFFF
H'0020 0000
H'003F FFFF
H'0040 0000
Ghost area in
4 Mbytes
H'007F FFFF
H'0080 0000
H'0080 3FFF
H'0080 4000
H'0080 BFFF
H'0080 C000
H'0081 FFFF
H'0082 0000
1 Gbyte
H'FFFF FFFF
Notes1: This location varies with chip mode settings.
System space
2: The boot program space can read out only when FP = 1, MOD0 = 1, and MOD1 = 0.
Figure 3.1.2 Address Space of the M32170F4
Ghost area in
units of 128
Kbytes
H'00FF FFFF
3-4Ver.0.10
3
A
A
ADDRESS SPACE
3.1 Outline of Address Space
<Logical address space of M32170F3>
Logical address
H'0000 0000
2 Gbytes
H'7FFF FFFF
H'8000 0000
1 Gbyte
H'BFFF FFFF
H'C000 0000
User space
Boot
program
space
(16 Mbytes)
BOOT ROM area
(8 Kbytes)
Reserved area
(8 Kbytes)
Extended external
Ghost area
in units of
16 Mbytes
H'8000 0000
H'8000 1FFF
H'8000 2000
H'8000 3FFF
H'8000 4000
Ghost area
in units of
16 Mbytes
H'BFFF FFFF
area
(4 Mbytes)
EIT vector entry
Internal ROM area
(384 Kbytes)
(Note 1)
Reserved area
(640 Kbytes)
CS0 area
CS1 area
SFR area
(16 Kbytes)
Internal RAM area
(32 Kbytes)
Reserved area
AA
(80 Kbytes)
AA
H'0000 0000
H'0005 FFFF
H'000F FFFF
H'0010 0000
H'001F FFFF
H'0020 0000
H'003F FFFF
H'0040 0000
Ghost area in
4 Mbytes
H'007F FFFF
H'0080 0000
H'0080 3FFF
H'0080 4000
H'0080 BFFF
H'0080 C000
H'0081 FFFF
H'0082 0000
1 Gbyte
H'FFFF FFFF
Notes1: This location varies with chip mode settings.
System space
2: The boot program space can read out only when FP = 1, MOD0 = 1, and MOD1 = 0.
Figure 3.1.3 Address Space of the M32170F3
Ghost area in
units of 128
Kbytes
H'00FF FFFF
3-5Ver.0.10
ADDRESS SPACE
3
3.2 Operation Modes
3.2 Operation Modes
The 32170 is placed in one of the following modes by setting its operation mode (using MOD0 and
MOD1 pins). For details about the mode used to rewrite the internal flash memory, refer to Section
VCCVSSProcessor mode (FP = VSS)
VCCVCCReserved (cannot be used)
Notes 1:VCC connects to +5 V, and VSS connects to GND.
2:
For flash rewrite mode (FP = VCC) not listed in the above table, refer to Section 6.5, "Programming
of Internal Flash Memory."
The internal ROM and extended external areas are located differently depending on the 32170's
operation mode. (All other areas in address space are located the same way.) The address maps of
internal ROM and extended external areas in each mode are shown below. (For flash rewrite mode
(FP = VCC) not listed in the above table, refer to Section 6.5, "Programming of Internal Flash
Memory.")
Non-CS0 area
H'0000 0000
H'000B FFFF
H'000C 0000
H'000F FFFF
H'0010 0000
H'001F FFFF
H'0020 0000
Internal ROM
area
(768 Kbytes)
Internal ROM
area
(768 Kbytes)
Reserved area
(256 Kbytes)
CS0 area
(1 Mbyte)
CS1 area
(2 Mbytes)
Extended external area
CS0 area
(2 Mbytes)
Extended external area
CS1 area
(2 Mbytes)
H'003F FFFF
<Single-chip mode><Processor mode>
<Extended external mode>
Figure 3.2.1 M32170F6 Operation Mode and Internal ROM/Extended External Areas
3-6Ver.0.10
3
ADDRESS SPACE
3.2 Operation Modes
Non-CS0 area
H'0000 0000
H'0007 FFFF
H'0008 0000
H'000F FFFF
H'0010 0000
H'001F FFFF
H'0020 0000
H'003F FFFF
Internal ROM
area
(512 Kbytes)
<Single-chip mode><Processor mode>
Internal ROM
area
(512 Kbytes)
Reserved area
(512 Kbytes)
CS0 area
(1 Mbyte)
CS1 area
(2 Mbytes)
Extended external area
<Extended external mode>
CS0 area
(2 Mbytes)
Extended external area
CS1 area
(2 Mbytes)
Figure 3.2.2 M32170F4 Operation Mode and Internal ROM/Extended External Areas
H'0000 0000
H'0005 FFFF
H'0006 0000
H'000F FFFF
H'0010 0000
H'001F FFFF
H'0020 0000
H'003F FFFF
Non-CS0 area
Internal ROM
area
(384 Kbytes)
<Single-chip mode><Processor mode>
Internal ROM
area
(384 Kbytes)
Reserved area
(640 Kbytes)
CS0 area
(1 Mbyte)
CS1 area
(2 Mbytes)
Extended external area
<Extended external mode>
CS0 area
(2 Mbytes)
Extended external area
CS1 area
(2 Mbytes)
Figure 3.2.3 M32170F3 Operation Mode and Internal ROM/Extended External Areas
3-7Ver.0.10
ADDRESS SPACE
3
3.3 Internal ROM/Extended External Area
3.3 Internal ROM Area and Extended External Area
The 8 Mbyte area at addresses H'0000 0000 to H'007F FFFF in the user space accommodates the
internal ROM and extended external areas. Of this, a 4 Mbytes of address space from H'0000 0000
to H'0003 FFFF is the area that the user can actually use. All other areas here comprise a 4 Mbytes
of ghost area. (When programming, do not use this ghost area intentionally.)
For details on how the internal ROM and extended external areas are located differently depending
on the 32170's operation modes set, refer to Section 3.2, "Operation Modes."
3.3.1 Internal ROM Area
The internal ROM is located in the area shown below. Also, this area has an EIT vector entry
(and ICU vector table) located in it at the beginning.
Table 3.3.1 Addresses at Which the 32170's Internal ROM is Located
An extended external area is provided only when extended external mode or processor mode has
been selected when setting the 32170's operation mode. For access to this extended external area,
the 32170 outputs the control signals necessary to access external devices.
The 32170's CS0 and CS1 signals are output corresponding to the address mapping of the extended external area. The CS0 signal is output for the CS0 area, and the CS1 signal is output for
the CS1 area.
Table 3.3.2 Address Mapping of the Extended External Area in Each Operation Mode of the
32170
_______________
_______________
Operation Mode Address mapping of the extended external area
Single-chip modeNone
Extended external modeAddresses H'0010 0000 to H'001F FFFF (CS0 area: 1 Mbytes)
Addresses H'0020 0000 to H'003F FFFF (CS1 area: 2 Mbytes)
Addresses H'0020 0000 to H'003F FFFF (CS1 area: 2 Mbytes)
3-8Ver.0.10
ADDRESS SPACE
3
3.4 Internal ROM/SFR Area
3.4 Internal RAM Area and SFR Area
The 8 Mbyte area at addresses H'0080 0000 to H'00FF FFFF in the user space accommodates the
internal RAM area and Special Function Register (SFR) area. Of this, a 128 Kbytes of address
space from H'0080 0000 to H'0081 FFFF is the area that the user can actually use. All other areas
here comprise a ghost area in units of 128 Kbytes. (When programming, do not use this ghost area
intentionally.)
3.4.1 Internal RAM Area
The internal RAM is located in the area shown below.
Table 3.4.1 Addresses at Which the 32170's Internal ROM is Located
TOP Interrupt Control Register 0 (TOPIR0)
TOP Interrupt Control Register 2 (TOPIR2)
TIO Interrupt Control Register 0 (TIOIR0)
TIO Interrupt Control Register 2 (TIOIR2)
TIN Interrupt Control Register 0 (TINIR0)
TIN Interrupt Control Register 2 (TINIR2)
TIN Interrupt Control Register 4 (TINIR4)
TIN Interrupt Control Register 6 (TINIR6)
~
~
~
~
~
~
~
~
~
~
+0 Address+1 Address
TIN Input Processing Control Register 2 (TINCR2)
TIN Input Processing Control Register 3 (TINCR3)
TIN Input Processing Control Register 4 (TINCR4)
F/F Source Select Register 0 (FFS0)
F/F Source Select Register 1 (FFS1)
F/F Protect Register 0 (FFP0)
F/F Data Register 0 (FFD0)
F/F Protect Register 1 (FFP1)
F/F Data Register 1 (FFD1)
TOP Interrupt Control Register 1 (TOPIR1)
TOP Interrupt Control Register 3 (TOPIR3)
TIO Interrupt Control Register 1 (TIOIR1)
TMS Interrupt Control Register (TMSIR)
TIN Interrupt Control Register 1 (TINIR1)
TIN Interrupt Control Register 3 (TINIR3)
TIN Interrupt Control Register 5 (TINIR5)
TIN Interrupt Control Register 7 (TINIR7)
P0 Data Register (P0DATA)
P2 Data Register (P2DATA)
P4 Data Register (P4DATA)
P6 Data Register (P6DATA)
P8 Data Register (P8DATA)
P10 Data Register (P10DATA)
P12 Data Register (P12DATA)
P14 Data Register (P14DATA)
P16 Data Register (P16DATA)
P18 Data Register (P18DATA)
P20 Data Register (P20DATA)
DMA2 Transfer Count Register (DM2TCT)
DMA7 Transfer Count Register (DM7TCT)
DMA3 Transfer Count Register (DM3TCT)
DMA8 Transfer Count Register (DM8TCT)
DMA4 Transfer Count Register (DM4TCT)
DMA9 Transfer Count Register (DM9TCT)
P1 Data Register (P1DATA)
P3 Data Register (P3DATA)
P7 Data Register (P7DATA)
P9 Data Register (P9DATA)
P11Data Register (P11DATA)
P13 Data Register (P13DATA)
P15 Data Register (P15DATA)
P17 Data Register (P17DATA)
P19 Data Register (P19DATA)
P21 Data Register (P21DATA)
~
~
~
~
Figure 3.4.10 Register Mapping of the SFR Area (7)
P0 Direction Register (P0DIR)
P2 Direction Register (P2DIR)
P4 Direction Register (P4DIR)
P6 Direction Register (P6DIR)
P8 Direction Register (P8DIR)
P10 Direction Register (P10DIR)
P12 Direction Register (P12DIR)
P14 Direction Register (P14DIR)
P16 Direction Register (P16DIR)
P18 Direction Register (P18DIR)
P20 Direction Register (P20DIR)
P22 Direction Register (P22DIR)
P1 Direction Register (P1DIR)
P3 Direction Register (P3DIR)
P7 Direction Register (P7DIR)
P9 Direction Register (P9DIR)
P11 Direction Register (P11DIR)
P13 Direction Register (P13DIR)
P15 Direction Register (P15DIR)
P17 Direction Register (P17DIR)
P19 Direction Register (P19DIR)
P21 Direction Register (P21DIR)
CAN0 Global Mask Register Standard ID0 (C0GMSKS0)
CAN0 Global Mask Register Extended ID0 (C0GMSKE0)CAN0 Global Mask Register Extended ID1 (C0GMSKE1)
CAN0 Global Mask Register Extended ID2 (C0GMSKE2)
CAN0 Local Mask Register A Standard ID0 (C0LMSKAS0)
CAN0 Local Mask Register A Extended ID0 (C0LMSKAE0)CAN0 Local Mask Register A Extended ID1 (C0LMSKAE1)
CAN0 Local Mask Register A Extended ID2 (C0LMSKAE2)
CAN0 Local Mask Register B Standard ID0 (C0LMSKBS0)CAN0 Local Mask Register B Standard ID0 (C0LMSKBS1)
CAN0 Local Mask Register B Extended ID0 (C0LMSKBE0)CAN0 Local Mask Register B Extended ID0 (C0LMSKBE1)
CAN0 Local Mask Register B Extended ID0 (C0LMSKBE0)
~
~
CAN0 Message Slot 0 Control Register (C0MSL0CNT)
CAN0 Message Slot 4 Control Register (C0MSL4CNT)
CAN0 Message Slot 6 Control Register (C0MSL6CNT)
CAN0 Message Slot 8 Control Register (C0MSL8CNT)
CAN0 Message Slot 10 Control Register (C0MSL10CNT)
CAN0 Message Slot 12 Control Register (C0MSL12CNT)
CAN0 Message Slot 14 Control Register (C0MSL14CNT)
+0 Address+1 AddressAddress
CAN0 Control Register (CAN0CNT)
CAN0 Status Register (CAN0STAT)
CAN0 Extension ID Register (CAN0EXTID)
CAN0 Configuration Register (CAN0CONF)
CAN0 Time Stamp Count Register (CAN0TSTMP)
CAN0 Slot Interrupt Status Register (CAN0SLIST)
CAN0 Slot Interrupt Mask Register (CAN0SLIMK)
ADDRESS SPACE
3.4 Internal ROM/SFR Area
CAN0 Transmit Error Count Register (CAN0TEC)
CAN0 Error Interrupt Mask Register (CAN0ERIMK)
CAN0 Global Mask Register Standard ID1 (C0GMSKS1)
CAN0 Local Mask Register A Standard ID1 (C0LMSKAS1)
CAN0 Message Slot 1 Control Register (C0MSL1CNT)
CAN0 Message Slot 3 Control Register (C0MSL3CNT)CAN0 Message Slot 2 Control Register (C0MSL2CNT)
CAN0 Message Slot 5 Control Register (C0MSL5CNT)
CAN0 Message Slot 7 Control Register (C0MSL7CNT)
CAN0 Message Slot 9 Control Register (C0MSL9CNT)
CAN0 Message Slot 11 Control Register (C0MSL11CNT)
CAN0 Message Slot 13 Control Register (C0MSL13CNT)
CAN0 Message Slot 15 Control Register (C0MSL15CNT)
~
~
~
~
Figure 3.4.16 Register Mapping of the SFR Area (13)
CAN0 Message Slot 15 Data 0 (C0MSL15DT0)
CAN0 Message Slot 15 Data 2 (C0MSL15DT2)
CAN0 Message Slot 15 Data 4 (C0MSL15DT4)
CAN0 Message Slot 15 Data 6 (C0MSL15DT6)
+0 Address+1 AddressAddress
CAN0 Message Slot 10 Time Stamp (C0MSL10TSP)
CAN0 Message Slot 11 Data Length Register (C0MSL11DLC)
CAN0 Message Slot 11 Time Stamp (C0MSL11TSP)
CAN0 Message Slot 12 Data Length Register (C0MSL12DLC)
CAN0 Message Slot 12 Time Stamp (C0MSL12TSP)
CAN0 Message Slot 13 Data Length Register (C0MSL13DLC)
CAN0 Message Slot 13 Time Stamp (C0MSL13TSP)
CAN0 Message Slot 14 Data Length Register (C0MSL14DLC)
CAN0 Message Slot 14 Time Stamp (C0MSL14TSP)
CAN0 Message Slot 15 Data Length Register (C0MSL15DLC)
CAN0 Message Slot 15 Time Stamp (C0MSL11TSP)
CAN0 Message Slot 10 Data 3 (C0MSL10DT3)
CAN0 Message Slot 10 Data 5 (C0MSL10DT5)
CAN0 Message Slot 10 Data 7 (C0MSL10DT7)
CAN0 Message Slot 11 Standard ID1 (C0MSL11SID1)
CAN0 Message Slot 11 Extended ID1 (C0MSL11EID1)
CAN0 Message Slot 11 Data 1 (C0MSL11DT1)
CAN0 Message Slot 11 Data 3 (C0MSL11DT3)
CAN0 Message Slot 11 Data 5 (C0MSL11DT5)
CAN0 Message Slot 11 Data 7 (C0MSL11DT7)
CAN0 Message Slot 12 Standard ID1 (C0MSL12SID1)
CAN0 Message Slot 12 Extended ID1 (C0MSL12EID1)
CAN0 Message Slot 12 Data 1 (C0MSL12DT1)
CAN0 Message Slot 12 Data 3 (C0MSL12DT3)
CAN0 Message Slot 12 Data 5 (C0MSL12DT5)
CAN0 Message Slot 12 Data 7 (C0MSL12DT7)
CAN0 Message Slot 13 Standard ID1 (C0MSL13SID1)
CAN0 Message Slot 13 Extended ID1 (C0MSL13EID1)
CAN0 Message Slot 13 Data 1 (C0MSL13DT1)
CAN0 Message Slot 13 Data 3 (C0MSL13DT3)
CAN0 Message Slot 13 Data 5 (C0MSL13DT5)
CAN0 Message Slot 13 Data 7 (C0MSL13DT7)
CAN0 Message Slot 14 Standard ID1 (C0MSL14SID1)
CAN0 Message Slot 14 Extended ID1 (C0MSL14EID1)
CAN0 Message Slot 14 Data 1 (C0MSL14DT1)
CAN0 Message Slot 14 Data 3 (C0MSL14DT3)
CAN0 Message Slot 14 Data 5 (C0MSL14DT5)
CAN0 Message Slot 14 Data 7 (C0MSL14DT7)
CAN0 Message Slot 15 Standard ID1 (C0MSL15SID1)
CAN0 Message Slot 15 Extended ID1 (C0MSL15EID1)
CAN0 Message Slot 15 Data 1 (C0MSL15DT1)
CAN0 Message Slot 15 Data 3 (C0MSL15DT3)
CAN0 Message Slot 15 Data 5 (C0MSL15DT5)
CAN0 Message Slot 15 Data 7 (C0MSL15DT7)
~
~
Figure 3.4.19 Register Mapping of the SFR Area (16)
3-27Ver.0.10
ADDRESS SPACE
3
3.5 EIT Vector Entry
3.5 EIT Vector Entry
The EIT vector entry is located at the beginning of the internal ROM/extended external areas.
Instructions for branching to the start addresses of respective EIT event handlers are written here.
Note that it is
to Chapter 4, "EIT."
branch instructions and not the jump addresses that are written here. For details, refer
Note: When flash entry bit = 1 (i.e., flash enable mode), the EI vector entry is at H'0080 4000.
Figure 3.5.1 EIT Vector Entry
3-28Ver.0.10
ADDRESS SPACE
3
3.6 ICU Vector Table
3.6 ICU Vector Table
The ICU vector table is used by the internal interrupt controller. The start addresses of interrupt
handlers for the interrupt requests from respective internal peripheral I/Os are set at the addresses shown below. For details, refer to Chapter 5, "Interrupt Controller."
The 32170's ICU vector table is shown in Figures 3.6.1 and 3.6.2.
The 32170 has a special function, called the "Virtual Flash Emulation Function," which allows the
internal RAM to be mapped in blocks of 8 Kbytes from the beginning (up to four blocks for the
M32170F6, up to three blocks for the M32170F4 and M32170F3) into internal flash memory areas
divided in 8 Kbytes (L banks). Similarly, this function allows the internal RAM to be mapped in
blocks of 4 Kbytes, for the M32170F6 (up to two blocks) starting from the RAM address H'0080
C000, for the M32170F4 and M32170F3 (up to two blocks) starting from the RAM address H'0080
A000 into internal flash memory areas divided in 4 Kbytes (S banks). For details about this function,
refer to Section 6.7, "Pseudo-Flash Emulation Function."
3-31Ver.0.10
3
ADDRESS SPACE
3.7 Notes on Address Space
❊ This is a blank page. ❊
3-32Ver.0.10
CHAPTER 4CHAPTER 4
EIT
4.1Outline of EIT
4.2EIT Event
4.3EIT Processing Procedure
4.4EIT Processing Mechanism
4.5Acceptance of EIT Events
4.6Saving and Restoring the PC
and PSW
4.7EIT Vector Entry
4.8Exception Processing
4.9Interrupt Processing
4.10 Trap Processing
4.11 EIT Priority Levels
4.12 Example of EIT Processing
4
4.1 Outline of EIT
4.1 Outline of EIT
If some event occurs when the CPU is executing an ordinary program, it may become necessary to
suspend the program being executed and execute another program. Events like this one are
referred to by a generic name as EIT (Exception, Interrupt, and Trap).
(1) Exception
This is an event related to the context being executed. It is generated by an error or violation
during instruction execution. In the M32R/E, this type of event includes Address Exception (AE)
and Reserved Instruction Exception (RIE).
(2) Interrupt
This is an event generated irrespective of the context being executed. It is generated in hardware
by a signal from an external source. In the M32R/E, this type of event includes External Interrupt
(EI), System Break Interrupt (SBI), and Reset Interrupt (RI).
EIT
(3) Trap
This refers to a software interrupt generated by executing a TRAP instruction. This type of event
is intentionally generated in a program as in the OS's system call by the programmer.
EIT
ExceptionReserved Instruction Exception (RIE)
Address Exception (AE)
InterruptReset Interrupt (RI)
System Break Interrupt (SBI)
External Interrupt (EI)
TrapTRAP
Figure 4.1.1 Classification of EITs
4-2Ver.0.10
4
4.2 EIT Event
4.2.1 Exception
(1) Reserved Instruction Exception (RIE)
Reserved Instruction Exception (RIE) is generated when execution of a reserved instruction
(unimplemented instruction) is detected.
(2) Address Exception (AE)
Address Exception (AE) is generated when an attempt is made to access a misaligned address
in Load or Store instructions.
EIT
4.2 EIT Event
4.2.2 Interrupt
(1) Reset Interrupt (RI)
Reset Interrupt (RI) is always accepted by entering the RESET signal. The reset interrupt is
assigned the highest priority.
(2) System Break Interrupt (SBI)
System Break Interrupt (SBI) is an emergency interrupt which is used when power outage is
detected or a fault condition is notified by an external watchdog timer. This interrupt can only be
used in cases when after interrupt processing, control will not return to the program that was
being executed when the interrupt occurred.
(3) External Interrupt (EI)
External Interrupt (EI) is requested from internal peripheral I/Os managed by the interrupt
controller. The 32170's internal interrupt controller manages these interrupts by assigning each
one of eight priority levels including an interrupt-disabled state.
____________
4.2.3 Trap
Traps are software interrupts which are generated by executing the TRAP instruction. Sixteen
distinct vector addresses are provided corresponding to TRAP instruction operands 0-15.
4-3Ver.0.10
4
4.3 EIT Processing Procedure
4.3 EIT Processing Procedure
EIT processing consists of two parts, one in which they are handled automatically by hardware, and
one in which they are handled by user-created programs (EIT handlers). The procedure for
processing EITs when accepted, except for a rest interrupt, is shown below.
EIT request
generated
Program execution restarted
Program
InstructionAInstructionBInstruction
C
suspended
EIT request
accepted
processing-
canceled type
InstructionCInstruction
Instruction
(RIE, AE)
D
••••
Instruction processing
-completed type
(EI, TRAP)
EIT
PC BPC
PSW (B)PSW
EIT vector
entry
Branch
instruc
-tion
Hardware
preprocessing
Hardware
postprocessing
User-created EIT handler
EIT handlers except for SBI
General-purpose
registers, (B)PSW,
and BPC restored
from stack
(SBI)
BPC, (B)PSW,
and general-purpose
registers saved to
stack
(System Break Interrupt
SBI
processing)
Processing
by
handler
Program terminated or
system is reset
Note: (B)PSW denotes the BPSW field of the PSW register.
(B)PSW PSW
RTE
instruc-
tion
BPC PC
Figure 4.3.1 Outline of EIT Processing Procedure
4-4Ver.0.10
4
When an EIT is accepted, the M32R/E saves the PC and PSW (as will be described later) and
branches to the EIT vector. The EIT vector has an entry address assigned for each EIT.
where the BRA (branch) instruction (note that these are not branch address) for the EIT handler is
written.
In the M32R/E's hardware preprocessing, only the contents of the PC and PSW registers are
transferred to the backup registers (BPC register and the BPSW field of the PSW register), and no
other operations are performed. Therefore, please make sure the BPC register, the PSW register
(including the BPSW field), and the general-purpose registers to be used in the EIT handler are
saved to the stack by the EIT handler you write.
the stack in a program by the user.)
When processing by the EIT handler is completed, restore the saved registers from the stack and
finally execute the "RTE" instruction. Control is thereby returned from EIT processing to the
program that was being executed when the EIT occurred. (This does not apply to the System Break
Interrupt, however.)
In the M32R/E's hardware postprocessing, the contents of the backup registers (BPC register and
the BPSW field of the PSW register) are moved back to the PC and PSW registers.
(Remember that these registers must be saved to
4.3 EIT Processing Procedure
EIT
This is
4-5Ver.0.10
4
4.4 EIT Processing Mechanism
4.4 EIT Processing Mechanism
The M32R/E's EIT processing mechanism consists of the M32R CPU core and the interrupt
controller for internal peripheral I/Os. It also has the backup registers for the PC and PSW (BPC
register and the BPSW field of the PSW register). The M32R/E's internal EIT processing
mechanism is shown below.
M32R/E
M32R CPU core
EIT
RESET
SBI
Internal
peripheral
I/O
•
•
•
•
•
•
Interrupt
controller
(ICU)
RI
SBI
EI
IE flag
(PSW)
RI
AE, RIE, TRAP
SBI
High
Priority
EI
Low
BPC register
BPSW
PSW register
Figure 4.4.1 The M32R/E's EIT Processing Mechanism
4-6Ver.0.10
PSW
PC register
4
4.5 Acceptance of EIT Events
4.5 Acceptance of EIT Event
When an EIT event occurs, the M32R/E suspends the program it has hitherto been executing and
branches to EIT processing by the relevant handler. Conditions under which each EIT event occurs
and the timing at which they are accepted are shown below.
Table 4.5.1 Acceptance of EIT Events
EIT EventType of ProcessingAcceptance TimingValues Set in BPC Register
Reserved InstructionInstruction processing-During instructionPC value of the instruction
Exception (RIE)canceled typeexecutionwhich generated RIE
Address Exception (AE) Instruction processing-During instructionPC value of the instruction
canceled typeexecutionwhich generated AE
EIT
Reset Interrupt (RI)Instruction processing-Each machine cycleIndeterminate value
aborted type
System BreakInstruction processing-Break in instructionsPC value of the next instruction
Interrupt (SBI)completed type(only word boundaries)
External Interrupt (EI)Instruction processing-Break in instructionsPC value of the next instruction
completed type(only word boundaries)
Trap (TRAP)Instruction processing-Break in instructionsPC value of TRAP
completed typeinstruction + 4
4-7Ver.0.10
4
4.6 Saving and Restoring the PC and PSW
4.6 Saving and Restoring the PC and PSW
The following describes operation of the M32R at the time when it accepts an EIT and when it
executes the "RTE" instruction.
(1) Hardware preprocessing when an EIT is accepted
Save the SM, IE, and C bits of the PSW register
➀
BSM← SM
BIE← IE
BC← C
Update the SM, IE, and C bits of the PSW register
➁
SM← Remains unchanged (RIE, AE, TRAP)
or set to 0 (SBI, EI, RI)
IE← Set to 0
C← Set to 0
EIT
Save the PC register
➂
BPC← PC
Set the vector address in the PC register
➃
Branches to the EIT vector and executes the branch instruction ("BRA" instruction) written
in it, thereby transferring control to the user-created EIT handler.
(2) Hardware postprocessing when the "RTE" instruction is executed
Restore the SM, IE, and C bits of the PSW register from their backup bits.
❶
SM← BSM
IE← BIE
C← BC
Restore the value of the PC register from the BPC register
❷
PC← BPC
Note: The value of the BPC register and those of the BSM, BIE, and BC bits of the PSW register
after execution of the "RTE" instruction are indeterminate.
4-8Ver.0.10
4
A
A
Save SM, IE, and C bits
1
BSM
BIE
BC
Update SM, IE, and C bits
2
SM
IE
C
SM
IE
C
Unchanged/0
0
0
EIT
4.6 Saving and Restoring the PC and PSW
Save PC
3
BPC
Set vector address in PC
4
PC
PC
Vector address
Restore BSM, BIE, and BC bits
from backup bits
SM
IE
C
The values of BSM, BIE, and BC
bits after execution of the "RTE"
instruction are indeterminate.
When EIT is accepted
Restore PC value from BPC
21
BSM
BIE
BC
PSWBPCPC
1
2
The value of BPC after
execution of the "RTE"
instruction is indeterminate.
3
4
When "RTE" instruction is executed
Figure 4.6.1 Saving and Restoring the PC and PSW
12
4-9Ver.0.10
BPSW fieldPSW field
16 1723 24 2531(LSB)15870(MSB)
00000000000000000000000000PSW
SMIECBCBSMBIE
4
4.7 EIT Vector Entry
4.7 EIT Vector Entry
The EIT vector entry is located in the user space starting from address H'0000 0000. The table
below lists the EIT vector entry.
Table 4.7.1 EIT Vector Entry
EIT
Name
Reset InterruptRIH'0000 0000 (Note 1)00Indeterminate
System Break Interrupt SBIH'0000 001000PC of the next instruction
Reserved InstructionRIEH'0000 0020Indeterminate0PC of the instruction that
Exceptiongenerated EIT
Address ExceptionAEH'0000 0030Indeterminate0PC of the instruction that
TrapTRAP0H'0000 0040Indeterminate0PC of TRAP instruction + 4
Abbreviation
TRAP1H'0000 0044Indeterminate0PC of TRAP instruction + 4
TRAP2H'0000 0048Indeterminate0PC of TRAP instruction + 4
TRAP3H'0000 004CIndeterminate0PC of TRAP instruction + 4
TRAP4H'0000 0050Indeterminate0PC of TRAP instruction + 4
TRAP5H'0000 0054Indeterminate0PC of TRAP instruction + 4
TRAP6H'0000 0058Indeterminate0PC of TRAP instruction + 4
TRAP7H'0000 005CIndeterminate0PC of TRAP instruction + 4
TRAP8H'0000 0060Indeterminate0PC of TRAP instruction + 4
TRAP9H'0000 0064Indeterminate0PC of TRAP instruction + 4
Vector AddressSMIE BPC
generated RIE
TRAP10H'0000 0068Indeterminate0PC of TRAP instruction + 4
TRAP11H'0000 006CIndeterminate0PC of TRAP instruction + 4
TRAP12H'0000 0070Indeterminate0PC of TRAP instruction + 4
TRAP13H'0000 0074Indeterminate0PC of TRAP instruction + 4
TRAP14H'0000 0078Indeterminate0PC of TRAP instruction + 4
TRAP15H'0000 007CIndeterminate0PC of TRAP instruction + 4
External InterruptEIH'0000 0080 (Note 2)00PC of the next instruction
Note 1: During boot mode, this vector address is moved to the beginning of the boot ROM (address H'8000
0000). For details, refer to Section 6.5, "Programming of Internal Flash Memory."
Note 2: During flash E/W enable mode, this vector address is moved to the beginning of the internal RAM
(address H'0080 4000). For details, refer to Section 6.5, "Programming of Internal Flash Memory."
4-10Ver.0.10
4
4.8 Exception Processing
4.8.1 Reserved Instruction Exception (RIE)
[Occurrence Conditions]
Reserved Instruction Exception (RIE) is generated when execution of a reserved instruction
(unimplemented instruction) is detected. Instruction check is performed on the op-code part of
the instruction.
When a reserved instruction exception occurs, the instruction which generated it is not executed.
If an external interrupt is requested at the same time a reserved instruction exception is detected,
it is the reserved instruction exception that is accepted.
[EIT Processing]
(1) Saving SM, IE, and C bits
EIT
4.8 Exception Processing
The SM, IE, and C bits of the PSW register are saved to their backup bits – the BSM, BIE,
and BC bits.
BSM← SM
BIE← IE
BC← C
(2) Updating SM, IE, and C bits
The SM, IE, and C bits of the PSW register are updated as shown below.
SM← Unchanged
BIE← 0
BC← 0
(3) Saving PC
The PC value of the instruction that generated the reserved instruction exception is set in
the BPC register. For example, if the instruction that generated the reserved instruction
exception is at address 4, the value 4 is set in the BPC register. Similarly, if the instruction
is at address 6, the value 6 is set in the BPC register. In this case, the value of the BPC
register bit 30 indicates whether the instruction that generated the reserved instruction
exception resides on a word boundary (BPC[30] = 0) or not on a word boundary (BPC[30]
= 1).
However, in either case of the above, the address to which the "RTE" instruction returns
after completion of processing by the EIT handler is address 4. (This is because the two
low-order bits are cleared to "00" when returning to the PC.)
4-11Ver.0.10
4
EIT
4.8 Exception Processing
+0+1+2+3
H'00
H'04
H'08
H'0C
~
RIE occurred
Address
Return
address
~
BPC
Figure 4.8.1 Example of a Return Address for Reserved Instruction Exception (RIE)
(4) Branching to the EIT vector entry
Control branches to the address H'0000 0020 in the user space. This is the last operation
performed in hardware preprocessing by the M32R/E.
(5) Jumping from the EIT vector entry to the user-created handler
H'04
~
address
Return
Address
H'00
H'04
H'08
H'0C
~
+0+1+2+3
~
RIE occurred
~
BPC
H'06
~
~
The M32R/E executes the "BRA" instruction written at address H'0000 0020 of the EIT
vector entry by the user to jump to the start address of the user-created handler. At the
beginning of the EIT handler you created, first save the BPC and PSW registers and the
necessary general-purpose registers to the stack.
(6) Returning from the EIT handler
At the end of the EIT handler, restore the general-purpose registers and the BPC and PSW
registers from the stack and then execute the "RTE" instruction. As you execute the "RTE"
instruction, hardware postprocessing is automatically performed by the M32R/E.
4-12Ver.0.10
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.