PanaX Series is a trademark of Matsushita Electric Industrial Co., Ltd.
The other corporation names, logotype and product names written in this book are trademarks or registered trademarks of their
corresponding corporations.
Request for your special attention and precautions in using the technical
informaition and semiconductors described in this book
(1)An export permit needs to be obtained from the competent authorities of the Japanese Government if any of
the products or technologies described in this book and controlled under the "Foreign Exchange and Foreign
Trade Law" is to be exported or taken out of Japan.
(2)The contents of this book are subject to change without notice in matters of improved function.When
finalizing your design, therefore, ask for the most up-to-date version in advance in order to check for any
changes.
(3)We are not liable for any damage arising out of the use of the contents of this book, or for any infringement
of patents or any other rights owned by a third party.
(4)No part of this book may be reprinted or reproduced by any means without written permission from our
company.
(5)This book deals with standard specification. Ask for the latest individual Product Standards or Specifications
in advance for more detailsd infomation required for your design, purchasing and applications.
If you have any inquiries or questions about this book or our semiconductors, please contact one of our sales
offices listed at the back of this book.
Table 16-6-1 Flash Memory Register List ..................................................................................... 16-8
xvii
Page 26
xviii
Page 27
0
1.General Specifications
1
Page 28
General Specifications
1.1Overview
The MN1030 Series is a 32-bit microcontroller that maintains the software assets of Matsushita Electronics' 16-bit
MN102 Series of microcontrollers by offering ease of use and excellent cost-performance with a simple, highperformance architecture.
Built around a compact 32-bit CPU core with a basic instruction word length of one byte, the MN103001G (mask
ROM version) includes ROM, RAM, a bus control circuit, interrupt control circuit, timers, a serial interface, A/D
converter, and input/output ports in a 100-pin QFP. The MN1030F01K (flash memory version) is equipped with
flash memory instead of mask ROM, has the same on-chip peripheral functions as the MN103001G, and has the
same package and pin specifications. This microcontroller is ideal for multimedia devices, which must be able to
process large volumes of data (for audio, stills, video, etc.), as well as for real-time control equipment that requires
fast and precise control. When supplied with power supply voltage of 3.3 V, the MN103001G operates at
60 MHz and achieves performance of 60 MIPS.
1.2Features
Low voltage, high-speed processing, low power consumption
■ Minimum instruction execution time:
16.7 ns (during 3.3 V internal 60 MHz operation *MN103001G)
25 ns (during 3.3 V internal 40 MHz operation *MN1030F01K)
■ Power consumption (TYP.):
300 mW (during 3.3 V internal 60 MHz operation *MN103001G)
270 mW (during 3.3 V internal 40 MHz operation *MN1030F01K)
Compact and high-performance CPU core
■ Simple and highly efficient instruction set
(Number of basic instructions: 46; number of extension instructions: 24; number of addressing modes: 6)
■ Excellent coding efficiency with instructions that have a basic word length of one byte
■ Load/store architecture with 5-stage pipeline organization provides fast instruction execution
• Pins for which two or more names are shown are multipurpose pins.
* "VDD2" in the case of the MN103001G, "VPP" in the case of the MN1030F01K.
1-6
Page 33
1.4.2 Pin Functions
Table 1-4-2 shows the function of each pin of this microcontroller.
Table 1-4-2 Pin Function Table (1/2)
General Specifications
CategoryPin name
Power supplyVDD8Digital system power supply (+3.3 V)
VSS7Digital system GND
VDD2(VPP)1“VDD2” in the case of the MN103001G, “VPP” in the
ClockOSCII1Oscillator input
OSCOO1Oscillator output
SYSCLKO1System clock output (multipurpose)
CKSELI1Switch for using/not using PLL
PVDD1PLL power supply (+3.3 V)
PVSS1PLL GND
Address busA23 to 0O24Address lines 23 to 0 (multipurpose, A23 also serves as
Data busD15 to 0I/O16Data lines 15 to 0 (multipurpose)
Address/ADM15 to 0I/O(16)Address/Data lines 15 to 0 (A15 to 0 multipurpose)
Data bus
Bus controlMMOD1 to 0I2Mode setting signals
signalsEXMOD1 to 0I2Extension mode setting (multipurpose)
REO1Memory read signal (multipurpose)
CS3 to 0O4Chip select signals (multipurpose)
WE1 to 0O2Memory write signals (multipurpose)
DKI1Data acknowledge signal (multipurpose)
BGO1Bus authority release signal (multipurpose)
BRI1Bus authority request signal (multipurpose)
CASO(1)DRAM CAS signals (for 2WE) (multipurpose of A22)
RAS2 to 1O(2)DRAM RAS signal (multipurpose of CS2 to 1)
ASO(1)Address strobe signal (Also serves as D0.)
RWSELO(1)Read/write select (Also serves as D1.)
DCAS1 to 0O(2)DRAM CAS signal (for 2 CAS)
DWEO(1)DRAM write signal (for 2 CAS)
Input/Number
Outputof pins
Pin Function
case of the MN1030F01K. Connect to 5 V or 3.3 V.
Always input 5 V to VPP when writing.
AN3 to 0I(4)A/D converter analog signal inputs (multipurpose of
AVDD1Analog system power supply (+3.3 V)
AVSS1Analog system GND
I/O portsP02 to P00O(3)Port 0; output port (multipurpose)
P17 to P10I/O(8)Port 1; input/output port (multipurpose)
P27 to P20I/O(8)Port 2; input/output port (multipurpose)
P30I/O(1)Port 3; input/output port (multipurpose)
P45 to P40I/O(6)Port 4; input/output port (multipurpose)
P55 to P50I/O(6)Port 5; input/output port (multipurpose)
P63 to P60I/O(4)Port 6; input/output port (multipurpose)
P73 to P70O(4)Port 7; output port (multipurpose)
P83 to P80I(4)Port 8; input port (multipurpose)
P96, P95, P91, P90
P97, P94 to P92
PA7 to PA0I/O(8)Port A; input/output port (multipurpose)
PB7 to PB0I/O(8)Port B; input/output port (multipurpose)
PC3 to PC0O(4)Port C; output port (multipurpose)
Input/Number
Outputof pins
(SBO3 is output only.)
Serial 3 to 0 transfer clock inputs/outputs (multipurpose)
(SBT3 is input only.)
(Use input of AVDD to 0 V only.)
of IRQ3)
IRQ7 to 4) (Use input of VREFH to 0 V only.)
I/O(4)Port 96, 95, 91, 90; input/output port (multipurpose)
O(4)Port 97, 94, 93, 92; output port (multipurpose)
Pin Function
Notes:
1. A number that is not enclosed in parentheses in the “Number of pins” column indicates the main pins, while a
number enclosed in parentheses indicates multipurpose pins.
2. After the reset condition is released, maintain the NMIRQ pin at the high level until the initialization routine
(which sets the stack pointer SP) is completed. If the NMIRQ pin is not used, connect it to VDD via a resistor.
1-8
Page 35
2.CPU
2
Page 36
CPU
2.1Basic Specifications of CPU
• StructureLoad/store architecture
Data/Address/SP Registers x 9
(Data registers: 32-bit x 4, Address registers: 32-bit x 4, SP: 32-bit x 1)
Other Registers
(PC: 32-bit x 1, PSW: 16-bit x 1, Multiply/divide register: 32-bit x 1,
Branch target registers: 32-bit x 2)
• InstructionsNumber of instructions: 46
Number of addressing modes: 6
Basic instruction length: 1 byte
Code assignment: 1 byte to 2 bytes (basic part)
• Address space4 GB
Unified space for instructions and data
(Instructions can not be read from internal data RAM.)
*1 in the case of the MN103001G.
*2 in the case of the MN1030F01K.
2-2
Page 37
2.2Block Diagram
The block diagram for this microcontroller, focusing on the CPU, is shown below.
Address registerData register
CPU
User
extension
function unit
A0
A1
A2
A3
AULU
Extension interface
D0
D1
D2
D3
Operand address
SP
MDR
PSW
Barrel
shifter
Operand dataInstruction
Internal
data RAM
External interface
Program
counter
block
Bus contol block
AU
Instruction address
instruction ROM/
Instruction
execution
control block
Instruction
decoder
Instruction
queue
Internal
Internal flash
memory
Internal
peripheral
function
Interrupt
control
block
Fig. 2-2-1 CPU Core Block Diagram
2-3
Page 38
CPU
2.3Programming Model
2.3.1 CPU Registers
• The register set is divided into data registers that are used for arithmetic operations, etc., address registers that
are used for pointers, and a stack pointer. This arrangement contributes greatly to the improved performance of
the internal architecture, through reduction of instruction code size, improved parallelism in pipeline processing,
etc.
• This register enables programming in C and other high-level languages.
Data Register
Address Register
Stack Pointer
Program Counter
Multiply/Divide Register
Processor Status Word
Loop Instruction Register
31
31
31
31
31
31
D0
D1
D2
D3
A0
A1
A2
A3
SP
PC
MDR
15
LIR
0
0
0
0
0
0
PSW
0
Loop Address Register
31
LAR
0
Fig. 2-3-1 CPU Registers
• The loop instruction register (LIR) and the loop address register (LAR) are used to provide high-speed execution
of branch instructions. High-speed loop control is performed by loading the branch target instruction and following
fetch address with the SETLB instruction and forming the loop using the Lcc instruction.
2-4
Page 39
■ Data Register (32-bit x 4)
This register can be used generally for all operations. Operations are performed with a 32-bit length and the data
size is converted when sending data to and from the memory or by executing the EXTB or EXTH instructions.
When loading data, 8-bit data is zero-extended to 32 bits and sent to the register. When storing data, the lower 8
bits of the register are sent to the memory. When handling the loaded 8-bit data as a signed integer, the data is
sign-extended from 8 bits to 32 bits with the EXTB instruction. When loading data, 16-bit data is zero-extended
to 32 bits and sent to the register. When storing data, the lower 16 bits of the register are sent to the memory.
When handling the loaded 16-bit data as a signed integer, the data is sign-extended from 16 bits to 32 bits with
the EXTH instruction.
■ Address Register (32-bit x 4)
This register is used as an address pointer, and only instructions (addition, subtraction and comparison) for
address calculation are supported.
The address register data is used for pointers, and data is normally sent to and from the memory with a 32-bit
length.
■ Stack Pointer (32-bit x 1)
This pointer designates the first address of the stack region.
CPU
■ Program Counter (32-bit x 1)
This counter designates the address of the command being executed.
■ Multiply/Divide Register (32-bit x 1)
This register is provided for multiply and divide instructions. It holds the upper 32 bits of 64-bit multiplication
results for multiply instructions and the remainder (32 bits) for divide instructions. Also, the upper 32 bits of the
dividend are loaded to this register before executing divide instructions.
■ Processor Status Word (16-bit x 1)
This register indicates the CPU status, and contains the operation result flags and interrupt mask level, etc.
15
0
S1 S0 IE IM2 IM1
0
Fig. 2-3-2 Processor Status Word
IM0
0000
VCN
0
Z
2-5
Page 40
CPU
Z: Zero Flag
This flag is set when an operation result is all zeroes, and is cleared by any other result. This flag is
also cleared by a reset.
N: Negative Flag
This flag is set if the MSB of an operation result is "1", and is cleared if the MSB is "0". This flag
is also cleared by a reset.
C: Carry Flag
This flag is set when a carry or borrow to or from the MSB is generated in the course of executing an
operation, and is cleared if no carry or borrow is generated. This flag is also cleared by a reset.
V: Overflow Flag
This flag is set when an overflow occurs in a signed value in the course of executing an operation,
and is cleared if no overflow is generated. This flag is also cleared by a reset.
IM2 to IM0: Interrupt Mask
These bits indicate the CPU interrupt mask level. The three bits define the mask level from level 0
(000) to level 7 (111), with level 0 being the highest mask level. The CPU accepts only those
interrupt requests of a level higher than the mask level indicated here.
When an interrupt is accepted, the IM bits are set to the priority level of that interrupt. Until the
processing of the accepted interrupt is completed, the CPU does not accept interrupts with the same
interrupt level or lower.
The interrupt mask level is set to level 0 (000) by a reset.
IE: Interrupt Enable
Setting this bit to “1” allows interrupts to be accepted.
Once the CPU accepts an interrupt request, the IE bit is cleared to "0" and further acceptance of
interrupts is prohibited. Accordingly, the IE bit must be reset when processing nested interrupts.
This bit is cleared when the system is reset.
S1 to S0: Software Bits
These are the software control bits for the operating system. These bits cannot be used by general
user programs. These bits are cleared by a reset.
For details on changes of these flags, refer to the "Instruction Manual".
■ Loop Instruction Register (32-bit x 1)
This register is provided for the branch instruction (Lcc), and is used to load branch target instructions with the
SETLB instruction. This register works together with the Lcc instruction to enable high-speed loop control.
■ Loop Address Register (32-bit x 1)
This register is provided for the branch instruction (Lcc), and is used to load following fetch addresses with the
SETLB instruction.
2-6
Page 41
CPU
2.3.2Control Registers
This microcontroller uses the memory-mapped-I/O method and allocates the peripheral circuit registers to the
internal I/O space between addresses x'20000000 and x'3FFFFFFF.
The registers listed below are described in this section. For details on other control registers, refer to the respective
sections that explain the various internal peripheral functions.
Table 2-3-1 List of Control Registers
AddressName SymbolNumber of bits Initial valueAccess size
The interrupt vector register (IVAR0 to IVAR6) contains the lower 16 bits of the start address of the interrupt
handler for interrupts of the level accepted by the CPU. IVAR0 corresponds to level 0 interrupts; in similar fashion,
IVAR1 to IVAR6 correspond to levels 1 to 6, respectively. IVAR0 to IVAR6 are allocated to the internal I/O space
between addresses x'20000000 to x'20000018, respectively.
IVAR IVAR IVAR IVAR IVAR IVAR IVAR IVAR IVAR IVAR IVAR IVAR IVAR IVAR IVAR IVAR
n15n14n13n12n11n10n9n8n7n6n5n4n3n2n1n0
Bit No.Bit nameDescription
15 to 0IVARn15 to 0Lower 16 bits of the start address of the level interrupt handler
The IVARn register should be accessed by halfwords (16 bits). Byte and word access is not supported.
Note that the upper 16 bits of the start address of the level interrupt handler are fixed to x'4000.
Core's Internal Memory Control Register (MEMCTRC)
The core's internal memory control register (MEMCTRC) sets the number of waits for the memory mounted inside
this microcontroller. This register is allocated to the internal I/O space at address x'20000020.
Bit No.1514131211109876543210
Bit name————— ———— ———
Reset00000 0000 0000111
AccessRRRRR RRRR RRRRRRR
LD EXT DROM ROM
USE WAIT WWAIT
Writing these bits is prohibited, since operation is guaranteed only with the settings that are in place after a reset.
2-8
Page 43
CPU
CPU Mode Register (CPUM)
The CPU mode register (CPUM) sets the clock operating mode for the CPU and peripheral blocks. This register is
allocated to the internal I/O space at address x'20000040.
Bit No.1514131211109876543210
Bit name————————— —OSCID STOP HALT SLEEP OSC1 OSC0
0OSC0Always returns "0" when read. Always write "0".
1OSC1Always returns "0" when read. Always write "0".
2SLEEPCPU operating mode control flag (SLEEP transfer request)
3HALTCPU operating mode control flag (HALT transfer request)
4STOPCPU operating mode control flag (STOP transfer request)
5OSCIDAlways returns "0" when read. Always write "0".
15 to 6—reserved
The various operating modes can be set by setting the bits as shown in the table below.
Oscillation control and operating mode control
Operating mode STOP HALT SLEEP OSC1 OSC0
ClockCPU operation Peripheral function
oscillationclockoperation clock
NORMAL00000OscillatingRunningRunning
HALT01000OscillatingStoppedStopped
SLEEP00100OscillatingStoppedRunning
STOP10000StoppedStoppedStopped
The CPUM register should be accessed by halfwords (16 bits). Byte and word access is not supported.
If the CPUM register is accessed to make a transition to an operating mode of SLEEP/HALT/STOP during execution
of a program in external memory, a branch instruction should not be located within the three instructions immediately
following the CPUM register access instruction.
2-9
Page 44
CPU
2.4Instructions
2.4.1Addressing Modes
The 32-bit microcontroller is equipped with the following 6 addressing modes which are frequently used with
compilers.
All 6 addressing modes of register direct, immediate value, register indirect, register indirect with displacement,
absolute and register indirect with index can be used with data transfer group instructions.
The 2 addressing modes of register direct and immediate addressing can be used with register operation instructions.
Register indirect with index addressing is an addressing mode used to efficiently access arrays and other data.
Table 2-4-1 Addressing Mode Types
Addressing mode
Register direct
Immediate value
Register indirect
Register indirect
with displacement
Dm / Dn
Am / An
imm8 / regs
imm16
imm32
imm40
imm48
(Am) / (An)
(d8, Am)/(d8, An)
: d8 is sign-extended
(d16, Am)/(d16, An)
: d16 is sign-extended
(d32, Am)/(d32, An)
(Branch instructions only)
(d8, PC)
: d8 is sign-extended
(d16, PC)
: d16 is sign-extended
(d32, PC)
Address calculationEffective address
Am/An
Am/An
+
031
031
715031
(32-bit address)
(32-bit address)
d32/d16/d8
031
PC
(32-bit address)
+
715031
d32/d16/d8
031
031
031
(d8, SP)
: d8 is zero-extended
(d16, SP)
: d16 is zero-extended
(d32, SP)
(abs16)
Absolute
: abs16 is zero-extended
(abs32)
Register indirect with index
(Di, Am)/(Di, An)
SP
+
d32/d16/d8
15
abs32/abs16
Am/An
+
031
(32-bit address)
715031
031
(32-bit address)
031
(32-bit address)
031
031
031
031
Di
When accessing data using the register indirect with displacement and register indirect with index modes, the base
address (the contents of Am, An and SP) and the effective address must be located within the same address space.
For details on memory spaces, refer to section 4.1, "Memory Mode Types and Selection."
2-10
Page 45
CPU
2.4.2Data Types
Data types can be processed in the four types of bit, byte, halfword and word data. Byte data, halfword data and
word data can be handled as signed and unsigned data. The sign bit is MSB.
The data in the memory must be aligned data. In other words, the two bits on the LSB side of addresses containing
word data must be "00" (addresses which are a multiple of 4), and the LSB of addresses containing halfword data
must be "0" (addresses which are a multiple of 2).
Byte and bit placement conforms with the Little Endian format. Therefore, the address of the byte data on the MSB
side of halfword data is the LSB side byte data address + 1,and the address of the byte data on the MSB side of word
data is the LSB side byte data address + 3. The bit number for bit data starts at 0 on the LSB and increases towards
the MSB.
Table 2-4-2 Data Types
(1) Bit data
(2) Byte data
Unsigned 8-bit
Signed 8-bit(sign bit: MSB)
(3) Halfword data
Unsigned 16-bit
Signed 16-bit(sign bit: MSB)
(4) Word data
Unsigned 32-bit
Signed 32-bit(sign bit: MSB)
MSBLSB
Bit No.3124231615870
Address in the memory
Word data
Halfword data
Byte data
Upper halfwordLower halfword
Most significant byteLeast significant byte
Most significant byte Least significant byte
4n4n+14n+24n+3
Fig. 2-4-1 Little Endian Format
2-11
Page 46
CPU
2.4.3Instruction Set
The instruction set has a simple organization, and features the generation of compact and optimized code through a
C compiler.
The instruction code size is reduced by making the basic instruction word length one byte. As a result, increases in
the code size of the assembler program can be kept to a minimum even though the instruction set is simple, with
data transfers to and from memory limited to load and store operations.
Table 2-4-3 Instruction Types (All 46 types and extension instructions)
• Transfer instructions
MOVTransfer of word data between registers
Transfer of word data between registers and the memory
Transfer of immediate values to registers
MOVBUTransfer of byte data between registers and the memory
(zero-extension)
MOVHUTransfer of halfword data between registers and the memory
(zero-extension)
EXT64-bit sign-extension of word data
EXTB32-bit sign-extension of byte data
EXTBU32-bit zero-extension of byte data
EXTH32-bit sign-extension of halfword data
EXTHU32-bit zero-extension of halfword data
MOVMTransfer between multiple registers and the memory
CLRData clear
• Arithmetic instructions
ADDAddition
ADDCAddition with carry
SUBSubtraction
SUBCSubtraction with borrow
MULSigned multiplication
MULUUnsigned multiplication
DIVSigned division
DIVUUnsigned division
INCIncrement by 1
INC4Increment by 4
• Compare instructions
CMPCompare
• Logical instructions
ANDAnd
ORInclusive Or
XORExclusive Or
NOTNot (complement of 1)
2-12
Page 47
CPU
• Bit instructions
BTSTBit Test
BSETTest and set (processing unit: byte)
BCLRTest and clear (processing unit: byte)
• Shift instructions
ASRShift Right Arithmetic
LSRShift Right Logical
ASLShift Left Arithmetic
ASL2Shift Left 2-bit Arithmetic
RORRotate 1 bit to the right
ROLRotate 1 bit to the left
• Branch instructions
BccBranch on condition codes (PC relative)
LccLoop on condition codes (PC relative)
SETLBSet loop buffer
JMPUnconditional branch (PC relative, register indirect)
CALLSubroutine call (Advanced function)
CALLSSubroutine call
RETReturn from subroutine (Advanced function)
RETFReturn from subroutine (Advanced function, high-speed)
RETSReturn from subroutine
RTIReturn from interrupt program
TRAPSubroutine call to specified address
NOPNo operation
• Extension instructions
UDFUser extension instruction (sign-extension)
UDFUUser extension instruction (zero-extension)
Note:
Interrupts are prohibited and the bus is locked (occupied by the CPU) when executing BSET or BCLR, however, if
a BSET or BCLR instruction is executed during program execution in external memory, a bus authority release due
to an external bus request may be interposed between the data read and data write by the BSET or BCLR instruction.
If the atomic bus cycles (i.e. bus lock) of the BSET or BCLR instruction need to be guaranteed in a system that uses
multiple processors, either of the following measures should be taken.
1. A program in which a BSET or BCLR instruction is executed should be placed in internal memory.
2.
Designate the bus authority request pin (BR) as a general-purpose input port, and the bus authority release pin
_____
_____
(BG) as a general-purpose output port, for instance, so that bus requests cannot be accepted during execution of
a BSET or BCLR instruction.
2-13
Page 48
CPU
2.5Interrupts
2.5.1Overview of Interrupts
The most important key to real-time control is the ability to shift quickly to interrupt handler processing.
If an interrupt is generated during the execution of an instruction that requires multiple cycles for execution
(multiplication or division instructions, for example), interrupt response is improved by aborting the execution of
the instruction and immediately accepting the interrupt. After control returns from the interrupt processing program,
the aborted instruction is re-executed.
In addition, by minimizing the resources saved to memory to just the 6 bytes of the PC and the PSW when an
interrupt is generated, the speed of interrupt processing is improved, as is the flexibility of software control.
Furthermore, fast response and optimal program allocation are possible by placing interrupt processing programs at
different addresses for each interrupt level.
This microcontroller has the interrupts shown below. When any of these interrupts occurs, control is shifted to the
appropriate processing program in accordance with the cause.
Reset interrupt
Non-maskable interruptPriority ranking
Level interrupt n (n = 0 to 6)
➤
Fig. 2-5-1 shows an overview of the interrupt system. This microcontroller is equipped with 19 interrupt group
control blocks outside the CPU, and controls the interrupts of each group separately. Each interrupt group control
block can accept up to 4 interrupt requests. This allows the controller to support to 38 interrupt factors, providing it
with high expandability and enabling flexible ASIC support.
Except for the reset interrupt, all interrupts from the timer and other peripheral circuits and external pin interrupts
are registered in the interrupt group control blocks. Then, the interrupt requests which pass the interrupt priority
level (level 0 to 6) set in the interrupt group control blocks are output to the CPU. Groups 0 is assigned to nonmaskable interrupts only.
CPU
71
Group 0
Interrupt group control
Group 2
Interrupt group control
4
Interrupt
Interrupt
4
Non-maskable interrupts
3 factors are allocated to this group: external pin non-maskable
interrupt, watchdog timer overflow interrupt and system error
interrupt. The remaining factor is reserved.
2-14
Group 19
Interrupt group control
Interrupt controller (INTC)
Fig. 2-5-1 Overview of the Interrupt System
External interrupts
8 external pin interrupts as well as timer, serial
and other peripheral interrupts are assigned.
4
Interrupt
Page 49
2.5.2Registers
[Flags in the PSW] (CPU)
Interrupt-related flags in the processor status word (PSW) include interrupt enable and interrupt mask level.
IE (Interrupt Enable) R/W
• This flag allows all interrupts to be accepted except for non-maskable interrupts and reset interrupts.
Interrupts are allowed when IE = 1. IE = 0 when the system is reset.
• When an interrupt is accepted, IE is cleared (interrupt prohibited). Set IE when accepting nested
interrupts within the interrupt handler.
IM2 to IM0 (Interrupt Mask Level) R/W
• This holds the current interrupt mask level. When IE = 1, CPU accepts interrupts with levels higher
than IM2 to IM0. Level 0 (000) when the system is reset.
• The following table shows the relationship between mask levels and acceptable interrupt levels.
Table 2-5-1 Relationship between Mask Levels and Interrupt Levels that Can Be Accepted
[Interrupt Control Registers (GnICR)] R/W halfword/byte access
Interrupt control registers (GnICR: n = 0, 2 to 19) combine interrupt priority level, interrupt enable, interrupt
request and interrupt detect fields into a single register in order to control CPU external peripheral interrupts. There
are 19 interrupt control registers, one for each group, and they are located in the internal I/O space from x'34000100
to x'3400014C. Register G0ICR is dedicated for non-maskable interrupts, and G0ICR is called NMICR (from the
least significant bit: external pin non-maskable interrupt, watchdog timer overflow interrupt, system error interrupt).
Fig. 2-5-2 shows the interrupt control register (GnICR) configuration, and each field is described in detail as
follows.
G0ICR (NMICR)
GnICR (n = 2 to 19)
15
1413121110987654321
0ID
00000000000
15
1413121110987654321
LVIEIR
0ID
0
0
Fig. 2-5-2 Interrupt Control Register (GnICR)
2-15
Page 50
CPU
LV2 to LV0 (Interrupt Priority Level) R/W
• This 3-bit field sets the interrupt priority level. When the interrupt priority level set in LV2 to LV0
is higher than the interrupt mask level set in IM2 to IM0 in the PSW (i.e., the value set in LV2 to
LV0 is smaller than the value set in IM2 to IM0), interrupts in the corresponding interrupt group
are enabled. All interrupts (max. 4) in the same interrupt group have the interrupt priority level
specified by LV2 to LV0.
• When interrupt requests are asserted simultaneously from multiple interrupt groups, the group with
the highest interrupt priority level is accepted. Also, when multiple interrupt groups are set to the
same interrupt priority level, the interrupt from the group with the highest priority ranking (the
interrupt group with the smallest group number) is accepted.
• All bits are cleared to "0" when the system is reset.
IE3 to IE0 (Interrupt Enable) R/W
• This field has up to 4 bits which specify interrupt approval. The IE3 to IE0 bits correspond to each
interrupt factor (max. 4) in the interrupt group. Interrupts are enabled when the corresponding IE3
to IE0 bit is "1".
• Interrupt occurs when IR3 to IR0 and IE3 to IE0 are set.
• All bits are cleared to "0" when the system is reset.
IR3 to IR0 (Interrupt Request) R/W
• This field has up to 4 bits which register interrupt requests. The IR3 to IR0 bits correspond to each
interrupt. After the interrupts are accepted, IR3 to IR0 should be cleared by the software during the
interrupt handler.
• All bits are cleared to "0" when the system is reset.
• Conditions for setting and clearing IR3 to IR0 are listed below.
ID3 to ID0 (Interrupt Detect) R/W
• This field has up to 4 bits which contain the logical product of IE3 to IE0 and IR3 to IR0. When an
interrupt allowed by IE3 to IE0 occurs, the bit corresponding to that interrupt goes to "1". This field
is used to specify interrupts within groups during interrupt processing.
• Interrupt requests are canceled by writing the specified values in IR3 to IR0 and ID3 to ID0 and
clearing the interrupt request field.
ID change (G0ICR)IR change (GnICR: n = 2 to 19)
Write
ID
0Unchanged
10
ID after write
Write
IRID
00Unchanged
010
10Unchanged
111
IR after write
2-16
Page 51
CPU
[Interrupt Accept Group Register (IAGR)] R halfword/byte access
During a register read, the interrupt accept group register (IAGR) indicates the smallest group number of the groups
that are generating an interrupt of the interrupt levels accepted by the CPU, which are indicated by IM2 to IM0 of
the PSW. This register is allocated to address x'34000200 in the internal I/O space. The GN4 to GN0 field (5 bits)
corresponds to the interrupt group number. A branch destination of the interrupt program for each group can be
found, for example, by referencing the contents of the address obtained by adding the interrupt accept group register
value to the leading address of the interrupt vector table. The interrupt accept group register is a read only register,
and writing cannot be performed. When there are no interrupt factors of the applicable interrupt level, IAGR
becomes 0.
Accessing IAGR is meaningless during non-maskable interrupts.
The interrupt vector register (IVAR0 to IVAR6) contains the lower 16 bits of the start address of the interrupt
handler for interrupts of the accepted level. This register is allocated between addresses x'20000000 to x'20000018
in the internal I/O space. The start address of interrupt levels 0 to 6 correspond to IVAR0 to IVAR6. When an
interrupt occurs, control is transferred to the address which is comprised of the upper 16 bits (x'4000) and the lower
16 bits (IVARn). This register is undefined when the system is reset.
IVARn
141312111098 7654321
15
0
Fig. 2-5-4 Interrupt Vector Address Register
2-17
Page 52
CPU
2.5.3Interrupt Types
The three types of interrupts are listed below:
[Reset interrupt]
The reset interrupt is the interrupt with the highest priority level, and is generated by setting the RST pin to "L"
level. As a result of the reset interrupt, the registers, etc., are initialized. When the RST pin goes to "H" level, the
microcontroller waits until the oscillation of the internal clock stabilizes, and then begins executing program
instructions starting from address x'40000000.
[Non-maskable Interrupts]
Non-maskable interrupts are accepted regardless of the PSW interrupt enable (IE) and interrupt mask level IM2 to
IM0 values. These interrupts include external pin non-maskable interrupt, watchdog timer overflow interrupt and
system error interrupt.
When a non-maskable interrupt is accepted, control transfers to an interrupt processing program located at x'40000008
or beyond.
The interrupt handler accesses NMICR to analyze the interrupt factor, performs interrupt processing, cancels the
interrupt factor, and then returns to the normal program using the RTI instruction.
External pin non-maskable interrupt
External pin non-maskable interrupt is generated when the NMIRQ pin goes to "L" level. If an external pin
non-maskable interrupt is generated, the external non-maskable interrupt request flag (NMIF) in the nonmaskable interrupt control register (NMICR) is set to "1".
Watchdog timer overflow interrupt
Watchdog timer overflow interrupt occurs when the watchdog timer count operation control flag (WDCNE)
in the watchdog timer control register (WDCTR) is "1" and the watchdog timer overflows. If a watchdog
interrupt is generated, the watchdog timer overflow interrupt request flag (WDIF) in the non-maskable interrupt
control register (NMICR) is set to "1".
System error interrupt
System error interrupt occurs when an unaligned memory access or an unimplemented instruction is executed
or other fatal error occurs. If a system error interrupt is generated, the system error interrupt request flag
(SYSEF) in the non-maskable interrupt control register (NMICR) is set to "1".
Note: Do not change the interrupt enable (IE) in PSW during non-maskable interrupt processing.
2-18
Page 53
CPU
[Level interrupts]
Level interrupts are interrupts for which the interrupt level can be controlled through the interrupt enable (IE) and
interrupt mask (IM2 to IM0) bits in the PSW. Level interrupts are interrupts from the interrupt group controllers
external to the CPU (in other words, peripheral interrupts). There are 18 groups, or 35 interrupt factors.
Each interrupt group controller includes an interrupt control register (GnICR); the interrupt priority level can be set
independently for each interrupt group. It is also possible to set the same interrupt priority level for different
interrupt groups. If interrupts of the same priority level are generated simultaneously, the interrupts are accepted in
the sequence set by the hardware (the lower the interrupt group number, the higher the priority).
When a level interrupt is accepted, the hardware causes the program to branch to an address with the upper 16 bits
being "x'4000" and the lower 16 bits indicated by the interrupt vector address register IVARn corresponding to the
interrupt level.
The interrupt handler accesses IAGR to analyze the interrupt group, accesses GnICR (n = 2 to 19) to analyze the
interrupt factor, performs interrupt processing, cancels the interrupt factor, and then returns to the normal program
using the RTI instruction.
2.5.4Interrupt Definition
When this microcontroller accepts an interrupt, first the sequences automatically processed by the hardware are
executed. Then control transfers to interrupt handler by the software and the interrupt handler is started up.
The interrupt processing sequences are described below.
(Interrupt processing sequences executed by the hardware)
1. The PSW is saved to the stack (SP-8).
2. The PC (return address) is saved to the stack (SP-4).
3. The PSW is updated.
IE is cleared and the accepted interrupt level is set in IM2 to IM0. (IM2 to IM0 is undefined in case of nonmaskable interrupts.)
4. The stack pointer is updated. (SP-8 → SP)
5. Control is transferred to the address corresponding to the accepted interrupt factor or the address comprised of
the interrupt vector address register (IVARn).
When an interrupt other than a reset interrupt is accepted, control is transferred to the address corresponding to the
interrupt factor or the address comprised of the interrupt vector address register. The processing listed below is then
performed at the branch destination in order to judge the interrupt factor in further detail.
See "2.5.3 Interrupt Types" for processing reset interrupts.
(Note) In General, Branch instructions (JMP instruction, etc.) are placed at the branch destination for reset interrupts,
then it branches to the initialization program.
2-19
Page 54
CPU
(Example of pre-processing by the interrupt handler)
1. The registers are saved.
The saved registers are those used by the interrupt handler.
2. The interrupt group analysis is executed.
2.1 The interrupt acknowledge sequence is executed.
Interrupt acknowledge consists of reading out the interrupt accept group register (IAGR) to obtain the group
number of the interrupt group with the highest priority among the specified interrupt levels.
2.2 The leading address of the interrupt handler for each level is generated.
2.3 Control is transferred to the interrupt handler for each level.
3. When there are multiple factors within the same group, the interrupt control register (GnICR) is read out to
designate the factor.
* In case of non-maskable interrupts, the factor is specified by accessing the NMICR directly without accessing
the IAGR.
4. Control is transferred to the interrupt handler for each factor.
Note that because this microcontroller uses a store buffer when writing data via the bus controller, it is necessary,
when releasing the interrupt factor, to read the appropriate register immediately after clearing the interrupt
factor in order to wait for the factor in the GnICR to be cleared completely.
(Example of post-processing by the interrupt handler)
5. The registers are restored.
The restored registers are those saved by the pre-processing.
6. The RTI instruction is executed and control returns to the program before the interrupt.
Fig. 2-5-5 shows the interrupt sequence flow. (when not accepting nested interrupts)
The numbers in the figure correspond to the numbers of processing performed by the interrupt handler in the
previous section.
Interrupt
max. 11 Cycles
ProgramHandler (pre-processing)
Interrupt processing by hardware
3 Cycles
Processing for each level
1
2
Processing for each group
3
4
Interrupt
handler
Processing for
each factor
Interrupt processing
and interrupt request
cancel
2-20
RTI
5
6
Fig. 2-5-5 Interrupt Sequence Flow
Handler (post-processing)
Page 55
CPU
An even higher interrupt response speed can be realized by assigning only one factor or only a few factors to a
single interrupt level.
Fig. 2-5-6 shows the interrupt sequence flow when assigning one factor to each interrupt level.
Interrupt
max. 11 Cycles
Program
3 Cycles
Interrupt processing by hardware
RTI
Processing for each factor
1
Handler (pre-processing)
Interrupt
handler
5
Handler (post-processing)
6
Fig. 2-5-6 Interrupt Sequence Flow
[Nested Interrupts]
When a level interrupt occurs, nested interrupts can be prohibited by clearing IE of the PSW. However, nested
interrupts can be achieved even while processing level interrupts by setting IE to "1" during processing. However,
in order for nested interrupts to occur, the interrupts must have a higher priority than interrupt mask level IM2 to
IM0 of the PSW at that time. (The GnICR interrupt priority level LV2 to LV0 is smaller than the PSW interrupt
mask level IM2 to IM0.)
When non-maskable interrupts occur, nesting of level interrupts and non-maskable interrupts is prohibited until the
interrupt handler is finished by execution of the RTI instruction.
[Interrupt Acceptance Timing]
If an interrupt request occurs part-way through the execution of an instruction, even instructions which require
multiple execution cycles such as multiply/divide and other instructions are aborted if possible and the interrupt is
accepted. The aborted instruction is executed again after returning from interrupt processing. Aborting these
instructions sets the interrupt acceptance prohibited interval to 11 cycles or less. (The maximum interrupt prohibited
interval of 11 cycles occurs when saving or restoring all registers with the MOVM, CALL or RET instructions.
This occurs only for special cases such as task context switching.)
2-21
Page 56
CPU
[Stack Frame]
When an interrupt is accepted, a stack frame is allocated and the total 6 bytes of information in the PC and PSW are
saved in order to return from the interrupt. However, since the transfer of data across the 32-bit boundary is prohibited,
the SP value must constantly be set to a multiple of 4. Accordingly, a stack frame is allocated as shown in
Fig. 2-5-7 so that the SP value is constantly set to a multiple of 4. Ultimately, an 8-byte area with a total of 6 bytes
of information is saved.
+34n+2+1
Smaller addresses
(Rsv.)
PC (Return address)
PSW
SP (After the interrupt)
SP (Before the interrupt)
Fig. 2-5-7 Stack Frame Configuration
2-22
Page 57
3.Extension Instruction Specifications
3
Page 58
Extension Instruction Specifications
3.1Operation Extension Function
The MN1030 series 32-bit microcontrollers are provided with 32 extension instructions which can be defined by
users. This allows the desired processing to be performed at high speed for each model expansion by assigning
multiply, multiply-accumulate, saturation and other application-oriented operations to extension instructions and
connecting extension function unit via the extension operation interface of the CPU core.
Extension instructions include instructions UDF00 to UDF15 which transfer register or immediate values to the
extension function unit and load the operation results to the data register, and instructions UDF20 to UDF35 which
only transfer register to the extension function unit. Processing which performs user-defined operations is assigned
to instructions UDF00 to UDF15, and processing which only transfers data to the extension function unit is assigned
to instructions UDF20 to UDF35. Extension operations which require three or more inputs can be realized by
transferring the input data to the extension function unit beforehand using instructions UDF20 to UDF35 and then
performing the operation using instructions UDF00 to UDF15.
The block diagram showing extension function unit connected to the CPU for this series is as follows.
This microcontroller has a 32 x 16 multiplier, priority encoder, and saturation compensation unit on chip. The
extension functions that use the extension function unit are explained in section 3.2, "Extension Instructions."
Instruction
data
Program
counter
block
Instruction
address
Operation
extension block A
Instruction decoding
Register
Instruc-
tion
queue
Operand data
block
Barrel
shifter
CPU
instruction
decoder
AULU
Operand address
User
extension
instruction
decoder A
User extension
Operation extension interface
function unit
A
Fig. 3-1-1 Block Diagram of the Extension Function Unit
Operation
extension block B
User
extension
instruction
decoder B
User extension
function unit
B
......
......
......
3-2
Page 59
3.2Extension Instructions
3.2.1Explanation of Notations
The notations used to describe instruction manual are shown below.
OP:Opcode
Am, An:Address Register (m, n = 3 to 0)
Dm, Dn:Data Register (m, n = 3 to 0)
SP:Stack Pointer
imm:Immediate value (used as the general meaning)
imm8:8-bit immediate value
imm16:16-bit immediate value
imm32:32-bit immediate value
d8:8-bit displacement
d16:16-bit displacement
d32:32-bit displacement
abs16:16-bit absolute
abs32:32-bit absolute
MDR:Multiply/Divide Register (core built in)
MDRQ:High-speed multiplication register (inside Extension Function Unit)
LIR:Loop Instruction Register
LAR:Loop Address Register
PSW:Processor Status Word
PC:Program Counter
( ):Indirect addressing
See "2.4.1 Addressing Modes" for a detailed description.
regs:Multiple register operand
0x....:Hexadecimal notation (The numbers following 0x are expressed in hexadecimal notation.)
Extension Instruction Specifications
Notations used to express flag changes are listed below.
("Flag" is the general term used to refer to the lower 4 bits (V, C, N, Z) in the PSW.)
–:No flag change
+:Flag change
*:Undefined
0:Reset
1:Set
3-3
Page 60
Extension Instruction Specifications
3.2.2 Extension Block Register Set
The extension block has the following dedicated registers in which it stores the results of high-speed multiplication
operations and multiply-and-accumulate operations.
Bit 31Bit 0
Multiply Register
MDRQ
Multiply & Accumulate
Bit 31Bit 0
Register (Higher)
Multiply & Accumulate
Bit 31Bit 0
Register (Lower)
Multiply & Accumulate
Overflow Detect Flag Register
Fig. 3-2-1 Extension Block Register Set
■ Multiply register (32 bits x 1 register)
This register is provided for high-speed multiplication instructions. A multiplication instruction uses this
register to store the high-order 32 bits of the 64-bit multiplication result.
■ Multiply-and-accumulate register (higher) (32 bits x 1 register)
This register is provided for multiply-and-accumulate operation instructions. A multiply-and-accumulate
operation instruction uses this register to store the high-order 32 bits of the 64-bit multiply-and-accumulate
operation result.
■ Multiply-and-accumulate register (lower) (32 bits x 1 register)
This register is provided for multiply-and-accumulate operation instructions. A multiply-and-accumulate
operation instruction uses this register to store the low-order 32 bits of the 64-bit multiply-and-accumulate
operation result.
MCRH
MCRL
Bit 0
MCVF
■ Multiply-and-accumulate overflow detect flag register (1 bit x 1 register)
This one-bit register is set when an overflow occurs in a multiply-and-accumulate operation. This flag is
not cleared until the next CLRMAC instruction or PUTCX instruction is executed.
3-4
Page 61
3.2.3Extension Instruction Details
PUTX (Register transfer instruction for high-speed multiplication: Load)
[Instruction Format (Macro Name)]
PUTX Dm
[Assembler Mnemonic]
udf20 Dm, Dm
[Operation]
The contents of Dm are transferred to the high-speed multiply register MDRQ.
[Flag Changes]
FlagChangeCondition
V–
C–
N–
Z–
Extension Instruction Specifications
[Programming Cautions]
When "udf20 Dm, Dn" is operated, Dn is ignored.
3-5
Page 62
Extension Instruction Specifications
PUTCX (Register transfer instruction for multiply-and-accumulate operation: Load)
[Instruction Format (Macro Name)]
PUTCXDm, Dn
[Assembler Mnemonic]
udf21Dm, Dn
[Operation]
This instruction transfers the contents of Dm to the multiply-and-accumulate register MCRH.
This instruction also transfers the contents of Dn to the multiply-and-accumulate register MCRL.
The contents of the V flag are set in the multiply-and-accumulate overflow detect register MCVF.
[Flag Changes]
FlagChangeCondition
V–
C–
N–
Z–
3-6
Page 63
GETX (Register transfer instruction for high-speed multiplication: Store)
[Instruction Format (Macro Name)]
GETX Dn
[Assembler Mnemonic]
udf15 Dn, Dn
[Operation]
The contents of the high-speed multiply register MDRQ are transferred to Dn.
[Flag Changes]
FlagChangeCondition
V0Always 0
C0Always 0
N+1 when MSB of the transfer results is 1; 0 in all other cases
Z+1 when the transfer results are 0; 0 in all other cases
Extension Instruction Specifications
[Programming Cautions]
There is a one-instruction delay in the updating of the PSW to reflect flag changes.
However, the Bcc and Lcc instructions can evaluate the flags without waiting for the flag changes to be reflected in
the PSW.
When "udf15 Dm, Dn" is operated, Dm is ignored.
The operations of "udf15 imm8, Dn", "udf15 imm16, Dn" and "udf15 imm32, Dn" are not assured. In addition, a
system error interrupt does not occur in these cases.
3-7
Page 64
Extension Instruction Specifications
GETCHX (Register high-order 32-bit transfer instruction for multiply-and-accumulate operation: Store)
[Instruction Format (Macro Name)]
GETCHX Dn
[Assembler Mnemonic]
udf12 Dn, Dn
[Operation]
This instruction transfers the contents of the multiply-and-accumulate register MCRH to Dn.
The content of the multiply-and-accumulate overflow detect register MCVF is set in the V flag.
[Flag Changes]
When multiply-and-accumulate operation overflow was not detected (MCVF = 0)
FlagChangeCondition
V0Indicates that the multiply-and-accumulate operation is valid.
C0Always 0
N*Undefined
Z*Undefined
When multiply-and-accumulate operation overflow was detected (MCVF = 1)
FlagChangeCondition
V1Indicates that the multiply-and-accumulate operation is invalid.
C0Always 0
N*Undefined
Z*Undefined
[Programming Cautions]
There is a one-instruction delay in the updating of the PSW to reflect flag changes.
However, the Bcc and Lcc instructions can evaluate the flags without waiting for the flag changes to be reflected in
the PSW.
When "udf12 Dm, Dn" is operated, Dm is ignored.
The operations of "udf12 imm8, Dn", "udf12 imm16, Dn" and "udf12 imm32, Dn" are not assured. In addition, a
system error interrupt does not occur in these cases.
3-8
Page 65
Extension Instruction Specifications
GETCLX (Register low-order 32-bit transfer instruction for multiply-and-accumulate operation: Store)
[Instruction Format (Macro Name)]
GETCLX Dn
[Assembler Mnemonic]
udf13 Dn, Dn
[Operation]
This instruction transfers the contents of the multiply-and-accumulate register MCRL to Dn.
The contents of the multiply-and-accumulate overflow detect register MCVF are set in the V flag.
[Flag Changes]
When multiply-and-accumulate operation overflow was not detected (MCVF = 0)
FlagChangeCondition
V0Indicates that the multiply-and-accumulate operation is valid.
C0Always 0
N*Undefined
Z*Undefined
When multiply-and-accumulate operation overflow was detected (MCVF = 1)
FlagChangeCondition
V1Indicates that the multiply-and-accumulate operation is invalid.
C0Always 0
N*Undefined
Z*Undefined
[Programming Cautions]
There is a one-instruction delay in the updating of the PSW to reflect flag changes.
However, the Bcc and Lcc instructions can evaluate the flags without waiting for the flag changes to be reflected in
the PSW.
When "udf13 Dm, Dn" is operated, Dm is ignored.
The operations of "udf13 imm8, Dn", "udf13 imm16, Dn" and "udf13 imm32, Dn" are not assured. In addition, a
system error interrupt does not occur in these cases.
3-9
Page 66
Extension Instruction Specifications
CLRMAC (Register clear instruction for multiply-and-accumulate operation)
[Instruction Format (Macro Name)]
CLRMAC
[Assembler Mnemonic]
udf22 D0, D0
[Operation]
This instruction clears the contents of the multiply-and-accumulate registers MCRH and MCRL.
This instruction also clears the contents of the multiply-and-accumulate overflow detect register MCVF.
[Flag Changes]
FlagChangeCondition
V–
C–
N–
Z–
[Programming Cautions]
When "udf22 Dm, Dn" is operated, Dm and Dn are ignored.
3-10
Page 67
Extension Instruction Specifications
MULQ (Signed high-speed multiplication instruction: between registers)
[Instruction Format (Macro Name)]
MULQ Dm, Dn
[Assembler Mnemonic]
udf00 Dm, Dn
[Operation]
This instruction performs multiplication quickly using the multiplier of the extension function unit.
The contents of Dm (signed 32-bit integer: multiplicand) and Dn (signed 32-bit integer: multiplier) are multiplied,
and the upper 32 bits of the results (64 bits) are written into the high-speed multiply register MDRQ and the lower
32 bits into Dn.
The significant value range of the multiplicand stored in Dm before the operation is judged (starting point: LSB,
judgment unit: 2 bytes), and the operation is only performed for the range containing these significant values. In
other words, the smaller the absolute value of the contents stored in Dm, the quicker operation results can be
obtained.
[Flag Changes]
FlagChangeCondition
V*Undefined
C*Undefined
N+1 when MSB of the lower 32 bits of the results is 1; 0 in all other cases
Z+1 when the lower 32 bits of results are 0; 0 in all other cases
[Programming Cautions]
PSW updating by flag changes is delayed by one instruction.
However, Bcc and Lcc instructions can evaluate flags without waiting for flag reflection to PSW.
3-11
Page 68
Extension Instruction Specifications
MULQI (Signed high-speed multiplication instruction: between immediate value and register)
[Instruction Format (Macro Name)]
MULQI imm, Dn
[Assembler Mnemonic]
udf00 imm8, Dn :imm8 is sign-extended
udf00 imm16, Dn :imm16 is sign-extended
udf00 imm32, Dn
[Operation]
This instruction performs multiplication quickly using the multiplier of the extension function unit.
The 32-bit data obtained by sign-extending imm (multiplicand) and the contents of Dn (signed 32-bit integer:
multiplier) are multiplied, and the upper 32 bits of the results (64 bits) are written into the high-speed multiply
register MDRQ and the lower 32 bits into Dn.
The significant value range of the multiplicand stored in imm before the operation is judged (starting point: LSB,
judgment unit: 2 bytes), and the operation is only performed for the range containing these significant values. In
other words, if the number of imm bits is “16” or less, the operation results will be derived faster.
[Flag Changes]
FlagChangeCondition
V*Undefined
C*Undefined
N+1 when MSB of the lower 32 bits of the results is 1; 0 in all other cases
Z+1 when the lower 32 bits of results are 0; 0 in all other cases
[Programming Cautions]
PSW updating by flag changes is delayed by one instruction.
However, Bcc and Lcc instructions can evaluate flags without waiting for flag reflection to PSW.
3-12
Page 69
Extension Instruction Specifications
MULQU (Unsigned high-speed multiplication instruction: between registers)
[Instruction Format (Macro Name)]
MULQU Dm, Dn
[Assembler Mnemonic]
udf01 Dm, Dn
[Operation]
This instruction performs multiplication quickly using the multiplier of the extension function unit.
The contents of Dm (unsigned 32-bit integer: multiplicand) and Dn (unsigned 32-bit integer: multiplier) are multiplied,
and the upper 32 bits of the results (64 bits) are written into the high-speed multiply register MDRQ and the lower
32 bits into Dn.
The significant value range of the multiplicand stored in Dm before the operation is judged (starting point: LSB,
judgment unit: 2 bytes), and the operation is only performed for the range containing these significant values. In
other words, the smaller the contents stored in Dm, the quicker operation results can be obtained.
[Flag Changes]
FlagChangeCondition
V*Undefined
C*Undefined
N+1 when MSB of the lower 32 bits of the results is 1; 0 in all other cases
Z+1 when the lower 32 bits of results are 0; 0 in all other cases
[Programming Cautions]
PSW updating by flag changes is delayed by one instruction.
However, Bcc and Lcc instructions can evaluate flags without waiting for flag reflection to PSW.
3-13
Page 70
Extension Instruction Specifications
MULQIU (Unsigned high-speed multiplication instruction: between immediate value and register)
[Instruction Format (Macro Name)]
MULQIU imm, Dn
[Assembler Mnemonic]
udfu01 imm8, Dn :imm8 is zero-extended
udfu01 imm16, Dn :imm16 is zero-extended
udfu01 imm32, Dn
[Operation]
This instruction performs multiplication quickly using the multiplier of the extension function unit.
The 32-bit data obtained by zero-extending imm (multiplicand) and the contents of Dn (unsigned 32-bit integer:
multiplier) are multiplied, and the upper 32 bits of the results (64 bits) are written into the high-speed multiply
register MDRQ and the lower 32 bits into Dn.
The significant value range of the multiplicand stored in imm before the operation is judged (starting point: LSB,
judgment unit: 2 bytes), and the operation is only performed for the range containing these significant values. In
other words, if the number of imm bits is “16” or less, the operation results will be derived faster.
[Flag Changes]
FlagChangeCondition
V*Undefined
C*Undefined
N+1 when MSB of the lower 32 bits of the results is 1; 0 in all other cases
Z+1 when the lower 32 bits of results are 0; 0 in all other cases
[Programming Cautions]
PSW updating by flag changes is delayed by one instruction.
However, Bcc and Lcc instructions can evaluate flags without waiting for flag reflection to PSW.
3-14
Page 71
Extension Instruction Specifications
MAC (Signed multiply-and-accumulate operation instruction: between registers)
[Instruction Format (Macro Name)]
MAC Dm, Dn
[Assembler Mnemonic]
udf28 Dm, Dn
[Operation]
This instruction performs the multiply-and-accumulate operation using the multiplier and adder in the extension
function unit.
The instruction multiplies the contents of Dm (signed 32-bit integer: multiplicand) by the contents of Dn (signed
32-bit integer: multiplier), it adds the product obtained by this multiplication to the cumulative sum (64 bits) of the
upper 32 bits and lower 32 bits stored in the respective multiply-and-accumulate registers MCRH and MCRL, and
it then stores the upper 32 bits of the result (64 bits) in the multiply-and-accumulate register MCRH and the lower
32 bits in the multiply-and-accumulate register MCRL.
If an overflow from the 64-bit cumulative sum data is generated when the product is added to the cumulative sum,
multiply-and-accumulate overflow detection flag 1 is output to register MCVF.
[Flag Changes]
FlagChangeCondition
V–
C–
N–
Z–
[Programming Cautions]
A non-extension instruction that consumes at least two cycles must be inserted between this instruction and the next
extension instruction.
3-15
Page 72
Extension Instruction Specifications
MACH (Signed half word data multiply-and-accumulate operation instruction: between registers)
[Instruction Format (Macro Name)]
MACH Dm, Dn
[Assembler Mnemonic]
udf30Dm, Dn
[Operation]
This instruction performs the multiply-and-accumulate operation using the multiplier and adder in the extension
function unit.
The instruction multiplies the contents of Dm (signed 16-bit integer: multiplicand) by the contents of Dn (signed
16-bit integer: multiplier), it adds the product obtained by this multiplication to the cumulative sum (64 bits) of the
upper 32 bits and lower 32 bits stored in the respective multiply-and-accumulate registers MCRH and MCRL, and
it then stores the upper 32 bits of the result (64 bits) in the multiply-and-accumulate register MCRH and the lower
32 bits in the multiply-and-accumulate register MCRL.
If an overflow from the 64-bit cumulative sum data is generated when the product is added to the cumulative sum,
multiply-and-accumulate overflow detection flag 1 is output to register MCVF.
[Flag Changes]
FlagChangeCondition
V–
C–
N–
Z–
[Programming Cautions]
A non-extension instruction that consumes at least one cycle must be inserted between this instruction and the next
extension instruction.
3-16
Page 73
Extension Instruction Specifications
MACB (Signed byte data multiply-and-accumulate operation instruction: between registers)
[Instruction Format (Macro Name)]
MACB Dm, Dn
[Assembler Mnemonic]
udf32 Dm, Dn
[Operation]
This instruction performs the multiply-and-accumulate operation using the multiplier and adder in the extension
function unit.
The instruction multiplies the contents of Dm (signed 8-bit integer: multiplicand) by the contents of Dn (signed
8-bit integer: multiplier), adds the resulting product to the 32-bit cumulative sum that is stored in the multiply-andaccumulate register MCRL, and then stores the new resulting 32-bit cumulative sum back in multiply-and-accumulate
register MCRL.
If an overflow from the 32-bit cumulative sum data is generated when the product is added to the cumulative sum,
multiply-and-accumulate overflow detection flag 1 is output to register MCVF.
[Flag Changes]
FlagChangeCondition
V–
C–
N–
Z–
[Programming Cautions]
A non-extension instruction that consumes at least one cycle must be inserted between this instruction and the next
extension instruction.
3-17
Page 74
Extension Instruction Specifications
MACU (Unsigned multiply-and-accumulate operation instruction: between registers)
[Instruction Format (Macro Name)]
MACU Dm, Dn
[Assembler Mnemonic]
udf29Dm, Dn
[Operation]
This instruction performs the multiply-and-accumulate operation using the multiplier and adder in the extension
function unit.
The instruction multiplies the contents of Dm (unsigned 32-bit integer: multiplicand) by the contents of Dn (unsigned
32-bit integer: multiplier), it adds the product obtained by this multiplication to the cumulative sum (64 bits) of the
upper 32 bits and lower 32 bits stored in the respective multiply-and-accumulate registers MCRH and MCRL, and
it then stores the upper 32 bits of the result (64 bits) in the multiply-and-accumulate register MCRH and the lower
32 bits in the multiply-and-accumulate register MCRL.
If an overflow from the 64-bit cumulative sum data is generated when the product is added to the cumulative sum,
multiply-and-accumulate overflow detection flag 1 is output to register MCVF.
[Flag Changes]
FlagChangeCondition
V–
C–
N–
Z–
[Programming Cautions]
A non-extension instruction that consumes at least two cycles must be inserted between this instruction and the next
extension instruction.
3-18
Page 75
Extension Instruction Specifications
MACHU (Unsigned half word data multiply-and-accumulate operation instruction: between registers)
[Instruction Format (Macro Name)]
MACHU Dm, Dn
[Assembler Mnemonic]
udf31 Dm, Dn
[Operation]
This instruction performs the multiply-and-accumulate operation using the multiplier and adder in the extension
function unit.
The instruction multiplies the contents of Dm (unsigned 16-bit integer: multiplicand) by the contents of Dn (unsigned
16-bit integer: multiplier), it adds the product obtained by this multiplication to the cumulative sum (64 bits) of the
upper 32 bits and lower 32 bits stored in the respective multiply-and-accumulate registers MCRH and MCRL, and
it then stores the upper 32 bits of the result (64 bits) in the multiply-and-accumulate register MCRH and the lower
32 bits in the multiply-and-accumulate register MCRL.
If an overflow from the 64-bit cumulative sum data is generated when the product is added to the cumulative sum,
multiply-and-accumulate overflow detection flag 1 is output to register MCVF.
[Flag Changes]
FlagChangeCondition
V–
C–
N–
Z–
[Programming Cautions]
A non-extension instruction that consumes at least one cycle must be inserted between this instruction and the next
extension instruction.
3-19
Page 76
Extension Instruction Specifications
MACBU (Unsigned byte data multiply-and-accumulate operation instruction: between registers)
[Instruction Format (Macro Name)]
MACBU Dm, Dn
[Assembler Mnemonic]
udf33Dm, Dn
[Operation]
This instruction performs the multiply-and-accumulate operation using the multiplier and adder in the extension
function unit.
The instruction multiplies the contents of Dm (unsigned 8-bit integer: multiplicand) by the contents of Dn (unsigned
8-bit integer: multiplier), adds the resulting product to the 32-bit cumulative sum that is stored in the multiply-andaccumulate register MCRL, and then stores the new resulting 32-bit cumulative sum back in multiply-and-accumulate
register MCRL.
If an overflow from the 32-bit cumulative sum data is generated when the product is added to the cumulative sum,
multiply-and-accumulate overflow detection flag 1 is output to register MCVF.
[Flag Changes]
FlagChangeCondition
V–
C–
N–
Z–
[Programming Cautions]
A non-extension instruction that consumes at least one cycle must be inserted between this instruction and the next
extension instruction.
3-20
Page 77
Extension Instruction Specifications
SAT16 (16-bit saturation operation instruction)
[Instruction Format (Macro Name)]
SAT16 Dm, Dn
[Assembler Mnemonic]
udf04 Dm, Dn
[Operation]
When Dm is a 16-bit signed number which is the maximum positive value (0x00007fff) or more, the maximum
positive value (0x00007fff) is written into Dn. When Dm is a 16-bit signed number which is the maximum negative
value (0xffff8000) or less, the maximum negative value (0xffff8000) is stored in Dn. In all other cases, the contents
of Dm are written into Dn.
[Flag Changes]
FlagChangeCondition
V*Undefined
C*Undefined
N+1 when MSB of the operation results is 1; 0 in all other cases
Z+1 when the operation results are 0; 0 in all other cases
[Programming Cautions]
PSW updating by flag changes is delayed by one instruction.
However, Bcc and Lcc instructions can evaluate flags without waiting for flag reflection to PSW.
The operations of "udf04 imm8, Dn", "udf04 imm16, Dn" and "udf04 imm32, Dn" are not assured. In addition, a
system error interrupt does not occur in these cases.
3-21
Page 78
Extension Instruction Specifications
SAT24 (24-bit saturation operation instruction)
[Instruction Format (Macro Name)]
SAT24 Dm, Dn
[Assembler Mnemonic]
udf05 Dm, Dn
[Operation]
When Dm is a 24-bit signed number which is the maximum positive value (0x007fffff) or more, the maximum
positive value (0x007fffff) is written into Dn. When Dm is a 24-bit signed number which is the maximum negative
value (0xff800000) or less, the maximum negative value (0xff800000) is written into Dn. In all other cases, the
contents of Dm are written into Dn.
[Flag Changes]
FlagChangeCondition
V*Undefined
C*Undefined
N+1 when MSB of the operation results is 1; 0 in all other cases
Z+1 when the operation results are 0; 0 in all other cases
[Programming Cautions]
PSW updating by flag changes is delayed by one instruction.
However, Bcc and Lcc instructions can evaluate flags without waiting for flag reflection to PSW.
The operations of "udf05 imm8, Dn", "udf05 imm16, Dn" and "udf05 imm32, Dn" are not assured. In addition, a
system error interrupt does not occur in these cases.
udf02 Dm, Dn
udf02 imm8, Dn: Only 0x20, 0x10, and 0x08 are valid as values for imm8
[Operation]
This instruction sets the contents of the multiply-and-accumulate operation overflow detect register MCVF in the V
flag. In addition, depending on the value of Dm or imm8, the following operations are performed.
(1) When the value of Dm or imm8 is 32 (0x00000020)
When the 64-bit result of the multiply-and-accumulate operation that is stored in the multiply-and-accumulate
registers MCRH and MCRL is equal to or greater than the maximum positive value for a 32-bit signed numeric
value (0x000000007fffffff), the maximum positive value (0x7fffffff) is stored in Dn. If the value stored in the
multiply-and-accumulate registers MCRH and MCRL is equal to or less than the maximum negative value for a 32bit signed numeric value (0xffffffff80000000), the maximum negative value (0x80000000) is stored in Dn. In all
other cases, the contents of MCRL are stored in Dn.
(2) When the value of Dm or imm8 is 16 (0x00000010)
When the 64-bit result of the multiply-and-accumulate operation that is stored in the multiply-and-accumulate
registers MCRH and MCRL is equal to or greater than the maximum positive value for a 16-bit signed numeric
value (0x0000000000007fff), the maximum positive value (0x00007fff) is stored in Dn. If the value stored in the
multiply-and-accumulate registers MCRH and MCRL is equal to or less than the maximum negative value for a 16bit signed numeric value (0xffffffffffff8000), the maximum negative value (0xffff8000) is stored in Dn. In all other
cases, the contents of MCRL are stored in Dn.
(3) When the value of Dm or imm8 is 8 (0x00000008)
When the 32-bit result of the multiply-and-accumulate operation that is stored in the multiply-and-accumulate
register MCRL is equal to or greater than the maximum positive value for an 8-bit signed numeric value (0x0000007f),
the maximum positive value (0x7f) is stored in Dn. If the value stored in the multiply-and-accumulate register
MCRL is equal to or less than the maximum negative value for an 8-bit signed numeric value (0xffffff80), the
maximum negative value (0x80) is stored in Dn. In all other cases, the contents of MCRL are stored in Dn.
(4) When the value of Dm or imm8 is any other value
The value in Dn is undefined.
3-23
Page 80
Extension Instruction Specifications
[Flag Changes]
When multiply-and-accumulate operation overflow was not detected (MCVF = 0)
FlagChangeCondition
V0Indicates that the multiply-and-accumulate operation is valid.
C0Always 0
N*Undefined
Z*Undefined
When multiply-and-accumulate operation overflow was detected (MCVF = 1)
FlagChangeCondition
V1Indicates that the multiply-and-accumulate operation is invalid.
C0Always 0
N*Undefined
Z*Undefined
[Programming Cautions]
There is a one-instruction delay in the updating of the PSW to reflect flag changes.
However, the Bcc and Lcc instructions can evaluate the flags without waiting for the flag changes to be reflected in
the PSW.
The operations of "udf02 imm16, Dn" and "udf02 imm32, Dn" are not assured. In addition, a system error interrupt
does not occur in these cases.
When the 32-bit result of the multiply-and-accumulate operation that is stored in the multiply-and-accumulate
register MCRL is equal to or greater than the maximum positive value for a 9-bit signed numeric value (0x000000ff),
the maximum positive value (0xff) is stored in Dn. If the value stored in the multiply-and-accumulate register
MCRL is equal to or less than the negative value for a 32-bit signed numeric value (0x00000000), the 0 (0x00) is
stored in Dn. In all other cases, the contents of MCRL are stored in Dn.
This instruction sets the contents of the multiply-and-accumulate operation overflow detect register MCVF in the
V flag.
[Flag Changes]
When multiply-and-accumulate operation overflow was not detected (MCVF = 0)
FlagChangeCondition
V0Indicates that the multiply-and-accumulate operation is valid.
C0Always 0
N*Undefined
Z*Undefined
When multiply-and-accumulate operation overflow was detected (MCVF = 1)
FlagChangeCondition
V1Indicates that the multiply-and-accumulate operation is invalid.
C0Always 0
N*Undefined
Z*Undefined
[Programming Cautions]
There is a one-instruction delay in the updating of the PSW to reflect flag changes.
However, the Bcc and Lcc instructions can evaluate the flags without waiting for the flag changes to be reflected in
the PSW.
When "udf03 Dm, Dn" is operated, Dm is ignored.
The operations of "udf03 imm8, Dn", "udf03 imm16, Dn" and "udf03 imm32, Dn" are not assured. In addition, a
system error interrupt does not occur in these cases.
When the 64-bit result of the multiply-and-accumulate operation that is stored in the multiply-and-accumulate
registers MCRH and MCRL is equal to or greater than the maximum positive value for a 48-bit signed numeric
value (0x00007fffffffffff), the maximum positive value (0x00007fffffffffff) is output and bits 47 through bits 16 of
that output are stored in Dn. If the value stored in the multiply-and-accumulate registers MCRH and MCRL is
equal to or less than the maximum negative value for a 48-bit signed numeric value (0xffff800000000000), the
maximum negative value (0xffff800000000000) is output and bits 47 through bits 16 of that output are stored in
Dn. In all other cases, the contents of MCRH and MCRL are output and bits 47 through bits 16 of that output are
stored in Dn.
This instruction sets the contents of the multiply-and-accumulate operation overflow detect register MCVF in the
V flag.
[Flag Changes]
When multiply-and-accumulate operation overflow was not detected (MCVF = 0)
FlagChangeCondition
V0Indicates that the multiply-and-accumulate operation is valid.
C0Always 0
N*Undefined
Z*Undefined
When multiply-and-accumulate operation overflow was detected (MCVF = 1)
FlagChangeCondition
V1Indicates that the multiply-and-accumulate operation is invalid.
C0Always 0
N*Undefined
Z*Undefined
[Programming Cautions]
There is a one-instruction delay in the updating of the PSW to reflect flag changes.
However, the Bcc and Lcc instructions can evaluate the flags without waiting for the flag changes to be reflected in
the PSW.
When "udf06 Dm, Dn" is operated, Dm is ignored.
The operations of "udf06 imm8, Dn", "udf06 imm16, Dn" and "udf06 imm32, Dn" are not assured. In addition, a
system error interrupt does not occur in these cases.
3-26
Page 83
Extension Instruction Specifications
BSCH (Bit search instruction)
[Instruction Format (Macro Name)]
BSCH Dm, Dn
[Assembler Mnemonic]
udf07 Dm, Dn
[Operation]
Bit search is performed within the bit string of the 32 bits contained in Dm from the bit position of the bit number
indicated by the contents of Dn - 1 in the direction that the bit number becomes smaller. The bit number of the first
bit position where a "1" is found is written into Dn.
When the contents of the lower 5 bits of Dn are 0, bit search is performed from bit 31 in the direction that the bit
number becomes smaller.
If search is performed up to the bit position of bit 0 without finding a "1", the C flag is set, Dn is set to 0x00000000,
and instruction execution ends.
When instruction execution starts, the upper 27 bits of Dn are ignored.
Dn before executionDn after execution
Bit 31Bit 0
MSBLSB
Search direction
Search range
[Flag Changes]
When search was successful ("1" was found)
FlagChangeCondition
V*Undefined
C0This indicates that search was successful.
N*Undefined
Z*Undefined
When search failed ("1" was not found)
FlagChangeCondition
V*Undefined
C1This indicates that search failed.
N*Undefined
Z*Undefined
10000000000000000
[Programming Cautions]
PSW updating by flag changes is delayed by one instruction.
However, Bcc and Lcc instructions can evaluate flags without waiting for flag reflection to PSW.
The operations of "udf07 imm8, Dn", "udf07 imm16, Dn" and "udf07 imm32, Dn" are not assured. In addition, a
system error interrupt does not occur in these cases.
3-27
Page 84
Extension Instruction Specifications
SWAP (Data swapping instruction that swaps bytes [high-order to low-order and vice versa] in four-byte data)
[Instruction Format (Macro Name)]
SWAPDm, Dn
[Assembler Mnemonic]
udf08Dm, Dn
[Operation]
This instruction swaps the positions of the high-order and low-order 8-bit bytes within the respective high- and
low-order 16-bit half-words within the 32-bit data stored in Dm, and then swaps the positions of the high-order and
low-order 16-bit half-words, and then stores the result in Dn. As a result, bits 31 through 24 of Dm are stored in bits
7 through 0 in Dn, bits 23 through 16 of Dm are stored in bits 15 through 8 in Dn, bits 15 through 8 of Dm are stored
in bits 23 through 16 in Dn, and bits 7 through 0 of Dm are stored in bits 31 through 24 in Dn.
Dm before execution
Bit 31
Dm[31:24]
Dm[23:16]Dm[15:8]Dm[7:0]
Bit 0
MSB
Dn after execution
Bit 31Bit 0
Dm[7:0]Dm[15:8]Dm[23:16]Dm[31:24]
MSB
The sample of execution
Before execution:0x12345678
After execution:0x78563412
LSB
LSB
3-28
Page 85
Extension Instruction Specifications
[Flag Changes]
FlagChangeCondition
V*Undefined
C*Undefined
N*Undefined
Z*Undefined
[Programming Cautions]
PSW updating by flag changes is delayed by one instruction.
However, Bcc and Lcc instructions can evaluate flags without waiting for flag reflection to PSW.
The operations of "udf08 imm8, Dn", "udf08 imm16, Dn" and "udf08 imm32, Dn" are not assured. In addition, a
system error interrupt does not occur in these cases.
3-29
Page 86
Extension Instruction Specifications
SWAPH (Data swapping instruction [high-order to low-order and vice versa] in two-byte data)
[Instruction Format (Macro Name)]
SWAPH Dm, Dn
[Assembler Mnemonic]
udf09Dm, Dn
[Operation]
This instruction swaps bits 15 through 8 of Dm with bits 7 through 0, and bits 31 through 24 with bits 23 through
16, and then stores the result in Dn.
Dm before execution
Bit 31
Dm[31:24]
Dm[23:16]Dm[15:8]Dm[7:0]
Bit 0
MSB
Dn after execution
Bit 31
Dm[7:0]Dm[15:8]Dm[23:16]Dm[31:24]
MSB
The sample of execution
Before execution:0x12345678
After execution:0x34127856
[Flag Changes]
FlagChangeCondition
V*Undefined
C*Undefined
N*Undefined
Z*Undefined
LSB
Bit 0
LSB
[Programming Cautions]
PSW updating by flag changes is delayed by one instruction.
However, Bcc and Lcc instructions can evaluate flags without waiting for flag reflection to PSW.
The operations of "udf09 imm8, Dn", "udf09 imm16, Dn" and "udf09 imm32, Dn" are not assured. In addition, a
system error interrupt does not occur in these cases.
3-30
Page 87
Extension Instruction Specifications
3.2.4 Programming Notes
■ Notes on instruction description
These programming notes address instruction descriptions as well as instruction placement and combinations.
Failure to heed these notes will result in misoperation. A list of these notes is shown below.
Table 3-2-1Notes on Instruction Description
Preceding instructionFollowing instruction
Word/half-word data
Multiply-and-accumulate
instruction *1
Word/half-word data
Multiply-and-accumulate
instruction *1
Byte data
Multiply-and-accumulate
instruction *2
Multiply-and-accumulate
instruction *3
(◆ For details, refer to note (e)
on page 3-36.)
Multiply-and-
accumulate
instruction *3
MCRH, MCRL
access instruction *4
MCRH, MCRL
access instruction *4
Multiply-and-
accumulate
instruction *3
High-speed
multiplication
instruction *5
Multiply-and-
accumulate
instruction *3
High-speed
multiplication
instruction *5
Placement
relationship
Following
Following
Following
Following
-
Notes
Insert at least one cycle between the
instructions
Insert at least two cycles between the
instructions
Insert at least one cycle between the
instructions
Insert at least three cycles between the
instructions
Insert at least two NOP instructions
immediately before the instructions
*1: The category “Word/half-word data multiply-and-accumulate instruction” applies to the following instructions:
MAC instruction, MACH instruction, MACU instruction, MACHU instruction
*2: The category “byte data multiply-and-accumulate instruction” applies to the following instructions:
MACB instruction, MACBU instruction
*3: The category “multiply-and-accumulate instruction” applies to the following instructions:
(a) Note on the description of word/half-word data multiply-and-accumulate instructions and multiply-and-
accumulate instructions
When executing a word/half-word data multiply-and-accumulate instruction followed by a multiply-and-accumulate
instruction, the result produced by the word/half-word data multiply-and-accumulate instruction is used in the
execution of the subsequent multiply-and-accumulate instruction. Therefore, it is essential to not initiate the
subsequent multiply-and-accumulate instruction until after the result that is required from the word/half-word data
multiply-and-accumulate instruction has been output. As a result, one cycle must be inserted between the word/
half-word data multiply-and-accumulate instruction and the subsequent multiply-and-accumulate instruction.
Multiply-and-accumulate instruction (1)
Word/half-word data
Insert one cycle
DEC
Instruction decoding
EX
Operation
MEM
WB
This note applies to the following instructions:
<Word/half-word data multiply-and-accumulate instructions>
MAC instruction, MACH instruction, MACU instruction, MACHU instruction
Multiply -and-accumulate
instruction (1) has output the
result that is required by
multiply-and-accumulate
instruction (2)
Operation
3-32
Page 89
Extension Instruction Specifications
(b) Note on the description of word/half-word data multiply-and-accumulate instructions and MCRH, MCRL
access instructions
When executing a word/half-word data multiply-and-accumulate instruction followed by an MCRH, MCRL access
instruction, the result produced by the word/half-word data multiply-and-accumulate instruction is used in the
execution of the subsequent MCRH, MCRL access instruction. Therefore, it is essential to not initiate the subsequent
MCRH, MCRL access instruction until after the result that is required from the word/half-word data multiply-andaccumulate instruction has been output. As a result, two cycles must be inserted between the word/half-word data
multiply-and-accumulate instruction and the subsequent MCRH, MCRL access instruction.
Result can be
Word/half-word data
Multiply-and-accumulate instruction
DEC
Instruction decoding
EX
Insert two cycles
MCRH, MCRL access instruction
Operation
referenced
Instruction
decoding
Operation
MEM
WB
This note applies to the following instructions:
<Word/half-word data multiply-and-accumulate instructions>
MAC instruction, MACH instruction, MACU instruction, MACHU instruction
Multiply -and- accumu late
instruction has output the result
that is required by MCRH, MCRL
access instruction
3-33
Page 90
Extension Instruction Specifications
(c) Note on the description of byte data multiply-and-accumulate instructions and MCRH, MCRL access instructions
When executing a byte data multiply-and-accumulate instruction followed by an MCRH, MCRL access instruction,
the result produced by the byte data multiply-and-accumulate instruction is used in the execution of the subsequent
MCRH, MCRL access instruction. Therefore, it is essential to not initiate the subsequent MCRH, MCRL access
instruction until after the result that is required from the byte data multiply-and-accumulate instruction has been
output. As a result, one cycle must be inserted between the byte data multiply-and-accumulate instruction and the
subsequent MCRH, MCRL access instruction.
M ulti ply- and- accu m ul ate
instruction has output the result
that is required by MCRH, MCRL
access instruction
3-34
Page 91
Extension Instruction Specifications
(d) Note on the description of multiply-and-accumulate instructions and multiply-and-accumulate instructions or
multiply-and-accumulate instructions and quick multiplication instructions
When executing a multiply-and-accumulate instruction followed by another multiply-and-accumulate instruction
or a quick multiplication instruction, at least three cycles must be inserted between the instructions. However, no
problems are encountered in the case of the instruction combinations listed in the table, or when the value of the
multiply-and-accumulate operation overflow detect register MCVF is not used.
Preceding instructionFollowing instruction
MAC or MACHMAC or MACH
MACU or MACHUMACU or MACHU
MACBMACB
MACBUMACBU
This note applies to the following instructions (except in the case of the instruction combinations listed above):
(e) Note on the description of memory access and multiply-and-accumulate instruction or high-speed multiplication
instruction
There is an error occasion - CPU hung-up - as written below, if High-speed multiplication instruction or Multiplyand-accumulate instruction is executed within 2 instructions after a memory access instruction that accesses to
internal ROM, internal peripheral I/O space or external memory space (this space is referred to as "the space other
than internal RAM" below).
However, this note is not applied in either of the following 4 conditions.
1. The Extension Instruction is not used.
PanaXSeries C compiler outputs High-speed multiplication instruction only if you use compiler option
(-mmulq). If you don't use that option, PanaXSeries C compiler never outputs Extension Instruction.
2. Only High-speed multiplication instructions are used in Extension Instructions.
3. Only Multiply-and-accumulate instructions are used in Extension Instructions.
4. Only the other extension instructions are used in Extension Instructions.
♦ In this note, "Extension Instructions" are classified into Multiply-and-accumulate instructions, High-speed
multiplication instructions and the other extension instructions.
There is an error occasion - CPU hung-up -, when "error actualizing condition" occurs after generating "error
making potential condition".
"Error making potential condition" and "Error actualizing condition" are described in details below. An "interrupt"
on this note is defined as one of level interrupts or non-maskable interrupts*.
* When ICE is used, there is error occasion as in the case of level interrupts and non-maskable interrupts.
<Error making potential condition>
Error making potential condition occurs when an interrupt is requested during instruction decoding of High-speed
multiplication instruction or Multiply-and-accumulate instruction executed after a memory access instruction that
accesses to the space other than internal RAM. Error making potential conditions are classified into the following
12 cases.
Case 1:
Instruction flow
Case 2:
Instruction flow
Memory access instruction accesses to
the space other than internal RAM
High-speed multiplication instruction
or Multiply-and-accumulate instruction
Memory access instruction accesses to
the space other than internal RAM
An 1-cycle executing instruction
The interrupt occurrence
3-36
High-speed multiplication instruction
or Multiply-and-accumulate instruction
The case where the High-speed multiplication instruction
uses 32-bit immediate value is excluded.
The interrupt occurrence
Page 93
Extension Instruction Specifications
Case 3:
Instruction flow
Memory access instruction accesses to
Branch
High-speed multiplication instruction
or Multiply-and-accumulate instruction
The interrupt
occurrence
the space other than internal RAM
Lcc instruction
The case where the High-speed multiplication instruction
uses 32-bit immediate value is excluded.
If a stack area is in the internal RAM, any error making potential condition shown on the following cases 4 to 12 is
not generated.
Case 4:
Case 5:
Instruction flow
RET instruction with stack area
outside internal RAM area
The case where the number of returned register by RET instruction is 0 or 1 is excluded.
And also the case where 2 registers are returned by RET instruction and the High-speed
multiplication instruction uses 32-bit immediate value is excluded.
Instruction flow
Branch
Branch
High-speed multiplication instruction
or Multiply-and-accumulate instruction
An 1-cycle executing instruction
The interrupt
occurrence
Case 6:
Case 7:
RET instruction with stack area
outside internal RAM area
The case where the number of returned register by RET instruction is 0, 1 or 2 is excluded.
And also the case where the High-speed multiplication instruction uses 32-bit immediate
value is excluded.
Instruction flow
RETF instruction with stack area
outside internal RAM area
The case where the number of returned register by RETF instruction is 0 is excluded.
Instruction flow
RETF instruction with stack area
outside internal RAM area
The case where the number of returned register by RETF instruction is 0 is excluded.
And also the case where the High-speed multiplication instruction uses 32-bit immediate
value is excluded.
Branch
Branch
High-speed multiplication instruction
or Multiply-and-accumulate instruction
High-speed multiplication instruction
or Multiply-and-accumulate instruction
An 1-cycle executing instruction
High-speed multiplication instruction
or Multiply-and-accumulate instruction
The interrupt
occurrence
The interrupt
occurrence
The interrupt
occurrence
Case 8:
Instruction flow
CALL instruction with stack area
outside internal RAM area
The case where the High-speed multiplication instruction uses 32-bit immediate value is excluded.
Branch
High-speed multiplication instruction
or Multiply-and-accumulate instruction
The interrupt
occurrence
3-37
Page 94
Extension Instruction Specifications
Case 9:
Instruction flow
CALLS or JSR instruction with stack area
outside internal RAM area
The case where the High-speed multiplication instruction uses 32-bit immediate value is excluded.
Case 10:
Instruction flow
TRAP instruction with stack area
outside internal RAM area
The case where the High-speed multiplication instruction uses 32-bit immediate value is excluded.
Case 11:
Case 12:
Instruction
flow
Instruction
flow
A level interrupt with stack area
outside internal RAM area
A level interrupt with stack area
outside internal RAM area
Branch
Branch
High-speed multiplication instruction
or Multiply-and-accumulate instruction
High-speed multiplication instruction
or Multiply-and-accumulate instruction
Interrupt program
High-speed multiplication instruction
or Multiply-and-accumulate instruction
Interrupt program
An 1-cycle executing instruction
The interrupt
occurrence
The interrupt
occurrence
The non-maskable
interrupt
occurrence
High-speed multiplication instruction
or Multiply-and-accumulate instruction
The non-maskable
interrupt
occurrence
The case where the High-speed multiplication instruction uses 32-bit immediate value is excluded.
<Error actualizing condition>
Error actualizing condition is generated by the first extension instruction executed in the interrupt program, or after
switching of the task. Error actualizing condition is shown below.
Extension instructions
which cause to generate
error making potential
condition
High-speed
multiplication
instruction
Multiply-and-
accumulate
instruction
First extension instruction executed after generating
High-speed multiplication
instruction
No problem
No problem
error making potential condition
Multiply-and-accumulate
instruction
Error generation
No problem
The other extension
instruction
Error generation
Error generation
The error making potential condition is cleared when there is no problem.
When the condition of use corresponds to "Error generation", it is possible to solve the error condition by inserting
the 2 NOP instructions as follows.
When the program is compiled and assembled, 2 NOP instructions are inserted on default by using the assembler
and linker V3.3R1 or later.
Instruction
flow
3-38
High-speed multiplication instruction
or Multiply-and-accumulate instruction
Instruction
flow
NOP instruction
NOP instruction
High-speed multiplication instruction
or Multiply-and-accumulate instruction
Page 95
Extension Instruction Specifications
In addition, please obey the following recommended conditions of 3 points when a program is developed by the
assembler so that this error would not occur. As for the program developed by the PanaXSeries C compiler, the
following recommended conditions are guaranteed.
1. Please use RTI instruction on a return from an interrupt.
2. Please use the value set by SETLB instruction for LIR and LAR which stores branch target of Lcc instruction.
3. Please don't execute RET instruction or RETF instruction operating the stack frame.
This note applies to the following instructions :
<Memory access instructions>
Ones of the following instructions which access to a memory.
MOV instruction, MOVBU instruction, MOVHU instruction, MOVM instruction, BSET instruction,
BCLR instruction, MOVH instruction (Only store) or MOVB instruction (Only store).
This microcontroller has a 32-bit linear address space of up to 4 Gbytes.
The address space is comprised of internal memory space built into the chip and external memory space located
outside the chip. The internal memory space can be further divided into internal data space which allows highspeed data access, internal I/O space which contains the I/O ports and control registers built into the chip, and
internal instruction space which mainly contains instructions.
Instructions can only be located in the internal instruction space within the internal memory space and in the
external memory space. Data can be located in all address spaces, and can be referenced by the MOV instruction.
Accordingly, all addressing modes can be used to access data, enabling efficient programming.
The address space differs according to the two memory modes of memory extension mode and processor mode.
For details on the address space in each memory mode, refer to Fig. 4-3-1 and Fig. 4-3-2. When using the register
indirect with displacement and register indirect with index addressing modes, make sure that the space (either the
internal instruction space, the internal data space, the internal I/O space, or the external memory space) containing
the address pointed at by the base registers (Am, An and SP) and the space containing the calculated address are the
same.
4-2
Page 99
Memory Modes
4.2Memory Mode Pin Processing
Fix the input levels for the memory mode pins (MMOD0,1) as shown in Table 4-2-1 and Fig. 4-2-1 with pull-up/
pull-down resistors.
For details on the pull-up/pull-down resistance, refer to “High-speed Serial Control Card Operation Manual”.
For details on the memory mode settings for onboard writing of flash memory in the MN1030F01K, refer to
chapter 16, “Internal Flash Memory”.
VDD
R
R'
Pull up or pull down
VDD
R
R'
MMOD0
(SDATA)
MN103001G
/MN1030F01K
MMOD1
(SCLOCK)
Fig. 4-2-1 Memory Mode Pin Connection Diagram
Note that the memory mode pins (MMOD0,1) also serve as serial interface pins for debugging and for onboard
writing of flash memory in the MN1030F01K. The memory mode pins (MMOD0 and 1) are normally input pins,
but when they are connected to the serial interface for debugging and for onboard writing of flash memory in the
MN1030F01K, they become N ch (when pulled up) or P ch (when pulled down) open drain input/output pins.
♦ Direct inquires for details on the serial interface for debugging and for onboard writing of flash memory in the
MN1030F01K to the contact indicated at the end of this manual.
4-3
Page 100
Memory Modes
4.3Description of Memory Mode
4.3.1Memory Extension Mode
The memory mode which comprises a system from both internal and external memory is called memory extension
mode. This mode enables configuration of a system where the program and data make the best use of the highspeed performance of internal memory and the large capacity of external memory. This mode is useful when the
program sizes exceed the maximum internal capacity or when locating instructions externally due to facilitate
program revisions.
Memory extension mode has memory space of up to 3 GB from addresses x'00000000 to x'BFFFFFFF. Addresses
x'00000000 to x'1FFFFFFF are the internal data space (up to 512 MB) which contains data, addresses x'20000000
to x'3FFFFFFF are the internal I/O space (up to 512 MB) which is assigned to the I/O ports and control registers,
addresses x'40000000 to x'7FFFFFFF are the internal instruction space which contains instructions and table data,
and addresses x'80000000 to x'BFFFFFFF are the external memory space (up to 1 GB).
The MN103001G has 128 Kbytes of internal instruction ROM located at x'40000000 to x'4001FFFF. The
MN103001G also has 8 Kbytes of internal data RAM located at x'00000000 to x'00001FFF.
The MN1030F01K has 256 Kbytes of internal flash memory located at x'40000000 to x'4002FFFF. The
MN1030F01K also has 8 Kbytes of internal data RAM located at x'00000000 to x'00001FFF.
Note that it is prohibited to access unmounted space of the internal data space, the internal I/O space and the
internal instruction space. When accessing the unmounted space, the operation is not assured.
x'00000000
x'20000000
x'40000000
Internal data
memory (~512 MB)
Internal I/O
(~512 MB)
Internal instruction
memory (~1 GB)
4 GB
x'80000000
External memory
(~1 GB)
x'BFFFFFFF
System reserve
region
x'FFFFFFFF
Fig. 4-3-1 Memory Space in Extension Memory Mode
4-4
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.