V850 Instruction Set Reference
V850 Instruction Set Reference
V850 Instruction Set Reference
On April 1st, 2010, NEC Electronics Corporation merged with Renesas Technology
Corporation, and Renesas Electronics Corporation took over all the business of both
companies. Therefore, although the old company name remains in this document, it is a valid
Renesas Electronics document. We appreciate your understanding.
(Note 1) “Renesas Electronics” as used in this document means Renesas Electronics Corporation and also includes its majority-
owned subsidiaries.
(Note 2) “Renesas Electronics product(s)” means any product developed or manufactured by or for Renesas Electronics.
User’s Manual
V850 FAMILY TM
32-bit Single-Chip Microcontroller
Architecture
© 1994
Printed in Japan
[MEMO]
Purchase of NEC I 2C components conveys a license under the Philips I 2C Patent Rights to use
these components in an I 2 C system, provided that the system conforms to the I 2C Standard
Specification as defined by Philips.
V800 Series, V850 Family, V850/SA1, V850/SB1, V850/SB2, V850/SF1, V850/SV1, V850E/MA1, V850E/MA2,
V850E/IA1, V850E/IA2, V850E/MS1, V850E/MS2, V851, V852, V853, and V854 are trademarks of NEC
Corporation.
Windows is a trademark or a registered trademark of Microsoft Corporation in the United States and/or
other countries.
• The information in this document is current as of March, 2001. The information is subject to change
without notice. For actual design-in, refer to the latest publications of NEC's data sheets or data
books, etc., for the most up-to-date specifications of NEC semiconductor products. Not all products
and/or types are available in every country. Please check with an NEC sales representative for
availability and additional information.
• No part of this document may be copied or reproduced in any form or by any means without prior
written consent of NEC. NEC assumes no responsibility for any errors that may appear in this document.
• NEC does not assume any liability for infringement of patents, copyrights or other intellectual property rights of
third parties by or arising from the use of NEC semiconductor products listed in this document or any other
liability arising from the use of such products. No license, express, implied or otherwise, is granted under any
patents, copyrights or other intellectual property rights of NEC or others.
• Descriptions of circuits, software and other related information in this document are provided for illustrative
purposes in semiconductor product operation and application examples. The incorporation of these
circuits, software and information in the design of customer's equipment shall be done under the full
responsibility of customer. NEC assumes no responsibility for any losses incurred by customers or third
parties arising from the use of these circuits, software and information.
• While NEC endeavours to enhance the quality, reliability and safety of NEC semiconductor products, customers
agree and acknowledge that the possibility of defects thereof cannot be eliminated entirely. To minimize
risks of damage to property or injury (including death) to persons arising from defects in NEC
semiconductor products, customers must incorporate sufficient safety measures in their design, such as
redundancy, fire-containment, and anti-failure features.
• NEC semiconductor products are classified into the following three quality grades:
"Standard", "Special" and "Specific". The "Specific" quality grade applies only to semiconductor products
developed based on a customer-designated "quality assurance program" for a specific application. The
recommended applications of a semiconductor product depend on its quality grade, as indicated below.
Customers must check the quality grade of each semiconductor product before using it in a particular
application.
"Standard": Computers, office equipment, communications equipment, test and measurement equipment, audio
and visual equipment, home electronic appliances, machine tools, personal electronic equipment
and industrial robots
"Special": Transportation equipment (automobiles, trains, ships, etc.), traffic control systems, anti-disaster
systems, anti-crime systems, safety equipment and medical equipment (not specifically designed
for life support)
"Specific": Aircraft, aerospace equipment, submersible repeaters, nuclear reactor control systems, life
support systems and medical equipment for life support, etc.
The quality grade of NEC semiconductor products is "Standard" unless otherwise expressly specified in NEC's
data sheets or data books, etc. If customers wish to use NEC semiconductor products in applications not
intended by NEC, they must contact an NEC sales representative in advance to determine NEC's willingness
to support a given application.
(Note)
(1) "NEC" as used in this statement means NEC Corporation and also includes its majority-owned subsidiaries.
(2) "NEC semiconductor products" means any semiconductor product developed or manufactured by or for
NEC (as defined above).
M8E 00. 4
Some information contained in this document may vary from country to country. Before using any NEC
product in your application, pIease contact the NEC office in your country to obtain a list of authorized
representatives and distributors. They will verify:
• Device availability
• Ordering information
• Development environment specifications (for example, specifications for third-party tools and
components, host computers, power plugs, AC supply voltages, and so forth)
• Network requirements
In addition, trademarks, registered trademarks, export restrictions, and other legal issues may also vary
from country to country.
NEC Electronics Inc. (U.S.) NEC Electronics (Germany) GmbH NEC Electronics Hong Kong Ltd.
Santa Clara, California Benelux Office Hong Kong
Tel: 408-588-6000 Eindhoven, The Netherlands Tel: 2886-9318
800-366-9782 Tel: 040-2445845 Fax: 2886-9022/9044
Fax: 408-588-6130 Fax: 040-2444580
800-729-9288 NEC Electronics Hong Kong Ltd.
NEC Electronics (France) S.A. Seoul Branch
NEC Electronics (Germany) GmbH Velizy-Villacoublay, France Seoul, Korea
Duesseldorf, Germany Tel: 01-3067-5800 Tel: 02-528-0303
Tel: 0211-65 03 02 Fax: 01-3067-5899 Fax: 02-528-4411
Fax: 0211-65 03 490
NEC Electronics (France) S.A. NEC Electronics Singapore Pte. Ltd.
NEC Electronics (UK) Ltd. Madrid Office Novena Square, Singapore
Milton Keynes, UK Madrid, Spain Tel: 253-8311
Tel: 01908-691-133 Tel: 091-504-2787 Fax: 250-3583
Fax: 01908-670-290 Fax: 091-504-2860
NEC Electronics Taiwan Ltd.
NEC Electronics Italiana s.r.l. NEC Electronics (Germany) GmbH Taipei, Taiwan
Milano, Italy Scandinavia Office Tel: 02-2719-2377
Tel: 02-66 75 41 Taeby, Sweden Fax: 02-2719-5951
Fax: 02-66 75 42 99 Tel: 08-63 80 820
Fax: 08-63 80 388 NEC do Brasil S.A.
Electron Devices Division
Guarulhos-SP, Brasil
Tel: 11-6462-6810
Fax: 11-6462-6829
J01.2
Page Description
p. 103 Modification of Table 5-10 List of Number of Instruction Execution Clock Cycles
p. 106 Modification of description in CHAPTER 6 INTERRUPTS AND EXCEPTIONS
Target Readers This manual is intended for users who wish to understand the functions of the V850 CPU
core in the V850 Family in designing systems using the products of the V850 Family.
Purpose This manual is intended for users to understand the functions of the V850 Family
Architecture described in the Organization below.
With the V850 Family, data consisting of 2 bytes is called a half-word, and data
consisting of 4 bytes is called a word.
Conventions Data significance: Higher digits on the left and lower digits on the right
Active low representation: ××× (overscore over pin or signal name)
Memory map address: Higher address on the top and lower address on the
bottom
Note: Footnote for item marked with Note in the text
Caution: Information requiring particular attention
Remark: Supplementaly information
Numeric representation: Binary ... ×××× or ××××B
Decimal ... ××××
Hexadecimal ... ××××H
Prefixes indicating the power of 2 (address space, memory capacity):
K (kilo) ... 210 = 1,024
M (mega) ... 220 = 1,0242
G (giga) ... 230 = 1,0243
Data type: Word ... 32 bits
Halfword ... 16 bits
Byte ... 8 bits
The V850 Family is a collection of NEC’s single-chip microcontrollers that have a CPU core using the RISC
microprocessor technology of the V800 SeriesTM, with on-chip ROM/RAM and peripheral I/Os, etc.
The V850 Family of microcontrollers provides a migration path to the existing NEC-original single-chip microcontroller
“78K Series”, and boasts higher cost-performance.
The V850 Family has products that incorporate the V850 and V850E CPUs, however this manual targets products
that incorporate the V850 CPU.
This chapter briefly outlines the V850 Family.
1.1 General
The V850 Family consists of single-chip microcontrollers that use a RISC microprocessor core.
The V850 Family includes the V851, V852, V853, V854, V850/SA1, V850/SB1, V850/SB2, V850/SF1, and V850/
SV1 which incorporate the V850 CPU, and the V850E/MS1TM, V850E/MS2TM, V850E/MA1TM, V850E/MA2TM, V850E/
IA1TM, V850E/IA2TM, and V850E/xxx which incorporate the V850E CPU.
The products incorporating the V850 CPU are single-chip control-system microcontrollers, and the products
incorporating the V850E CPU are single-chip microcontrollers that have enhanced external bus interface performance
and that support not only the control-system but also data processing.
Performance
Year of development
Note For details of the V850E CPU core architecture, refer to V850E/MS1 User’s Manual Architecture
(U12197E) and V850E1 User’s Manual Architecture (U14559E).
Instruction
ROM/ PC
queue
PROM/
flash 32-bit barrel
memory shifter
Multiplier Prefetch
System 16 × 16 → 32 control
register
Internal
peripheral Internal RAM
I/O
General
register ALU
32 bits × 32 Bus
control
Internal bus
CPU ································· Executes almost all instructions such as address calculation, arithmetic and logical
operation, and data transfer in one clock by using a 5-stage pipeline. Contains dedicated
hardware such as a multiplier (16 × 16 bits) and a barrel shifter (32 bits/clock) to execute
complicated instructions at high speeds.
Internal ROM ··················· ROM, EPROM, or flash memory mapped from address 00000000H. Can be accessed
by the CPU in one clock during instruction fetch.
Internal RAM ··················· RAM mapped to a space preceding address FFFFEFFFH. Can be accessed by the CPU
in one clock during data access.
Internal peripheral I/O ····· Peripheral I/O area mapped from address FFFFF000H.
BCU ································· Starts the required bus cycle based on a physical address obtained by the CPU. If the
CPU does not issue a request for starting a bus cycle, the BCU generates a prefetch
address, and prefetches an instruction code. The prefetched instruction code is loaded
to an internal instruction queue.
The register sets of the V850 Family can be classified into two types: program register sets that can be used for
general programming, and system register sets that can control the execution environment. All the registers are 32
bits wide.
31 0
r0 Zero Register
r1 Reserved for Address Generation
r2
r3 Stack Pointer (SP)
r4 Global Pointer (GP)
r5 Text Pointer (TP)
r6
r7
r8
r9
r10
r11
r12
r13
r14
r15
r16
r17
r18
r19
r20
r21
r22
r23
r24
r25
r26
r27
r28
r29
r30 Element Pointer (EP)
r31 Link pointer (LP)
PC Program Counter
Remark For detailed descriptions of r1, r3 to r5, and r31 used by the assembler and C compiler,
refer to C Compiler Package (CA850) User’s Manual.
31 24 23 1 0
PC RFU 0
The system registers control the status of the V850 Family and hold information on interrupts.
31 0
EIPC Exception/Interrupt PC
31 0
EIPC PC
31 0
EIPSW PSW
31 0
FEPC PC
31 0
FEPSW PSW
31 16 15 0
31 8 7 6 5 4 3 2 1 0
N E I S C O
PSW RFU A S Z
P P D T Y V
(2/2)
Note In the case of saturation instructions, the SAT, S, and OV flags will be set accordingly by the result of the
operation as shown in the table below. Note that the SAT flag is set to 1 only when the OV flag has been
set due to an overflow condition caused by a saturation instruction.
Operand Specification
Number System Register
LDSR STSR
0 EIPC √ √
1 EIPSW √ √
2 FEPC √ √
3 FEPSW √ √
4 ECR — √
5 PSW √ √
6 to 31 Reserved
—: Accessing prohibited
√: Accessing enabled
Reserved: Accessing registers in this range is prohibited and will lead to undefined results.
Caution When using the LDSR instruction with the EIPC and FEPC registers, only even address values
should be specified. After interrupt servicing has ended with the RETI instruction, bit 0 in the
EIPC and FEPC registers will be ignored and assumed to be zero when the PC is restored.
7 0
Data
A Address
15 87 0
Data
A+1 A Address
31 24 23 16 15 87 0
Data
7 n 0 Bit number
Byte of address A · · · · · · · · · · · · · · · · · · · · · · · ·
Data
A Address
3.2.1 Integer
With the V850 Family, an integer is expressed as a binary number of 2’s complement and is 8, 16, or 32 bits long.
Regardless of its length, bit 0 of an integer is the least significant bit. The higher the bit number, the more significant
the bit. Because 2’s complement is used, the most significant bit is used as a sign bit.
3.2.3 Bit
The V850 Family can handle 1-bit data that can take a value of 0 (cleared) or 1 (set). Bit manipulation can be
performed only on 1-byte data in the memory space in the following four ways:
• Set
• Clear
• Invert
• Test
With the V850 Family, word data to be allocated in memory must be aligned at an appropriate boundary. Therefore,
word data must be aligned at a word boundary (the lower 2 bits of the address are 0), and half-word data must be
aligned at a half-word boundary (the lowest bit of the address is 0). If data is not aligned at a boundary, the data
is accessed with the lowest bit(s) of the address (lower 2 bits in the case of word data and lowest 1 bit in the case
of half-word data) automatically masked. Byte data can be placed at any address.
Note that the process of aligning is called alignment.
The V850 Family supports a 4-GB linear address space. Both memory and I/O are mapped to this address space
(memory-mapped I/O). The V850 Family outputs 32-bit addresses to the memory and I/O. The maximum address
is 232–1.
Byte ordering is little endian. Byte data allocated at each address is defined with bit 0 as LSB and bit 7 as MSB.
In regards to multiple-byte data, the byte with the lowest address value is defined to have the LSB and the byte with
the highest address value is defined to have the MSB (little endian).
Data consisting of 2 bytes is called a half-word, and 4-byte data is called a word. In this User’s Manual, data
consisting of 2 or more bytes is illustrated as below, with the lower address shown on the right and the higher address
on the left.
7 0
A Address
15 87 0
A+1 A Address
31 24 23 16 15 87 0
The V850 Family employs a 32-bit architecture and supports a linear address space (data space) of up to 4 GB.
It supports a linear address space (program space) of up to 16 MB for instruction addressing.
Figure 4-1 shows the memory map of the V850 Family.
The capacity of the on-chip ROM and RAM depends on each product. For details, refer to the memory map section
in the User's Manual Hardware of each product.
FFFFFFFFH
Peripheral I/O
FFFFEFFFH
Internal RAM
4 GB linear
Internal ROM/PROM/
flash memory
00000000H
The CPU generates two types of addresses: instruction addresses used for instruction fetch and branch operations;
and operand addresses used for data access.
31 24 23 0
0 0 0 0 0 0 0 0 PC 0
31 22 21 0
31 24 23 0
0 0 0 0 0 0 0 0 PC 0
Memory to be manipulated
31 24 23 0
0 0 0 0 0 0 0 0 PC 0
31 9 8 0
31 24 23 0
0 0 0 0 0 0 0 0 PC 0
Memory to be manipulated
31 0
rn
31 24 23 0
0 0 0 0 0 0 0 0 PC 0
Memory to be manipulated
Remark vector: Operand that is 5-bit immediate data to specify the trap vector (00H to 1FH), and is used by
the TRAP instruction.
cccc: Operand consisting of 4-bit data used by the SETF instruction to specify the condition code.
Assigned as part of the instruction code as 5-bit immediate data by appending 1-bit 0 above
highest bit.
(a) Type 1
The address of the data memory location to be accessed is determined by adding the value in the specified
general register to the 16-bit displacement value contained in the instruction. This addressing mode applies
to instructions using the operand format disp16 [reg1].
31 0
reg1
31 16 15 0
Memory to be manipulated
(b) Type 2
The address of the data memory location to be accessed is determined by adding the value in the 32-bit
element pointer (r30) to the 7- or 8-bit displacement value contained in the instruction. This addressing mode
applies to SLD and SST instructions.
31 0
31 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 disp8
or
(Zero extension) disp7
Memory to be manipulated
31 0
reg1
31 16 15 0
Memory to be manipulated
The V850 Family has two types of instruction formats: 16-bit and 32-bit. The 16-bit instructions include binary
operation, control, and conditional branch instructions, and the 32-bit instructions include load/store, jump, and
instructions that handle 16-bit immediate data.
Some instructions have an unused field (RFU). This field is reserved for future expansion and must be fixed
to 0.
An instruction is actually stored in memory as follows:
15 11 10 5 4 0
15 11 10 5 4 0
15 11 10 7 6 4 3 0
15 11 10 7 6 5 1 0
disp/sub-opcode
15 11 10 6 5 0 31 17 16
15 11 10 5 4 0 31 16
15 11 10 5 4 0 31 17 16
disp/sub-opcode
15 14 13 11 10 5 4 0 31 16
15 11 10 5 4 0 31 27 26 21 20 16
15 13 12 11 10 5 4 0 31 27 26 21 20 16
RFU/sub-opcode RFU/immediate/vector
Load/store instructions ...................... Transfer data from memory to a register or from a register to memory.
SLD
LD
SST
ST
Arithmetic operation instructions ..... Add, subtract, multiply, divide, transfer, or compare data between regis-
ters.
MOV
MOVHI
MOVEA
ADD
ADDI
SUB
SUBR
MULH
MULHI
DIVH
CMP
SETF
Saturated operation instructions ...... Execute saturation addition or subtraction. If the result of the operation
exceeds the maximum positive value (7FFFFFFFH), 7FFFFFFFH is
returned. If the result exceeds the negative value (80000000H), 80000000H
is returned.
SATADD
SATSUB
SATSUBI
SATSUBR
Logical operation instructions .......... These instructions include logical operation instructions and shift instruc-
tions. The shift instructions include arithmetic shift and logical shift
instructions. Operands can be shifted by two or more bit positions in one
clock cycle by the universal barrel shifter.
TST
OR
ORI
AND
ANDI
XOR
XORI
NOT
SHL
SHR
SAR
Branch instructions ...................... Branch operations include unconditional branch along with conditional branch
instructions which alter the flow of control, depending on the status of
conditional flags in the PSW. Program control can be transferred to the
address specified by a branch instruction.
JMP
JR
JARL
BGT
BGE
BLT
BLE
BH
BNL
BL
BNH
BE
BNE
BV
BNV
BN
BP
BC
BNC
BZ
BNZ
BR
BSA
Bit manipulation instructions ...... Execute a logical operation to bit data in memory. Only a specified bit is
affected as a result of executing a bit manipulation instruction.
SET1
CLR1
NOT1
TST1
Special instructions ...................... These instructions are special in that they do not fall in any of the categories
of instructions described above.
LDSR
STSR
TRAP
RETI
HALT
DI
EI
NOP
Mnemonic of instruction
Meaning of instruction
Instruction format Indicates the description and operand of the instruction. The following symbols are used in
description of an operand:
Symbol Meaning
reg2 General register (mainly used as destination register. Some are also used as
source registers)
Operation Describes the function of the instruction. The following symbols are used:
Symbol Meaning
← Assignment
GR [ ] General register
SR [ ] System register
+ Add
– Subtract
|| Bit concatenation
× Multiply
÷ Divide
AND And
OR Or
XOR Exclusive Or
Symbol Meaning
Flag Indicates the flags which are altered after executing the instruction.
CY – ← Indicates that the flag is not affected.
OV 0 ← Indicates that the flag is cleared to 0.
S 1 ← Indicates that the flag is set to 1.
Z –
SAT –
Instruction List
ADD
Add
Op code 15 0
(1) rrrrr001110RRRRR
15 0
(2) rrrrr010010iiiii
Explanation (1) Adds the word data of general register reg1 to the word data of general register reg2, and
stores the result in general register reg2. The data of general register reg1 is not affected.
(2) Adds 5-bit immediate data, sign-extended to word length, to the word data of general
register reg2, and stores the result in general register reg2.
ADDI
Add Immediate
Format Format VI
Op code 15 0 31 16
rrrrr110000RRRRR iiiiiiiiiiiiiiii
Explanation Adds 16-bit immediate data, sign-extended to word length, to the word data of general register
reg1, and stores the result in general register reg2. The data of general register reg1 is not
affected.
AND
And
Format Format I
Op code 15 0
rrrrr001010RRRRR
Flag CY –
OV 0
S 1 if the result of an operation is negative; otherwise, 0.
Z 1 if the result of an operation is 0; otherwise 0.
SAT –
Explanation ANDs the word data of general register reg2 with the word data of general register reg1, and
stores the result in general register reg2. The data of general register reg1 is not affected.
ANDI
And Immediate
Format Format VI
Op code 15 0 31 16
rrrrr110110RRRRR iiiiiiiiiiiiiiii
Flag CY –
OV 0
S 0
Z 1 if the result of an operation is 0; otherwise 0.
SAT –
Explanation ANDs the word data of general register reg1 with the value of the 16-bit immediate data, zero-
extended to word length, and stores the result in general register reg2. The data of general
register reg1 is not affected.
Bcond
Branch on Condition Code
Op code 15 0
ddddd1011dddcccc
Flag CY –
OV –
S –
Z –
SAT –
Explanation Tests a condition flag specified by the instruction. Branches if a specified condition is satisfied;
otherwise, executes the next instruction. The branch destination PC holds the sum of the
current PC value and 9-bit displacement, which is 8-bit immediate shifted 1 bit and sign-
extended to word length.
Remark Bit 0 of the 9-bit displacement is masked to 0. The current PC value used for calculation is
the address of the first byte of this instruction. If the displacement value is 0, therefore, the
branch destination is this instruction itself.
Condition Code
Instruction Status of Condition Flag Branch Condition
(cccc)
Signed BGT 1111 ( (S xor OV) or Z) = 0 Greater than signed
Caution If executing a conditional branch instruction of a signed integer (BGT, BGE, BLT, or BLE) when
the SAT flag is set to 1 as a result of executing a saturated operation instruction, the branch
condition loses its meaning. In ordinary arithmetic operations, if an overflow condition occurs,
the S flag is inverted (0 → 1 or 1 → 0). This is because the result is a negative value if it exceeds
the maximum positive value and it is a positive value if it exceeds the maximum negative value.
However, when a saturated operation instruction is executed, and if the result exceeds the
maximum positive value, the result is saturated with a positive value; if the result exceeds the
maximum negative value, the result is saturated with a negative value. Unlike the ordinary
operation, therefore, the S flag is not inverted even if an overflow occurs.
Hence, the S flag of the PSW is affected differently when the instruction is a saturate operation,
as opposed to an ordinary arithmetic operation. A branch condition which is an XOR of S and
OV flags will therefore, have no meaning.
CLR1
Clear Bit
Op code 15 0 31 16
10bbb111110RRRRR dddddddddddddddd
Flag CY –
OV –
S –
Z 1 if bit NO.bit#3 of memory disp16 [reg1] = 0.
0 if bit NO.bit#3 of memory disp16 [reg1] = 1.
SAT –
Explanation Adds the data of general register reg1 to the 16-bit displacement, sign-extended to word length,
to generate a 32-bit address. Then clears the bit, specified by the bit number of 3 bits, of the
byte data referenced by the generated address. Not specified bit is not affected.
Remark The Z flag of the PSW indicates whether the specified bit was a 0 or 1 before this instruction
is executed. It does not indicate the content of the specified bit after this instruction has been
executed.
CMP
Compare
Op code 15 0
(1) rrrrr001111RRRRR
15 0
(2) rrrrr010011iiiii
Explanation (1) Compares the word data of general register reg2 with the word data of general register
reg1, and indicates the result by using the condition flags. To compare, the contents of
general register reg1 are subtracted from the word data of general register reg2. The data
of general registers reg1 and reg2 is not affected.
(2) Compares the word data of general register reg2 with 5-bit immediate data, sign-extended
to word length, and indicates the result by using the condition flags. To compare, the
contents of the sign-extended immediate data is subtracted from the word data of general
register reg2. The data of general register reg2 is not affected.
DI
Disable Interrupt
Instruction format DI
Format Format X
Op code 15 0 31 16
0000011111100000 0000000101100000
Flag CY –
OV –
S –
Z –
SAT –
ID 1
Explanation Sets the ID flag of the PSW to 1 to disable the acknowledgement of maskable interrupts during
executing this instruction.
Remark Interrupts are not sampled during execution of this instruction. The ID flag actually becomes
valid at the start of the next instruction. But because interrupts are not sampled during
instruction execution, interrupts are immediately disabled. Non-maskable interrupts (NMI) are
not affected by this instruction.
DIVH
Divide Half-Word
Format Format I
Op code 15 0
rrrrr000010RRRRR
Flag CY –
OV 1 if an overflow occurs; otherwise, 0.
S 1 if the result of an operation is negative; otherwise, 0.
Z 1 if the result of an operation is 0; otherwise, 0.
SAT –
Explanation Divides the word data of general register reg2 by the lower half-word data of general register
reg1, and stores the quotient in general register reg2. If the data is divided by 0, Overflow
occurs, and the quotient is undefined. The data of general register reg1 is not affected.
Remark The remainder is not stored. Overflow occurs when the maximum negative value (80000000H)
is divided by –1 (in which case the quotient is 80000000H) and when data is divided by 0 (in
which case the quotient is undefined).
If an interrupt occurs while this instruction is executed, division is aborted, and the interrupt is
processed. Upon returning from the interrupt, the division is restarted from the beginning, with
the return address being the address of this instruction. Also, general registers reg1 and reg2
will retain their original values prior to the start of execution.
The higher 16 bits of general register reg1 are ignored when division is executed.
EI
Enable Interrupt
Instruction format EI
Format Format X
Op code 15 0 31 16
1000011111100000 0000000101100000
Flag CY –
OV –
S –
Z –
SAT –
ID 0
Explanation Resets the ID flag of the PSW to 0 and enables the acknowledgement of maskable interrupts
beginning at the next instruction.
HALT
Halt
Operation Halts
Format Format X
Op code 15 0 31 16
0000011111100000 0000000100100000
Flag CY –
OV –
S –
Z –
SAT –
Explanation Stops the operating clock of the CPU and places the CPU in the HALT mode.
Remark The HALT mode is exited by any of the following three events:
• RESET input
• NMI input
• Maskable interrupt (when ID of PSW = 0)
If an interrupt is acknowledged during the HALT mode, the address of the following instruction
is stored in EIPC or FEPC.
JARL
Jump and Register Link
Operation GR [reg2] ← PC + 4
PC ← PC + sign-extend (disp22)
Format Format V
Op code 15 0 31 16
rrrrr11110dddddd ddddddddddddddd0
Flag CY –
OV –
S –
Z –
SAT –
Explanation Saves the current PC value plus 4 to general register reg2, adds the current PC value and 22-
bit displacement, sign-extended to word length, and transfers control to that PC. Bit 0 of the
22-bit displacement is masked to 0.
Remark The current PC value used for calculation is the address of the first byte of this instruction. If
the displacement value is 0, the branch destination is this instruction itself.
This instruction is equivalent to a call subroutine instruction, and saves the PC return address
to general register reg2. The JMP instruction, which is equivalent to a subroutine-return
instruction, can be used to specify the general register containing the return address saved
during the JARL subroutine-call instruction, to restore the program counter.
JMP
Jump Register
Operation PC ← GR [reg1]
Format Format I
Op code 15 0
00000000011RRRRR
Flag CY –
OV –
S –
Z –
SAT –
Explanation Transfers control to the address specified by general register reg1. Bit 0 of the address is
masked to 0.
Remark When using this instruction as the subroutine-return instruction, specify the general register
containing the return address saved during the JARL subroutine-call instruction, to restore the
program counter. When using the JARL instruction, which is equivalent to the subroutine-call
instruction, store the PC return address in general register reg2.
JR
Jump Relative
Format Format V
Op code 15 0 31 16
0000011110dddddd ddddddddddddddd0
Flag CY –
OV –
S –
Z –
SAT –
Explanation Adds the 22-bit displacement, sign-extended to word length, to the current PC value and stores
the value in the PC, and then transfers control to that PC. Bit 0 of the 22-bit displacement is
masked to 0.
Remark The current PC value used for the calculation is the address of the first byte of this instruction
itself. Therefore, if the displacement value is 0, the jump destination is this instruction.
LD
Load
Op code 15 0 31 16
(1) rrrrr111000RRRRR dddddddddddddddd
15 0 31 16
(2) rrrrr111001RRRRR ddddddddddddddd0
15 0 31 16
(3) rrrrr111001RRRRR ddddddddddddddd1
Flag CY –
OV –
S –
Z –
SAT –
Explanation (1) Adds the data of general register reg1 to a 16-bit displacement, sign-extended to word
length, to generate a 32-bit address. Byte data is read from the generated address, sign-
extended to word length, and then stored in general register reg2.
(2) Adds the data of general register reg1 to a 16-bit displacement sign-extended to word
length to generate a 32-bit address. Half-word data is read from this 32-bit address with
its bit 0 masked to 0, sign-extended to word length, and stored in general register reg2.
(3) Adds the data of general register reg1 to a 16-bit displacement sign-extended to word
length to generate a 32-bit address. Word data is read from this 32-bit address with bits
0 and 1 masked to 0, and stored in general register reg2.
Caution When the data of general register reg1 is added to a 16-bit displacement sign-extended to word
length, the lower bits of the result may be masked to 0 depending on the type of data to be
accessed (half word, word) to generate an address.
LDSR
Load to System Register
Format Format IX
Op code 15 0 31 16
rrrrr111111RRRRR 0000000000100000
Remark The fields used to define reg1 and reg2 are swapped in this instruction. Normally,
“RRR” is used for reg1 and is the source operand while “rrr” signifies reg2 and is
the destination operand. In this instruction, “RRR” is still the source operand, but
is represented by reg2, while “rrr” is the special register destination, as labeled
below:
rrrrr: regID specification
RRRRR: reg2 specification
Explanation Loads the word data of general register reg2 to a system register specified by the system
register number (regID). The data of general register reg2 is not affected.
Remark If the system register number (regID) is equal to 5 (PSW register), the values of the
corresponding bits of the PSW are set according to the contents of reg2. This only affects the
flag bits, the reserved bits remain at 0. Also, interrupts are not sampled when the PSW is being
written with a new value. If the ID flag is enabled with this instruction, interrupt disabling begins
at the start of execution, even though the ID flag does not become valid until the beginning of
the next instruction.
Caution The system register number regID is a number which identifies a system register. Accessing
system registers which are reserved or write-prohibited is prohibited and will lead to undefined
results.
MOV
Move
Op code 15 0
(1) rrrrr000000RRRRR
15 0
(2) rrrrr010000iiiii
Flag CY –
OV –
S –
Z –
SAT –
Explanation (1) Transfers the word data of general register reg1 to general register reg2. The data of
general register reg1 is not affected.
(2) Transfers the value of a 5-bit immediate data, sign-extended to word length, to general
register reg2.
MOVEA
Move Effective Address
Format Format VI
Op code 15 0 31 16
rrrrr110001RRRRR iiiiiiiiiiiiiiii
Flag CY –
OV –
S –
Z –
SAT –
Explanation Adds the 16-bit immediate data, sign-extended to word length, to the word data of general
register reg1, and stores the result in general register reg2. The data of general register reg1
is not affected. The flags are not affected by the addition.
Remark This instruction calculates a 32-bit address and stores the result without affecting the PSW
flags.
MOVHI
Move High Half-Word
Format Format VI
Op code 15 0 31 16
rrrrr110010RRRRR iiiiiiiiiiiiiiii
Flag CY –
OV –
S –
Z –
SAT –
Explanation Adds a word value, whose higher 16 bits are specified by the 16-bit immediate data and lower
16 bits are 0, to the word data of general register reg1 and stores the result in general register
reg2. The data of general register reg1 is not affected. The flags are not affected by the addition.
Remark This instruction is used to generate the higher 16 bits of a 32-bit address.
MULH
Multiply Half-Word
Op code 15 0
(1) rrrrr000111RRRRR
15 0
(2) rrrrr010111iiiii
Flag CY –
OV –
S –
Z –
SAT –
Explanation (1) Multiplies the lower half-word data of general register reg2 by the half-word data of general
register reg1, and stores the result in general register reg2 as word data. The data of
general register reg1 is not affected.
(2) Multiplies the lower half-word data of general register reg2 by a 5-bit immediate data, sign-
extended to half-word length, and stores the result in general register reg2.
Remark The higher 16 bits of general registers reg1 and reg2 are ignored in this operation.
MULHI
Multiply Half-Word Immediate
Format Format VI
Op code 15 0 31 16
rrrrr110111RRRRR iiiiiiiiiiiiiiii
Flag CY –
OV –
S –
Z –
SAT –
Explanation Multiplies the lower half-word data of general register reg1 by the 16-bit immediate data, and
stores the result in general register reg2. The data of general register reg1 is not affected.
Remark The higher 16 bits of general register reg1 are ignored in this operation.
NOP
No Operation
Format Format I
Op code 15 0
0000000000000000
Flag CY –
OV –
S –
Z –
SAT –
Remark The contents of the PC are incremented by two. The op code is the same as that of MOV r0,
r0.
NOT
Not
Format Format I
Op code 15 0
rrrrr000001RRRRR
Flag CY –
OV –
S 1 if the result of an operation is negative; otherwise, 0.
Z 1 if the result of an operation is 0; otherwise, 0.
SAT –
Explanation Logically negates (takes the 1’s complement of) the word data of general register reg1, and
stores the result in general register reg2. The data of general register reg1 is not affected.
NOT1
Not Bit
Op code 15 0 31 16
01bbb111110RRRRR dddddddddddddddd
Flag CY –
OV –
S –
Z 1 if bit NO.bit#3 of memory disp16 [reg1] = 0.
0 if bit NO.bit#3 of memory disp16 [reg1] = 1.
SAT –
Explanation Adds the data of general register reg1 to a 16-bit displacement, sign-extended to word length
to generate a 32-bit address. The bit, specified by the 3-bit field “bbb”, is inverted at the byte
data location referenced by the generated address. The bits other than the specified bit are
not affected.
Remark The Z flag of the PSW indicates whether the specified bit was 0 or 1 before this instruction is
executed, and does not indicate the content of the specified bit after this instruction has been
executed.
OR
Or
Format Format I
Op code 15 0
rrrrr001000RRRRR
Flag CY –
OV 0
S 1 if the result of an operation is negative; otherwise, 0.
Z 1 if the result of an operation is 0; otherwise, 0.
SAT –
Instruction OR Or
Explanation ORs the word data of general register reg2 with the word data of general register reg1, and
stores the result in general register reg2. The data of general register reg1 is not affected.
ORI
Or Immediate
Format Format VI
Op code 15 0 31 16
rrrrr110100RRRRR iiiiiiiiiiiiiiii
Flag CY –
OV 0
S 1 if the result of an operation is negative; otherwise, 0.
Z 1 if the result of an operation is 0; otherwise, 0.
SAT –
Explanation ORs the word data of general register reg1 with the value of the 16-bit immediate data, zero-
extended to word length, and stores the result in general register reg2. The data of general
register reg1 is not affected.
RETI
Return from Trap or Interrupt
Operation if PSW.EP = 1
then PC ← EIPC
PSW ← EIPSW
else if PSW.NP = 1
then PC ← FEPC
PSW ← FEPSW
else PC ← EIPC
PSW ← EIPSW
Format Format X
Op code 15 0 31 16
0000011111100000 0000000101000000
Explanation This instruction restores the restore PC and PSW from the appropriate system register and
returns from an exception or interrupt routine. The operations of this instruction are as follows:
(1) If the EP flag of the PSW is 1, the restore PC and PSW are read from the EIPC and EIPSW,
regardless of the status of the NP flag of the PSW.
If the EP flag of the PSW is 0 and the NP flag of the PSW is 1, the restore PC and PSW
are read from the FEPC and FEPSW.
If the EP flag of the PSW is 0 and the NP flag of the PSW is 0, the restore PC and PSW
are read from the EIPC and EIPSW.
(2) Once the PC and PSW are restored to the return values, control is transferred to the return
address.
Caution When restoring from an NMI or exception processing using the RETI instruction, the PSW.NP
and PSW.EP flags must be set accordingly to restore the PC and PSW:
• When returning from non-maskable interrupt processing using the RETI instruction:
PSW.NP = 1 and PSW.EP = 0
• When restoring from an exception processing using the RETI instruction:
PSW.EP = 1
Use the LDSR instruction for setting the flags.
Interrupts are not accepted in the latter half of the ID stage during LDSR execution because
of the operation of the interrupt controller.
SAR
Shift Arithmetic Right
Op code 15 0 31 16
(1) rrrrr111111RRRRR 0000000010100000
15 0
(2) rrrrr010101iiiii
Explanation (1) Arithmetically shifts the word data of general register reg2 to the right by ‘n’ positions, where
‘n’ is a value from 0 to +31, specified by the lower 5 bits of general register reg1 (after the
shift, the MSB prior to shift execution is copied and set as the new MSB value), and then
writes the result to general register reg2. If the number of shifts is 0, general register reg2
retains the same value prior to instruction execution. The data of general register reg1
is not affected.
(2) Arithmetically shifts the word data of general register reg2 to the right by ‘n’ positions, where
‘n’ is a value from 0 to +31, specified by the 5-bit immediate data, zero-extended to word
length (after the shift, the MSB prior to shift execution is copied and set as the new MSB
value), and then writes the result to general register reg2. If the number of shifts is 0,
general register reg2 retains the same value prior to instruction execution.
SATADD
Saturated Add
Op code 15 0
(1) rrrrr000110RRRRR
15 0
(2) rrrrr010001iiiii
Explanation (1) Adds the word data of general register reg1 to the word data of general register reg2, and
stores the result in general register reg2. However, if the result exceeds the maximum
positive value 7FFFFFFFH, 7FFFFFFFH is stored in reg2; if the result exceeds the
maximum negative value 80000000H, 80000000H is stored in reg2. The SAT flag is set
to 1. The data of general register reg1 is not affected.
(2) Adds a 5-bit immediate data, sign-extended to word length, to the word data of general
register reg2, and stores the result in general register reg2. However, if the result exceeds
the maximum positive value 7FFFFFFFH, 7FFFFFFFH is stored in reg2; if the result
exceeds the maximum negative value 80000000H, 80000000H is stored in reg2. The SAT
flag is set to 1.
Remark The SAT flag is a cumulative flag. Once the result of the saturated operation instruction has
been saturated, this flag is set to 1 and is not reset to 0 even if the result of the subsequent
operation is not saturated.
Even if the SAT flag is set to 1, the saturated operation instruction is executed normally.
Caution To reset the SAT flag to 0, load data to the PSW by using the LDSR instruction.
SATSUB
Saturated Subtract
Format Format I
Op code 15 0
rrrrr000101RRRRR
Explanation Subtracts the word data of general register reg1 from the word data of general register reg2,
and stores the result in general register reg2. However, if the result exceeds the maximum
positive value 7FFFFFFFH, 7FFFFFFFH is stored in reg2; if the result exceeds the maximum
negative value 80000000H, 80000000H is stored in reg2. The SAT flag is set to 1. The data
of general register reg1 is not affected.
Remark The SAT flag is a cumulative flag. Once the result of the operation of the saturated operation
instruction has been saturated, this flag is set to 1 and is not reset to 0 even if the result of the
subsequent operations is not saturated.
Even if the SAT flag is set to 1, the saturated operation instruction is executed normally.
Caution To reset the SAT flag to 0, load data to the PSW by using the LDSR instruction.
SATSUBI
Saturated Subtract Immediate
Format Format VI
Op code 15 0 31 16
rrrrr110011RRRRR iiiiiiiiiiiiiiii
Explanation Subtracts the 16-bit immediate data, sign-extended to word length, from the word data of
general register reg1, and stores the result in general register reg2. However, if the result
exceeds the maximum positive value 7FFFFFFFH, 7FFFFFFFH is stored in reg2; if the result
exceeds the maximum negative value 80000000H, 80000000H is stored in reg2. The SAT flag
is set to 1. The data of general register reg1 is not affected.
Remark The SAT flag is a cumulative flag. Once the result of the operation of the saturated operation
instruction has been saturated, this flag is set to 1 and is not reset to 0 even if the result of the
subsequent operations is not saturated.
Even if the SAT flag is set to 1, the saturated operation instruction is executed normally.
Caution To reset the SAT flag to 0, load data to the PSW by using the LDSR instruction.
SATSUBR
Saturated Subtract Reverse
Format Format I
Op code 15 0
rrrrr000100RRRRR
Explanation Subtracts the word data of general register reg2 from the word data of general register reg1,
and stores the result in general register reg2. However, if the result exceeds the maximum
positive value 7FFFFFFFH, 7FFFFFFFH is stored in reg2; if the result exceeds the maximum
negative value 80000000H, 80000000H is stored in reg2. The SAT flag is set to 1. The data
of general register reg1 is not affected.
Remark The SAT flag is a cumulative flag. Once the result of the operation of the saturated operation
instruction has been saturated, this flag is set to 1 and is not reset to 0 even if the result of the
subsequent operations is not saturated.
Even if the SAT flag is set to 1, the saturated operation instruction is executed normally.
Caution To reset the SAT flag to 0, load data to the PSW by using the LDSR instruction.
SETF
Set Flag Condition
Format Format IX
Op code 15 0 31 16
rrrrr1111110cccc 0000000000000000
Flag CY –
OV –
S –
Z –
SAT –
Explanation The general register reg2 is set to 1 if a condition specified by condition code “cccc” is satisfied;
otherwise, 0 are stored in the register. One of the codes shown in Table 5-9 should be specified
as the condition code “cccc”.
Condition Code
Condition Name Condition Expression
(cccc)
0000 V OV = 1
1000 NV OV = 0
0001 C/L CY = 1
1001 NC/NL CY = 0
0010 Z Z=1
1010 NZ Z=0
0011 NH (CY or Z) = 1
1011 H (CY or Z) = 0
0100 S/N S=1
1100 NS/P S=0
0101 T always
1101 SA SAT = 1
0110 LT (S xor OV) = 1
SET1
Set Bit
Op code 15 0 31 16
00bbb111110RRRRR dddddddddddddddd
Flag CY –
OV –
S –
Z 1 when bit NO.bit#3 of memory disp16 [reg1] = 0.
0 when bit NO.bit#3 of memory disp16 [reg1] = 1
SAT –
Explanation Adds the 16-bit displacement, sign-extended to word length, to the data of general register reg1
to generate a 32-bit address. The bit, specified by the 3-bit field “bbb”, is set at the byte data
location referenced by the generated address. The bits other than the specified bit are not
affected.
Remark The Z flag of the PSW indicates whether the specified bit was 0 or 1 before this instruction is
executed, and does not indicate the content of the specified bit after this instruction has been
executed.
SHL
Shift Logical Left
Op code 15 0 31 16
(1) rrrrr111111RRRRR 0000000011000000
15 0
(2) rrrrr010110iiiii
Explanation (1) Logically shifts the word data of general register reg2 to the left by ‘n’ positions, where ‘n’
is a value from 0 to +31, specified by the lower 5 bits of general register reg1 (0 is shifted
to the LSB side), and then writes the result to general register reg2. If the number of shifts
is 0, general register reg2 retains the same value prior to instruction execution. The data
of general register reg1 is not affected.
(2) Logically shifts the word data of general register reg2 to the left by ‘n’ positions, where ‘n’
is a value from 0 to +31, specified by the 5-bit immediate data, zero-extended to word length
(0 is shifted to the LSB side), and then writes the result to general register reg2. If the
number of shifts is 0, general register reg2 retains the value prior to instruction execution.
SHR
Shift Logical Right
Op code 15 0 31 16
(1) rrrrr111111RRRRR 0000000010000000
15 0
(2) rrrrr010100iiiii
Explanation (1) Logically shifts the word data of general register reg2 to the right by ‘n’ positions where
‘n’ is a value from 0 to +31, specified by the lower 5 bits of general register reg1 (0 is shifted
to the MSB side). This instruction then writes the result to general register reg2. If the
number of shifts is 0, general register reg2 retains the same value prior to instruction
execution. The data of general register reg1 is not affected.
(2) Logically shifts the word data of general register reg2 to the right by ‘n’ positions, where
‘n’ is a value from 0 to +31, specified by the 5-bit immediate data, zero-extended to word
length (0 is shifted to the MSB side). This instruction then writes the result to general
register reg2. If the number of shifts is 0, general register reg2 retains the same value prior
to instruction execution.
SLD
Load
Format Format IV
Op code 15 0
(1) rrrrr0110ddddddd
15 0
(2) rrrrr1000ddddddd
15 0
(3) rrrrr1010dddddd0
Flag CY –
OV –
S –
Z –
SAT –
Explanation (1) Adds the 7-bit displacement, zero-extended to word length, to the element pointer to
generate a 32-bit address. Byte data is read from the generated address, sign-extended
to word length, and stored in reg2.
(2) Adds the 8-bit displacement, zero-extended to word length, to the element pointer to
generate a 32-bit address. Half-word data is read from this 32-bit address with bit 0 masked
to 0, sign-extended to word length, and stored in reg2.
(3) Adds the 8-bit displacement, zero-extended to word length, to the element pointer to
generate a 32-bit address. Word data is read from this 32-bit address with bits 0 and 1
masked to 0, and stored in reg2.
Caution When the element pointer is added to the 8-bit displacement zero extended to word length, the
lower bits of the result may be masked to 0 depending on the type of data to be accessed (half
word, word).
SST
Store
Format Format IV
Op code 15 0
(1) rrrrr0111ddddddd
15 0
(2) rrrrr1001ddddddd
15 0
(3) rrrrr1010dddddd1
Flag CY –
OV –
S –
Z –
SAT –
Explanation (1) Adds the 7-bit displacement, zero-extended to word length, to the element pointer to
generate a 32-bit address, and stores the data of the lowest byte of reg2 at the generated
address.
(2) Adds the 8-bit displacement, zero-extended to word length, to the element pointer to
generate a 32-bit address, and stores the lower half-word data of reg2 at the generated
32-bit address with bit 0 masked to 0.
(3) Adds the 8-bit displacement, zero-extended to word length, to the element pointer to
generate a 32-bit address, and stores the word data of reg2 at the generated 32-bit address
with bits 0 and 1 masked to 0.
Caution When the element pointer is added to the 8-bit displacement zero-extended to word length, the
lower bits of the result may be masked to 0 depending on the type of data to be accessed (half
word, word).
ST
Store
Op code 15 0 31 16
(1) rrrrr111010RRRRR dddddddddddddddd
15 0 31 16
(2) rrrrr111011RRRRR ddddddddddddddd0
15 0 31 16
(3) rrrrr111011RRRRR ddddddddddddddd1
Flag CY –
OV –
S –
Z –
SAT –
Explanation (1) Adds the 16-bit displacement, sign-extended to word length, to the data of general register
reg1 to generate a 32-bit address, and stores the lowest byte data of general register reg2
at the generated address.
(2) Adds the 16-bit displacement, sign-extended to word length, to the data of general register
reg1 to generate a 32-bit address, and stores the lower half-word data of general register
reg2 at the generated 32-bit address with bit 0 masked to 0. Therefore, stored data is
automatically aligned on a half-word boundary.
(3) Adds the 16-bit displacement, sign-extended to word length, to the data of general register
reg1 to generate a 32-bit address, and stores the word data of general register reg2 at the
generated 32-bit address with bits 0 and 1 masked to 0. Therefore, stored data is
automatically aligned on a word boundary.
Caution When the data of general register reg1 is added to a 16-bit displacement sign-extended to word
length, the lower bits of the result may be masked to 0 depending on the type of data to be
accessed (half word, word) to generate an address.
STSR
Store Contents of System Register
Format Format IX
Op code 15 0 31 16
rrrrr111111RRRRR 0000000001000000
Flag CY –
OV –
S –
Z –
SAT –
Explanation Stores the contents of a system register specified by system register number (regID) in general
register reg2. The contents of the system register are not affected.
Remark The system register number regID is a number which identifies a system register. Accessing
system register which is reserved is prohibited and will lead to undefined results.
SUB
Subtract
Format Format I
Op code 15 0
rrrrr001101RRRRR
Explanation Subtracts the word data of general register reg1 from the word data of general register reg2,
and stores the result in general register reg2. The data of general register reg1 is not affected.
SUBR
Subtract Reverse
Format Format I
Op code 15 0
rrrrr001100RRRRR
Explanation Subtracts the word data of general register reg2 from the word data of general register reg1,
and stores the result in general register reg2. The data of general register reg1 is not affected.
TRAP
Software Trap
Format Format X
Op code 15 0 31 16
00000111111iiiii 0000000100000000
Flag CY –
OV –
S –
Z –
SAT –
Explanation Saves the restore PC and PSW to EIPC and EIPSW, respectively; sets the exception code
(EICC of ECR) and the flags of the PSW (EP and ID flags); jumps to the address of the trap
handler corresponding to the trap vector specified by vector number (0 to 31), and starts
exception processing. The condition flags are not affected.
The restore PC is the address of the instruction following the TRAP instruction.
TST
Test
Format Format I
Op code 15 0
rrrrr001011RRRRR
Flag CY –
OV 0
S 1 if the result of an operation is negative; otherwise, 0.
Z 1 if the result of an operation is 0; otherwise, 0.
SAT –
Explanation ANDs the word data of general register reg2 with the word data of general register reg1. The
result is not stored, and only the flags are changed. The data of general registers reg1 and
reg2 are not affected.
TST1
Test Bit
Op code 15 0 31 16
11bbb111110RRRRR dddddddddddddddd
Flag CY –
OV –
S –
Z 1 if bit NO.bit#3 of memory disp16 [reg1] = 0.
0 if bit NO.bit#3 of memory disp16 [reg1] = 1.
SAT –
Explanation Adds the data of general register reg1 to a 16-bit displacement, sign-extended to word length,
to generate a 32-bit address. Performs the test on the bit, specified by the 3-bit field “bbb”,
at the byte data location referenced by the generated address. If the specified bit is 0, the Z
flag is set to 1; if the bit is 1, the Z flag is reset to 0. The byte data, including the specified bit,
is not affected.
XOR
Exclusive Or
Format Format I
Op code 15 0
rrrrr001001RRRRR
Flag CY –
OV 0
S 1 if the result of an operation is negative; otherwise, 0.
Z 1 if the result of an operation is 0; otherwise, 0.
SAT –
Explanation Exclusively ORs the word data of general register reg2 with the word data of general register
reg1, and stores the result in general register reg2. The data of general register reg1 is not
affected.
XORI
Exclusive Or Immediate
Format Format VI
Op code 15 0 31 16
rrrrr110101RRRRR iiiiiiiiiiiiiiii
Flag CY –
OV 0
S 1 if the result of an operation is negative; otherwise, 0.
Z 1 if the result of an operation is 0; otherwise, 0.
SAT –
Explanation Exclusively ORs the word data of general register reg1 with a 16-bit immediate data, zero-
extended to word length, and stores the result in general register reg2. The data of general
register reg1 is not affected.
The number of instruction execution clock cycles differs depending on the combination of instructions. For details,
see CHAPTER 8 PIPELINE.
Table 5-10 shows a list of the number of instruction execution clock cycles.
Execution clock
Instructions Mnemonic Operand Byte
i–r–l
SATADD R, r 2 1–1–1
SATADD imm5, r 2 1–1–1
SATSUBI imm16, R, r 4 1–1–1
Execution clock
Instructions Mnemonic Operand Byte
i–r–l
AND R, r 2 1–1–1
TST R, r 2 1–1–1
SHR imm5, r 2 1–1–1
SAR R, r 4 1–1–1
SHL R, r 4 1–1–1
Branch JMP [R] 2 3–3–3
JR disp22 4 3–3–3
JARL disp22, r 4 3–3–3
Bcond disp9 When condition is satisfied 2 3–3–3
EI – 4 1–1–1
TRAP vector 4 4–4–4
HALT – 4 1–1–1
RETI – 4 4–4–4
Undefined instruction code trap 4 4–4–4
Operand
Symbol Meaning
Execution clock
Symbol Meaning
Interrupts are events that occur independently of the program execution and are divided into two types: maskable
and non-maskable interrupts. In contrast, an exception is an event whose occurrence is dependent on the program
execution. There is no major difference between interrupts and exceptions in terms of control flow.
The V850 Family can process various interrupt requests from the on-chip peripheral hardware and external
sources. In addition, exception processing can be started by an instruction (TRAP instruction) and by the occurrence
of an exception event (exception trap).
The interrupts and exceptions supported in the V850 Family are described below. When an interrupt or exception
is deleted, control is transferred to a handler whose address is determined by the source of the interrupt or exception.
The source of the event is specified by the exception code that is stored in the exception cause register (ECR). Each
handler analyzes the exception cause register (ECR) and performs appropriate interrupt servicing or exception
handling. The restore PC and PSW are written to the status saving registers (EIPC, EIPSW/FEPC, FEPSW).
To restore execution from interrupt or exception processing, use the RETI instruction.
Read the restore PC and PSW from the status saving register, and transfer control to the restore PC.
The restore PC is the PC saved to the EIPC or FEPC when interrupt/exception processing is started. “next PC”
is the PC that starts processing after interrupt/exception processing.
The processing of maskable interrupts is controlled by the user through the INTC unit (interrupt controller). The
INTC is different for each device in the V850 Family due to the variations of on-chip peripherals, interrupt/exception
causes and exception codes.
The EIPC and EIPSW are used as the status saving registers. Interrupts are held pending in the interrupt controller
(INTC) when one of the following two conditions occurs: when the interrupt input (INT) is masked by its INTC, or when
an interrupt processing routine is currently being executed (when the NP bit of the PSW is 1 or when the ID bit of
the PSW is 1). New maskable interrupt processing is started by the pending INT input when the mask condition is
cleared and the NP and ID bits of the PSW are reset to 0 by the LDSR and RETI instructions.
The EIPC and EIPSW must be saved by the program to enable nesting of interrupts because only one set of EIPC
and EIPSW is provided. Bits 31 through 24 of the EIPC and bits 31 through 8 of the EIPSW are fixed to 0.
Figure 6-1 illustrates how a maskable interrupt is processed.
Maskable
interrupt (INT) occurs
Yes
Mask
No
1
PSW.ID
Interrupt processing
The FEPC and FEPSW are used as the status saving registers. Non-maskable interrupts are held pending in the
INTC when another non-maskable interrupt is currently being executed (when the NP bit of the PSW is 1). New non-
maskable interrupt processing is started by the pending non-maskable interrupt request when the NP bit of the PSW
is reset to 0 by the RETI and LDSR instructions.
Figure 6-2 illustrates how a non-maskable interrupt is processed.
Non-maskable
interrupt (NMI) occurs
1
PSW.NP
Interrupt processing
Software
exception (TRAP instruction) occurs
EIPC ← Restore PC
EIPSW ← PSW
ECR.EICC ← Exception code
PSW.EP ← 1
PSW.ID ← 1
PC ← Handler address
Exception processing
15 13 12 11 10 5 4 0 31 27 26 23 22 21 20 17 16
0 0 1 1
× × × × × 1 1 1 1 1 1 × × × × × × × × × × to × × × × × × ×
1 1 1 1
If an exception trap occurs, the CPU performs the following steps, and transfers control to the handler routine.
Exception trap
(ILGOP) occurs
EIPC ← Restore PC
EIPSW ← PSW
ECR.EICC ← Exception code
PSW.NP ← 1
PSW.EP ← 1
PSW.ID ← 1
PC ← 00000060H
Exception processing
The execution address of the illegal instruction is obtained by “restore PC - 4” when an exception trap occurs.
Caution The operation is not guaranteed when an instruction that has not been defined either as an
instruction or an illegal instruction is executed.
(1) If the EP bit of the PSW is 0 and the NP bit of the PSW is 1, the restore PC and PSW are read from the FEPC
and FEPSW; otherwise, the restore PC and PSW are read from the EIPC and EIPSW.
(2) Control is transferred to the address of the restored PC and PSW.
When execution has returned from exception processing or non-maskable interrupt processing, the NP and EP
bits of the PSW must be set to the following values by using the LDSR instruction immediately before the RETI
instruction, in order to restore the PC and PSW normally:
RETI instruction
1
PSW.EP
Restore
from
exception 1
PSW.NP
PC ← EIPC PC ← FEPC
PSW ← EIPSW PSW ← FEPSW
Jump to PC
When a low-level signal is input to the RESET pin, the system is reset, and all on-chip hardware is initialized.
7.1 Initialization
When a low-level signal is input to the RESET pin, the system is reset, and each hardware register is set in the
status shown in Table 7-1. When the RESET signal goes high, program execution begins. If necessary, re-initialize
the contents of each register by program control.
7.2 Start Up
All devices in the V850 Family begin program execution from address 00000000H after reset. After reset, no
immediate interrupt requests are acknowledged. To enable interrupts, clear the ID bit of the program status word
(PSW) to 0.
The V850 Family is based on the RISC architecture and executes almost all the instructions in one clock cycle
under control of a 5-stage pipeline.
The processor uses a 5-stage pipeline.
The operation to be performed in each stage is as follows:
The instruction execution sequence of the V850 Family consists of five stages including fetch and write back stages.
The execution time of each stage differs depending on the type of the instruction and the type of the memory to
be accessed.
As an example of pipeline operation, Figure 8-1 shows the processing of the CPU when nine standard instructions
are executed in succession.
1 through 13 in the figure above indicate the states of the CPU. In each state, write back of instruction n, memory
access of instruction n+1, execution of instruction n+2, decoding of instruction n+3, and fetching of instruction n+4
are simultaneously performed. It takes five clock cycles to process a standard instruction, including fetching and write
back. Because five instructions can be processed at the same time, however, a standard instruction can be executed
in 1 clock cycle on average.
This section explains the pipeline flow during the execution of instructions.
During instruction fetch (IF stage) and memory access (MEM stage), the internal ROM/PROM and the internal RAM
are accessed, respectively. In this case, the IF and MEM stages are processed in 1 clock. In all other cases, the
required time for access consists of the fixed access time, with the addition in some cases of a path wait time. Access
times are shown in Figure 8-2 below.
Resource (Bus Width) Internal ROM/PROM Internal RAM Internal Peripheral I/O External Memory
Stage (32 Bits) (32 Bits) (8/16 Bits) (16 Bits)
Instruction fetch 1 3 Impossible 3+n
Memory access (MEM) 3 1 3+n 3+n
[Description] The pipeline consists of 5 stages, IF, ID, EX, MEM, and WB. If an instruction using the execution
result is placed immediately after the load instruction, data wait time occurs. For details, see
8.3 Pipeline Disorder.
[Description] The pipeline consists of 5 stages, IF, ID, EX, MEM and WB. However, no operation is performed
in the WB stage, because no data is written to registers.
[Instructions] MOV, MOVEA, MOVHI, ADD, ADDI, CMP, SUB, SUBR, SETF
1 2 3 4 5 6
[Pipeline] Arithmetic operation
instruction IF ID EX MEM WB
Next instruction IF ID EX MEM WB
[Description] The pipeline consists of 5 stages, IF, ID, EX, MEM and WB. However, no operation is performed
in the MEM stage, because memory is not accessed.
1 2 3 4 5 6
Multiply instruction 1 IF ID EX1 EX2 WB
Multiply instruction 2 IF ID EX1 EX2 WB
[Description] The pipeline consists of 5 stages, IF, ID, EX1, EX2, and WB. There is no MEM stage. The EX
stage requires 2 clocks, but the EX1 and EX2 stages can operate independently. Therefore,
the number of clocks for instruction execution is always 1, even if several multiply instructions
are executed in a row. However, if an instruction using the execution result is placed
immediately after a multiply instruction, data wait time occurs. For details, see 8.3 Pipeline
Disorder.
[Instructions] DIVH
1 2 3 4 37 38 39 40 41 42
[Pipeline]
Divide instruction IF ID EX1 EX2 EX35 EX36 MEM WB
Next instruction IF – – – ID EX MEM WB
Next to next instruction IF ID EX MEM WB
[Description] The pipeline consists of 40 stages, IF, ID, EX1 to EX36, MEM, and WB. The EX stage requires
36 clocks. No operation is performed in the MEM stage, because memory is not accessed.
[Instructions] NOT, OR, ORI, XOR, XORI, AND, ANDI, TST, SHR, SAR, SHL
1 2 3 4 5 6
[Pipeline] Logical operation
instruction IF ID EX MEM WB
Next instruction IF ID EX MEM WB
[Description] The pipeline consists of 5 stages, IF, ID, EX, MEM, and WB. No operation is performed in the
MEM stage, because memory is not accessed.
[Description] The pipeline consists of 5 stages, IF, ID, EX, MEM, and WB. However, no operation is performed
in the MEM stage, because memory is not accessed.
[Instructions] Bcond instructions (BGT, BGE, BLT, BLE, BH, BNL, BL, BNH, BE, BNE, BV, BNV, BN, BP,
BC, BNC, BZ, BNZ, BSA): Except BR instruction
[Description] The pipeline consists of 5 stages, IF, ID, EX, MEM, and WB. However, no operation is performed
in the MEM and WB stages, because memory is not accessed and no data is written to registers.
1 2 3 4 5 6 7 8
[Pipeline] Unconditional branch
instruction IF ID EX MEM WB *
Next instruction IF ×
Branch destination instruction IF ID EX MEM WB
[Description] The pipeline consists of 5 stages, IF, ID, EX, MEM, and WB. However, no operation is performed
in the MEM and WB stages, because memory is not accessed and no data is written to registers.
However, in the case of the JARL instruction, data is written to the restore PC in the WB stage.
Also, the IF stage of the next instruction of the branch instruction is not executed.
1 2 3 4 5 6 7 8 9 10
[Pipeline] SET1, CLR1, NOT1
instruction IF ID EX1 MEM EX2 EX3 MEM WB
Next instruction IF – – – ID EX MEM WB
Next to next instruction IF ID EX MEM WB
[Description] The pipeline consists of 8 stages, IF, ID, EX1, MEM, EX2, EX3, MEM, and WB. However, no
operation is performed in the WB stage, because no data is written to registers.
In the case of these instructions, the memory access is read modify write, and the EX and MEM
stages require 3 and 2 clocks, respectively.
(2) TST1
1 2 3 4 5 6 7 8 9 10
[Pipeline] TST1 instruction IF ID EX1 MEM EX2 EX3 MEM WB
Next instruction IF – – – ID EX MEM WB
Next to next instruction IF ID EX MEM WB
[Description] The pipeline consists of 8 stages, IF, ID, EX1, MEM, EX2, EX3, MEM, and WB. However, no
operation is performed in the second MEM and WB stages, because there is no second memory
access nor data write to registers.
In the case of this instruction, the memory access is read modify write, and the EX and MEM
stage require 3 and 2 clocks, respectively.
[Description] The pipeline consists of 5 stages, IF, ID, EX, MEM, and WB. However, no operation is performed
in the MEM stage, because memory is not accessed. Also, if the STSR instruction using the
EIPC and FEPC system registers is placed immediately after the LDSR instruction setting these
registers, data wait time occurs. For details, see 8.3 Pipeline Disorder.
(2) NOP
1 2 3 4 5 6
[Pipeline] NOP instruction IF ID EX MEM WB
Next instruction IF ID EX MEM WB
[Description] The pipeline consists of 5 stages, IF, ID, EX, MEM, and WB. However, no operation is performed
in the EX, MEM and WB stages, because no operation and no memory access is executed,
and no data is written to registers.
(3) EI, DI
1 2 3 4 5 6
EI, DI instruction IF ID EX MEM WB
[Pipeline]
Next instruction IF ID EX MEM WB
[Description] The pipeline consists of 5 stages, IF, ID, EX, MEM, and WB. However, no operation is performed
in the MEM and WB stages, because memory is not accessed and data is not written to
registers.
(4) HALT
[Pipeline]
1 2 3 4 5 6 HALT release
HALT
instruction IF ID EX MEM WB
Next IF – – – – – ID EX MEM WB
instruction
IF ID EX MEM WB
Next to next instruction
[Description] The pipeline consists of 5 stages, IF, ID, EX, MEM and WB. No operation is performed in the
MEM and WB stages, because memory is not accessed and no data is written to registers. Also,
for the next instruction, the ID stage is delayed until the HALT state is released.
(5) TRAP
1 2 3 4 5 6 7 8 9
[Pipeline] TRAP instruction IF ID1 ID2 EX MEM WB
Next instruction IF ×
Jump destination instruction IF ID EX MEM WB
[Description] The pipeline consists of 6 stages, IF, ID1, ID2, EX, MEM, and WB. However, no operation is
performed in the MEM stage, because memory is not accessed. The ID stage requires 2 clocks.
Also, the IF stage of the next instruction and next to next instruction is not executed.
(6) RETI
1 2 3 4 5 6 7 8 9
[Pipeline] RETI instruction IF ID1 ID2 EX MEM WB
Next instruction IF ×
Jump destination instruction IF ID EX MEM WB
[Description] The pipeline consists of 6 stages, IF, ID1, ID2, EX, MEM, and WB. However, no operation is
performed in the MEM and WB stages, because memory is not accessed and no data is written
to registers. The ID stage requires 2 clocks. Also, the IF stage of the next instruction and next
to next instruction is not executed.
The pipeline consists of 5 stages from IF (Instruction Fetch) to WB (Write Back). Each stage basically requires
1 clock for processing, but the pipeline may become disordered, causing the number of execution clocks to increase.
This section describes the main causes of pipeline disorder.
32 bits
1 2 3 4 5 6 7 8 9 10
Branch instruction IF ID EX MEM WB
Instruc- Instruc-
X8H tion d tion e Next instruction IF × –
Next to next instruction IF ×
Instruc- Instruc-
X4H tion b tion c Branch destination instruction (instruction b) IF1 IF2 ID EX MEM WB
Branch destination’s next instruction (instruction c) IF ID EX MEM WB
Instruc- Instruc-
X0H tion a tion b
Align hazards can be prevented through the following handling in order to obtain faster instruction execution.
1 2 3 4 5 6 7 8 9
Load instruction 1
(LD [R4], R6) IF ID EX MEM WB
Instruction 2 (ADD 2, R6) IF IL ID EX MEM WB
Instruction 3 IF – ID EX MEM WB
Instruction 4 IF ID EX MEM WB
As described in Figure 8-3, when an instruction placed immediately after a load instruction uses its execution result,
a data wait time occurs due to the interlock function, and the execution speed is lowered. This drop in execution speed
can be avoided by placing instructions that use the execution result of a load instruction at least 2 instructions after
the load instruction.
1 2 3 4 5 6 7 8 9
Multiply instruction 1
(MULH 3, R6) IF ID EX1 EX2 WB
Instruction 2 (ADD 2, R6) IF IL ID EX MEM WB
Instruction 3 IF – ID EX MEM WB
Instruction 4 IF ID EX MEM WB
As described in Figure 8-4, when an instruction placed immediately after a multiply instruction uses its execution
result, a data wait time occurs due to the interlock function, and the execution speed is lowered. This drop in execution
speed can be avoided by placing instructions that use the execution result of a multiply instruction at least 2 instructions
after the multiply instruction.
8.3.4 Referencing execution result of LDSR instruction for EIPC and FEPC
When using the LDSR instruction to set the data of the EIPC and FEPC system registers, and immediately after
referencing the same system registers with the STSR instruction, the use of the system registers for the STSR
instruction is delayed until the setting of the system registers with the LDSR instruction is completed (occurrence of
hazard).
The V850 Family’s interlock function delays the ID stage of the STSR instruction immediately after.
As a result of the above, when using the execution result of the LDSR instruction for EIPC and FEPC for an STSR
instruction following immediately after, the number of execution clocks of the LDSR instruction becomes 3.
Figure 8-5. Example of Execution Result of LDSR Instruction for EIPC and FEPC
1 2 3 4 5 6 7 8 9 10
LDSR instruction
(LDSR R6, 0) Note IF ID EX MEM WB
STSR instruction
(STSR 0, R7) Note IF IL IL ID EX MEM WB
Next instruction IF – – ID EX MEM WB
Next to next instruction IF ID EX MEM WB
Note System register 0 used for the LDSR and STSR instructions designates EIPC.
As described in Figure 8-5, when an STSR instruction is placed immediately after an LDSR instruction that uses
the operand EIPC or FEPC, and that STSR instruction uses the LDSR instruction execution result, the interlock
function causes a data wait time to occur, and the execution speed is lowered. This drop in execution speed can be
avoided by placing STSR instructions that reference the execution result of the preceding LDSR instruction at least
3 instructions after the LDSR instruction.
• Place instructions that use the execution result of load instructions (LD, SLD) at least 2 instructions after the
load instruction.
• Place instructions that use the execution result of multiply instructions (MULH, MULHI) at least 2 instructions
after the multiply instruction.
• If using the STSR instruction to read the setting results written to the EIPC or FEPC registers with the LDSR
instruction, place the STSR instruction at least 3 instructions after the LDSR instruction.
• For the first branch destination instruction, use a 2-byte instruction, or a 4-byte instruction placed at the word
boundary.
1 2 3 4 5 6 7 8 9
Instruction 1 IF ID EX MEM WB
Instruction 2 IF ID EX MEM WB
Instruction 3 IF ID EX MEM WB
Instruction 4 IF ID EX MEM WB
Instruction 5 IF ID EX MEM WB
1 2 3 4 5 6 7 8 9 10 11
Instruction 1 IF ID EX MEM WB
Instruction 2 IF ID – EX MEM WB
Instruction 3 IF – ID – EX MEM WB
Instruction 4 IF – ID EX MEM WB
Instruction 5 IF ID EX MEM WB
Example 1. Execution result of arithmetic operation instruction and logical operation used by instruction
following immediately after
1 2 3 4 5 6
ADD 2, R6 IF ID EX MEM WB
MOV R6, R7 IF ID EX MEM WB
1 2 3 4 5 6 7 8
ADD 2, R6 IF ID EX MEM WB
MOV R6, R7 IF – – ID EX MEM WB
Example 2. Data read from memory by the load instruction used by instruction following immediately after
1 2 3 4 5 6 7 8 9
LD [R4], R6 IF ID EX MEM WB
ADD 2, R6 IF IL ID EX MEM WB
Next instruction IF – ID EX MEM WB
Next to next instruction IF ID EX MEM WB
1 2 3 4 5 6 7 8 9 10
LD [R4], R6 IF ID EX MEM WB
ADD 2, R6 IF – – ID EX MEM WB
Next instruction IF ID EX MEM WB
Next to next instruction IF ID EX MEM WB
Mnemonic
Convention
Name Meaning
Identifier Meaning
0 Reset to 0
* Set to 1 or reset to 0 according to instruction execution result
– No change
ADDI imm16, reg1, reg2 VI * * * * – Add. Adds the 16-bit immediate data, sign-
extended to word length, to the word data of
reg1, and stores the result in reg2.
AND reg1, reg2 I – 0 * * – AND. ANDs the word data of reg2 with the word
data of reg1, and stores the result in reg2.
ANDI imm16, reg1, reg2 VI – 0 * * – AND. ANDs the word data of reg1 with the 16-bit
immediate data, zero-extended to word length,
and stores the result in reg2.
CLR1 bit#3, disp16 [reg1] VIII – – – * – Bit clear. Adds the data of reg1 to 16-bit
displacement, sign-extended to word length, to
generate a 32-bit address. Then clears the bit,
specified by the instruction bit field, of the byte
data referenced by the generated address.
CMP reg1, reg2 I * * * * – Compare. Compares the word data of reg2 with
the word data of reg1, and indicates the result
by using the condition flags. To compare, the
contents of reg1 are subtracted from the word
data of reg2.
CMP imm5, reg2 II * * * * – Compare. Compares the word data of reg2 with
the 5-bit immediate data, sign-extended to word
length, and indicates the result by using the
condition flags. To compare, the contents of the
sign-extended immediate data are subtracted
from the word data of reg2.
JARL disp22, reg2 V – – – – – Jump and register link. Saves the current PC
value plus 4 to general register reg2, adds a 22-
bit displacement, sign-extended to word length,
to the current PC value, and transfers control to
the PC. Bit 0 of the 22-bit displacement is
masked to 0.
LD.B disp16 [reg1], reg2 VII – – – – – Byte load. Adds the data of reg1 to a 16-bit
displacement, sign-extended to word length, to
generate a 32-bit address. Byte data is read
from the generated address, sign-extended to
word length, and then stored in reg2.
LD.H disp16 [reg1], reg2 VII – – – – – Half-word load. Adds the data of reg1 to a 16-bit
displacement, sign-extended to word length, to
generate a 32-bit address. Half-word data is
read from this 32-bit address with its bit 0
masked to 0, sign-extended to word length, and
stored in reg2.
LD.W disp16 [reg1], reg2 VII – – – – – Word load. Adds the data of reg1 to a 16-bit
displacement, sign-extended to word length, to
generate a 32-bit address. Word data is read
from this 32-bit address with bits 0 and 1 masked
to 0, and stored in reg2.
LDSR reg2, regID IX – – – – – Load to system register. Set the word data of
reg2 to a system register specified by regID. If
regID is PSW, the values of the corresponding
bits of reg2 are set to the respective flags of the
PSW.
MOV reg1, reg2 I – – – – – Moves data. Transfers the word data of reg1 to
reg2.
MOVEA imm16, reg1, reg2 VI – – – – – Moves effective address. Adds a 16-bit immediate
data, sign-extended to word length, to the word
data of reg1, and stores the result in reg2.
MOVHI imm16, reg1, reg2 VI – – – – – Moves higher half-word. Adds word data, in
which the higher 16 bits are defined by the 16-bit
immediate data while the lower 16 bits are set to
0, to the word data of reg1 and stores the result
in reg2.
MULHI imm16, reg1, reg2 VI – – – – – Signed multiply. Multiplies the lower half-word
data of reg1 by a 16-bit immediate data, and
stores the result in reg2.
NOP – I – – – – – No operation.
NOT reg1, reg2 I – 0 * * – Logical not. Logically negates (takes 1’s comple-
ment of) the word data of reg1, and stores the
result in reg2.
NOT1 bit#3, disp16 [reg1] VIII – – – * – Bit not. First, adds the data of reg1 to a 16-bit
displacement, sign-extended to word length, to
generate a 32-bit address. The bit specified by
the 3-bit field “bbb” is inverted at the byte data
location referenced by the generated address.
OR reg1, reg2 I – 0 * * – Logical sum. ORs the word data of reg2 with the
word data of reg1, and stores the result in reg2.
ORI imm16, reg1, reg2 VI – 0 * * – Logical sum. ORs the word data of reg1 with the
16-bit immediate data, zero-extended to word
length, and stores the result in reg2.
SAR reg1, reg2 IX * 0 * * – Arithmetic right shift. Arithmetically shifts the word
data of reg2 to the right by ‘n’ positions, where ‘n’
is specified by the lower 5 bits of reg1 (the MSB
prior to shift execution is copied and set as the
new MSB), and then writes the result to reg2.
SAR imm5, reg2 II * 0 * * – Arithmetic right shift. Arithmetically shifts the word
data of reg2 to the right by ‘n’ positions specified
by the 5-bit immediate data, zero-extended to
word length (the MSB prior to shift execution is
copied and set as the new MSB), and then writes
the result to reg2.
SATADD reg1, reg2 I * * * * * Saturated add. Adds the word data of reg1 to the
word data of reg2, and stores the result in reg2.
However, if the result exceeds the maximum
positive value, the maximum positive value is
stored in reg2; if the result exceeds the maximum
negative value, the maximum negative value is
stored in reg2. The SAT flag is set to 1.
SATADD imm5, reg2 II * * * * * Saturated add. Adds the 5-bit immediate data,
sign-extended to word length, to the word data of
reg2, and stores the result in general register
reg2. However, if the result exceeds the positive
maximum value, the maximum positive value is
stored in reg2; if the result exceeds the maximum
negative value, the maximum negative value is
stored in reg2. The SAT flag is set to 1.
SET1 bit#3, disp16 [reg1] VIII – – – * – Bit set. First, adds a 16-bit displacement, sign-
extended to word length, to the data of reg1 to
generate a 32-bit address. The bits, specified by
the 3-bit bit field “bbb” is set at the byte data
location specified by the generated address.
SHL reg1, reg2 IX * 0 * * – Logical left shift. Logically shifts the word data of
reg2 to the left by ‘n’ positions (0 is shifted to the
LSB side), where ‘n’ is specified by the lower 5
bits of reg1, and writes the result to reg2.
SHL imm5, reg2 II * 0 * * – Logical left shift. Logically shifts the word data of
reg2 to the left by ‘n’ positions (0 is shifted to the
LSB side), where ‘n’ is specified by a 5-bit
immediate data, zero-extended to word length,
and writes the result to reg2.
SHR reg1, reg2 IX * 0 * * – Logical right shift. Logically shifts the word data
of reg2 to the right by ‘n’ positions (0 is shifted to
the MSB side), where ‘n’ is specified by the lower
5 bits of reg1, and writes the result to reg2.
SHR imm5, reg2 II * 0 * * – Logical right shift. Logically shifts the word data
of reg2 to the right by ‘n’ positions (0 is shifted to
the MSB side), where ‘n’ is specified by a 5-bit
immediate data, zero-extended to word length,
and writes the result to reg2.
SLD.B disp7 [ep], reg2 IV – – – – – Byte load. Adds the 7-bit displacement, zero-
extended to word length, to the element pointer to
generate a 32-bit address. Byte data is read
from the generated address, sign-extended to
word length, and stored in reg2.
SLD.H disp8 [ep], reg2 IV – – – – – Half-word load. Adds the 8-bit displacement,
zero-extended to word length, to the element
pointer to generate a 32-bit address. Half-word
data is read from this 32-bit address with bit 0
masked to 0, sign-extended to word length, and
stored in reg2.
SLD.W disp8 [ep], reg2 IV – – – – – Word load. Adds the 8-bit displacement, zero-
extended to word length, to the element pointer to
generate a 32-bit address. Word data is read
from this 32-bit address with bits 0 and 1 masked
to 0, and stored in reg2.
SST.B reg2, disp7 [ep] IV – – – – – Byte store. Adds the 7-bit displacement, zero-
extended to word length, to the element pointer to
generate a 32-bit address, and stores the data of
the lowest byte of reg2 at the generated address.
SST.H reg2, disp8 [ep] IV – – – – – Half-word store. Adds the 8-bit displacement,
zero-extended to word length, to the element
pointer to generate a 32-bit address, and stores
the lower half-word of reg2 at the generated 32-
bit address with bit 0 masked to 0.
SST.W reg2, disp8 [ep] IV – – – – – Word store. Adds the 8-bit displacement, zero-
extended to word length, to the element pointer to
generate a 32-bit address, and stores the word
data of reg2 at the generated 32-bit address with
bits 0 and 1 masked to 0.
ST.B reg2, disp16 [reg1] VII – – – – – Byte store. Adds the 16-bit displacement, sign-
extended to word length, to the data of reg1 to
generate a 32-bit address, and stores the lowest
byte data of reg2 at the generated address.
ST.H reg2, disp16 [reg1] VII – – – – – Half-word store. Adds the 16-bit displacement,
sign-extended to word length, to the data of reg1
to generate a 32-bit address, and stores the
lower half-word of reg2 at the generated 32-bit
address with bit 0 masked to 0.
SUB reg1, reg2 I * * * * – Subtract. Subtracts the word data of reg1 from
the word data of reg2, and stores the result in
reg2.
SUBR reg1, reg2 I * * * * – Subtract reverse. Subtracts the word data of reg2
from the word data of reg1, and stores the result
in reg2.
TST reg1, reg2 I – 0 * * – Test. ANDs the word data of reg2 with the word
data of reg1. The result is not stored, and only
the flags are changed.
TST1 bit#3, disp16 [reg1] VIII – – – * – Bit test. Adds the data of reg1 to a 16-bit
displacement, sign-extended to word length, to
generate a 32-bit address. Performs the test on
the bit, specified by the 3-bit field “bbb”, at the
byte data location referenced by the generated
address. If the specified bit is 0, the Z flag is set
to 1; if the bit is 1, the Z flag is reset to 0.
XOR reg1, reg2 I – 0 * * – Exclusive OR. Exclusively ORs the word data of
reg2 with the word data of reg1, and stores the
result in reg2.
Load/store (3-operand)
(2-operand immediate)
MOV Move
ADD Add
CMP Compare
SATADD Saturated Add
SETF Set Flag Condition
SHL Shift Logical Left
SHR Shift Logical Right
SAR Shift Arithmetic Right
The following tables (a) through (f) show the op code maps corresponding to instruction codes.
Instruction code
15 14 13 12 11 10 5 4 0 31 27 26 21 20 17 16
(a) Op code
Bits 6 to 5
00 01 10 11 Format
Bits 10 to 7
0000 MOV/NOP NOT DIVH JMP I
0001 SATSUBR SATSUB SATADD MULH
0010 OR XOR AND TST
0011 SUBR SUB ADD R, r CMP R,r
0100 MOV imm5, r SATADD ADD imm5, r CMP imm5, r II
0101 SHR imm5, r SAR imm5, r SHL imm5, r MULH
0110 SLD.B IV
0111 SST.B
1000 SLD.H
1001 SST.H
1010 SLD.W/SST.WNote 1
1011 Bcond III
1100 ADDI MOVEA MOVHI SATSUBI VI
1101 ORI XORI ANDI MULHI
Note 2
1110 LD.B LD.H/LD.W ST.B ST.H/ST.WNote 2
V/VII/VIII/IX/X
Note 3 Note 4
1111 JARL Bit manipulation Extension 1
Bit 0
0 1
Bits 10 to 7
0110 SLD.B
0111 SST.B
1000 SLD.H
1001 SST.H
1010 SLD.W SST.W
Bit 16
0 1
Bits 6 to 5
00 LD.B
01 LD.H LD.W
10 ST.B
11 ST.H ST.W
Bit 14
0 1
Bit 15
0 SET1 NOT1
1 CLR1 TST1
Bits 22 to 21
00 01 10 11
Bits 26 to 23
0000 SETF LDSR STSR Undefined
0001 SHR R, r SAR R, r SHL R, r Undefined
0010 TRAP HALT RETI Extension 2Note
0011
to Illegal instruction
1111
Bits 14 to 13
00 01 10 11
Bit 15
0 DI Undefined
1 EI
[B] [D]
Based addressing .................................................. 35 Data alignment ....................................................... 29
bbb .......................................................................... 47 Data format ............................................................. 27
BC ........................................................................... 54 Data representation ............................................... 28
Bcond ...................................................................... 53 Data type ................................................................ 27
BE ........................................................................... 54 Data type and addressing ..................................... 27
BGE ........................................................................ 54 DI ............................................................................ 57
BGT ......................................................................... 54 Disable interrupt ..................................................... 57
BH ........................................................................... 54 disp× ............................................................................... 45
Bit ............................................................................ 28 DIVH ....................................................................... 58
BIT .......................................................................... 28 Divide half-word ..................................................... 58
Bit addressing ........................................................ 37 Divide instructions ................................................ 116
Bit manipulation instructions .......................... 44, 118
bit#3 ........................................................................ 45 [E]
BL ............................................................................ 54 ECR ........................................................................ 23
BLE ......................................................................... 54 EI ............................................................................. 59
BLT ......................................................................... 54 EICC ....................................................................... 24
BN ........................................................................... 54 EIPC ........................................................................ 23
BNC ........................................................................ 54 EIPSW .................................................................... 23
BNE ......................................................................... 54 Element pointer ...................................................... 22
BNH ........................................................................ 54 Enable interrupt ...................................................... 59
BNL ......................................................................... 54 EP ........................................................................... 25
BNV ......................................................................... 54 ep ............................................................................ 45
BNZ ......................................................................... 54 Exception .............................................................. 106
BP ........................................................................... 54 Exception cause register ....................................... 23
BR ........................................................................... 54 Exception processing ........................................... 110
Branch instructions ........................................ 43, 117 Exception trap ...................................................... 111
Branch on condition code ...................................... 53 Exclusive or .......................................................... 101
[V]
vector ...................................................................... 45
[W]
WORD ..................................................................... 28
Word ....................................................................... 28
[X]
XOR ................................................................ 46, 101
XOR1 .................................................................... 102
[Z]
zero-extend (n) ....................................................... 46
Zero register ........................................................... 22
Tel. FAX
Address
North America Hong Kong, Philippines, Oceania Asian Nations except Philippines
NEC Electronics Inc. NEC Electronics Hong Kong Ltd. NEC Electronics Singapore Pte. Ltd.
Corporate Communications Dept. Fax: +852-2886-9022/9044 Fax: +65-250-3583
Fax: +1-800-729-9288
+1-408-588-6130
Korea Japan
Europe
NEC Electronics Hong Kong Ltd. NEC Semiconductor Technical Hotline
NEC Electronics (Europe) GmbH
Seoul Branch Fax: +81- 44-435-9608
Technical Documentation Dept.
Fax: +82-2-528-4411
Fax: +49-211-6503-274
South America Taiwan
NEC do Brasil S.A. NEC Electronics Taiwan Ltd.
Fax: +55-11-6462-6829 Fax: +886-2-2719-5951
Document title: