The revision list can be viewed directly by
clicking the title page.
The revision list summarizes the locations of
revisions and additions. Details should always
be checked by referring to the relevant text.
32
SH-4A
Software Manual
Renesas 32-Bit RISC Microcomputer
SuperH™ RISC engine Family
Rev.1.50
Revision Date: Oct. 29, 2004
Rev. 1.50, 10/04, page ii of xx
Keep safety first in your circuit designs!
1. Renesas Technology Corp. puts the maximum effort into making semiconductor products better and
more reliable, but there is always the possibility that trouble may occur with them. Trouble with
semiconductors may lead to personal injury, fire or property damage.
Remember to give due consideration to safety when making your circuit designs, with appropriate
measures such as (i) placement of substitutive, auxiliary circuits, (ii) use of nonflammable material or
(iii) prevention against any malfunction or mishap.
Notes regarding these materials
1. These materials are intended as a reference to assist our customers in the selection of the Renesas
Technology Corp. product best suited to the customer's application; they do not convey any license
under any intellectual property rights, or any other rights, belonging to Renesas Technology Corp. or
a third party.
2. Renesas Technology Corp. assumes no responsibility for any damage, or infringement of any thirdparty's rights, originating in the use of any product data, diagrams, charts, programs, algorithms, or
circuit application examples contained in these materials.
3. All information contained in these materials, including product data, diagrams, charts, programs and
algorithms represents information on products at the time of publication of these materials, and are
subject to change by Renesas Technology Corp. without notice due to product improvements or
other reasons. It is therefore recommended that customers contact Renesas Technology Corp. or
an authorized Renesas Technology Corp. product distributor for the latest product information
before purchasing a product listed herein.
The information described here may contain technical inaccuracies or typographical errors.
Renesas Technology Corp. assumes no responsibility for any damage, liability, or other loss rising
from these inaccuracies or errors.
Please also pay attention to information published by Renesas Technology Corp. by various means,
including the Renesas Technology Corp. Semiconductor home page (http://www.renesas.com).
4. When using any or all of the information contained in these materials, including product data,
diagrams, charts, programs, and algorithms, please be sure to evaluate all information as a total
system before making a final decision on the applicability of the information and products. Renesas
Technology Corp. assumes no responsibility for any damage, liability or other loss resulting from the
information contained herein.
5. Renesas Technology Corp. semiconductors are not designed or manufactured for use in a device or
system that is used under circumstances in which human life is potentially at stake. Please contact
Renesas Technology Corp. or an authorized Renesas Technology Corp. product distributor when
considering the use of a product contained herein for any specific purposes, such as apparatus or
systems for transportation, vehicular, medical, aerospace, nuclear, or undersea repeater use.
6. The prior written approval of Renesas Technology Corp. is necessary to reprint or reproduce in
whole or in part these materials.
7. If these products or technologies are subject to the Japanese export control restrictions, they must
be exported under a license from the Japanese government and cannot be imported into a country
other than the approved destination.
Any diversion or reexport contrary to the export control laws and regulations of Japan and/or the
country of destination is prohibited.
8. Please contact Renesas Technology Corp. for further details on these materials or the products
contained therein.
Rev. 1.50, 10/04, page iii of xx
General Precautions on Handling of Product
1. Treatment of NC Pins
Note: Do not connect anything to the NC pins.
The NC (not connected) pins are either not connected to any of the internal circuitry or are
they are used as test pins or to reduce noise. If something is connected to the NC pins, the
operation of the LSI is not guaranteed.
2. Treatment of Unused Input Pins
Note: Fix all unused input pins to high or low level.
Generally, the input pins of CMOS products are high-impedance input pins. If unused pins
are in their open states, intermediate levels are induced by noise in the vicinity, a passthrough current flows internally, and a malfunction may occur.
3. Processing before Initialization
Note: When power is first supplied, the product’s state is undefined.
The states of internal circuits are undefined until full power is supplied throughout the
chip and a low level is input on the reset pin. During the period where the states are
undefined, the register settings and the output state of each pin are also undefined. Design
your system so that it does not malfunction because of processing while it is in this
undefined state. For those products which have a reset function, reset the LSI immediately
after the power supply has been turned on.
4. Prohibition of Access to Undefined or Reserved Addresses
Note: Access to undefined or reserved addresses is prohibited.
The undefined or reserved addresses may be used to expand functions, or test registers
may have been be allocated to these addresses. Do not access these registers; the system’s
operation is not guaranteed if they are accessed.
5. Reading from/Writing to Reserved Bit of Each Register
Note: Treat the reserved bit of register used in each module as follows except in cases where the
specifications for values which are read from or written to the bit are provided in the
description.
The bit is always read as 0. The write value should be 0 or one, which has been read
immediately before writing.
Writing the value, which has been read immediately before writing has the advantage of
preventing the bit from being affected on its extended function when the function is
assigned.
Rev. 1.50, 10/04, page iv of xx
Configuration of This Manual
This manual comprises the following items:
1. General Precautions on Handling of Product
2. Configuration of This Manual
3. Preface
4. Contents
5. Overview
6. Description of Functional Modules
• CPU and System-Control Modules
• On-Chip Peripheral Modules
The configuration of the functional description of each module differs according to the
module. However, the generic style includes the following items:
i) Feature
ii) Input/Output Pin
iii) Register Description
iv) Operation
v) Usage Note
When designing an application system that includes this LSI, take notes into account. Each
section includes notes in relation to the descriptions given, and usage notes are given, as required,
as the final part of each section.
7. List of Registers
8. Appendix
9. Index
Rev. 1.50, 10/04, page v of xx
Preface
The SH-4A is a RISC (Reduced Instruction Set Computer) microcomputer which includes a
Renesas Technology-original RISC CPU as its core.
Target Users: This manual was written for users who will be using the SH-4A in the design of
application systems. Users of this manual are expected to understand the
fundamentals of electrical circuits, logical circuits, microcomputers, and assembly/C
languages programming.
Objective: This manual was written to understand the instructions of the SH4A. For the
hardware functions, refer to corresponding hardware manual.
Notes on reading this manual:
• In order to understand the overall functions of the chip
Read the manual according to the contents. This manual can be roughly categorized into parts
on the CPU, system control functions, and instructions.
• In order to understand the instructions
The instruction format and basic operation are explained in section 3, Instruction Set. For
details on each instruction operation, read section 10, Instruction Descriptions.
Rules: Register name: The following notation is used for cases when the same or a
similar function, e.g. serial communication, is implemented
on more than one channel:
XXX_N (XXX is the register name and N is the channel
number)
Bit order: The MSB is on the left and the LSB is on the right.
Number notation: Binary is B'xxxx, hexadecimal is H'xxxx, decimal is xxxx.
Signal notation: An overbar is added to a low-active signal: xxxx
Related Manuals: The latest versions of all related manuals are available from our web site.
Please ensure you have the latest versions of all documents you require.
http://www.renesas.com/
The SH-4A is a 32-bit RISC (reduced instruction set computer) microprocessor that is upward
compatible with the SH-1, SH-2, SH-3, and SH-4 microcomputers at instruction set code level. Its
16-bit fixed-length instruction set enables program code size to be reduced by almost 50%
compared with 32-bit instructions. The features of the SH-4A are listed in table 1.1.
Table 1.1 Features
Item Features
CPU
• Renesas Technology original architecture
• 32-bit internal data bus
• General-register files:
Sixteen 32-bit general registers (eight 32-bit shadow registers)
Seven 32-bit control registers
Four 32-bit system registers
• RISC-type instruction set (upward compatible with the SH-1, SH-2, SH-3,
and SH-4 microcomputers)
Instruction length: 16-bit fixed length for improved code efficiency
Load/store architecture
Delayed branch instructions
Instructions executed with conditions
Instruction set based on the C language
• Super scalar which executes two instructions simultaneously including the
FPU
• Instruction execution time: Two instructions per cycle (max)
• Virtual address space: 4 Gbytes
• Space identifier ASID: 8 bits, 256 virtual address spaces
• On-chip multiplier
• Seven-stage pipeline
Rev. 1.50, 10/04, page 1 of 448
Item Features
Floatingpoint unit
(FPU)
Memory
management
unit (MMU)
• On-chip floating-point coprocessor
• Supports single-precision (32 bits) and double-precision (64 bits)
• Supports IEEE754-compliant data types and exceptions
• Two rounding modes: Round to Nearest and Round to Zero
• Handling of denormalized numbers: Truncation to zero or interrupt
• 64-entry full associative TLB for instructions and operands
• Supports software selection of replacement method and random-counter
replacement algorithms
• Contents of TLB are directly accessible through address mapping
Rev. 1.50, 10/04, page 2 of 448
Item Features
Cache memory
L memory
• Instruction cache (IC)
4-way set associative
32-byte block length
• Operand cache (OC)
4-way set associative
32-byte block length
Selectable write method (copy-back or write-through)
• Storage queue (32 bytes × 2 entries)
Note: For the size of instruction cash and operand cash, see corresponding
hardware manual on the product.
• Two independent read/write ports
8-/16-/32-/64-bit access from the CPU
8-/16-/32-/64-bit and 16-/32-byte access from the external devices
Note: For the size of L memory, see the hardware manual of the target product.
Rev. 1.50, 10/04, page 3 of 448
1.2 Changes from SH-4 to SH-4A
Table 1.2 summarizes the changes from SH-4 to SH-4A based on the sections and sub-sections in
this manual.
Table 1.2 Changes from SH-4 to SH-4A
Section No. and
Name
1. Overview Modified entirely
2. Programming
Model
3. Instruction Set 3.3 Instruction Set
4. Pipelining
5. Exception Handling
6. FPU
Subsection
2.2 Register
4.1 Pipelines The number of stages in the pipeline is
4.2 Parallel-
4.3 Execution Cycles The number of execution cycles is
6.3.2 Floating-Point
6.5 Floating-Point
Sub-section
Name Changes
(Detailed differences are described in the
following sections).
The operations in SZ=1 and PR=1 are
Descriptions
Executability
Status/Control
Register (FPSCR)
Exceptions
added to the floating point status/control
register (FPSCR).
9 instructions are added as CPU
instructions.
3 instructions are added as FPU
instructions.
changed from five to seven.
9 instructions are added as CPU
instructions.
3 instructions are added as FPU
instructions.
Instruction group and parallel execution
combinations are modified.
modified.
Operations in SZ = 1 and PR = 1 and each
endian are added
Specification of FPU exception detection
condition with FPU exception enabled is
changed.
Rev. 1.50, 10/04, page 4 of 448
Section No. and
Name
7. Memory
Management Unit
7.7 32-Bit Address
Subsection
7.1.1 Address Spaces
7.2 Register
7.2.6 Physical Address
7.2.7 Instruction Re-
7.3 TLB Functions Space attribute bits (SA [2:0]) and timing
7.4.5 Avoiding Synonym
7.5.1,
7.5.4
7.6 Memory-Mapped
7.6.3 UTLB Address
7.6.4 UTLB Data Array Memory allocated addresses are changed
Sub-section
Name Changes
Area P4 configuration is modified.
On-chip RAM space is deleted.
The page table entry assist register (PTEA)
Descriptions
Space Control
Register (PASCR)
Fetch Inhibit
Control Register
(IRMCR)
Problems
Instruction TLB
Multiple Hit
Exception and
Data TLB Multiple
Hit Exception
TLB Configuration
Array
Extended Mode
is deleted.
A physical address space control register is
added.
Newly added
Newly added.
control bit (TC) are deleted from the TLB.
The corresponding bits are modified
according to the cache size change and the
index mode deletion.
Multiple hits during the UTLB search
caused by ITLB mishandling are changed
to be handled as a TLB multiple hit
instruction exception.
Data array 2 in the ITLB and UTLB is
deleted.
Associative writes to the UTLB address
array are changed to not generate data
TLB multiple hit exceptions.
Memory allocated addresses are changed
from H'F6000000–H'F6FFFFFF to
H'F6000000–H'F60FFFFF.
from H'F7000000–H'F77FFFFF to
H'F7000000–H'F70FFFFF.
Newly added.
Rev. 1.50, 10/04, page 5 of 448
Section No. and
Name
8. Caches
8.8 Notes on Using
9. L Memory Newly added.
10. Instruction
Descriptions
Subsection
8.1 Features
8.2 Register
8.2.1 Cache Control
8.2.4 On-Chip Memory
8.3 Operand Cache
8.3.6 OC Two-Way
8.4 Instruction Cache
8.4.3 IC Two-Way Mode Newly added.
8.5.1 Coherency
8.6 Memory-Mapped
Sub-section
Name Changes
Instruction cache capacity is changed to 32
Kbytes.
The caching method is changed to a 4-way
set-associative method.
An on-chip memory control register is
Descriptions
Register (CCR)
Control Register
(RAMCR)
Operation
Mode
Operation
between Cache
and External
Memory
Cache
Configuration
32-Bit Address
Extended Mode
added.
Modified.
(Descriptions in CCR are modified.)
Newly added.
RAM mode and OC index mode are
deleted.
Newly added.
IC index mode is deleted.
The ICBI, PREFI, and SYNCO instructions
are added.
The entry bits and the way bits are modified
according to the size modification and
changed into 4-way set associative cache.
Newly added.
9 instructions are added as CPU
instructions.
3 instructions are added as FPU
instructions.
Rev. 1.50, 10/04, page 6 of 448
Section 2 Programming Model
The programming model of the SH-4A is explained in this section. The SH-4A has registers and
data formats as shown below.
2.1 Data Formats
The data formats supported in the SH-4A are shown in figure 2.1.
0
7
Byte (8 bits)
Word (16 bits)
Longword (32 bits)
Single-precision floating-point (32 bits)
Double-precision floating-point (64 bits)
[Legend]
s
:Sign field
e
:Exponent field
f
:Fraction field
6251
se
Figure 2.1 Data Formats
15
31
sef
f
0
0
031 3022
063
Rev. 1.50, 10/04, page 7 of 448
2.2 Register Descriptions
2.2.1 Privileged Mode and Banks
Processing Modes: This LSI has two processing modes, user mode and privileged mode. This
LSI normally operates in user mode, and switches to privileged mode when an exception occurs or
an interrupt is accepted. There are four kinds of registers—general registers, system registers,
control registers, and floating-point registers—and the registers that can be accessed differ in the
two processing modes.
General Registers: There are 16 general registers, designated R0 to R15. General registers R0 to
R7 are banked registers which are switched by a processing mode change.
• Privileged mode
In privileged mode, the register bank bit (RB) in the status register (SR) defines which banked
register set is accessed as general registers, and which set is accessed only through the load
control register (LDC) and store control register (STC) instructions.
When the RB bit is 1 (that is, when bank 1 is selected), the 16 registers comprising bank 1
general registers R0_BANK1 to R7_BANK1 and non-banked general registers R8 to R15 can
be accessed as general registers R0 to R15. In this case, the eight registers comprising bank 0
general registers R0_BANK0 to R7_BANK0 are accessed by the LDC/STC instructions.
When the RB bit is 0 (that is, when bank 0 is selected), the 16 registers comprising bank 0
general registers R0_BANK0 to R7_BANK0 and non-banked general registers R8 to R15 can
be accessed as general registers R0 to R15. In this case, the eight registers comprising bank 1
general registers R0_BANK1 to R7_BANK1 are accessed by the LDC/STC instructions.
• User mode
In user mode, the 16 registers comprising bank 0 general registers R0_BANK0 to R7_BANK0
and non-banked general registers R8 to R15 can be accessed as general registers R0 to R15.
The eight registers comprising bank 1 general registers R0_BANK1 to R7_BANK1 cannot be
accessed.
Control Registers: Control registers comprise the global base register (GBR) and status register
(SR), which can be accessed in both processing modes, and the saved status register (SSR), saved
program counter (SPC), vector base register (VBR), saved general register 15 (SGR), and debug
base register (DBR), which can only be accessed in privileged mode. Some bits of the status
register (such as the RB bit) can only be accessed in privileged mode.
System Registers: System registers comprise the multiply-and-accumulate registers
(MACH/MACL), the procedure register (PR), and the program counter (PC). Access to these
registers does not depend on the processing mode.
Rev. 1.50, 10/04, page 8 of 448
Floating-Point Registers and System Regi sters Rela ted t o FPU : There are thirty-two floating-
point registers, FR0–FR15 and XF0–XF15. FR0–FR15 and XF0–XF15 can be assigned to either
of two banks (FPR0_BANK0–FPR15_BANK0 or FPR0_BANK1–FPR15_BANK1).
FR0–FR15 can be used as the eight registers DR0/2/4/6/8/10/12/14 (double-precision floatingpoint registers, or pair registers) or the four registers FV0/4/8/12 (register vectors), while XF0–
XF15 can be used as the eight registers XD0/2/4/6/8/10/12/14 (register pairs) or register matrix
XMTRX.
System registers related to the FPU comprise the floating-point communication register (FPUL)
and the floating-point status/control register (FPSCR). These registers are used for communication
between the FPU and the CPU, and the exception handling setting.
Register values after a reset are shown in table 2.1.
Table 2.1 Initial Register Values
Type RegistersInitial Value*
General registers R0_BANK0 to R7_BANK0,
R0_BANK1 to R7_BANK1,
R8 to R15
Control registers
SR MD bit = 1, RB bit = 1, BL bit = 1, FD bit = 0,
3.
Accessed as general registers when the RB bit is set to 1 in SR. Accessed only by
LDC/STC instructions when the RB bit is cleared to 0.
Banked registers
4.
Accessed as general registers when the RB bit is cleared to 0 in SR. Accessed only
by LDC/STC instructions when the RB bit is set to 1.
Figure 2.2 CPU Register Configuration in Each Processing M ode
GBR
MACH
MACL
PR
VBR
PC
SPC
SGR
DBR
3
3
3
3
3
3
3
3
Rev. 1.50, 10/04, page 10 of 448
Loading...
+ 442 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.