Information regarding change of names mentioned
within this document, to Renesas Technology Corp.
On April 1st 2003 the following semiconductor operations were transferred to
Renesas Technology Corporation: operations covering microcomputer, logic,
analog and discrete devices, and memory chips other than DRAMs (flash
memory, SRAMs etc.).
Accordingly, although Hitachi, Hitachi, Ltd., Hitachi Semiconductors, and other
Hitachi brand names are mentioned in the document, these names have all
been changed to Renesas Technology Corporation.
Except for our corporate trademark, logo and corporate statement, no
changes whatsoever have been made to the contents of the document, and
these changes do not constitute any alteration to the contents of the
document itself.
Thank you for your understanding.
Renesas Technology Home Page: www.renesas.com
Renesas Technology Corp.
April 1, 2003
Renesas Technology Corp.
Page 2
SuperH™ RISC Engine
SH7032 and SH7034
HD6417032, HD6477034,
HD6437034, HD6417034
HD6437034B, HD6417034B
Hardware Manual
ADE-602-062E
Rev. 6.0
9/18/02
Hitachi, Ltd.
Page 3
Cautions
1. Hitachi neither warrants nor grants licenses of any rights of Hitachi’s or any third party’s
patent, copyright, trademark, or other intellectual property rights for information contained in
this document. Hitachi bears no responsibility for problems that may arise with third party’s
rights, including intellectual property rights, in connection with use of the information
contained in this document.
2. Products and product specifications may be subject to change without notice. Confirm that you
have received the latest product standards or specifications before final design, purchase or
use.
3. Hitachi makes every attempt to ensure that its products are of high quality and reliability.
However, contact Hitachi’s sales office before using the product in an application that
demands especially high quality and reliability or where its failure or malfunction may directly
threaten human life or cause risk of bodily injury, such as aerospace, aeronautics, nuclear
power, combustion control, transportation, traffic, safety equipment or medical equipment for
life support.
4. Design your application so that the product is used within the ranges guaranteed by Hitachi
particularly for maximum rating, operating supply voltage range, heat radiation characteristics,
installation conditions and other characteristics. Hitachi bears no responsibility for failure or
damage when used beyond the guaranteed ranges. Even within the guaranteed ranges,
consider normally foreseeable failure rates or failure modes in semiconductor devices and
employ systemic measures such as fail-safes, so that the equipment incorporating Hitachi
product does not cause bodily injury, fire or other consequential damage due to operation of
the Hitachi product.
5. This product is not designed to be radiation resistant.
6. No one is permitted to reproduce or duplicate, in any form, the whole or part of this document
without written approval from Hitachi.
7. Contact Hitachi’s sales office for any questions regarding this document or Hitachi
semiconductor products.
Page 4
Preface
The SH7032 and SH7034 are microprocessors that integrate peripheral functions necessary for
system configuration with a 32-bit internal architecture SH1-DSP CPU as its core.
The SH7032 and SH7034's on-chip peripheral functions include an interrupt controller, timers,
serial communication interfaces, a user break controller (UBC), a bus state controller (BSC), a
direct memory access controller (DMAC), and I/O ports, making it ideal for use as a
microcomputer in electronic devices that require high speed together with low power
consumption.
Intended Readership: This manual is intended for users undertaking the design of an application
system using the SH7032 and SH7034. Readers using this manual require a
basic knowledge of electrical circuits, logic circuits, and microcomputers.
Purpose: The purpose of this manual is to give users an understanding of the hardware
functions and electrical characteristics of the SH7032 and SH7034. Details
of execution instructions can be found in the SH-1, SH-2, SH-DSP
Programming Manual, which should be read in conjunction with the present
manual.
Using this Manual:
• For an overall understanding of the SH7032 and SH7034's functions
Follow the Table of Contents. This manual is broadly divided into sections on the CPU, system
control functions, peripheral functions, and electrical characteristics.
• For a detailed understanding of CPU functions
Refer to the separate publication SH-1, SH-2, SH-DSP Programming Manual.
Note on bit notation: Bits are shown in high-to-low order from left to right.
Related Material: The latest information is available at our Web Site. Please make sure that you
have the most up-to-date information available.
http://www.hitachisemiconductor.com/
The on-chip peripheral module registers are located in the on-chip peripheral module space (area
5: H'5000000–H'5FFFFFF), but since the actual register space is only 512 bytes, address bits
A23–A9 are ignored. 32k shadow areas in 512 byte units that contain exactly the same contents as
the actual registers are thus provided in the on-chip peripheral module space.
In this manual, register addresses are specified as though the on-chip peripheral module registers
were in the 512 bytes H'5FFFE00–H'5FFFFFF. Only the values of the A27–A24 and A8–A0 bits
are valid; the A23–A9 bits are ignored. When area H'5000000–H'50001FF is accessed, for
example, the result will be the same as when area H'5FFFE00–H'5FFFFFF is accessed. For more
details, see Section 8.3.5, Area Descriptions: Area 5.
Page 10
List of Items Revised or Added for This Version
SectionPageDescriptionEdition
1.1 SuperH
Microcomputer
Features
Table 1.2 Product
Lineup
6, 7SH7034, SH7032: 2 to 16.6 MHz device deleted.
Product
Number
SH7032ROMless 5.0 V2 to 20 MHz-20 to +75°C HD6417032F20HD6417032F20112-pin plastic
SH7034PROM5.0 V2 to 20 MHz -20 to +75°C HD6477034F20HD6477034F20112-pin plastic
On-Chip
Operating
ROM
Mask5.0 V2 to 20 MHz-20 to +75°C HD6437034AF20HD6437034AF20112-pin plastic
ROM
ROMless 5.0 V2 to 20 MHz-20 to +75°C HD6417034F20HD6417034F20112-pin plastic
Operating
Voltage
Frequency
3.3 V2 to 12.5 MHz -20 to +75°C HD6417032VF12HD6417032VF12
5.0 V2 to 20 MHz-20 to +75°C HD6417032X20HD6417032TE20120-pin plastic
3.3 V2 to 12.5 MHz -20 to +75°C HD6417032VX12HD6417032VTE12
3.3 V2 to12.5 MHz -20 to +75°C HD6 4 7 70 3 4 V F1 2 HD6 4 7 70 3 4 V F1 2
5.0 V2 to 20 MHz-20 to +75°C HD6477034X20HD6 4 7 70 3 4 TE 2 0 120-pin plastic
3.3 V2 to 12.5 MHz -20 to +75°C HD6 4 7 70 3 4 V X 1 2 HD6 4 7 70 3 4 V TE 1 2
3.3 V2 to 12.5 MHz -20 to +75°C HD6437034AVF12 HD6437034AF12
5.0 V2 to 20 MHz-20 to +75°C HD6437034AX20HD6437034ATE20120-pin plastic
3.3 V2 to 12.5 MHz -20 to +75°C HD6437 0 3 4 A VX 1 2 HD6437034ATE12
3.3 V2 to 12.5 MHz -20 to +75°C HD6417034VF12HD6417034VF12
5.0 V2 to 20 MHz-20 to +75°C HD6417034X20HD6417034TE20120-pin plastic
3.3 V2 to 12.5 MHz -20 to +75°C HD6417034VX12HD6417034VTE12
Temperature
RangeModel
-40 to +85°C HD6417032FI20HD6417032FI20
-40 to +85°C HD6417032VFI12HD6417032VFI12
-40 to +85°C HD6417032XI20HD6417032TEI20
-40 to +85°C HD6417032VXI12HD6417032VTEI12
-40 to +85°C HD6477034FI20HD6477034FI20
-40 to +85°C HD6 4 7 70 3 4 V FI 1 2 HD6 4 7 70 3 4 V FI 1 2
-40 to +85°C HD6477034XI20HD6 4 7 70 3 4 TE I 2 0
-40 to +85°C HD6 4 7 70 3 4 V X I 1 2 HD6 4 7 70 3 4 V TE I 1 2
-40 to +85°C HD6437034AFI20HD6437034AFI20
-40 to +85°C HD6437034AVFI12 HD6437034AFI12
-40 to +85°C HD6437034AXI20HD6437034ATEI20
-40 to +85°C HD6437034AVXI12 HD6437034ATEI12
-40 to +85°C HD6417034FI20HD6417034FI20
-40 to +85°C HD6417034VFI12HD6417034VFI12
-40 to +85°C HD6417034XI20HD6417034TEI20
-40 to +85°C HD6417034VXI12HD6417034VTEI12
Marking
Model No.
6
2
*
Package
QFP (FP-112)
TQFP (TFP-120)
QFP (FP-112)
TQFP (TFP-120)
QFP (FP-112)
TQFP (TFP-120)
QFP (FP-112)
TQFP (TFP-120)
Product
Number
SH7034B
Notes: *1 The electrical characteristics of the SH7034B mask ROM version and SH7034 PROM
1.3.2 Pin Functions
Table 1.3 Pin
12Note amended
*2 Can be used in the SH7034 PROM version.
Functions
On-Chip
Operating
Voltage
Operating
Frequency
ROM
1
*
Mask3.3 V4 to 12.5 MHz -20 to +75°C HD6437034BVF12 6437034B(***)F112-pin plastic
ROM
ROMless 3.3 V4 to 20 MHz-20 to +75°C HD6417034BVF20 HD6417034BVF20112-pin plastic
Temperature
RangeModel
-40 to +85°C HD6437034BVFW12 6437034B(***)FW
-20 to +75°C HD6437034BVX12 6437034B(***)X120-pin plastic
-40 to +85°C HD6437034BVXW12 6437034B(***)XW
-40 to +85°C HD6417034BVFW20 HD6417034BVFW20
-20 to +75°C HD6417034BVX20 6417034BVTE20120-pin plastic
-40 to +85°C HD6417034BVXW20 6417034BVTEW20
Marking
Model No.
2
*
Package
QFP (FP-112)
TQFP (TFP-120)
QFP (FP-112)
TQFP (TFP-120)
version are different.
*2 For mask ROM versions, (***) is the ROM code.
6
Page 11
SectionPageDescriptionEdition
2.1.2 Control
Registers
Figure 2.2 Control
Registers
2.1.4 Initial Values
of Registers
Table 2.1 Initial
Values of Registers
3.1 Types of
Operating Modes and
Their Selection
Table 3.1 Operating
Mode Selection
8.11.3 Maximum
Number of States
from BREQ Input to
Bus Release
Figure 8.47 Bus
Release Procedure
18Description amended
Bits I3–I0: Interrupt mask bits.
19Description amended
SRBits I3–I0 are 1111(H'F), reserved bits are 0, and other
49Note amended
*2 Only modes 0 and 1 are available in the SH7032 and SH7034
ROMless version.
174Description amended
bits are undefined
t
BRQS
t
BACD1
t
BACD2
6
6
6
6
9.1.4 Register
Configuration
Table 9.2 DMAC
Registers
9.3.4 DMA Transfer
Types
10.1.4 Register
Configuration
Table 10.3 Register
Configuration
10.4.5 ResetSynchronized PWM
Mode
Procedure for
Selecting ResetSynchronized PWM
Mode (figure 10.31):
179*4 added
*4 Only the values of bits A27–A24 and A8–A0 are valid; bits A23–A9
are ignored. For details on the register addresses, see section
8.3.5, Area Descriptions.
200Description amended
Line 3
⋅⋅⋅ destination or source must be the SCI or A/D converter
(table 9.4). ⋅⋅⋅
230*2 description amended
*2 Only 0 can be written to clear flags.
268Description amended
4. Set bits CMD1 and CMD0 in TFCR to select reset-synchronized
PWM mode. TIOCA3, TIOCB3, TIOCA4, TIOCB4, TOCXA4, and
TOCXB4 become PWM output pins.
6
6
6
6
Page 12
SectionPageDescriptionEdition
10.4.6
Complementary
PWM Mode
Procedure for
Selecting
Complementary
PWM Mode (Figure
10.33):
10.6.15 ITU
Operating Modes
Table 10.18 ITU
Operating Modes
(Channel 0)
Table 10.19 ITU
Operating Modes
(Channel 1)
271Description amended
3. Set bits CMD1 and CMD0 in TMDB to select complementary PWM
mode. TIOCA3, TIOCB3, TIOCA4, TIOCB4, TOCXA4, and
TOCXB4 become PWM pins.
301Table amended
TSNCTMDRTFCRTOCRTIOR0TCR0
Operating
ModeSyncMDF FDIR PWM
Synch-
ronized
preset
PWM√——PWM0
Output
compare A
function
SYNC0
——√——— — √√ √√
= 1
√——PWM0
302Table amended
TSNCTMDRTFCRTOCRTIOR1TCR1
Operating
ModeSyncMDF FDIR PWM
Synch-
ronized
preset
PWM√——PWM1
Output
compare A
function
SYNC1
——√——— — √√ √√
= 1
√——PWM1
Register Setting
Reset
Comp
Sync
PWM
PWM Buffer
——— — — √ *√√
= 1
————IOA2 = 0,
= 0
Register Setting
Reset
Comp
Sync
PWM
PWM Buffer
——— — — √
= 1
————IOA2 = 0,
= 0
Output
Level
Select IOAIOB
√√√
others:
don’t care
Output
Level
Select IOAIOB
√√√
others:
don’t care
*
Clear
Clock
Select
Select
Clear
Clock
Select
Select
√√
6
6
6
Table 10.20 ITU
Operating Modes
(Channel 2)
12.1.4 Register
Configuration
Table 12.2 WDT
Registers
303Table amended
TSNCTMDRTFCRTOCRTIOR2TCR2
Operating
ModeSyncMDF FDIR PWM
Synch-
ronized
preset
PWM√——PWM2
Output
compare A
function
SYNC2
——√——— — √√ √√
= 1
√——PWM2
337*4 added
NameAbbreviation R/WValueWrite
Timer control/status registerTCSRR/(W)
Timer counterTCNTR/WH'00H'5FFFFB9
Reset control/status registerRSTCSRR/(W)
Notes: *1 Write by word transfer. A byte or longword write cannot be used.
*2 Read by byte transfer. The correct value cannot be obtained by a word or longword
read.
*3 Only 0 can be written in bit 7, to clear the flag.
*4 Only the values of bits A27–A24 and A8–A0 are valid; bits A23–A9 are ignored. For
details on the register addresses, see section 8.3.5, Area Descriptions
Register Setting
Reset
Comp
Sync
PWM
PWM Buffer
——— — — √
= 1
————IOA2 = 0,
= 0
Output
Level
Select IOAIOB
3
*
3
*
Clear
Clock
Select
Select
*
√√
√√√
others:
don’t care
4
*
Initial
1
*
Address
Read
2
*
H'18H'5FFFFB8H'5FFFFB8
H'1FH'5FFFFBAH'5FFFFBB
6
6
Page 13
SectionPageDescriptionEdition
12.2.2 Timer
Control/Status
Register (TCSR)
13.2.6 Serial Control
Register
13.2.8 Bit Rate
Register (BRR)
Table 13.3 Bit Rates
and BRR Settings in
Asynchronous Mode
Table 13.4 Bit
Rates and BRR
Settings in
Synchronous Mode
338Note added
Note: * Only 0 can be written, to clear the flag.
359Initial value added
Internal clock, SCK pin used for input pin (input signal
2
is ignored) or output pin (output level is undefined)
*
(Initial value)
2
Internal clock, SCK pin used for serial clock output
*
(Initial value)
367Note added
Note: Settings with an error of 1% or less are recommended.
Port A I/O registerPAIORR/WH'0000H'5FFFFC48, 16, 32
Port A control register 1 PACR1R/WH'3302H'5FFFFC88, 16, 32
Port A control register 2 PACR2R/WH'FF95H'5FFFFCA8, 16, 32
Port B I/O registerPBIORR/WH'0000H'5FFFFC6 8, 16, 32
Port B control register 1 PBCR1R/WH'0000H'5FFFFCC8, 16, 32
Port B control register 2 PBCR2R/WH'0000H'5FFFFCE8, 16, 32
Column address strobe
pin control register
Note: * Only the values of bits A27–A24 and A8–A0 are valid; bits A23–A9 are ignored. For
details on the register addresses, see section 8.3.5, Area Descriptions.
Port C data registerPCDRR/WH'5FFFFD08, 16, 32
Note: * Only the values of bits A27–A24 and A8–A0 are valid; bits A23–A9 are ignored. For
6
—
details on the register addresses, see section 8.3.5, Area Descriptions.
Page 14
SectionPageDescriptionEdition
19.1.2 Register
Table 19.2 Standby
Control Register
(SBYCR)
20.1.2 DC
Characteristics
Table 20.2 DC
Characteristics
Table 20. 2 DC
Characteristics
Table 20.3
Permitted Output
Current Values
20.1.3 AC
Characteristics
(1) Clock Timing
Table 20.4 Clock
Timing
460Note added
NameAbbreviationR/WInitial Value Address*Access size
Standby control registerSBYCRR/WH'1FH'5FFFFBC 8, 16, 32
Note: * Only the values of bits A27–A24 and A8–A0 are valid; bits A23–A9 are ignored. For
details on the register addresses, see section 8.3.5, Area Descriptions.
46716.6 MHz deleted6
Table of 16.6 MHz deleted6
47116.6 MHz deleted6
47216.6 MHz deleted6
6
(2) Control Signal
Timing
Table 20.5 Control
Signal Timing
(3) Bus Timing
Table 20.6 Bus
Timing (1)
Table 20.7 Bus
Timing (2)
47416.6 MHz deleted6
478,
479
Description amended
6
Read data access time 1
Read data access time 2
Read data access time from
6
*
CAS 2
Read data access time from
6
*
RAS 1
Read data access time from
6
*
RAS 2
Data setup time for CAStCAS setup time for RASt
Row address hold timet
*
6
*
Table deleted
t
ACC1
t
ACC2
t
CAC2
t
RAC1
t
RAC2
DS
CSR
RAH
4
*
t
– 30
cyc
t
× (n+2) –
cyc
3
*
30
t
× (n+1) –
cyc
3
*
25
t
× 1.5 – 20 —ns20.11, 20.12
cyc
t
× (n+2.5)
cyc
3
*
– 20
5
*
0
10—ns20.16–20.18
10—ns20.11, 20.13
—ns20.8, 20.11, 20.12
—ns20.9, 20.10,
—ns
—ns
—ns20.11, 20.13
20.13–20.15
20.13–20.15
20.13–20.15
6
6
Table 20.7 Bus
Timing (2)
494Description amended
Read data access time 1
Read data access time 2
4
*
4
*
t
ACC1tcyc
t
ACC2tcyc
– 44—ns20.21, 20.24, 20.25
2
× (n+2) – 44
*
—ns20.22, 20.23,
20.26–20.28
6
Page 15
SectionPageDescriptionEdition
(4) DMAC Timing
Table 20.8 DMAC
Timing
(5) 16-bit Integrated
Timer Pulse Unit
Timing
Table 20.9 16-bit
Integrated Timer
Pulse Unit Timing
(6) Programmable
Timing Pattern
Controller and I/O
Port Timing
Table 20.10
Programmable
Timing Pattern
Controller and I/O
Port Timing
50716.6 MHz deleted6
50916.6 MHz deleted6
51016.6 MHz deleted6
(7) Watchdog Timer
Timing
Table 20.11
Watchdog Timer
Timing
(8) Serial
Communication
Interface Timing
Table 20.12 Serial
Communication
Interface Timing
(9) A/D Converter
Timing
Table 20.13 A/D
Converter Timing
20.1.4 A/D
Converter
Characteristics
51116.6 MHz deleted
51216.6 MHz deleted
51316.6 MHz deleted
51616.6 MHz deleted
6
6
6
6
Table 20.14 A/D
Converter
Characteristics
20.2 SH7034B 3.3 V
51712.5 MHz added6
12.5 MHz Version
and 20 MHz
1
Version
*
Electrical
Characteristics
Page 16
SectionPageDescriptionEdition
20.2.1 Absolute
Maximum Ratings
Table 20.15
Absolute Maximum
Ratings
Table 20.16 DC
Characteristics
517Notes amended
ItemSymbolRatingUnit
Power supply voltageV
Input voltage (except port C)V
Input voltage (port C)V
Analog power supply voltageAV
Analog reference voltageAV
Analog input voltageV
Operating temperatureT
Storage temperatureT
518,
Caution: Operating the chip in excess of the absolute maximum rating may result in permanent
Notes: *1 ROMless products only for 20 MHz version
12.5 MHz added
damage.
*2 Regular-specification products; for wide-temperature-range products, Topr = –40 to
+85°C
519
Conditions: VCC = 3.3 V ±0.3V, AVCC = 3.3 V ±0.3V, AVCC = VCC ±0.3V, AV
AV
CC
Notes: *1 ROMless products only for 20 MHz version
*2 Regular-specification products; for wide-temperature-range products, Ta = –40 to
+85°C
CC
in
in
CC
ref
AN
opr
stg
, VSS = AVSS = 0 V, φ = 12.5 to 20 MHz
–0.3 to +4.6 V
–0.3 to VCC + 0.3V
–0.3 to AVCC + 0.3V
–0.3 to +4.6 V
–0.3 to AVCC + 0.3V
–0.3 to AVCC + 0.3V
–20 to +75
–55 to +125˚C
1
*
, Ta = –20 to +75°C
2
*
= 3.0 V to
ref
2
*
6
˚C
6
Table 20.17
Permitted Output
Current Values
CurrentOrdinaryI
consumptionoperation
Sleep—20—mAf = 12.5 MHz
Standby—0.15µATa ≤ 50°C
52112.5 MHz added
ItemSymbolMinTypMaxMinTypMaxUnit
Output low-level
permissible current
(per pin)
Output low-level
permissible current
(total)
Output high-level
permissible current
(per pin)
Output high-level
permissible current
(total)
Caution: To ensure reliability of the chip, do not exceed the output current values given in table
20.18.
I
OL
∑ I
–I
–∑ I
OH
CC
—25—mAf = 12.5 MHz
—3560mAf = 20 MHz
—3040mAf = 20 MHz
——10 µA50°C < Ta
6
12.5 MHz20 MHz
——10 ——10mA
OL
——80 ——80mA
——2.0 ——2.0mA
——25 ——25mA
OH
Page 17
SectionPageDescriptionEdition
20.2.3 AC
Characteristics
(1) Clock Timing
Table 20.18 Clock
Timing
(2) Control Signal
Timing
Table 20.19 Control
Signal Timing
52212.5 MHz added and description amended
12.5 MHz20 MHz
ItemSymbolMinMaxMinMaxUnitFigures
EXTAL input high level
pulse width
EXTAL input low level
pulse width
EXTAL input rise timet
EXTAL input fall timet
Clock cycle timet
Clock high pulse widtht
Clock low pulse widtht
Clock rise timet
Clock fall timet
Reset oscillation settling
2Overflow flag (OVF)0Clear conditions: 0 is written in OVF after
1Input capture/compare match
flag B (IMFB)
0Input capture/compare match
flag A (IMFA)
6
12.5 MHz20 MHz
6
reading OVF = 1(Initial value)
1Set conditions: TCNT value overflows (H'FFFF
? H'0000) or underflows (H'FFFF ? H'0000)
0Clear conditions: 0 is written in IMFB after
reading IMFB = 1(Initial value)
1Set conditions: (1) When GRB is functioning as
the output compare register, and TCNT = GRB;
(2) When GRB is functioning as the input
capture register, and the TCNT value is
transferred to GRB by the input capture signal
0Clear conditions: 0 is written in IMFA after
reading IMFA = 1(Initial value)
1Set conditions: (1) When GRA is functioning as
the output compare register, and TCNT = GRA;
(2) When GRA is functioning as the input
capture register, and the TCNT value is
transferred to GRA by the input capture signal
A.2.23 Timer Output
Control Register
(TOCR)
Table A.24 TOCR
Bit Functions
587Table amended
Bit Bit nameValueDescription
1Output level select 4 (OLS4)0Reverse output of TIOCA3, TIOCA4, TIOCB4
0Output level select 3 (OLS3)0Reverse output of TIOCB3, TOCXA4, TOCXB4
6
1Direct output of TIOCA3, TIOCA4, TIOCB4
(Initial value)
1Direct output of TIOCB3, TOCXA4, TOCXB4
(Initial value)
Page 20
SectionPageDescriptionEdition
A.3 Register Status
in Reset and PowerDown States
Table A.77 Register
Status in Reset and
Power-Down States
A.2.65 TPC Output Control Register (TPCR) TPC.......................................................... 636
A.2.66 Next Data Enable Register A (NDERA) TPC ...................................................... 638
A.2.67 Next Data Enable Register B (NDERB) TPC....................................................... 638
A.2.68 Next Data Register A (NDRA) TPC
(When the Output Triggers of TPC Output Groups 0 and 1 are the Same).......... 639
A.2.69 Next Data Register A (NDRA) TPC
(When the Output Triggers of TPC Output Groups 0 and 1 are the Same).......... 639
A.2.70 Next Data Register A (NDRA) TPC
(When the Output Triggers of TPC Output Groups 0 and 1 are Different).......... 640
A.2.71 Next Data Register A (NDRA) TPC
(When the Output Triggers of TPC Output Groups 0 and 1 are Different).......... 640
A.2.72 Next Data Register B (NDRB) TPC
(When the Output Triggers of TPC Output Groups 2 and 3 are the Same).......... 641
A.2.73 Next Data Register B (NDRB) TPC
(When the Output Triggers of TPC Output Groups 2 and 3 are the Same).......... 641
xii
Page 34
A.2.74 Next Data Register B (NDRB) TPC
(When the Output Triggers of TPC Output Groups 2 and 3 are Different).......... 642
A.2.75 Next Data Register B (NDRB) TPC
(When the Output Triggers of TPC Output Groups 2 and 3 are Different).......... 642
A.3 Register Status in Reset and Power-Down States .............................................................. 643
Appendix B Pin States......................................................................................................... 646
Appendix C Package Dimensions.................................................................................... 652
xiii
Page 35
xiv
Page 36
Section 1 Overview
1.1SuperH Microcomputer Features
SuperH microcomputers (SH7000 series) comprise a new generation of reduced instruction set
computers (RISC) in which a Hitachi-original CPU and the peripheral functions required for
system configuration are integrated onto a single chip.
The CPU has a RISC-type instruction set. Most instructions can be executed in one system clock
cycle, which strikingly improves instruction execution speed. In addition, the CPU has a 32-bit
internal architecture for enhanced data-processing ability. As a result, the CPU enables highperformance systems to be constructed with advanced functionality at low cost, even in
applications such as realtime control that require very high speeds, an impossibility with
conventional microcomputers.
SH microcomputers include peripheral functions such as large-capacity ROM, RAM, a direct
memory access controller (DMAC), timers, a serial communication interface (SCI), an A/D
converter, an interrupt controller (INTC), and I/O ports. External memory access support functions
enable direct connection to SRAM and DRAM. These features can drastically reduce system cost.
For on-chip ROM, masked ROM or electrically programmable ROM (PROM) can be selected.
The PROM version can be programmed by users with a general-purpose PROM programmer.
Table 1.1 lists the features of the SH microcomputers (SH7032 and SH7034).
1
Page 37
Table 1.1Features of the SH7032 and SH7034 Microcomputers
FeatureDescription
CPUOriginal Hitachi architecture
32-bit internal data paths
General-register machine:
• Sixteen 32-bit general registers
• Three 32-bit control registers
• Four 32-bit system registers
RISC-type instruction set:
• Instruction length: 16-bit fixed length for improved code efficiency
• Load-store architecture (basic arithmetic and logic operations are
Generates an interrupt when the CPU or DMAC generates a bus cycle
with specified conditions
Simplifies configuration of an on-chip debugger
On-chip clock pulse generator (maximum operating frequency: 20 MHz):
• 20-MHz pulses can be generated from a 20-MHz crystal with a duty
cycle correcting circuit
Supports external memory access:
• Sixteen-bit external data bus
Address space divided into eight areas with the following preset features:
• Bus size (8 or 16 bits)
• Number of wait cycles can be defined by user.
• Type of area (external memory area, DRAM area, etc.)
Simplifies connection to ROM, SRAM, DRAM, and peripheral I/O
• When the DRAM area is accessed:
RAS and CAS signals for DRAM are output
Tp cycles can be generated to assure RAS precharge time
Address multiplexing is supported internally, so DRAM can be
connected directly
• Chip select signals (CS0 to CS7) are output for each area
DRAM refresh function:
• Programmable refresh interval
• Supports CAS-before-RAS refresh and self-refresh modes
DRAM burst access function:
• Supports high-speed access modes for DRAM
Wait cycles can be inserted by an external WAIT signal
One-stage write buffer improves the system performance
Data bus parity can be generated and checked
3
Page 39
Table 1.1Features of the SH7032 and SH7034 Microcomputers (cont)
FeatureDescription
Direct memory
access
controller (DMAC)
(4 channels)
Permits DMA transfer between the following modules:
• External memory
• External I/O
• On-chip memory
• Peripheral on-chip modules (except DMAC)
DMA transfer can be requested from external pins, on-chip SCI, on-chip
timers, and on-chip A/D converter
Cycle-steal mode or burst mode
Channel priority level is selectable
Channels 0 and 1: dual or single address transfer mode is selectable;
external request sources are supported; channels 2 and 3: dual address
transfer mode, internal request sources only
16-bit integratedTen types of waveforms can be output
t i me r pulse unit (ITU)
Input pulse width and cycle can be measured
PWM mode: pulse output with 0–100% duty cycle (maximum resolution:
50 ns)
Complementary PWM mode: can output a maximum of three pairs of non-
overlapping PWM waveforms
Phase counting mode: can count up or down according to the phase of an
external two-phase clock
Timing patternMaximum 16-bit output (4 bits × 4 channels) can be output
controller (TPC)
Non-overlap intervals can be established between pairs of waveforms
Timing-source timer is selectable
Watchdog timerCan be used as watchdog timer or interval timer
(WDT) (1 channel)
Timer overflow can generate an internal reset, external signal, or interrupt
Power-on reset or manual reset can be selected as the internal reset
Serial communication
interface (SCI)
(2 channels)
Asynchronous or synchronous mode is selectable
Can transmit and receive simultaneously (full duplex)
On-chip baud rate generator in each channel
Multiprocessor communication function
A/D converterTen bits × 8 channels
Can be externally triggered
Variable reference voltage
4
Page 40
Table 1.1Features of the SH7032 and SH7034 Microcomputers (cont)
BREQ6267IBus request: Driven low by an external device
to request bus ownership.
BACK6065OBus request acknowledge: Indicates that bus
ownership has been granted to an external
device. By receiving the BACK signal, a device
that has sent a BREQ signal can confirm that it
has been granted the bus.
Note: *Pin 77 is VCC in the SH7032 and SH7034 (masked ROM version), and V
(PROM version).
in the SH7034
PP
11
Page 47
Table 1.3Pin Functions (cont)
TypeSymbol
Operating
mode
control
MD2,
MD1,
MD0
Pin No.
(FP-112)
Pin No.
(TFP-120)I/OName and Function
82, 81, 8087, 86, 85IMode select: Selects the operating mode. Do
not change these inputs while the chip is
operating. The following table lists the possible
operating modes and their corresponding
MD2–MD0 values.
The register set consists of sixteen 32-bit general registers, three 32-bit control registers, and four
32-bit system registers.
2.1.1General Registers (Rn)
General registers Rn consist of sixteen 32-bit registers (R0–R15). General registers are used for
data processing and address calculation. Register R0 also functions as an index register. For some
instructions, the R0 register must be used. Register R15 functions as a stack pointer to save or
restore status registers (SR) and the program counter (PC) during exception handling.
031
R0
R1
R2
R3
R4
R0 functions as an index register
in the indexed register addressing
mode and indirect indexed GBR
addressing mode. In some instruc-
tions, R0 functions as a source
register or a destination register.
R5
R6
R7
R8
R9
R10
R11
R12
R13
R14
R15, SP (hardware stack pointer)
Figure 2.1 General Registers (Rn)
R15 functions as a stack pointer (SP)
during exception handling.
17
Page 53
2.1.2Control Registers
Control registers consist of the 32-bit status register (SR), global base register (GBR), and vector
base register (VBR). The status register indicates processing states. The global base register
functions as a base address for the indirect GBR addressing mode to transfer data to the registers
of on-chip supporting modules. The vector base register functions as the base address of the
exception vector area including interrupts.
SR
31
9876543210
M QI 3
I2I1I0
ST
SR: Status register
T bit: The MOVT, CMP, TAS, TST,
BT, BF, SETT, and CLRT instructions
use the T bit to indicate true (1) or
false (0). The ADDV, ADDC, SUBV,
SUBC, DIV0U, DIV0S, DIV1, NEGC,
SHAR, SHAL, SHLR, SHLL, ROTR,
ROTL, ROTCR and ROTCL
instructions also use the T bit to indicate
carry/borrow or overflow/underflow
S bit: Used by the MAC instruction.
Reserved bits. These bits always read 0.
The write value should always be 0.
Bits I3–I0: Interrupt mask bits.
M and Q bits: Used by the DIV0U, DIV0S,
and DIV1 instructions.
31
GBR
VBR
Global base register (GBR):
0
Indicates the base address in indirect
GBR addressing mode. The indirect GBR
addressing mode is used to transfer data
to the on-chip supporting module register
area, etc.
031
Vector base register (VBR):
Stores the base address of the exception
vector area.
Figure 2.2 Control Registers
18
Page 54
2.1.3System Registers
System registers consist of four 32-bit registers: multiply and accumulate registers high and low
(MACH and MACL), procedure register (PR), and program counter (PC). The multiply and
accumulate registers store the results of multiply and accumulate operations. The procedure
register stores the return address for a subroutine procedure. The program counter stores program
addresses to control the flow of the processing.
3190
(Sign extended)
MACL
31
PR
31
PC
MACH
0
0
Figure 2.3 System Registers
2.1.4Initial Values of Registers
Table 2.1 lists the values of the registers after reset.
Multiply and accumulate (MAC) registers
high and low (MACH, MACL): Store the
results of multiply and accumulate opera-
tions. MACH is sign-extended when read
because only the lowest 10 bits are valid.
Procedure register (PR): Stores the return
address for a subroutine procedure.
Program counter (PC): Indicates the
fourth byte (second instruction) after
the current instruction.
Table 2.1Initial Values of Registers
ClassificationRegisterInitial Value
General registersR0–R14Undefined
R15 (SP)Value of the stack pointer in the vector address table
Control registersSRBits I3–I0 are 1111(H'F), reserved bits are 0, and other
bits are undefined
GBRUndefined
VBRH'00000000
System registersMACH, MACL, PRUndefined
PCValue of the program counter in the vector address table
19
Page 55
2.2Data Formats
2.2.1Data Format in Registers
Register operands are always longwords (32 bits). When the memory operand is only a byte (8
bits) or a word (16 bits), it is sign-extended into a longword when stored into a register (figure
2.4).
310
Longword
Figure 2.4 Data Format in Registers
2.2.2Data Format in Memory
Memory data formats are classified into bytes, words, and longwords. Byte data can be accessed
from any address, but an address error will occur if an attempt is made to access word data starting
from an address other than 2n or longword data starting from an address other than 4n. In such
cases, the data accessed cannot be guaranteed. The hardware stack area, which is referred to by the
hardware stack pointer (SP, R15), uses only longword data starting from address 4n because this
area stores the program counter and status register (figure 2.5).
Address m + 1Address m + 3
Address 2n
Address 4n
Address m
310
70
Byte
15
310
237
7
ByteByteByte
Address m + 2
15
150
Longword
77
000
WordWord
0
Figure 2.5 Data Format in Memory
20
Page 56
2.2.3Immediate Data Format
Byte (8-bit) immediate data is located in the instruction code. Immediate data accessed by the
MOV, ADD, and CMP/EQ instructions is sign-extended and is handled in registers as longword
data. Immediate data accessed by the TST, AND, OR, and XOR instructions is zero-extended and
is handled as longword data. Consequently, AND instructions with immediate data always clear
the upper 24 bits of the destination register.
Word or longword immediate data is not located in the instruction code but rather is stored in a
memory table. The memory table is accessed by an immediate data transfer instruction (MOV)
using the PC relative addressing mode with displacement.
2.3Instruction Features
2.3.1RISC-Type Instruction Set
All instructions are RISC type. Their features are as follows:
16-Bit Fixed Length: Every instruction is 16 bits long, making program coding much more
efficient.
One Instruction/Cycle: Basic instructions can be executed in one cycle using a pipeline system.
One-cycle instructions are executed in 50 ns at 20 MHz.
Data Length: Longword is the standard data length for all operations. Memory can be accessed in
bytes, words, or longwords. Byte or word data accessed from memory is sign-extended and
handled as longword data. Immediate data is sign-extended for arithmetic operations or zeroextended for logic operations (handled as longword data).
Table 2.2Sign Extension of Word Data
SH7000 Series CPUDescriptionConventional CPUs
MOV.W
@(disp,PC),R1
ADDR1,R0
...........
.DATA.WH'1234
Data is sign-extended to 32 bits, and
R1 becomes H'00001234. It is next
operated upon by an ADD
instruction.
ADD.W
#H'1234,R0
Note:The address of the immediate data is accessed by @(disp, PC).
21
Page 57
Load-Store Architecture: Basic operations are executed between registers. For operations that
involve memory, data is loaded into to the registers and executed (load-store architecture).
Instructions such as AND that manipulate bits, however, are executed directly in memory.
Delayed Branch Instructions: Unconditional branch instructions are delayed. Pipeline disruption
during branching is reduced by first executing the instruction that follows the branch instruction,
and then branching. See the SH-1/SH-2 Programming Manual for details.
Table 2.3Delayed Branch Instructions
SH7000 Series CPUDescriptionConventional CPU
BRA TRGET
ADD R1,R0
Executes an ADD before
branching to TRGET.
ADD.W R1,R0
BRA TRGET
Multiplication/Accumulation Operation: The five-stage pipeline system and the on-chip
multiplier enable 16-bit × 16-bit → 32-bit multiplication operations to be executed in 1–3 cycles.
16-bit × 16-bit + 42-bit → 42-bit multiplication/accumulation operations can be executed in 2–3
cycles.
T bit: T bit (in the status register) is set according to the result of a comparison, and in turn is the
condition (True/False) that determines if the program will branch. The T bit in the status register is
only changed by selected instructions, thus improving the processing speed.
Table 2.4T Bit
SH7000 Series CPUDescriptionConventional CPU
CMP/GE R1,R0
BT TRGET0
BF TRGET1
T bit is set when R0 ≥ R1. The program
branches to TRGET0 when R0 ≥ R1
and to TRGET1 when R0<R1.
CMP.W R1,R0
BGE TRGET0
BLT TRGET1
ADD #–1,R0
TST R0,R0
BT TRGET
T bit is not changed by ADD. T bit is set
when R0 = 0. The program branches if
R0 = 0.
Immediate Data: Byte (8-bit) immediate data is located in the instruction code. Word or
longword immediate data is not located in instruction codes but is stored in a memory table. The
memory table is accessed by an immediate data transfer instruction (MOV) using the PC relative
addressing mode with displacement.
Note:The address of the immediate data is accessed by @(disp, PC).
MOV.W #H'1234,R0
MOV.L #H'12345678,
R0
Absolute Address: When data is accessed by absolute address, the value already in the absolute
address is placed in the memory table. By loading the immediate data when the instruction is
executed, that value is transferred to the register and the data is accessed in the indirect register
addressing mode.
Table 2.6Absolute Address Accessing
ClassificationSH7000 Series CPUConventional CPU
Absolute addressMOV.L @(disp,PC),R1
MOV. B @R1,R0
.........
.DATA.L H'12345678
MOV.B
@H'12345678,R0
Note:The address of the immediate data is accessed by @(disp, PC).
16/32-Bit Displacement: When data is accessed by 16-bit or 32-bit displacement, the pre-existing
displacement value is placed in the memory table. By loading the immediate data when the
instruction is executed, that value is transferred to the register and the data is accessed in the
indirect indexed register addressing mode.
Table 2.7Accessing by Displacement
ClassificationSH7000 Series CPUConventional CPU
16-bit displacementMOV.W @(disp,PC),R0
MOV.W @(R0,R1),R2
.........
.DATA.WH'1234
Note:The address of the immediate data is accessed by @(disp, PC).
MOV.W @(H'1234,R1),R2
23
Page 59
2.3.2Addressing Modes
Addressing modes and effective address calculation are described in table 2.8.
RnThe effective address is register Rn. (The operand
is the contents of register Rn.)
@RnThe effective address is the contents of register Rn.
RnRn
@Rn +The effective address is the contents of register Rn.
A constant is added to the contents of Rn after the
instruction is executed. 1 is added for a byte
operation, 2 for a word operation, and 4 for a
longword operation.
RnRn
Rn + 1/2/4
1/2/4
+
—
Rn
Rn
(After the
instruction is
executed)
Byte: Rn + 1
→ Rn
Word: Rn + 2
→ Rn
Longword:
Rn + 4 → Rn
Pre-decrement
indirect
register
addressing
@–RnThe effective address is the value obtained by
subtracting a constant from Rn. 1 is subtracted for
a byte operation, 2 for a word operation, and 4 for a
longword operation.
Rn
Rn – 1/2/4
1/2/4
–
Rn – 1/2/4
Byte: Rn – 1
→ Rn
Word: Rn – 2
→ Rn
Longword:
Rn – 4 → Rn
(Instruction
executed
with Rn after
calculation)
24
Page 60
Table 2.8Addressing Modes and Effective Addresses (cont)
@(disp:4, Rn)The effective address is Rn plus a 4-bit
displacement (disp). disp is zero-extended, and
remains the same for a byte operation, is doubled
for a word operation, and is quadrupled for a
Byte: Rn +
disp
Word: Rn +
disp × 2
longword operation.
Longword:
Rn
disp
+
Rn + disp × 1/2/4
Rn + disp × 4
(zero-extended)
×
1/2/4
@(R0, Rn)
Rn
+
Rn + R0
Rn + R0
Indirect
GBR
addressing
with
displacement
Indirect
indexed
GBR
addressing
R0
@(disp:8,
GBR)
The effective address is the GBR value plus an 8bit displacement (disp). The value of disp is zeroextended, and remains the same for a byte
operation, is doubled for a word operation, and is
quadrupled for a longword operation.
GBR
disp
(zero-extended)
+
GBR
+ disp × 1/2/4
×
1/2/4
@(R0, GBR)The effective address is the GBR value plus the R0
value.
GBR
Byte: GBR +
disp
Word: GBR +
disp × 2
Longword:
GBR + disp ×
4
GBR + R0
R0
+
GBR + R0
25
Page 61
Table 2.8Addressing Modes and Effective Addresses (cont)
@(disp:8, PC)The effective address is the PC value plus an 8-bit
displacement (disp). disp is zero-extended, is
doubled for a word operation, and is quadrupled for
a longword operation. For a longword operation,
the lowest two bits of the PC are masked.
PC
*
&
Word: PC +
disp × 2
Longword:
PC &
H'FFFFFFFC
+ disp × 4
PC + disp × 2
H'FFFFFFFC
disp
+
PC & H'FFFFFFFC
or
+ disp × 4
(zero-extended)
×
2/4
PC relative
addressing
*: For longword
disp:8The effective address is the PC value sign-
extended with an 8-bit displacement (disp),
doubled, and added to the PC.
PC
disp
+
PC + disp × 2
(zero-extended)
×
2
disp:12The effective address is the PC value sign-
extended with a 12-bit displacement (disp),
doubled, and added to the PC.
PC
disp
+
PC + disp × 2
(zero-extended)
PC + disp ×
2
PC + disp ×
2
26
×
2
Page 62
Table 2.8Addressing Modes and Effective Addresses (cont)
#imm:8The 8-bit immediate data (imm) for the TST, AND,
OR, and XOR instructions is zero-extended.
#imm:8The 8-bit immediate data (imm) for the MOV, ADD,
and CMP/EQ instructions is sign-extended.
#imm:8Immediate data (imm) for the TRAPA instruction is
zero-extended and is quadrupled.
—
—
—
2.3.3Instruction Formats
The instruction format refers to the source operand and the destination operand. The meaning of
the operand depends on the instruction code. Symbols are as follows.
xxxxInstruction code
mmmmSource register
nnnnDestination register
iiiiImmediate data
ddddDisplacement
27
Page 63
Table 2.9Instruction Formats
Instruction FormatSource Operand
Destination
OperandExample
0 format
150
xxxxxxxxxxxxxxxx
n format
150
xxxxxxxxxxxxnnnn
m format
150
xxxxxxxx
mmmm
xxxx
——
—nnnn: Register
direct
Control register or
system register
Control register or
system register
nnnn: Register
direct
nnnn: Register
indirect with
pre-decrement
mmmm: Register
direct
mmmm: Register
indirect with
Control register or
system register
Control register or
system register
post-increment
NOP
MOVT Rn
STS MACH,Rn
STC.L SR,@-Rn
LDC Rm,SR
LDC.L @Rm+,SR
mmmm: Register
indirect
—
JMP @Rm
28
Page 64
Table 2.9Instruction Formats (cont)
Instruction FormatSource Operand
Destination
OperandExample
nm formatmmmm: Register
direct
150
xxxxxxxx
nnnn
mmmm
mmmm: Register
direct
mmmm: Register
indirect with postincrement (multiplyand-accumulate)
nnnn: Register
indirect with postincrement (multiplyand-accumulate)*
mmmm: Register
indirect with
post-increment
mmmm: Register
direct
nnnn: Register
direct
nnnn: Register
indirect
MACH, MACL
nnnn: Register
direct
nnnn: Register
indirect with
pre-decrement
ADD Rm,Rn
MOV.L Rm,@Rn
MAC.W
@Rm+,@Rn+
MOV.L @Rm+,Rn
MOV.L Rm,@-Rn
md format
150
xxxxdddd
xxxx
mmmm
nd4 format
150
xxxxdddd
xxxx
nnnn
nmd format
150
xxxxdddd
nnnn
mmmm
mmmm: Register
direct
mmmmdddd: Register
indirect with
nnnn: Indexed
register indirect
R0 (Register
direct)
displacement
R0 (Register direct) nnnndddd:
Register indirect
with displacement
mmmm: Register
direct
nnnndddd:
Register indirect
with displacement
mmmmdddd: Register
indirect with
nnnn: Register
direct
displacement
MOV.L
Rm,@(R0,Rn)
MOV.B
@(disp,Rn),R0
MOV.B
R0,@(disp,Rn)
MOV.L
Rm,@(disp,Rn)
MOV.L
@(disp,Rm),Rn
29
Page 65
Table 2.9Instruction Formats (cont)
Instruction FormatSource Operand
Destination
OperandExample
d format
150
xxxx
xxxx
dddd
dddd
d12 format
150
xxxx
dddd
dddddddd
nd8 format
150
xxxx
nnnn
dddd
dddd
dddddddd: GBR
indirect with
R0 (Register
direct)
displacement
R0 (Register direct) dddddddd: GBR
indirect with
displacement
dddddddd: PC
relative with
R0 (Register
direct)
displacement
dddddddd: PC
—
relative
dddddddddddd:
—
PC relative
dddddddd: PC
relative with
nnnn: Register
direct
displacement
MOV.L
@(disp,GBR),R0
MOV.L
R0,@(disp,GBR)
MOVA
@(disp,PC),R0
BF label
BRA label
(label = disp + PC)
MOV.L
@(disp,PC),Rn
i formatiiiiiiii:
Immediate
150
xxxxxxxxi i i i
i i i i
iiiiiiii:
Immediate
iiiiiiii:
Indexed GBR
indirect
R0 (Register
direct)
—
Immediate
ni format
150
xxxx
nnnn
i i i i
i i i i
iiiiiiii:
Immediate
nnnn: Register
direct
Note: *In multiply-and-accumulate instructions, nnnn is the source register.
AND.B
#imm,@(R0,GBR)
AND #imm,R0
TRAPA #imm
ADD #imm,Rn
30
Page 66
2.4Instruction Set
2.4.1Instruction Set by Classification
Table 2.10 lists instructions by classification.
Table 2.10Classification of Instructions
ClassificationTypes
Data
transfer
Arithmetic17ADDBinary addition28
operations
5MOVData transfer, immediate data transfer,
Operation
CodeFunction
supporting module data transfer, structure data
transfer
MOVAEffective address transfer
MOVTT bit transfer
SWAPSwap of upper and lower bytes
XTRCTExtraction of the middle of registers connected
ADDCBinary addition with carry
ADDVBinary addition with overflow check
CMP/condComparison
DIV1Division
DIV0SInitialization of signed division
DIV0UInitialization of unsigned division
Number of
Instructions
39
EXTSSign extension
EXTUZero extension
MACMultiplication and accumulation
MULSSigned multiplication
MULUUnsigned multiplication
NEGNegation
NEGCNegation with borrow
SUBBinary subtraction
SUBCBinary subtraction with carry
SUBVBinary subtraction with underflow check
Logic6ANDLogical AND14
operations
NOTBit inversion
ORLogical OR
TASMemory test and bit set
31
Page 67
Table 2.10Classification of Instructions (cont)
ClassificationTypes
Operation
CodeFunction
Number of
Instructions
Logic oper-6TSTLogical AND and T bit set14
ations
(cont)
XORExclusive OR
Shift10ROTLOne-bit left rotation14
ROTROne-bit right rotation
ROTCLOne-bit left rotation with T bit
ROTCROne-bit right rotation with T bit
SHALOne-bit arithmetic left shift
SHAROne-bit arithmetic right shift
SHLLOne-bit logical left shift
SHLLnn-bit logical left shift
SHLROne-bit logical right shift
SHLRnn-bit logical right shift
Branch7BFConditional branch (T = 0)7
BTConditional branch (T = 1)
BRAUnconditional branch
BSRBranch to subroutine procedure
JMPUnconditional branch
JSRBranch to subroutine procedure
RTSReturn from subroutine procedure
System11CLRTT bit clear31
control
CLRMACMAC register clear
LDCLoad to control register
LDSLoad to system register
NOPNo operation
RTEReturn from exception handling
SETTT bit set
SLEEPShift into power-down mode
STCStore control register data
STSStore system register data
TRAPATrap exception handling
Total56133
32
Page 68
The following tables (arranged by instruction classification) show instruction codes, operations,
and execution states, using the format shown below.
Direction of transfer
Memory operand
Flag bits in SR
Logical AND of each bit
Logical OR of each bit
Exclusive OR of each bit
Logical NOT of each bit
n-bit shift
*
ExecutionValue when no wait states are inserted
cycle
T bitValue of T bit after instruction is executed
—No change
Note:*The table shows the minimum number of execution states. In practice, the number of
instruction execution states will be increased in cases such as the following:
1.When there is conflict between an instruction fetch and a data access
2.When the destination register of a load instruction (memory → register) is also used by
the following instruction
Instruction execution cycles: The execution cycles shown
in the table are minimums. The actual number of cycles
may be increased:
1. When contention occurs between instruction fetches and
data access, or
2. When the destination register of the load instruction
(memory → register) and the register used by the next
instruction are the same.
The CPU has five processing states: reset, exception handling, bus-released, program execution
and power-down. The transitions between the states are shown in figure 2.6. For more information
on the reset and exception handling states, see section 4, Exception Handling. For details on the
power-down state, see section 19, Power-Down State.
45
Page 81
From any state when
RES = 0 and NMI = 1
Power-on reset stateManual reset state
From any state when
RES = 0 and NMI = 0
RES = 0, NMI = 0
RES = 0, NMI = 1
When an interrupt source
or DMA address error occurs
Bus request
cleared
Bus-release-state
Bus request
generated
Bus request
generated
Bus request
cleared
RES = 1,
NMI = 1
Exception handling state
Bus request
generated
Exception
handling
source occurs
Bus request
cleared
Program execution state
SLEEP instruction
with SBY bit cleared
RES = 1,
NMI = 0
Exception
handling
ends
Reset states
NMI interrupt
source occurs
SLEEP
instruction with
SBY bit set
Figure 2.6 Transitions Between Processing States
46
Standby modeSleep mode
Power-down state
Page 82
Reset State: In the reset state the CPU is reset. This occurs when the RES pin level goes low.
When the NMI pin is high, the result is a power-on reset; when it is low, a manual reset will occur.
When turning on the power, be sure to carry out a power-on reset.
In a power-on reset, all CPU internal states and on-chip supporting module registers are initialized.
In a manual reset, all CPU internal states and on-chip supporting module registers, with the
exception of the bus state controller (BSC) and pin function controller (PFC), are initialized. In a
manual reset, the BSC is not initialized, so refresh operations will continue.
Exception Handling State: Exception handling is a transient state that occurs when the CPU’s
processing state flow is altered by exception handling sources such as resets or interrupts.
In a reset, the initial values of the program counter PC (execution start address) and stack pointer
SP are fetched from the exception vector table and stored; the CPU then branches to the execution
start address and execution of the program begins.
For an interrupt, the stack pointer (SP) is accessed and the program counter (PC) and status
register (SR) are saved to the stack area. The exception handling routine start address is fetched
from the exception vector table; the CPU then branches to that address and the program starts
executing, thereby entering the program execution state.
Program Execution State: In the program execution state, the CPU sequentially executes the
program.
Power-Down State: In the power-down state, CPU operation halts and power consumption
decreases. The SLEEP instruction places the CPU in the power-down state. This state has two
modes: sleep mode and standby mode.
Bus-Released State: In the bus-released state, the CPU releases the bus to the device that has
requested it.
47
Page 83
2.5.2Power-Down State
In addition to the ordinary program execution states, the CPU also has a power-down state in
which CPU operation halts and power consumption is reduced There are two power-down state
modes: sleep mode and standby mode.
Sleep Mode: When the standby bit SBY (in the standby control register, SBYCR) is cleared to 0
and a SLEEP instruction is executed, the CPU switches from program execution state to sleep
mode. In sleep mode, the CPU halts and the contents of its internal registers and the data in onchip RAM are stored. The on-chip supporting modules other than the CPU do not halt in sleep
mode.
Sleep mode is cleared by a reset, any interrupt, or a DMA address error; the CPU returns to
ordinary program execution state through the exception handling state.
Software Standby Mode: To enter standby mode, set standby bit SBY (in the standby control
register, SBYCR) to 1 and execute a SLEEP instruction. In standby mode, all CPU, on-chip
supporting module and oscillator functions are halted. CPU internal register contents and on-chip
RAM data are held.
Standby mode is cleared by a reset or an external NMI interrupt. For resets, the CPU returns to the
ordinary program execution state through the exception handling state when placed in a reset state
during the oscillator settling time. For NMI interrupts, the CPU returns to the ordinary program
execution state through the exception handling state after the oscillator settling time has elapsed.
In this mode, power consumption drops markedly, since the oscillator stops.
Table 2.19Power-Down State
State
ModeConditionsClockCPU
Sleep
mode
Execute SLEEP
instruction with
SBY bit cleared
to 0 in SBYCR
RunHalted RunHeldHeldHeld
On-Chip
Supporting
Modules
CPU
RegistersRAM
I/O
PortsCanceling
1. Interrupt
2. DMA address
error
3. Power-on reset
Standby
mode
Note: * Differs depending on the supporting module and pin.
48
Execute SLEEP
instruction with
SBY bit set to 1
in SBYCR
Halted Halted Halted and
initialized
HeldHeldHeld or
*
high-Z
(selectable)
4. Manual reset
1. NMI
*
2. Power-on reset
3. Manual reset
Page 84
Section 3 Operating Modes
3.1Types of Operating Modes and Their Selection
The SH7032 microcomputer operates in one of two operating modes (modes 0 and 1) and the
SH7034 operates in one of four operating modes (modes 0, 1, 2, and 7). Modes 0 and 1 differ in
the bus width of memory area 0. The mode is selected by the mode pins (MD2–MD0) as indicated
in table 3.1. Do not change the mode selection while the chip is operating.
Table 3.1Operating Mode Selection
Pin Settings
Operating ModeMD2MD1MD0Mode NameBus Width of Area 0
*2 Only modes 0 and 1 are available in the SH7032 and SH7034 ROMless version.
3.2Operating Mode Descriptions
3.2.1Mode 0 (MCU Mode 0)
In mode 0, memory area 0 has an eight-bit bus width. For the memory map, see section 8, Bus
State Controller (BSC).
3.2.2Mode 1 (MCU Mode 1)
In mode 1, memory area 0 has a 16-bit bus width.
3.2.3Mode 2 (MCU Mode 2)
In mode 2, memory area 0 is assigned to the on-chip ROM. Mode 2 should only be set for the
product is the SH7034.
3.2.4Mode 7 (PROM Mode)
Mode 7 is a PROM mode. In this mode, the PROM can be programmed. For details, see section
17, ROM. Mode 7 should only be set for the SH7034 (PROM version).
49
Page 85
50
Page 86
Section 4 Exception Handling
4.1Overview
4.1.1Exception Handling Types and Priorities
As figure 4.1 indicates, exception handling may be caused by a reset, address error, interrupt, or
instruction. Exception sources are prioritized as indicated in figure 4.1. If two or more exceptions
occur simultaneously, they are accepted and handled in the priority order shown.
51
Page 87
Priority
Exception
source
Reset
Address
error
Interrupt
• Power-on reset
• Manual reset
• CPU address error
• DMA address error
• NMI
• User break
• IRQ
• On-chip module
• Trap instruction
• IRQ0–IRQ7
• Direct memory access
controller
• 16-bit integrated timer
pulse unit
• Serial communication
interface
• Parity control unit
(part of the bus con-
troller)
• A/D converter
• Watchdog timer
• DRAM refresh control
unit (part of the bus
controller)
• TRAPA instruction
High
Instruction
• General illegal
• Undefined code
instruction
• Illegal slot
instruction
• Undefined instruction
or instruction that
rewrites the PC
*1
placed directly after
Low
a delayed branch
instruction
*2
Notes: *1The instructions that rewrite the PC are JMP, JSR, BRA, BSR, RTS, RTE, BT, BF, and
TRAPA.
*2The delayed branch instructions are JMP, JSR. BRA. BSR, RTS, and RTE.
Figure 4.1 Exception Source Types and Priority
52
Page 88
4.1.2Exception Handling Operation
Exception sources are detected at the times indicated in table 4.1, whereupon handling starts.
Table 4.1Exception Source Detection and Start of Handling
Exception TypeSource Detection and Start of Handling
ResetPower-onLow-to-high transition at RES pin when NMI is high
ManualLow-to-high transition at RES pin when NMI is low
Address errorDetected when instruction is decoded and starts after the
instruction that was executing prior to this point is completed.
InterruptDetected when instruction is decoded and starts after the
instruction that was executing prior to this point is completed.
InstructionTrap instructionStarts when a trap instruction (TRAPA) is executed.
General illegal
instruction
Illegal slot
instruction
Starts when undefined code is decoded at a position other than
directly after a delayed branch instruction (a delay slot).
Starts when undefined code or an instruction that rewrites the PC
is decoded directly after a delayed branch instruction (in a delay
slot).
When exception handling begins, the CPU operates as follows:
Resets: The initial values of the program counter (PC) and stack pointer (SP) are read from the
exception vector table (the respective PC and SP values are H'00000000 and H'00000004 for a
power-on reset and H'00000008 and H'0000000C for a manual reset). For more information on the
exception vector table, see section 4.1.3, Exception Vector Table. Next, the vector base register
(VBR) is cleared to zero and interrupt mask bits (I3–I0) in the status register (SR) are set to 1111.
Program execution starts from the PC address read from the exception vector table.
Address Errors, Interrupts and Instructions: SR and PC are pushed onto the stack indicated in
R15. For interrupts, the interrupt priority level is written in the interrupt mask bits (I3–I0). For
address errors and instructions, bits I3–I0 are not affected. Next, the start address is fetched from
the exception vector table, and program execution starts from this address.
53
Page 89
4.1.3Exception Vector Table
Before exception handling can execute, the exception vector table must be set in memory. The
exception vector table holds the start addresses of exception handling routines (the table for reset
exception handling stores initial PC and SP values). Different vector numbers and vector table
address offsets are assigned to different exception sources. The vector table addresses are
calculated from the corresponding vector numbers and vector address offsets. In exception
handling, the exception handling routine start address is fetched from the exception vector table
indicated by this vector table address.
Table 4.2 lists vector numbers and vector table address offsets. Table 4.3 shows how vector table
addresses are calculated.
54
Page 90
Table 4.2Exception Vector Table
Vector
Exception Source
Power-on resetPC0H'00000000–H'00000003
SP1H'00000004–H'00000007
Manual resetPC2H'00000008–H'0000000B
SP3H'0000000C–H'0000000F
General illegal instruction4H'00000010–H'00000013
(Reserved for system use)5H'00000014–H'00000017
Illegal slot instruction6H'00000018–H'0000001B
(Reserved for system use)7H'0000001C–H'0000001F
CPU address error9H'00000024–H'00000027
DMA address error10H'00000028–H'0000002B
NumberVector table Address Offset
8H'00000020–H'00000023
InterruptsNMI11H'0000002C–H'0000002F
User break12H'00000030–H'00000033
(Reserved for system use)13–31H'00000034–H'00000037 to
H'0000007C–H'0000007F
Trap instruction (user vectors)32–63H'00000080–H'00000083 to
H'000000FC–H'000000FF
InterruptsIRQ064H'00000100–H'00000103
IRQ165H'00000104–H'00000107
IRQ266H'00000108–H'0000010B
IRQ367H'0000010C–H'0000010F
IRQ468H'00000110–H'00000113
IRQ569H'00000114–H'00000117
IRQ670H'00000118–H'0000011B
IRQ771H'0000011C–H'0000011F
On-chip
modules*
72–255H'00000120–H'00000123 to
H'000003FC–H'000003FF
Note: *See table 5.3, Interrupt Exception Vectors and Rankings, in section 5, Interrupt Controller
(INTC), for details on vector numbers and vector table address offsets of individual on-chip
supporting module interrupts.
55
Page 91
Table 4.3Calculation of Exception Vector Table Addresses
Exception SourceCalculation of Vector Table Address
Note:VBR: Vector base register. For vector table address offsets and vector numbers, see table
4.2.
4.2Resets
4.2.1Reset Types
A reset is the highest-priority exception. There are two types of reset: power-on reset and manual
reset. As table 4.4 shows, a power-on reset initializes the internal state of the CPU and all registers
of the on-chip supporting modules. A manual reset initializes the internal state of the CPU and all
registers of the on-chip supporting modules except the bus state controller (BSC), pin function
controller (PFC), and I/O ports (I/O).
Table 4.4Reset Types
Transition ConditionsInternal State
ResetNMIRESCPUOn-Chip Supporting Modules
Power-on ResetHighLowInitializedInitialized
Manual ResetLowLowInitializedAll initialized except BSC, PFC, and I/O
56
Page 92
4.2.2Power-On Reset
When the NMI pin is high, a low input at the RES pin drives the chip into the power-on reset state.
The RES pin should be driven low while the clock pulse generator (CPG) is stopped (or while the
CPG is operating during the oscillation settling time) for at least 20 t
to assure that the chip is
cyc
reset. A power-on reset initializes the internal state of the CPU and all registers of the on-chip
supporting modules. For pin states in the power-on reset state, see appendix B, Pin States.
While the NMI pin remains high, if the RES pin is held low for a certain time then driven high in
the power-on state, power-on reset exception handling begins. The CPU then:
1. Reads the start address (initial PC value) from the exception vector table.
2. Reads the initial stack pointer value (SP) from the exception vector table.
3. Clears the vector base register (VBR) to H'00000000, and sets interrupt mask bits I3–I0 in the
status register (SR) to H'F (1111).
4. Loads the values read from the exception vector table into the PC and SP and starts program
execution.
A power-on reset must be executed when turning on power.
4.2.3Manual Reset
When the NMI pin is high, a low input at the RES pin drives the chip into the manual reset state.
To ensure that the chip is properly reset, drive the RES pin low for at least 20 t
. A manual reset
cyc
initializes the internal state of the CPU and all registers of the on-chip supporting modules except
the bus state controller, pin function controller, and I/O ports. Since a manual reset does not affect
the bus state controller, the DRAM refresh control function operates even if the manual reset state
continues for a long time. When a manual reset is performed during the bus cycle, manual reset
exception handling is deferred until the end of the bus cycle. The manual reset thus cannot be used
to abort the bus cycle. For the pin states during the manual reset state, see appendix B, Pin States.
While the NMI pin remains low, if the RES pin is held low for a certain time then driven high in
the manual reset state, manual reset exception handling begins. The CPU carries out the same
operations as for a power-on reset.
57
Page 93
4.3Address Errors
4.3.1Address Error Sources
Address errors occur during instruction fetches and data reading/writing as shown in table 4.5.
Table 4.5Address Error Sources
Bus Cycle
TypeBus MasterOperationAddress Error
Instruction fetchCPUInstruction fetch from even addressNone (normal)
Instruction fetch from odd addressAddress error
Instruction fetch from outside on-chip
supporting module space
Instruction fetch from on-chip supporting
module space
Data read/writeCPU or DMACAccess to word data from even addressNone (normal)
Access to word data from odd addressAddress error
Access to longword data aligned on
longword boundary
Access to longword data not aligned on
longword boundary
Access to word or byte data in on-chip
supporting module space*
Access to longword data in 16-bit on-
chip supporting module space*
Access to longword data in 8-bit on-chip
supporting module space*
Note: *See section 8, Bus State Controller (BSC), for details on the on-chip supporting module
space.
None (normal)
Address error
None (normal)
Address error
None (normal)
None (normal)
Address error
4.3.2Address Error Exception Handling
When an address error occurs, address error exception handling starts after both the bus cycle that
caused the address error and the instructions that were being executed at that time, have been
completed. The CPU then:
1. Pushes SR onto the stack.
2. Pushes the program counter onto the stack. The PC value saved is the start address of the
instruction following the last instruction to be executed.
3. Fetches the exception handling routine start address from the exception vector table for the
address error that occurred and starts program execution from that address. The branch that
occurs here is not a delayed branch.
58
Page 94
4.4Interrupts
4.4.1Interrupt Sources
Table 4.6 lists the types of interrupt exception handling sources (NMI, user break, IRQ, on-chip
supporting module).
Table 4.6Interrupt Sources
InterruptRequesting Pin or ModuleNumber of Sources
16-bit integrated timer pulse unit15
Serial communication interface8
A/D converter1
Watchdog timer1
Bus state controller2
Each interrupt source has a different vector number and vector address offset value. See table 5.3,
Interrupt Exception Vectors and Rankings, in section 5, Interrupt Controller (INTC), for details on
vector numbers and vector table address offsets.
4.4.2Interrupt Priority Rankings
Interrupt sources are assigned priorities. When multiple interrupts occur at the same time, the
interrupt controller (INTC) ascertains their priorities and starts exception handling based on its
findings. Priorities from 16–0 can be assigned, with 0 the lowest level and 16 the highest. NMI has
priority level 16 and cannot be masked. NMI is always accepted. The user break priority level is
15. The IRQ and on-chip supporting module interrupt priority levels can be set in interrupt priority
level registers A–E (IPRA–IPRE) as shown in table 4.7. Priority levels 0–15 can be set. See
section 5.3.1, Interrupt Priority Registers A-E (IPRA–IPRE), for details.
59
Page 95
Table 4.7Interrupt Priority Rankings
TypePriorityComments
NMI 16Fixed and unmaskable
User break15Fixed
IRQ and on-chip supporting
modules
0–15Set in interrupt priority level registers A–E
(IPRA–IPRE)
4.4.3Interrupt Exception Handling
When an interrupt is generated, the INTC ascertains the interrupt ranking. NMI is always
accepted, but other interrupts are only accepted if their ranking is higher than the ranking set in the
interrupt mask bits (I3–I0) of SR.
When an interrupt is accepted, interrupt exception handling begins. In the interrupt exception
handling sequence, the SR and PC values are pushed onto the stack, and the priority level of the
accepted interrupt is copied to the interrupt mask level bits (I3–I0) in SR. In NMI exception
handling, the priority ranking is 16 but the value 15 (H'F) is stored in I3–I0. The exception
handling routine start address for the accepted interrupt is fetched from the exception vector table
and the program branches to that address and starts executing. For further information on
interrupts, see section 5.4, Interrupt Operation.
60
Page 96
4.5Instruction Exceptions
4.5.1Types of Instruction Exceptions
Table 4.8 shows the three types of instruction that start exception handling (trap instructions,
illegal slot instructions, and general illegal instructions).
Table 4.8Types of Instruction Exceptions
TypeSource InstructionComments
Trap instructionTRAPA—
Illegal slot
instruction
General illegal
instructions
Undefined code or instruction
that rewrites the PC located
immediately after a delayed
branch instruction (delay slot)
Undefined code in other than
delay slot
Delayed branch instructions are: JMP, JSR,
BRA, BSR, RTS, RTE. Instructions that
rewrite the PC are: JMP, JSR, BRA, BSR,
RTS, RTE, BT, BF, and TRAPA
—
4.5.2Trap Instruction
Trap instruction exception handling is carried out when a trap instruction (TRAPA) is executed.
The CPU then:
1. Saves the status register by pushing register contents onto the stack.
2. Pushes the program counter value onto the stack. The PC value saved is the start address of the
next instruction after the TRAPA instruction.
3. Reads the exception handling routine start address from the vector table corresponding to the
vector number specified in the TRAPA instruction, branches to that address, and starts
program execution. The branch is not a delayed branch.
61
Page 97
4.5.3Illegal Slot Instruction
An instruction located immediately after a delayed branch instruction is called an “instruction
placed in a delay slot.” If an undefined instruction is located in a delay slot, illegal slot instruction
exception handling begins executing when the undefined code is decoded. Illegal slot instruction
exception handling also begins when the instruction located in the delay slot is an instruction that
rewrites the program counter. In this case, exception handling begins when the instruction that
rewrites the PC is decoded. The CPU performs illegal slot exception handling as follows:
1. Saves the status register onto the stack.
2. Pushes the program counter value onto the stack. The PC value saved is the branch destination
address of the delayed branch instruction immediately before the instruction that contains the
undefined code or rewrites the PC.
3. Fetches the exception handling routine start address from the vector table corresponding to the
exception that occurred, branches to that address, and starts executing the program. The branch
is not a delayed branch.
4.5.4General Illegal Instructions
If an undefined instruction located other than in a delay slot (immediately after a delayed branch
instruction) is decoded, general illegal instruction exception handling is executed. The CPU
follows the same procedure as for illegal slot exception handling, except that the program counter
(PC) value pushed on the stack in general illegal instruction exception handling is the start address
of the illegal instruction with the undefined code.
62
Page 98
4.6Cases in which Exceptions are Not Accepted
In some cases, address errors and interrupts that directly follow a delayed branch instruction or
interrupt-disabled instruction are not accepted immediately. Table 4.9 lists these cases. When this
occurs, the exception is accepted when an instruction that can accept the exception is decoded.
Table 4.9Cases in which Exceptions are Not Accepted
Exception Source
CaseAddress ErrorInterrupt
1
Immediately after delayed branch instruction
Immediately after interrupt-disabled instruction
Address errors and interrupts are not accepted when an instruction in a delay slot immediately
following a delayed branch instruction is decoded. The delayed branch instruction and the
instruction in the delay slot are therefore always executed one after the other. Exception handling
is never inserted between them.
4.6.2Immediately after Interrupt-Disabling Instruction
Interrupts are not accepted when the instruction immediately following an interrupt-disabled
instruction is decoded. Address errors are accepted, however.
63
Page 99
4.7Stack Status after Exception Handling
Table 4.10 shows the stack after exception handling.
Table 4.10Stack after Exception Handling
TypeStack StatusTypeStack Status
Address
error
Trap
instruction
SP
SP
Address of
instruction
after instruc-
tion that has
finished
executing
SR
Address of
instruction
after TRAPA
instruction
SR
Upper 16 bits
Lower 16 bits
Upper 16 bits
Lower 16 bits
Upper 16 bits
Lower 16 bits
Upper 16 bits
Lower 16 bits
Interrupt
Illegal
slot
instruction
SP
SP
Address of
instruction
after instruc-
tion that
has finished
executing
Note:Stack status is based on a bus width of 16 bits.
SP
Start add-
ress of
illegal
instruction
SR
Upper 16 bits
Lower 16 bits
Upper 16 bits
Lower 16 bits
Lower 16 bits
64
Page 100
4.8Notes
4.8.1Value of the Stack Pointer (SP)
An address error occurs if the stack is accessed for exception handling when the value of the stack
pointer (SP) is not a multiple of four. Therefore, a multiple of four should always be stored in the
SP.
4.8.2Value of the Vector Base Register (VBR)
An address error occurs if the vector table is accessed for exception handling when the value of
the vector base register (VBR) is not a multiple of four. Therefore, VBR should always be set to a
multiple of four.
4.8.3Address Errors Caused by Stacking During Address Error Exception Handling
If the stack pointer is not a multiple of four, address errors will occur in the exception handling
(interrupt, etc.) stacking. After the exception handling ends, the CPU will then shift to address
error exception handling. An address error will also occur during the address error exception
handling stacking, but the CPU is set up to ignore the address error so that it can avoid an infinite
series of address errors. This allows it to shift program control to the address error exception
handling routine and handle the error.
When an address error does occur in exception handling stacking, the stacking bus cycle (write) is
executed. In SR and PC stacking, four is subtracted from each of the SPs so the SP values are not
multiples of four after stacking either. Since the address value output during stacking is the SP
value, the address that produced the error is exactly what is output. In such cases, the stacked write
data will be undefined.
65
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.