The MB91191/MB91192 are developed as one of the "32-bit single-chip microcontroller FR20 series"
around the new RISC architecture CPU as its cores, and the specifications for these products are optimized
for structures on which high-performance CPU processing power is required.
The functions and operations of the MB91191/MB91192 are described in this document specifically for
engineers who actually develop products using the MB91191 and MB91192. Please read through this
manual. For more information on various instructions, refer to "Instruction Manual".
Trademarks
■ Trademarks
FR is the abbreviation of FUJITSU RISC controller, which is a product of Fujitsu LIMITED.
Embedded Algorithm TM is a registered trademark of Advanced Micro Devices, Inc.
Other system and product names used in this manual are trademarks of the related companies and
organizations.
i
■ Organization of This Document
This manual contains the following 21 chapters and an appendix.
CHAPTER 1 Overview of MB91191/MB91192 Series
This chapter includes basic explanations including features of the MB91191/MB91192 series, block
diagrams, and a function outline.
CHAPTER 2 Handling Devices
This chapter describes points to note when using the MB91191/MB91192 series.
CHAPTER 3 CPU
This chapter provides basic explanations for such elements as the architecture, specifications, and
commands, etc., required to understand the CPU core functions of the FR series.
CHAPTER 4 External Bus Interface
This chapter describes an outline of the external bus interface, the register configuration/fun ctions, the
bus operation, and the bus timing, and program examples for the bus operation are explained.
CHAPTER 5 I/O Port
This chapter describes an outline of the I/O port and the register configuration/functions.
CHAPTER 6 FG Input
This chapter describes an outline of the FG input section, the register configuration/fu nctions, and their
operation.
CHAPTER 7 FRC Capture
This chapter describes an outline of the FRC capture section, the register configuratio n/functions, and
each input section operation.
CHAPTER 8 Programmable Pulse Generator (PPG0, 1)
This chapter describes an outline of the programmable pulse generator (PPG0, 1), the register
configuration/functions, and their operation.
CHAPTER 9 Real Timing Generator (RTG)
This chapter describes an outline of the real timing generator (RTG), the register configuration/
functions, and their operation.
CHAPTER 10 Timer
This chapter describes an outline of the timer section, the register configuration/functions, and timer
section operation.
CHAPTER 11 12-bit PWM
This chapter describes an outline of the PWM, the register configuration/functions, and the PWM
operations.
CHAPTER 12 8-bit Pulse Width Counter
This chapter describes an outline of the 8-bit pulse width counter, the register configuration/functions,
and 8-bit pulse width counter operations.
CHAPTER 13 External Interrupt
External interrupt comprises of the key input interrupt and external interrupt sections. This chapter
describes an outline of the external interrupt 1 (key input circuit) and exter nal interrupt (INT0 to 2), and
the register configuration/functions, and their operation.
ii
CHAPTER 14 Delayed Interrupt Module
This chapter describes an outline of the delayed interrupt m odule, the register configuration/functions,
and delayed interrupt module operations.
CHAPTER 15 Interrupt Controller
This chapter describes an outline of the interrupt controller, the register configuration/functions, and the
interrupt controller operations.
CHAPTER 16 10-bit A/D Converter
This chapter describes an outline of th e 10-bit A/D converter, the regi ster configuration/functions, and
the 10-bit A/D converter operations.
CHAPTER 17 Serial I/O
This chapter describes an outline of the serial I/O, the register configuration/functions, and the serial
data RAM and serial I/O operations.
CHAPTER 18 10-bit General-purpose Prescaler
This chapter describes an outline of the 10-bit general-purpose prescaler, the register configuration/
functions, and the 10-bit general-purpose prescaler operations.
CHAPTER 19 Bit Search Module
This chapter describes an outline of the bit search m odule, the register configuration/functions, the bit
search module operations, and save/return processes.
CHAPTER 20 Wait Controller
This chapter describes an outline of the wait control section, and the register configuration/functions.
CHAPTER 21 Flash Memory
This chapt er de sc ribe s an outl ine of th e fl ash mem ory , the register configuration/functions and the flash
memory operations.
Appendix
Details that could not be described within the body text, such as I/O map, interrupt vector, peripheral
circuit measurement speed, restrictions and commands list for us e o f th e M B 9119 1 /M B 9119 2 s erie s ar e
described in the appendix.
iii
• The contents of this document are subject to change without notice. Customers are advised to consult with
FUJITSU sales representatives before ordering.
• The information, su ch as des criptions o f function an d applicat ion circuit examples, in this d ocument are pres ented
solely for the purpose of reference t o show examples of operations and us es of FUJITSU semiconductor device;
FUJITSU does not warrant proper operation of the device with respect to use based on such information. When you
develop equipment incorporating the device based on such information, you must assume any responsibility arising
out of such use of the information. FUJITSU assumes no liability for any damages whatsoever arising out of the
use of the information.
• Any information in this document, including descriptions of function and schematic diagrams, shall not be
construed as license of the use or exercise of any intellectual property right, such as patent right or copyright, or
any other right of FUJITSU or any third party or does FUJITSU warrant non-infringement of any third-party's
intellectual property right or other right by using such information. FUJITSU assumes no liability for any
infringement of the intellectual property rights or other rights of third parties which would result from the use of
information co ntained herein.
• The products d escribed in this document a re designed, developed and ma nufactured as contemplated for general
use, including without limitation, ordinary industrial use, general office use, personal use, and household use, but
are not designed, de veloped and manufactured as cont emplated (1) for use accompanying fatal risks or dangers
that, unless extremely high safety is secured, could have a serious effect to the public, and could lead directly to
death, personal injury, severe physical damage or other loss (i.e., nuclear reaction control in nuclear facility,
aircraft flight control, air traffic control, mass transport control, medical life support system, missile launch control
in weapon system), or (2) for use requiring extremely high reliability (i.e., submersible repeater and artificial
satellite). Please note that FUJITSU will not be liable against you and/or any third party for any claims or damages
arising in connection with above-mentioned uses of the products.
• Any semiconduct or devices have an inheren t chance of failure. You must protect against injury, da mage or loss
from such failures by incorporating safety design measures into your facility and equipment such as redundancy,
fire protection, and prevention of over-cu rr e nt leve ls an d oth er abnormal operating conditions.
• If any products described in this document represent goods or technologies subject to certain restrictions on export
under the Foreig n Exchan ge and Fore ign Trad e Law o f Japan, the pri or aut horizat ion by Japanese govern ment wil l
be required for export of those products from Japan.
The explanation concerning the main term used in this book is shown as follows.
Term Meaning
I-bus It is a bus of the widt h o f 16 bits for an intern al ins truction . Becaus e the FR20 series has
adopted internal Harvard Architecture, the instruction and data are the independent
buses. The bus converter is connected with I-BUS.
D-bus It is a data bus of the width of the internal 32 bits. An internal resource is con nected
with D-bus.
C-bus It is an internal multiplex bus. The C-bus connects to the I-bus and D-bus via the switch.
The external interface module is connected with C-BUS. The external data bus
multiplexes data and instructions.
R-bus It is a data bus of the width of the internal 16 bits. R-bus is connected with D-bus
through the adaptor.
Various I/O, the clock generation block, and the interruption controller are connected
with R-bus.
The R-bus is 16-bit width, so the address and data are multiplexed. If the CPU accesses
these resources, it takes a number of cycles.
E-unit It is an operation execution unit.
φIt is a system clock. It is a clock output from the clock generation block to the each
internal resource connected with R-bus. The system clock at the highest speed shows
the same cycle as source oscillation but is divided into 1, 1/2, 1/4, and 1/8 (or 1/2, 1/4,
1/8, and 1/16) by PCK1 and PCK0 of the clock generator GCR register.
θIt is a system clock. It is an operation clock of resource and CPU connected with buses
other than R-bus.
The system clock at the highest speed shows the same cycle as source oscillation but is
divided into 1, 1/2, 1/4, and 1/8 (or 1/2, 1/4, 1/8, and 1/16) by CCK1 and CCK0 of the
clock generator GCR register.
v
vi vii
CONTENTS
CHAPTER 1Overview of MB91191/MB91192 Series ..................................................... 1
1.1Feature of MB91191/MB91192 Series ............................................................................................... 2
1.2Block Diagram of All MB91191/MB91192 Series ............................................................................... 4
3.12.7Stop Status .................................................................................................................................. 70
3.12.8Sleep Status ......................................................................................................................... ....... 73
3.12.9State Transition in Standby Mode ............................................................................................... 76
3.12.10 Gear Function ................................................................................................................. ...... ....... 77
3.12.11 Clock Series Diagram .................................................................................................................. 80
3.12.12 Clock Series of Peripheral Resource ........................................................................................... 81
3.12.13 Watchdog Function ...................................................................................................................... 82
CHAPTER 4External Bus Interface .............................................................................. 85
4.1Overview of External Bus Interface .................................................................................................. 86
5.8Port A, B ......................................................................................................................................... 135
5.9Port C, D ......................................................................................................................................... 137
Appendix CMeasurement accuracy of peripheral circuit ........................................................................ 308
Appendix DRestrictions for Using MB91191/MB91192 series ............................................................... 309
Appendix EInstruction List ...................................................................................................................... 310
E.1Instruction list of FR series ............................................................................................................. 314
x
CHAPTER 1
Overview of MB91191/
MB91192 Series
This chapter includes basic explanations including
features of the MB91191/MB91192 series, block
diagrams, and a function outline.
1.1 Feature of MB91191/MB91192 Series
1.2 Block Diagram of All MB91191/MB91192 Series
1.3 Package Dimension
1.4 Pin Assignment
1.5 Pin Function Description
1.6 I/O Circuit Type
1
CHAPTER 1 Overview of MB91191/MB91192 Series
1.1Feature of MB91191/MB91192 Series
The MB91191/MB91192 series is a single-chip microcontroller with a built-in peripheral I/
O resource suited to software servo control of VTRs that require high-speed CPU
processing, featuring a 32-bit RISC-CPU (FR20 series) at its core.
Dimensions in mm (inches).
Note: The values in parentheses are reference values.
FPT-120P-M05
Note 1)* : These dimensions do not include resin protrusion.
Note 2) Pins width and pins thickness include plating thickness.
Note 3) Pins width do not include tie bar cutting remainder.
MB91191/MB91192 series is available in one type of packages.
■ Package Dimension (LQFP-120)
Figure 1.3-1 Package Dimension of FTP-120-M05
5
CHAPTER 1 Overview of MB91191/MB91192 Series
0.35 0.05
5
■ Package Dimension (FLGA-144)
Figure 1.3-2 Package dimension of FLGA-144
(INDEX AREA)
11.00
0.05 S Q.
1.10
0.10
(0.80)
0.05
0.05
9.10
3 0.450.05
144
0.65
0.755
.175
0.45
0.050
0.08
M
5.175
0.7550.050
0.45
6
1.4Pin Assignment
Figure 1.4-1 and Figure 1.4-2 show the pin assignment of the MB91191/MB91192 series.
For the MB91191 series, the FLGA- 144 package does not suppl y. It only supplies for the MB9119 2
series.
8
1.5Pin Function Description
Table 1.5-1 lists the pin function of MB91191/MB91192 series.
The numbers shown in the tables has nothing to do with package pin numbers. For pin
numbers, see "1.4 Pin Assignment".
This pin is shared with serial 2 serial output.
It is CMOS input.
This pin is shared with serial 2 serial input.
It is CMOS schmitt input.
This pin is shared with analog input and key input.
It is CMOS schmitt input.
12
Table 1.5-1 Pin Function List
Pin No. (LQFP)Pin nameFormFunction
92 PB7/AN-7
93 PB6/AN-6
94 PB5/AN-5
95 PB4/AN-4
D
96 PB3/AN-3
This pin is shared with analog input.
It is CMOS schmitt input.
97 PB2/AN-2
98 PB1/AN-1
99 PB0/AN-0
AV
100
DD
-It is A/D converter power supply pin.
101 AVRH -It is A/D converter reference power supply pin.
102 AVss -It is Vss pin of A/D converter.
103 Vss -It is Vss pin.
104 P17/RTO4
105 P16/RTO3
106 P15/RTO2
C
This pin is shared with RTG output.
It is CMOS input.
107 P14/RTO1
108 P13/RTO0
109
P12/EC5/INT1
This pin is shared with timer 5 clock input and external
interrupt input. It is CMOS schmitt input.
110
111
P11/EC4/INT0 This pin is shared with timer 4 clock input and external
F
interrupt input. It is CMOS schmitt input.
P10/PMSK This pin is shared with PWC mask input.
It is CMOS schmitt input.
13
CHAPTER 1 Overview of MB91191/MB91192 Series
Table 1.5-1 Pin Function List
Pin No. (LQFP)Pin nameFormFunction
112
P07/EXI2/PMI
113 P06/EXI1
114 P05/EXI0
115
116
117
P04/CFG This pin is shared with capstan FG input.
P03/DFG This pin is shared with drum FG input.
P02/DPG This pin is shared with drum pulse input.
118 P01/RFG0
119 P00/RFG1
120
V
DD
This pin is shared with external capture input and PWC input.
It is CMOS schmitt input.
This pin is shared with external capture input.
It is CMOS schmitt input.
It is CMOS schmitt input.
F
It is CMOS schmitt input.
It is CMOS schmitt input.
This pin is shared with reel FG input.
It is CMOS schmitt input.
-It is power supply pin.
14
1.6I/O Circuit Type
Table 1.6-1 shows the I/O circuit type.
■ I/O Circuit Type
Table 1.6-1 I/O circuit types
Classifi-
cation
A
B
X0,OSCI
X1,OSCO
Circuit TypeRemark
• Oscillation return resistance about
Clock input
Standby control
1MΩ
• CMOS schmitt inpu t
Input
• CMOS level output
Output data
DC test
• CMOS input without standby
control
C
DC test
Direction CTL
Input
Standby control = 1 fix
15
CHAPTER 1 Overview of MB91191/MB91192 Series
Table 1.6-1 I/O circuit types
Classifi-
cation
D
E
Input control
Circuit TypeRemark
• CMOS level output
Output data
DC test
DC test
Direction CTL
Analog input
CH selection
Digital input
• CMOS input with input control
• Analog input
• CMOS level output
Output data
DC test
• CMOS schmitt input with input
control
• Analog input
DC test
Direction CTL
F
Input control
Standby control = 1 fix
Analog input
CH selection
Digital input
Output data
DC test
DC test
Direction CTL
Input
• CMOS level output
• CMOS schmitt input without
standby control
16
CHAPTER 2
Handling Devices
This chapter describes points to note when using the
MB91191/MB91192 series.
2.1 Precautions When Handling Devices
2.2 Others
17
CHAPTER 2 Handling Devices
2.1Precautions When Handling Devices
The semiconductor device breaks down at a certain probability. Moreover, the failure of
the semiconductor device is greatly controlled by the condition (circuit condition and
environmental condition, etc.) used.
To have the high use, the semiconductor device is explained about reliability about the
matter which should be noted and considered as follows.
■ Precautions when Designing
Here, the matter which should be noted when an electronic equipment is designed with a semiconductor
device is described.
Observance of absolute maximum rating
●
When an excessive stress (voltage, current, and temperature, etc.) adds, the semiconductor device has the
possibility to destroy. The value that this thres hold was provided is an absolute maximum rating. Therefore,
care must be taken not to exceed the rating even for one item.
Observance of recommended operation condition
●
The recommended operation condition is a condition to guarantee normal movement of the semiconductor
device. All standard values for electric features are assured within this condition range. Always u se under
the recommended operation condition. When this condition is exceeded and used, the adverse effect is
occasionally caused for reliability.
Use by the item, the condition, and th e logi cal combinatio n not described t o thi s material is not guaranteed.
Please consult with the section in charge of sales of our company about use by conditions other than being
described for the idea beforehand.
Processing and protection of terminal
●
In the semiconductor device, there are a power supply and various input/output terminals. The followi ng
attention is necessary for these.
• Prevention of over-voltage/over-current
Deterioration is caused in the device when the voltage/current which exceeds the maximum rating is
applied to each terminal, and when it is remarkable, it becomes destruction. Please prevent such an overvoltage/over-current occurring when you design the equipment.
• Protection of output terminal
If the output terminal is short circu ited with the power terminal or other output terminal, or when large
capacity load is connected, a large electrical current may result. If this condition is prolonged, the device
will be damaged, so this kind of connection should not be made.
• Processing of unused input terminal
18
If the input terminal with very high impedance is used while opened, the operation might become unstable.
Ensure connections to the power terminal and ground terminal have the appropriate resistance.
Latch up
●
The semiconductor device is composed by the formation of the region of the P-type and the N-type on the
substrate. Internal parasitism PN junction (thyristor structure) might keep doing on-line when the voltage of
an external abnormal voltage is added, and the heavy-current which exceeds hundreds of mA flow to the
power supply terminal. This is called a latch up. The reliability of the device is not only damaged when this
phenomenon occurs but also there is dreading the arrival heat generation, smoking, and the ignition to
destruction. Please note the following points to prevent this.
• There must not be what the voltage more than the maximum rating adds the terminal. Please note
abnormal noise and surge etc.
• An abnormal current must not flow in consideration of the power supply turning on sequence.
Restriction of safety etc. and observance of standard
●
All over the world, various restrictions and standards of safety and the EMI, etc. have been installed. Please
suit these restriction and standard when the customer designs the equipment.
Fail safe design
●
The semiconductor device breaks down at a certain probability. The customer safely designs such as the
device redundancy, fire spreading prevention, exceeding current prevention, and prevention of malfunction
not to occur the injury accident, fire accident, and social damage consequently when the semiconductor
device is broken.
Attention concer nin g usag e
●
The our company semiconductor device is intended to be used for a standard usage (associated equipment
for office appliances such as computers/OA and industries/communications/the measurements and
personal/home equipment etc.). The customer concerns the usage of threatening the life by the breakdown
and malfunction, dreading the damage to the human body, or the special application which the extreme
high reliability is requested (fro aviation/space, atomic control, device for relayed the bottom of the sea,
running control, the medical device to keep the life, etc.), be sure to consult with the sales divisio n of our
company. When you use without the consultation and acknowledge that the responsibility cannot be
assumed about the occurring damage etc.
■ Precautions when Mounting Package
In the package, there are a lead insertion type and a surface mounting type. In both cases, quality assurance
for heat resistance at the soldering stage only applies to the mounting under conditions recommended by us.
Please inquire the section in charge of sales of our company about details of the mounting condition.
Lead insertion type
●
There are two ways to mount the lead insertion type package onto the printing board-the first is to directly
solder it onto the printing board, and the second is to mount it on the printing board using the socket.
When soldering it directly to the printing board, the flow soldering method (wave soldering method)
whereby the solder is melted after inserting the lead through the hole in the printing board is generally used.
In this case, heat stress in excess of the usual maximum rating preservation temperature is added to the lead
part at the soldering stage. Please mount under the mounting recommendation condition of our company.
When the mounting method using the socket is used, if surface processing of the socket contact point and
surface processing of the IC lead are different, contact failure may be generated after a prolonged period.
Therefore, checking the surface processing of the socket contact and surface processing of the IC lead is
recommended before mounting.
19
CHAPTER 2 Handling Devices
Surface mounting type
●
The lead used in the surface mounting type package is thinner than that for the insertion type, so its shape is
easily changed. In line with the increased number of pins in the package, the lead pitch is also narrow, and
opening defects due to the lead change and short circuits due to the solder bridge can easily be caused, so
an appropriate mounting technique is required. We recommend the solder re-flow method, and implement
rank classification of the mounting conditions per product. Please mount according to the rank
classification of the our company recommendation.
About keeping the semiconductor device
●
The plastic package is made of resin, so moisture is absorbed if left in a natural environment. When the
heat when mounting on the moisture absorption package joins, the decrease and the package crack of the
wet-proofing by the interfacial flaking off generation might be generated. Please note the following points.
• The be dewy of moisture happens to the product in the place with a rapid temperature change. Store it in
a place with minimum temperature fluctuations that avoid such an environment.
• The depository of the product recommends the use of a dry box. Please keep under the relative humidity
to 70% RH and the temperature to 5 to 30 °C.
• Silica-gel is used as a dry medicine in our company with a damp-proof and high as packing material of
the semiconductor device if necessary an aluminum laminate bag. Put the semiconductor device in the
laminated aluminum bag and close it tightly for storage.
• Please avoid the place where a lot of places and dust where the corrosively gas is generated.
About the baking
●
The moisture absorption package can be dehumidified by executing the baking (heating dryness). Please
execute the baking by the condition which our company recommends.
Static electricity
●
Please note the following points so that the semiconductor device may cause destruction by static electricity
easily.
• Please adjust the relative humidity of th e working environment to 40% to 70% RH. Please examine the
use of TEL device (apparatus for generating ion) etc. if necessary.
• Earth the conveyer, soldering tank and iron, and peripheral incidental equipment to be used.
• In order to prevent electrocution of human body, try to earth through a ring or armlet with high
resistance (about 1MΩ), wear conductive clothing and shoes, and place a conductive mat on the floor to
minimize static build-up.
• Please execute the earth or the electrification prevention to the treatment device and meters.
• Avoid using materials that are easily charged, such as polystyrene foam, to store the assembled board.
20
■ Precautions
The reliability of the semiconductor is affected by the peripheral temperature as mentioned before, and
other environmental conditions. Please note the following points.
Humidity
●
As for environment long-term use under the high humidity environment, something wrong with the leak
character might occur in not only the device but also printed wiring board, etc. Please consider the dampproof processing such as giving when the high humidity is assumed.
Static electricity discharge
●
The semiconductor device might cause the malfunction by being generate the electrical discharge in Kon
when electrified thing exists in high voltage near the device. For this case, please treat the prevention of
electrification or the prevention of the electrical discharge.
Corrosively gas, dust, and oil
●
If the device is used within a corrosive gas environment or where dust and oil, etc. may become attached,
the effect may be detrimental due to chemical reactions. Protective measures should be considered when
used under such an environment.
Radiation and cosmic ray
●
A general device does not assume the environment exposed to the radiation and the cosmic ray in the
design. Therefore, use this to shield.
Smoking and ignition
●
The device of the resin molding type is not nonflammability. Do not use the device near any ignitable
substance. In the event of smoke or fire may be generated toxic gases.
Additionally, please consult the section in charge of sales of our company about use under a special
environment for the idea.
21
CHAPTER 2 Handling Devices
2.2Others
The others are explained
■ External Reset Input
When "L" level is input to the RST pin, to ensure the inside ach ieves reset status, "L" level input to the
RST
pin is required for at least five machine cycles.
■ Note on Using External Clock
When using the external clock, drive the X0. Figure 2.2-1 shows the example of using an external clock.
Figure 2.2-1 Example of using an external clock
OPEN
X0
X1
MB91191/MB91192 series
*:Be sure to make X1 pin open.
■ Power Supply Pin
If there are multiple VDD and VSS pins, from the point of view of device design, pins to be of the same
potential are connected the inside of the device to prevent such malfunctioning as latch up. To reduce
unnecessary radiation, prevent malfunctioning of the strobe signal due to the rise of ground level, and
observe the standard for total output current, be sure to connect the V
and ground externally.
Also try to ensure that connection to the V
the power supply source. In addition, We will recommend the ceramic capacitor of about 0.1 µF to be
connected as bypass capacitor between V
■ Crystal Oscillation Circuit
The noise near X0 and the X1 terminal becomes original of the malfunction of this device. The printing
board should be designed so that the X0, X1, crystal oscillator (or ceramic oscillator), and bypass capacitor
to the ground are arranged as close as possible.
Printing board artwork around the X0 and X1 terminals to the ground is strongly recommended, as steady
operation can be expected.
■ Handling NC Pin
Use the Non Connect (N.C.) terminal while open.
■ Mode (MD0 to MD2) Pin
Please tie directly to VDD or VSS and use these terminals.
In order to prevent erroneous entry to test mode due to noise, the pattern length between each mode
terminal and V
at low impedance.
or VSS on the printing board should be as short as possible, and they should be connected
DD
■ At Power On
When the power is turned on, the RST pin must be started from "L" level status, and changed to "H" level
after at least five cycles of the internal operation clock have passed, after the power source reaches the V
level.
and VSS pins to the po wer supp ly
DD
, Vss on this device is at the lowest impedance possible f rom
DD
and VSS near this device.
DD
DD
22
CHAPTER 3
CPU
This chapter provides basic explanations for such
elements as the architecture, specifications, and
commands, etc., required to understand the CPU core
functions of the FR series.
3.1 Memory Space
3.2 CPU Architecture
3.3 Dedicated Registers
3.4 General-purpose Register
3.5 Data Construction
3.6 Word Alignment
3.7 Memory Map
3.8 Overview of Instructions
3.9 EIT (Exception, Interruption, and Trap)
3.10 Reset Sequence
3.11 Memory Access Mode
3.12 Clock Generation Section (Low Power Consumption Mechanism)
23
CHAPTER 3 CPU
3.1Memory Space
The logical address space of the FR20 series is 4 Gbytes (232 addresses), and the CPU
performs linear access.
■ Direct Addressing Area
The under-mentioned area of the address space is used for I/O. This area is called the "direct addressing
area" and operand addresses can be specified directly within the command. A direct area is different as
follows depending on the size of the accessed data.
• Byte data access:0-0FF
• Half word data access:0-1FF
• Word data access:0-3FF
■ Memory Map
Figure 3.1-1 shows the memory map of the MB91191/MB91192.
H
H
H
24
Figure 3.1-1 MB91191/MB91192 Memory Map
00000000
000001FF
00000200
000002FF
00000300
0000037F
00000380
000003BF
000003C0
000003FF
00000400
000007FF
00000800
00000FFF
00001000
0000107F
00001080
000010FF
00001100
0000E7FF
0000E800
0000FFFF
00010000
000BFFFF
000C0000
000C07FF
000C0800
000FFFFB
000FFFFC
00100000
FFFFFFFF
H
H
H
PPG0 Data RAM area 256byte
H
H
I/O area
SIO0 Data RAM area 128byte
H
H
PPG1 Data RAM area 64byte
H
H
I/O area
H
H
H
H
I/O area
Access interdiction
H
H
SIO1 Data RAM area 128byte
H
H
SIO2 Data RAM area 128byte
H
H
Access interdiction
H
H
Internal RAM area 6Kbyte
H
H
Access interdiction
H
H
Internal RAM
H
H
Internal ROM
H
Reset vector
H
H
area 2Kbyte
area (254kByte)
External expansion area
H
MB91191RMB91192
Direct
Access
Area
1KB
Initial vector area
I/O area
PPG0 Data RAM area 256byte
SIO0 Data RAM area 128byte
PPG1 Data RAM area 64byte
I/O area
I/O area
Access interdiction
SIO1 Data RAM area 128byte
SIO2 Data RAM area 128byte
Access interdiction
Internal RAM area 8Kbyte
Access interdiction
Internal RAM
area 2Kbyte
Access interdiction
Internal ROM
area (384kByte)
Reset vector
External expansion area
00000000
000001FF
00000200
000002FF
00000300
0000037F
00000380
000003BF
000003C0
000003FF
00000400
000007FF
00000800
00000FFF
00001000
0000107F
00001080
000010FF
00001100
0000DFFF
0000E000
0000FFFF
00010000
0007FFFF
00080000
000807FF
00080800
0009FFFF
000A0000
000FFFFB
000FFFFC
00100000
FFFFFFFF
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
Note:
Under single-chip mode, access to the external extension area is impossible.
Select internal RO M external bus mode using the mode register to access the external exte nsion
area.
25
CHAPTER 3 CPU
3.2CPU Architecture
The FR20 CPU is a high performance core that adopts highly functional commands for
the embedded application as well as RISC architecture.
■ Feature of CPU Architecture
Adoption of RISC architecture
●
• Basic instruction: one instruction one cycle
32 bit architecture
●
• General-purpose register 32 bits × 16
Linear memory space of 4 GB
●
Installing of multipliers
●
• 32 bits x multiplication 32 bits: 5 cycles
• 16 bits x multiplication 16 bits: 3 cycles
Reinforcement of interruption processing function
●
• High-speed response speed (6 cycles)
• Support for multiple interr up ts
• Lev el mask function (16 levels)
Reinforcement of instruction for I/O operation
●
• Memory memory transfer operation
• Bit processing instruction
High code efficiency
●
• 16 bits in basic instruction word length
Low power consumption
●
• Sleep mode, stop mode
■ Construction of Internal Architecture
The FR20 CPU adopts the Harvard architecture structure whereby the command bus and data bus are
independent.
26
The on chip command cache is connected to the command bus (T-bus). A 32-bit <--> 16-bit bus converter
is connected to the data bus (D-bus), and performed interfaces between the CPU and peripheral resources.
A Harvard <--> Princeton bus converter is connected to both the I-bus and D-bus, performed and interfaces
between the CPU and bus controller.
Figure 3.2-1 shows the construction of internal architecture.
Figure 3.2-1 Construction of Internal architecture
FR20 CPU
D-BUSI-BUS
Instruction
Cache
32bit
16bit
Bus converter
R-busC-bus
Harvard
Princeton
Bus converter
●
Resource
CPU
Bus controller
The FR20's 32-bit RISC architecture is compactly implemented on the CPU. A five-level command
pipeline method is adopted to execute one command per cycle. The pipeline is composed of the following
stages.
• Instruction fetch (IF): The instruction address is output, and the instruction is fetched.
• Instruction decode (ID): The decode does the fetched instruction. The register is read.
• Execution (EX): The operation is executed.
• Memory access (MA): Loading into the memory or the store is accessed.
• Write-back (WB): Writes th e operation results (or loaded memory data) to the register.
Figure 3.2-2 shows the instruction pipeline.
Figure 3.2-2 Instruction pipeline
CLK
Instruction 1 WB
Instruction 2 MA
Instruction 3 EX
Instruction 4 ID
Instruction 5 IF
Instruction 6
WB
MA
EX
ID
IF
WB
MA
EX
ID
WB
MA
EX
WB
MA
WB
The instruction is never in any order executed. Accordingly, if command A enters the pipeline before
command B, command A always reaches write backstage before command B.
As a rule, the instruction is executed at the speed of one instruction per cycle. However, a number of cycles
27
CHAPTER 3 CPU
are required to execute commands for the load/store command to which memory wait is attached, branch
commands that do not have delay slots, and multi -cycle commands. Also, when the supplied instruction is
slow, the execution speed of the instruction decrease.
Refer to "3.8 Overview of Instructions" for details.
32-bit ↔ 16-bit bus converter
●
Interfaces between the D-BUS that quickly accesses at 32-bit width and the R-BUS that accesses at 16-bit
width, and realizes data access from the CPU to built-in peripheral circuit.
When 32-bit width access is performed from the CPU, this bus converter accesses the R-BUS by
converting it to 16-bit width access twice. Some of built-in peripheral circuits have access width-related
restrictions.
Harvard ↔ Princeton bus converter
●
Coordinates between the CPU command access and data access, and realizes smooth interface with the
external bus.
In CPU, the instruction bus and the data bus are the independent Harvard architecture structures. On the
other hand, the bus controller that controls the external bus has a Princeton architectural structure with a
single bus. This bus converter ranks the priority order for command access and data access of the CPU, and
controls access to the bus controller. This operation always optimizes the external bus access ranking.
It also has a two-word write buffer to eliminate CPU bus waiting time and a one-word pre-fetch buffer to
fetch commands.
28
3.3Dedicated Registers
Use the dedicated registers for specified purposes. Program counter (PC), program
status (PS), tabl e base register (TBR), return pointer (RP), system stack pointer (SSP),
user stack pointer (USP), and multiplication/division results registers (MDH/MDL) are
prepared.
■ Dedicated Registers List
Figure 3.3-1 shows the dedicated register list.
Figure 3.3-1 Dedicated registers list
Program counter (PC)
Program status (PS) ILM SCR CCR
Table base register (TBR)
Return pointer (RP)
System stack pointer (SSP)
User stack pointer (USP)
Multiplication and division result register
(MDH)
(MDL)
■ Program Counter (PC)
Function of program counter (PC: Program Counter) is described.
The program counter (PC) consists of 32-bit.
Figure 3.3-2 shows the bit configuration of the program counter (PC).
Figure 3.3-2 Program counter (PC)
bit
The address of the executed instruction is shown with the program counter.
If the PC is updated when an i nstruction is execute d, Bit 0 is set to "0". B it 0 ma y be "1 " only when an odd
address is specified as the branch destination address.
Even in that case, bit 0 is invalid, and the command must be placed in the address of the multiple of two.
The initial value by reset is irregular.
310 Initial value
■ Program Status Register (PS)
This register retains the program status, and is separated into three parts, namely, ILM, SCR, and CCR.
Refer to "3.3.1 Program Status Register (PS)" for details.
The undefined bits are all reserved bits. When the register is read, "0" is always read. Writing is invalid.
XXXXXXXX
H
29
CHAPTER 3 CPU
■ Table Base Register (TBR)
Function of table base register (TBR : Table Base Register) is described .
The table base register (TBR) consists of 32-bit.
Figure 3.3-3 shows the bit configuration of the table base register (TBR).
Figure 3.3-3 Table base register (TBR)
bit
310 Initial value
The table base register retains the starting address of the vector table used for EIT processing.
The initial value by reset is 000FFC00
■ Return Pointer (RP)
Function of Return Pointer (RP: Return Pointer) is described.
The return pointer (RP) consists of 32-bit.
Figure 3.3-4 shows the bit configuration of the return pointer (RP).
bit
310 Initial value
The address which returns from the sub routine is maintained at the return poin ter.
The value of PC is forwarded to this RP at CALL instruction execution time.
The content of RP is forwarded to PC at RET instruction execution time.
The initial value by reset is irregular.
■ System Stack Pointer (SSP)
Function of system stack poi nter (SSP: System Stack Pointer) is descr ibed.
The system stack pointer (SSP) consists of 32-bit.
.
H
Figure 3.3-4 Return pointer (RP)
000FFC00
H
XXXXXXXXH
30
Figure 3.3-5 shows the bit configuration of the system stack pointer (SSP).
Figure 3.3-5 System stack pointer (SSP)
bit
310 Initial value
00000000
H
SSP is the system stack pointer.
When the S flag is "0", the SSP functions as R15. The SSP can be specified explicitly.
Also used as the stack pointer specifying the stack that saves the PS and PC when EIT occurs.
The initial value by reset is 00000000
.
H
■ User Stack Pointer (USP)
Function of user stack pointer (USP: User Stack Pointer) is described.
The user stack pointer (USP) consists of 32-bit.
Figure 3.3-6 shows the bit configuration of the user stack pointer (USP).
Figure 3.3-6 User stack pointer (USP)
bit
USP is the user stack pointer.
When the S flag is "1", the USP functions as R15. The USP can be s pecified explicitly . The initial v alue by
reset is irregular.
The USP cannot be used for the RETI instruction.
310 Initial value
■ Multiplication and Division Result Register (MDH/MDL)
Function of multiplication and division result register (MDH/MDL: Multiply & Divide register) is
described.
The multiplication and division result register (MDH/MDL) consists of 32-bit.
Figure 3.3-7 shows the bit configuration of the multiplication and division result register (MDH/MDL).
Figure 3.3-7 Multiplication and division result storage register (MDH/MDL)
bit
MDH
MDL
MDH and MDL are the multiplication and division register. Each register is 32-bit long.
The initial value by reset is irregular.
310
XXXXXXXX
Initial value
XXXXXXXX
XXXXXXXXH
H
H
Functions when multiplication is executed
●
In the case of 32-bit x 32-bit multiplication, the 64-bit long operation results are stored in the
multiplication/division results register in the following format.
• MDH: Higher 32-bit
• MDL: Lower 32-bit
In the case of 16-bit x 16-bit multiplication, the results are stored in the multiplication/division results
register as follows.
• MDH: Indeterminate
• MDL: 32-bit
Functions when division is executed
●
When beginning to calculate, the dividend is stored in MDL.
When division is calculated using the DIV0S/DIV0U, DIV1, DIV2, DIV3, or DIV4S commands, the
results are stored in the MDL and MDH as follows.
• MDH: surplus
• MDL: commerce
31
CHAPTER 3 CPU
3.3.1Program Status Register (PS)
The register retains the program status, and is separated into three parts, ILM, SCR, and
CCR.
A bit undefined in figure is reservation all bit. When the register is read, "0" is always
read. Writing is invalid.
■ Program Status Register (PS)
Figure 3.3-8 shows the configuration of the program status register (PS).
Figure 3.3-8 Program status register (PS)
bit
Condition code register (CCR)
●
Figure 3.3-9 shows the configuration of the condition code register (CCR).
bit
The function of each bit is explained as follow.
[bit5] S: Stack flag
This bit specifies the stack pointer to be used as R15.
ValueFunction
31 20 16 10 8 7 0
76 5 4 3 2 1 0 Initial value
SINZVC--00XXXX
0
ILM
Figure 3.3-9 Condition code register (CCR)
The system stack pointer (SSP) is used as R15. When the EIT occurs, this bit is
automatically set to "0". (Note t hat a value saved on the stack is the value before it is
cleared)
SCR
CCR
H
32
1 The user stack pointer (USP) is used as R15.
This bit is cleared to "0" by a reset.
Select the SSP when the RETI instruction is executed.
[bit4] I: Interrupt enable flag
Permission and the interdiction of the user interruption demand are controlled.
ValueFunction
User interruption interdiction.
0
When the INT instruction is executed, this bit is cleared to "0".
(Note that a value saved on the stack is the value before it is cleared)
1
This bit is cleared to "0" by a reset.
[bit3] N: Negative flag
This bit indicates the code when the operation results are defined as integers expressed as complements
of 2.
ValueFunction
0 It is indicated that operation result was a positive value.
1 It is indicated that operation result was a negative value.
Initial state by reset is irregular.
[bit2] Z: Zero flag
This bit indicates whether or not the operation result is 0.
ValueFunction
0 It is indicated that operation result was the values other than 0.
User interruption permission.
Mask processing of user interrupt requests is controlled by the value retained by ILM.
1 It is shown that operation result was 0.
Initial state by reset is irregular.
[bit1] V: Overflow flag
This bit is considered to be the integer expressing the operand used for operations as complements of 2,
and indicates whether or not an overflow was generated as the result of such operation.
ValueFunction
0 It is indicated that no overflow has occurred as a result of the operation.
1 It is indicated that an overflow has occurred as a result of the operation.
Initial state by reset is irregular.
33
CHAPTER 3 CPU
[bit0] C: carrying flag
System Condition code Register (SCR)
●
Figure 3.3-10 shows the configuration of the system condition code register (SCR: System Condition Code
Register).
This bit indicates whether or not carry or borrow was generated from the highest bit through the
operation.
ValueFunction
0 It is indicated that no carry or borrow has occurred.
1 It is indicated that a carry or borrow has occurred.
Initial state by reset is irregular.
Figure 3.3-10 System condition code register (SCR)
bit
10 9 8 Initial value
D1D0T XX0
H
Each bit function of the system condition code register (SCR) is explained as follows.
[bit10, 9] D1, D0: Flag for step division
The middle data of step division execution time is maintained. Do not change while executing the
division processing.
Restart of the step division is guaranteed by saving/returning the PS register value when other processes
are carried out during the step division. Initial state by reset is irregular.
When the DIV0S instruction is executed, the divided and the divisor are referenced and set.
When the DIV0U instruction is executed, the bits clear forcibly.
[bit8] T: step trace trap flag
It is a flag which specifies whether to make the step trace trap effective.
ValueFunction
0 Step trace trap invalidity
1
Step trace trap effective
In this case, all NMIs for user and user interrupts will be interrupt disabled.
34
This bit is initialized to "0" by a reset.
The emulator uses the function of the step trace trap. When the emulator is used, it cannot be used in user
program.
Interrupt level mask register (ILM)
●
Figure 3.3-11 shows the configuration of the interrupt level mask register (ILM).
Figure 3.3-11 Interrupt level register (ILM)
bit
20 19 18 17 16 Initial value
ILM4 ILM3 ILM2 ILM1 ILM001111
H
The interrupt level mask register (ILM) retains the interrup t level mask value, and values retained by this
ILM are used as the level mask.
Interrupt requests are received only when the supported interrupt level is higher than the level indicated by
this ILM out of the interrupt requests to be input to the CPU.
As for the level value, 0(00000
) is the strongest, and 31(11111B) is weakest.
B
There is a limitation in the value which can be set from the program.
If the original value is between 16 to 31, the new value must be between 16 to 31. When the command
setting 0 to 15 is executed, the value (specified value + 16) is transferred.
If the original value is between 0 to 15, an arbitrary value between 0 to 31 can be set.
This register is initialized to 15 (01111
) by a reset.
B
35
CHAPTER 3 CPU
3.4General-purpose Register
Register R0 to R15 is a general-purpose register. These registers are used as the
pointer for memory access and accumulator for various operations.
■ General-purpose Register
Figure 3.4-1 shows the configuration of the general-purpose register.
Figure 3.4-1 Configuration of general-purpose register
32
R0
XXXX XXXX
R1
XXXX XXXX
R12
R13
R14
R15
bit
[Initial value]
XXXX XXXX
XXXX XXXX
AC
FP
SP
XXXX XXXX
0000 0000
H
H
H
H
H
H
Register R0-R15 is a general register. These registers are used as the pointer for memory access and
accumulator for various operations. The following of the 16 registers are expected to have special uses, so
some commands are emphasized.
• R13: Virtual accumulator (AC)
• R14: Frame pointer (FP)
• R15: Stack pointers (SP)
R0 to R14 of the initial value by reset is irregular. R15 becomes 00000000
(value of SSP).
H
36
3.5Data Construction
B
The data allocation of the FR20 series uses as follow.
• Bit ordering: Little endian
• Byte ordering: Big endian
■ Bit Ordering
In the FR20 series, the little endian has been adopted as a bit ordering.
Figure 3.5-1 shows the data allocation of the bit ordering.
As commands and data are accessed per byte, addresses to be allocated differ
depending on the command length and data width.
■ Program Access
It is necessary to arrange the program of the FR20 series in the address of the multiple of two. Bit 0 of the
program counter (PC) is set to "0" when updating the PC in line with execution of the com mand. It may be
"1" only when an odd address is specified as the branch destination address. Even in that case, bit 0 is
invalid, and the command must be placed in the address of the multiple of two.
There is no odd number address exception.
■ Data Access
In the FR20 series, when data is accessed, forced alignment is applied to the address depending on its width
as follows.
• Word Access:An address must be a multiple of 4. (The lowest 2-bit is forcibly "00".)
• Half-word access: An address must be a multiple of 2. (The lowest bit is forcibly "0".)
• Byte Access:-
When word or half-word data is accessed, "0" is forcibly set to some bits, which are the calculation results
of the effective address. For example, in the @(R13,Ri) addressing mode, the register before addition is
used for calculations as it is (even tho ugh the lowest bit is 1), and th e lower bits of th e addition results will
be masked. A register before calculation is not masked.
(example) LD @(R13,R 2),R0
R13 00002222
R2 00000003
Addition result 00002225
Address pin 00002224
H
H
H
Lower 2-bit forcibly mask
H
38
3.7Memory Map
The memory map for the FR20 series is shown.
■ Memory Map
The address space of the memory is 32 bit linear.
Figure 3.7-1 shows the memory map.
Figure 3.7-1 Memory map
0000 0000
0000 0100
0000 0200
0000 0400
000F FC00
000F FFFF
FFFF FFFF
H
H
H
H
H
H
H
Byte data
Halfword data
Word data
Vector table
initial region
Direct addressing region
Direct addressing
●
The under-mentioned region of the address space is a region for I/O. In this area, the operand address can
be specified directly within the command through direct addressing.
The size of the address area which an address can be directly specified is different in each data length.
• Byte data: (8 bits): 0 to 0FF
• Half-word data: (16 bits): 0 to 1FF
• Word data: (32 bits): 0 to 3FF
Vector table initial region
●
The region of 000FFC00
The vector table used for EIT processing can be allocated to an arbitrary address by rewriting the TBR, but
it is allocated to this address on initialization through reset.
H
H
H
- 000FFFFFH is EITT vector table initial area.
H
39
CHAPTER 3 CPU
3.8Overview of Instructions
The FR20 series supports logical operation and bit operations that are optimized for
embedded application, and direct addressing commands as well as a general RISC
command system. The set list shows the appendix. As each command is 16 bits length
(some commands are 32 or 48 bits), memory usage is more efficient.
■ Overview of Instructions
The instruction set can be divided into the following function groups.
• Arithmetic operation
• Load and store
•Divergence
• Logical operation and bit operation
• Direct addressing
•Others
Arithmetic operation
●
It has standard arithmetic operation commands (addition, subtraction, comparison) and shift commands
(logic shift, arithmetic operation shift). Operations with carry that are us ed for multi-word length operations
and operations that do not change the flag value which are convenient for address calculations are enabled
for addition and subtraction.
Furthermore, it has 32-bit x 32-bit and 16-bit x 16-bit multip lication commands, and the 32-bit/3 2-bit step
division commands.
Also equipped with an immediate transfer command that sets immediate values to the register, and an interregister transfer command.
The arithmetic operation command executes all operations using a general-purpose register and
multiplication/division register within the CPU.
Load and store
●
Load and store are the commands that read and write to external memories. They are also used to read and
write the peripheral circuits (I/O) within the chip.
Load and store have three types of access length, namely byte, half-word, and word. In addition to normal
indirect register memory addressing, memory addressing is also possible for certain commands such as
indirect displacement registers and indirect increment/decrement registers.
40
●
Branch
In the FR20 series, whether the operations are with or without delay slots can be specified for the branch
command.
It is an instruction of the branch, the call, the interruption, and the return. There are two types of branch
command. One type has a delay slot and the other does not. They can be optimized to suit the purpose.
Refer to "3.8.1 Branch Command with Delay Slot" and "3.8.2 Branch Command without Delay Slot" for
details of the branch commands.
Logical operation and bit operation
●
Logic operation instruction can perform AND, OR, and EOR logic operations between general-purpose
registers, or between a general-purpose register and the memory (or I/O). Moreover, the bit operation
instruction can operate the content of the memory (And, I/O) directly. The register of the memory
addressing is generally indirect.
Direct addressing
●
Direct addressing commands are used to access between I/O and general-purpose registers, or between I/O
and the memory. The I/O address can be accessed quickly and efficiently by direct specification within the
command instead of indirect register. Indirect memory addressing to the register with register increment/
decrement is also enabled for some commands.
Others
●
This command executes flag set up within the PS register, stack operation, code/zero expansion, etc. Also
equipped with high-level language supported function entry/exit, and register multi-load/store commands.
41
CHAPTER 3 CPU
3.8.1Branch Command with Delay Slot
The operation with the delay slot branches prior to execute the command at the branch
destination after executing the command located immediately after the branch
command.
■ Branch Command with Delay Slot
The following commands execute the branch command with delay slot.
JMP:D @RiCALL:Dlabel12CALL:D @RiRET:D
BRA:D label9BNO:D label9BEQ:Dlabel9BNE:D label9
BC:Dlabel9BNC:D label9BN:Dlabel9BP:Dlabel9
BV:Dlabel9BNV:D label9BLT:Dlabel9BGE:D label9
BLE:D lab el9BGT:D label9BLS:Dlabel9BHI:D label9
■ Operation of Branch Command with Delay Slot
Operations with delay slots branch out after executing the command placed just after the branch command
(called a "delay slot") prior to execute the branch destination command.
As the delay slot command is executed before the branch operation, the apparent execution speed is 1
cycle. The NOP command must be placed as an alternative if an effective command cannot be inserted in
the delay slot.
[example]
; Row of instruction
ADDR1, R2;
BRA:DLABEL; Branch instructio ns
MOVR2, R3; Delay slot ......Executed before branch
...
LABEL:STR 3 and @R4 ; The divergence ahead
The command placed in the delay slot is executed whether the branch condition for the condition branch
command will be realized or not.
For delay branch commands, the execution order of the partial command seems to be reversed, but this
applies only to PC update operations, and other operations (i.e. update and refer to register) are absolutely
executed in the described order.
Concrete examples are shown below.
The Ri to be referred to the JMP:D@Ri/CALL:D@Ri command will not be effected even if the command
●
within the delay slot updates the Ri.
42
[example]
LDI:32#Label, R0
JMP:D@R0 ; Branches out to Label
LDI:8#0,R0; No effects on the branch destination address
...
The RP to be referred by the RET:D command will not be effected even if the command within the delay
●
slot updates the RP.
[example]
RET:D; Branch to address defined beforehand in RP
MOVR8,RP; No effect on the return operation
...
The flag referred by the Bcc: Drel command is not effected by the delay slot command either.
●
[example]
ADD#1,R0; Flag change
BC:DOverflow ; Branch to execution result of above instruction
ANDCCR #0; Do not refer to this flag update in the above-mentioned branch instruction.
...
When RP is referred to for the command within the delay slot under the CALL:D command, the updated
●
contents will be read by the CALL:D command.
[example]
CALL:D Label; Update RP and branch
MOV RP and R0; RP of an execution above-mentioned CALL:D result is forwarded.
..
■ Limitations for Branch Command with Delay
Instruction that can be placed in the delay slot
●
Only commands that satisfy the following conditions can be executed within the delay slot.
• 1 cycle instruction.
• No branch instruction.
• Inst ruction which does not influence operation even when order chang es
The "1-cycle command" is a command in which "1", "a", "b", "c", or "d" is described in the cycle number
column within the commands list.
Step trace trap
●
Step trace trap will not be generated between execution of the branch command with delay slot and the
delay slot.
Interrupt/NMI
●
No interrupt/NUM is received between execution of the branch command with delay slot and the delay slot.
Undefined instruction exception
●
If an undefined command exists with the delay slot, undefined command exception will not be generated.
At this time, undefined instruction operates as NOP instruction.
43
CHAPTER 3 CPU
3.8.2Branch Command without Delay Slot
Branch Command without Delay Slot is described.
■ Branch Command without Delay Slot
The following commands execute the branch command without delay slot.
JMP @RiCALL label12CALL @RiRET
BRA label9BNOlabel9BEQlabel9BNElabel9
BC label9BNClabel9BNlabel9BPlabel9
BV label9BNVlabel9BLTlabel9BGElabel9
BLE label9BGTlabel9BLSlabel9BHIlabel9
■ Operation of Branch Command without Delay Slot
Operation of ones without delay slots are absolutely executed in command rank order. The instruction
provided immediately before the branch instruction is not executed after branching.
[example]
; Row of instruction
ADDR1, R2;
BRA LABEL; Branch instruction (delay slot none)
MOVR2, R3; Not executed
...
LABEL:STR 3 and @R4; The branch ahead
Execution cycle number for branch commands without delay slots will be 2 cycles branched, or 1 cycle
non-branched. As the appropriate command cannot be inserted into the delay slot, the command code
efficiency is better than the branch command with the delay slot described the NOP instruction. A balance
between execution speed and code efficiency can be struck by selecting either the operation with the delay
slot when effective commands can be set in the delay slot, or the operat ion without the delay slot when
effective commands cannot be set.
44
3.9EIT (Exception, Interruption, and Trap)
EIT indicates suspension of program execution due to generation of an event while
executing the current and other programs. It is a general term for Exception, Interrupt,
and Trap.
■ EIT (Exception, Interruption, and Trap)
The exception is an incident which occurs in relation to the context under execution. Execution restarts
from the instruction that caused the exception.
The interruption is an incident which occurs without any relation to the context under execution. The event
factor is hardware.
The trap is an incident which occurs in relation to the context under execution. There is something directed
by the program like the system call. Execution restarts from the instruction following the one that caused
the trap.
■ EIT Factor
The EIT factors are as follow.
• Reset
• User interruption (internal resource and exter nal interruption)
•NMI
• Delayed interrupt
• Undefined instruction exception
• Trap instruction (INT)
• Trap instruction (INTE)
• Step trace trap
• Coprocessor absent trap
• Coprocessor error trap
■ Return from EIT
Use the RETI instruction to return from EIT.
45
CHAPTER 3 CPU
3.9.1Interrupt Level of EIT
Interrupt levels is controlled by 0 to 31 by five bits.
11110
11111 31 -When ICR is set, it is an interruption interdiction.
10 decimal
number
5 to 14 (System reservation)
16 to 30 Interrupt
It is a level of 16 to 31 that the operation is possible.
Undefined command exception, coprocessor absence trap, coprocessor error trap and INT instruction are
unaffected by the interrupt level. Moreover, ILM is occasionally changed.
FactorRemark
(System reservation)
When the original value of the ILM is 16 to 31,
values within this range cannot be set as the ILM
by the program.
When ILM is set, it is a user interruption
interdiction.
■ Level Mask to Interruption/NMI
When NMI and interrupt requests are generated, the interrupt l evel held by the interru pt factor is compared
with the level mask value held by the ILM. And, when the following condition consists, the mask is done,
and the demand is not accepted.
Interrupt level held by factor ≥ Level mask value
46
3.9.2Interrupt Stack Operation
The value of PC and PS is saved and revived in the area shown by SSP. After an
interrupt, PC is stored in the address indicated by the SSP, and PS is stored in the
address (SSP+4).
■ Interrupt Stack
Figure 3.9-1 shows the example of the interrupt stack.
From address which TBR shows to vector region for EIT region of 1KB
■ EIT Vector Table
Each vector is 4 bytes, and the relationship between the vector number and vector address is expressed
below.
vctadr = TBR + vctofs = TBR +(03FCH - 4 × vct)
vctadr: Vector Address
vctofs: Vector offset
vct:Vector number
The lowest 2-bit of the addition result are always handled as "00".
The area of 000FFC00
to 000FFFFFH is an initial area of the vector table by reset. A special function is
H
allocated partially of the vector. The vector table on the architecture is shown in Table 3.9-2 .
Reset
System reservation
System reservation
System reservation
System reservation
System reservation
System reservation
Coprocessor absent trap
Coprocessor error trap
INTE Instruction
Instruction break exception
Operand break trap
Step trace trap
System reservation
Undefined instruction exception
NMI (for user)
Mask enable interrupt factor #0 (IRQ0)
Mask enable interrupt factor #1 (IRQ2) to
Mask enable interrupt factor #47 (IRQ47)
System reservation (used for REAL OS)
System reservation (used for REAL OS)
INT Instruction
48
3.9.4Multiple EIT Processing
When a number of EIT factors are generated simultaneously, one of the EIT factors is
selected and accepted in the CPU, and after the EIT sequence is executed, such EIT
factors are detected again. This operation is repeated as necessary.
When EIT factors are detected, if there are no more EIT factors that can be accepted, the
handler command for the last EIT factor accepted will be executed.
Therefore, the handler order for each factor when a number of EIT factors are generated
simultaneously is determined by the following two elements.
• Priority level of EIT factor acceptance
• How to mask the other fact or at receiving
■ Priority Level of EIT Factor Acceptance
Priority for acceptance of the EIT factors indicates the order when selecting the factors executing the EIT
sequence that saves PS and PC, updates the PC (on demand) and performs mask processing of other
factors. The handler of the factor previously accepted is not always executed first.
Table 3.9-3 shows the priority level of the EIT factor acceptance.
Table 3.9-3 Priority level of EIT factor acceptance and masking other factor
Priority order
of acceptance
1 ResetOther factors are abandoned.
2 Undefined instruction exceptionCancellation
3
4 User InterruptILM = Level of accepted factor
5 NMI (for user) ILM=15
7 INTE InstructionILM=4
8 Step trace trapILM=4
A tinge of mask processing onto other factors after accepting the EIT factors is added, and each handling
procedure for the generated EIT factors are also mentioned in Table 3.9-4 .
Coprocessor absent trap
Coprocessor error trap
FactorMasking of other factor
INT InstructionI Flag=0
None
49
CHAPTER 3 CPU
Table 3.9-4 Execution sequence of EIT handler
Execution sequence of handlerFactor
1
Reset
*1
2 Undefined instruction exception
3
4
Step trace trap
INTE instruction
*2
*2
5 NMI (for user)
6 INT instruction
7 User interrupt
Coprocessor absent trap
8
Coprocessor error trap
*1: Other factors are abandoned.
*2: If the INTE instruction is executed in steps, only EIT of the step trace trap generates
INTE instruction.
The factor by INTE is disregarded.
Figure 3.9-2 shows the example of multiple EIT processing.
Figure 3.9-2 Example of multiple EIT processing
[Example]
Priority level
(High) NMI generation
(Low) INT instruction execute
Main routine
NMI handler
INT instruction handler
First execute
Next execute
50
3.9.5Operation of EIT
This section explains operation of EIT
■ Operation of EIT
As per the following explanation, the "PC" at the transfer origin indicates the address of the command that
detected each EIT factor.
The "following command address" means that the command that detected EIT is as follows.
• If LDI is 32: PC+6
• If LDI: 20 and COPOP, COPLD, C OPST and used: PC+4
• Other instructions: PC+2
Operation of user interruption/NMI
●
When a user interrupt or interrupt request of NMI for user is generated, the request is accepted or not is
determined in the following order.
Right or wrong judgment of interruption demand acceptance
●
1. The interruption levels of request s that are gener ated simultaneously are compared, and the one with the
highest level (the smallest numeric value) will be selected. In terms of the levels used for comparisons,
the value retained by the supported ICR is used for mask enable interrupts, and a predetermined constant
is used for NMI.
2. When a number of interrupt requests of the same level are generated, the one with the youngest interrupt
number is selected.
3. Compares the interrupt level wit h the se lected inter rupt request with th e level m ask va lue determin ed by
ILM.
When the interrupt level is greater th an or equal to the level mask value, the int errupt request is masked
and not accepted.
To (4) at interrupt levels < level mask value.
4. When the selected interruption request is an interr uption that can be masked, the interruption request
will be masked and will not be accepted when the I flag is 0. If the I flag is 1, go to 5). When the
selected interrupt request is NMI, go to 5) regardless of the I-flag value.
5. When the above condition occurs, the interrupt request is accepted at the command-processing gap.
When an EIT request is detected, if the user interrupt/NMI request is accepted, the CPU operates as follows
using the interrupt number supporting the accepted interrupt request. ( ) in the [operation] shows the
address which the register indicates.
51
CHAPTER 3 CPU
[Operation]
1. SSP-4→ SSP
2. PS→ (SSP)
3. SSP-4→ SSP
4. Address of the following instruction→(SSP)
5. Interrupt level of accepted request→ ILM
6. "0"→ S Flag
7. (TBR + Vector offset of accepted interrupt request)→ PC
Prior to execute the front command of th e handler after the interrupt sequence ends, a new EIT is detected.
At this stage, if an acceptable EIT is generated, the CPU transits to the EIT processing sequence.
■ Operation of INT Instruction
The INT #u8 instruction operates as follow.
Branch to the interrupt handler for the vector indicated by u8.
[Operation]
1. SSP-4→ SSP
2. PS→ (SSP)
3. SSP-4→ SSP
4. PC+2→ (SSP)
5. "0"→ I Flag
6. "0"→ S Flag
7. (TBR+3FCH - 4 × u8)→ PC
■ Operation of INT Instruction
The INT instruction operates as follow.
Branch to the interrupt handler for the vector indicated by vector number #9.
[Operation]
1. SSP-4→ SSP
2. PS→ (SSP)
3. SSP-4→ SSP
4. PC+2→ (SSP)
5. "00100"→ ILM
6. "0"→ S Flag
7. (TBR+3D8H)→ PC
Do not use the INTE instruction during the INTE ins truction and step trace trap processing routine.
Moreover, EIT is not generated while executing the step by INTE.
52
■ Operation of Step Trace Trap
When the T flag of the SCR within the PS is set, and the step trace function is set to Enabled, a trap is
generated per command execution and creates a break.
Condition of step trace trap detection
●
•T Flag = 1
• There is no delayed branch instructio n.
• While executing other than the INTE command and step trace trap processing routine.
When the above condition occurs, breaks at the command operation gap.
[Operation]
1. SSP-4→ SSP
2. PS→ (SSP)
3. SSP-4→ SSP
4. Address of the following instruction→(SSP)
5. "00100"→ ILM
6. "0"→ S Flag
7. (TBR+3CCH)→ PC
When step trace traps are enabled by setting the T flag, NMI for users and user interruption are disabled.
Moreover, EIT by the INTE instruction is not generated.
■ Operation of Undefined Instruction Exception
If an undefined instruction is detected when decoding the command, an undefined instruction exception is
generated.
Detection condition of undefined instruction exception
●
• 1) It is detected that it is undefined instru ctio n at the decoding of the instruction.
• 2) Placed outside the delay slot (not immediately after the delay branch command).
When the above condition occurs, an undefined instruction exception is generated, and a break is created.
[Operation]
1. SSP-4→ SSP
2. PS→ (SSP)
3. SSP-4→ SSP
4. PC→ (SSP)
5. "0"→ S Flag
6. (TBR+3C4H)→ PC
The address of the actual command that detected the undefined instruction exception is saved as the PC.
53
CHAPTER 3 CPU
■ Coprocessor Absent Trap
When a coprocessor command using an unmounted coprocessor is executed, a coprocessor absence trap is
generated.
[Operation]
1. SSP-4→ SSP
2. PS→ (SSP)
3. SSP-4→ SSP
4. Address of the following instruction→(SSP)
5. "0"→ S Flag
6. (TBR+3E0H)→ PC
■ Coprocessor Error Trap
If an error occurs while using a coprocessor, when the coprocessor command that operates the coprocessor
is executed next, a coprocessor error trap is generated.
[Operation]
1. SSP-4→ SSP
2. PS→ (SSP)
3. SSP-4→ SSP
4. Address of the following instruction→(SSP)
5. "0"→ S Flag
6. (TBR+3DCH)→ PC
Note:
This product does not contain the coprocessor.
■ Operation of RETI Instruction
The RETI instruction is an instruction which returns from EIT processing routine.
[Operation]
1. (R15)→ PC
2. R15+4→ R15
3. (R15)→ PS
4. R15+4→ R15
Care must be taken that the stack pointer to be referred to returning of the PS and PC is selected in
accordance with the S flag contents. When the command that operates R15 (stack pointer) within the
interrupt handler is executed, set the S flag to "1" and use the USP as R15. The S flag must be returned to
"0" before the RETI command.
■ Delay Slot
54
In the delay slot of the branch instruction, there is a restriction concerning EIT.
Refer to "3.8.1 Branch Command with Delay Slot" for details.
3.10Reset Sequence
This section explains the reset when the CPU is the operation state.
■ Reset Factor
The reset factor is as follow.
• Input from external reset pin
• Software reset by the SRST bit operation of the standby control register (STCR)
• Count up of watchdog timer
•Power on reset
■ Initialization by Reset
The reset factor is generated, the CPU is initialized.
Releasing from the external reset pin or software reset
●
• The pin is set to the predetermined state.
• Each resource in the device is put in the reset state. The control register is initialized to the
predetermined value.
• The lowest gear is selected for the clock.
■ Reset Sequence
When a reset factor is released, the CPU executes the following reset sequence.
• (000FFFFC
Note:
After reset, operation mode needs to be set by the mode register setting.
) → PC
H
55
CHAPTER 3 CPU
3.11Memory Access Mode
In the FR20 series, operation mode is controlled by the mode pins (MD2, 1, 0) and the
mode register (MODR).
■ Operation Mode
In the operation mode, there are a bus mode and an access mode.
Bus modeAccess mode
Single-chip
Bus Mode
●
Internal ROM
external bus
External ROM
external bus
32 - bit bus widht
16 - bit bus widht
8 - bit bus widht
The bus mode controls the internal ROM operation and external access function operation, and is specified
by the mode set up pins (MD2, 1, 0) and M1, M0 bit of the mode register (MODR).
Access mode
●
The access mode controls the external data bus width, and is specified by the mode set up pins (MD2, 1, 0)
and BW1, 0 bits within the AMD0/AM D1/AMD32/AMD4 and AMD5 (address mode registe rs).
■ Mode Pin
Operation is specified by three pins (MD2, 1, 0) as per Table 3.11-1 .
Table 3.11-1 Mode Pin and setting mode
Mode pin
Mode name
MD2 MD1 MD0
0 0 0
0 0 1
0 1 0
External
vector mode 0
External
vector mode 1
External
vector mode 2
Reset vector
access area
External8 bits
External16 bit
External32 bit
External data bus
width
Remark
The use of the terminal
is prohibited.
0 1 1
1 -----
56
Internal vector
mode
Internal(Mode register) Single-chip mode
The use of the terminal
is prohibited.
■ Mode Data
Data that the CPU writes at "0000 07FFH" after reset is called mode data.
The mode register (MODR) exists in "0000 07FF
under the set up mode of this register. The mode register can be written only once after resetting.
The set value of this register is valid immediately after writing.
■ Mode Register (MODR)
bit
Initial value
Address: 0000 07FF
Access
[bit7, 6]: M1, M0
Table 3.11-2 Bus mode setting bits and function
M1 M0 FunctionRemark
0 0 Single-chip mode
0 1 Internal ROM external bus mode
H M1 M0 XXXXXXXXB
WW
There are bus mode setting bits. These bits specify the bus mode after writing the mode register.
" and after setting to this register, operation is carried out
H
Figure 3.11-1 Mode register (MODR)
76543210
Bus mode setting mode
Note:
1 0 External ROM external bus modeSetting disabled
1 1 -Setting disabled
Only set the "00" and "01" for this product above.
[bit5-0]:System Reserved bit
Always write "0" to these bits.
57
CHAPTER 3 CPU
■ Notes on Writing to Mode Register (MODR)
Before writing to the MODR, AMD0 to AMD5 must be set, and the bus width in each chip select (CS) area
must be decided.
The MODR has no bits used to set the bus width.
For the bus width, before writing to the MODR, the mode pins (MD2 to 0) are valid. After MODR writing,
set values (BW1, BW0) of the AMD0 to AMD5 will be valid.
For example, the external reset vector performs in the normal area 0 (the area in which the CSOX is active),
but in this case, the bus width is decided by the MD2 to MD0 pi ns . The bus width at that time is set to 32 or
16 bits by MD2 to MD0, and if MODR is written while nothing is set to AMD0, the initial value of the
AMD0 bus width has been set to 8 bits. So bus operation will be performed by transiting the area 0 to 8 bit
bus mode after writing the MODR, and erroneous operation will result.
AMD0 to AMD5 must be set before writing the MODR to prevent this kind of problem.
Figure 3.11-2 Notes on writing to mode register (MODR)
RST (Reset)
MODR programming
Bus width setting: MD2, 1, 0BW1, 0 of MD0-5A
58
3.12Clock Generation Section (Low Power Consumption
Mechanism)
The clock generation section is the modules that have the following functions:
• CPU clock generation (including the gear function)
• Peripheral clock generation (including the gear function)
• Reset generation and cause retention
• Standby function
• Built-in PLL (duty correction circuit)
■ Register in Clock Generation Section
Figure 3.12-1 Register in Clock Generation Section
bit
Address: 000480H
000481H
000482H
000483H
000484H
000485H
17
RSRR/WTCRReset Factor/Watchdog Cycle Control Register
STCRStandby Control Register
Reserve(Access interdiction)
CTBRTimebase Timer Clear Register
GCR Gear Control Register
WPR Watchdog Reset Generation Dalayed Register
59
CHAPTER 3 CPU
■ Block Diagram of Clock Generation Section
Figure 3.12-2 Block Diagram of Clock Generation Sec tion
X0
X1
Oscillation
circuit
Internal interrupt
Internal reset
R-bus
[Gear control unit]
GCR register
1/ 2
PLL
[Stop/Sleep control unit]
STCR regiter
[Reset factor circuit]
CPU gear
Peripheral
gear
M
P
X
State
transition
control
circuit
Internal
clock
generation
circuit
Reset
generation
F/F
CPU clock
Internal bus clock
Internal peripheral clock
STOP state
SLEEP state
CPU hold request
Internal reset
Power-on detection
RST pin
RSRR register
[Watchdog control unit]
WPR register
CTBR register
Watchdog F/F
Timebase timer
Count
clok
60
3.12.1Reset Factor Register (RSRR) and Watchdog Timer Cycle
Control Register (WTCR)
The reset factor register (RSRR) retains reset types generated, and the watchdog timer
cycle control register (WTCR) specifies the cycle for the watchdog timer.
■ Reset Factor Register (RSRR) and Watchdog Timer Cycle Control Register (WTCR)
Figure 3.12-3 Reset factor register (RSRR) and watchdog timer cycle control register (WTCR)
Initial value after
Power ON
Address: 000480
Access
[bit7]: PONR
When this bit is "1", it indicates that the previo usly generated reset was a powe r-on reset. When t his bit
is "1", contents other than this bit of this register are invalid.
[bit6]: (Reserved)
It is reserved bit. The reading value is undefined.
[bit5]: WDOG
bit
H
76543210
PONR WDOG ERSTSRST WT1WT01XXX XXXXB
RRRRWW
When this bit is "1", it indicates that the previously generated reset was a watchdog reset.
[bit4]: ERST
When this bit is "1", it indicates that the previously generated reset was caused by the external reset pin.
[bit3]: SRST
When this bit is "1", it indicates that the previously generated reset was caused by the s oftware reset
request.
[bit2]: (Reserved)
It is reserved bit. The reading value is undefined.
[bit1, 0]: WT1, 0
These bits specify the cycle of the watchdog timer. The bits and the selected cycle have the following
relationship. These bits are initialized when the entire reset is generated.
61
CHAPTER 3 CPU
Table 3.12-1 Watchdog timer cycle specified by WT1 and WT0
WT1 WT0
0 0
0 1
1 0
1 1
Note: φ is twice as large as X0 when GCR CHC is 1, and is one time as large as X0 when GCR CHC is 0.
Writing spacing to at least necessary for
control generation of watchdog reset WPR
15
φ× 2
(Initial value)φ × 2 15 to φ × 2
17
φ× 2
19
φ× 2
21
φ× 2
φ× 2 21 to φ × 2
Timer from last 5A
write to WPR to
H
occurrence of watchdog resettin g
16
φ × 2
φ × 2
17
to φ × 2
19
to φ × 2
18
20
22
62
3.12.2Standby Control Register (STCR)
This register controls standby operations and specifies the oscillation stabilization wait
time.
■ Standby Control Register (STCR)
Figure 3.12-4 Standby control register (STCR)
bit
76 5 4 3 2 1 0
Address: 00000481
Access
[bit7]:STOP
When "1" is written to this bit, the status will be stop that stops the internal peripheral clock, the internal
CPU clock, and oscillation.
[bit6]:SLEP
When "1" is written to this bit, the status will be standby that stops the internal CPU clock. If "1" is
written to both the STOP bit and this bit, the STOP bit is handled as the priority, so the status will be
stop.
H
STOP SLEEPSRST OSC1 OSC0
R/WR/WR/WR/W R/W
Initial value
000111--
B
[bit5]:(Reserved)
[bit4]:SRST
When "0" is written to this bit, a software reset request is generated.
[bit3, 2]:OSC1, 0
These bits specify the oscillation stabilization wait time. These bits and selected cycle have the
following relationship. This bit is initialized by a power-on reset, an d is unaffected by any other rese t
factors.
Table 3.12-2 Oscillation stabilization wait time specified by OSC1 and OSC0
OSC1 OSC0 Oscillation Stabilization Wait Time
0 0
0 1
1 0
1 1
φ× 2
15
φ× 2
17
φ× 2
19
φ× 2
21
(Initial value)
Note: φ is twice as large as X0 when GCR CHC is 1, and is one time as large as X0 when GCR CHC is 0.
[bit1, 0]:(Reserved)
There are reserved bits. The reading value is undefined.
63
CHAPTER 3 CPU
3.12.3Timebase Timer Clear Register (CTBR)
This register initializes the timebase timer contents to 0.
, 5AH continuously to this register clears the timebase timer to 0 immediately after 5AH.
H
The reading value of this register is irregular. There is no restriction on the time interval between A5
and 5AH writing.
Clearing the timebase timer using this register temporarily fluctuates oscillation stability wait interval,
watchdog cycle, and peripheral cycles that use the timebase.
H
64
3.12.4Gear Control Register (GCR)
The gear control register controls the gear functions of the CPU and peripheral clocks.
■ Gear Control Register (GCR)
Figure 3.12-6 Gear Control Register (GCR)
bit
Address: 000484
Access
[bit7, 6]:C CK1, 0
These bits specify the CPU gear cycle. The bits and selected cycles have the following relationship.
These bits are initialized by a reset.
This bit selects whether 1/2 division cycle or PLL/DCC cycle of the oscillation circuit is used as the
basic clock. The setting "1" is the 1/2 division cycle and the setting "0" is the PLL/DCC cycle.
, 5AH continuously to this register clears the flip-flop for the watchdog timer to "0"
H
, and postpones generation of the watchdog reset.
H
The reading value of this register is irregular. There is no time limit between A5
writing both data is not finished within the period as per the following table, a watchdog reset is
generated. However, clearing is automatically carried out under stop/sleep mode, so when these
conditions are generated, the watchdog reset is automatically post poned.
Table 3.12-5 Watchdog timer cycle specified by WT1 and WT2
WT1 WT0
Writing spacing to at least
necessary for control generation of
Time from 5A
watchdog reset WPR
0 0
0 1
1 0
φ × 2
φ × 2
φ × 2
15
17
19
final writing in WPR to
H
generation of watchdog reset
φ × 2
φ × 2
φ × 2
15
to φ × 2
17
to φ × 2
19
to φ × 2
16
18
20
Initial value
and 5AH, but if
H
1 1
Note: φ is twice as large as X0 when GCR CHC is 1, and is one time as large as X0 when GCR CHC is 0.
φ× 2
21
φ× 2
21
to φ × 2
22
67
CHAPTER 3 CPU
3.12.6Reset Factor Retention
The reset factor retention holds the factor of previous generation. All flag is cleared to
"0" by reading.
Once a factor flag is set, it is not cleared unless the factor is read.
■ Block Diagram of Reset Factor Retention Circuit
Figure 3.12-8 Reset factor circuit Block Diagram
Power-on
detection
watch-dog Timer
reset detect Circuit
RST pin
Reset input circuitERST
■ Setting of Reset Factor Retention
No special settings are required to use the rest factor function. Commands for reading the reset factor
register and branching to the appropriate program shall be placed near the front of the program to be set in
the reset entry address.
[example]
State
transition
circuit
PONR
WDOG
ERST
SRST
decoder
.or.
Internal bus
PONR
WDOG
SRST
SRST
68
RESET-ENTRY
LDI:32 #RSRR,R10
LDI:8 #10000000B,R2
LDUB @R10,R1; GET RSRR VALUE INTO R1
MOV R1,R10; R10 USED AS A TEMPORARY REGISTER
AND R2,R10; WAS PONR RESET?
BNE PONR-RESET
LSR #1,R2; POINT NEXT BIT
MOV R1,R10; R10 USED AS A TEMPORARY REGISTER
AND R2,R10; WAS WATCH DOG RESET?
BNE WDOG-RESET
...
Notes:
• When the PONR bit is 1, contents of bits other than that should be handled as indeterminate. Thus, if a
reset factor needs to be checked, the command for checking the power-on reset must be placed at the
front.
• Checking reset factors other than power-on reset can be done in any position. Priorities are determined
in the order of checking.
69
CHAPTER 3 CPU
3.12.7Stop Status
Stop status indicates the status that stops all internal clocks and oscillation circuit
operation. It can be minimized the power consumption.
■ Overview of Stop Status
Stop status indicates the status that stops all internal clocks and oscillation circuit operation. It can be
minimized the power consumption.
Transition to the stop status is performed as follow.
• Writing in standby control register ( STCR) using the instruction
Returning from the stop status is performed one of the following.
• Inte rrupt reque st (only appl ies to periphe rals where interrupt request can be generated even under stop
status)
• Applying the L level to the RST
Under stop status, all internal clock s are stopped, so bu ilt-in peripherals other than those that can generate
interrupts for returning will be stopped.
pin
■ Block Diagram of Stop Control Section
Figure 3.12-9 shows the block diagram of stop control section.
Figure 3.12-9 Block diagram of stop control section
STCR
Internal bus
Internal Interrupt
Internal reset
CPU Hold Enable
CPU Hold Request
STOP state display singal
STOP
Clear
State transition control circuit
STOP state transition request signal
Stop signal
State decoder
Clock
generation
Internal
bus clock
generation
Internal
peripheral
clock
generation
Clok stop
request singal
Internal clock generation circuit
Clok cancel
request singal
CPU clock
Internal bus clock
Internal peripheral clock
70
■ Transition to Stop Status
Transition to the stop state using an instruction
●
Write "1" to bit 7 of the STCR register to enter stop status.
After a stop request is issued, the status is changed such that the CPU does not use the internal bus, and
then the clocks are stopped in the following order.
CPU clock →internal bus clock → internal peripheral clock
The oscillation circuit stops when the internal peripheral clock stops.
Notes:
The following routine must be used to change the status to stop using a command.
• Before writing to the STCR, set the s ame value to the CCK1, 0 and PCK1, 0 bit lots of the GCR, and the
gear ratios between the CPU system clock and peripheral system clock should be the same.
• Do not provide the stop state when the CHC bit of GCR is "0". To enter stop status, "1" must be set to
the CHC bit of the GCR, and 1/2 division system clock must be selected.
• At least five consecutive NOP instructions must be provided immediately after writing to the STCR.
Returning from stop status can be performed by generating an interrupt or reset.
Return by interrupt
●
If the interrupt-enabled bit attached to the peripheral function is valid, returns from the stop status by
generating a peripheral interrupt.
Returning from the stop status to the normal operation status is carried out in the following procedure.
Generates interrupt -> Restarts oscillation circu it operation -> Waits for oscillation stabilization -> After
stabilization, restarts supply of internal peripheral clock -> Restarts supply of internal bus clock -> Restarts
supply of internal CPU clock
The program execution after oscillation stabilization waiting time is as follows.
• When the level of the interrupt is enabled by the I flag of CPU ILM
71
CHAPTER 3 CPU
• When the level of the interrupt is disabled by the I flag of CPU ILM
Return by RST pin
●
Returning from stop status to normal operating status is as per the following procedure.
- After saving the register, fetches in the interrupt vector and executes from the processing routine.
- Executes the instruction the following instruction that changed to the stop s tatu s.
Notes:
L level application to the RST
Waits for oscillation stabilization -> After stabilization, restarts supply of internal peripheral clock ->
Restarts supply of internal bus clock -> Restarts supply of internal CPU clock -> Fetches in the reset vector
-> Restarts the command execution from the reset entry address
• If an interrupt request has already been generated from a peripheral, status is not changed to stop, and
writing is ignored.
• No internal clocks are supplied while waiting for oscillation stabilization except for power-on reset. For
power-on reset, the internal status needs to be initialized, so all internal clocks are supplied.
pin -> Generates an internal reset -> Restarts o scillation cir cuit operation - >
72
3.12.8Sleep Status
Sleep status indicates that the CPU clock and internal bus clock are stopped.
Power consumption under the status where CPU operation is not required can be
reduced in some extent.
■ Overview of Sleep Status
Sleep status indicates that the CPU clock and internal bus clock are stopped.
Power consumption under the status where CPU operation is not required can be reduced in some extent.
The transition to the sleep status is performed as follow.
• Writing in standby control register ( STCR) using the instruction
Returning from the sleep status is performed one of the following.
• Interrupt request
• Reset factor generation
Under sleep status, the peripheral clock operates, so reset is possible by interrupt of built-in peripheral.
■ Block Diagram of Sleep Control Section
Figure 3.12-10 shows the block diagram of the sleep control section.
Figure 3.12-10 Block diagram of sleep control section
Internal bus
Internal Interrupt
Internal reset
STOP state display singal
SLEP
STCR
Clear
Sleep state transition request signal
Stop signal
State transition control circuit
State decoder
Clock
generation
Internal
bus clock
generation
Internal
peripheral
clock
generation
Clok stop
request singal
CPU clock
Internal clock generation circuit
Internal bus clock
Internal peripheral clock
Clok cancel
request singal
73
CHAPTER 3 CPU
■ Transition to Sleep Status
To enter sleep status, write "0" to bit 7 of the STCR register and "1" to bit 6.
Issues the sleep request, and then stops clocks in the following order once the status of the CPU is changed
so that the internal bus is not used.
CPU clock → Internal bus clock
Notes:
The following routine must be used to change to sleep status.
• Before writing the STCR , set the same value to the CC K1, 0 and PCK1, 0 bit lots of the GCR , and the
gear ratio between the CPU system clock and peripheral system clock should be the same.
• The CHC bit of GCR is can be any value.
• At least five consecutive NOP instructions must be provided immediately after writing to the STCR.
Returning from sleep status can be done by generating an interrupt or reset.
Return by interrupt
●
If the interrupt-enabled bit attached to the peripheral function is valid, returns from sleep status by
generating a peripheral interrupt.
Returning from sleep status to normal operating status is as per the following procedure.
Generates interrupt -> Restarts supply of internal bus clock -> Restarts supply of internal CPU clock
The program execution after clock supply is as follow.
74
• When the level of the interrupt is enabled by the I flag of CPU ILM
- After saving the register, fetches in the interrupt vector and executes from the processing routine.
• When the level of the interrupt is disabled by the I flag of CPU ILM
- Executes the instruction of the following instruction that changed to the stop status.
Notes:
Return by Reset request
●
Returning from sleep status to normal operating status is as per the following procedure.
Generates an internal reset -> Restarts supply of internal bus clock -> Restarts supply of internal CPU clock
-> Fetches in the reset vector -> Restarts the command execution from the reset entry address
• Execution of the numeric command following the command that writes the STCR may be complete.
Therefore, if a cancel or branch command for the interrupt request is placed immediately after, it may
seem as though a different operation from that expected is carried out.
• If an interrupt request has already been generated from a peripheral, the status will not be sleep.
75
CHAPTER 3 CPU
3.12.9State Transition in Standby Mode
Figure 3.12-11 shows the state transition in standby mode.
■ State Transition in Standby Mode
Figure 3.12-11 State transition in standby mode
Oscillation Stabilization
Wait Reset State
Oscillation Stabilization
Wait Time
STOP State
(1) Oscillation Stabilization Wait Time end
(2) Reset cancellation
(3) Reset input
(4) STCR register SLEP=1
(5) Interrupt input or NMI input
Power ON
Reset State
RUN State
SLEEP State
76
(6) STCR register STOP=1
3.12.10Ge ar Functio n
The gear function supplies to thin out the clock. There are two types of independent
circuits (for the CPU and for peripherals), and data can be transmitted and received
between the CPU and peripherals even with different gear ratios. Furthermore, whether
to use a clock with the same cycle as the clock from the oscillation circuit or a clock via
the 1/2 division circuit ca n be specified as the ori g inal clock selection.
■ Block Diagram of Gear Control Section
Figure 3.12-12 Block diagram of gear control section
Gear interval
generation circuit
for peripheral clock
CPU clock
Internal bus
clock
Internal peripheral
clock
Internal bus
X0
X1
Oscillation
circuit
CCK
PCK
CHC
1/2
PLL
Selection
circuit
(1 multiplication)
■ Setting of Gear Function
The requested gear ratio can be set by setting the CCK1, 0 bit of the gear control register (GCR) to the
requested value under the CPU clock control, or by setting the PCK1, 0 bit of the same register to the
requested value under the peripheral clock control.
Setting "1" to the CHC bit of the gear control register selects the 1/2 division circuit output as the source
clock, and uses "0" and the clock whose cycle is the same as the clock from the oscillation circuit as they
are. The CPU system and peripheral system are simultaneously changed to switch the source clock.
RTG
Servo
General-purpose
prescaler
Tim er 0-5
PWC
-FRC
Division clock generation
destination
-
Clock generation block
OSCI(PCK)
Clock generation block
Remark
Each input is synchronized
with X0
synchronized with φ
clock
FRC and external clock is
synchronized with φ
81
CHAPTER 3 CPU
3.12.13Watchdog Function
The watchdog function detects any uncontrolled programs. If writing A5H and 5AH to
the watchdog reset postpone register is not performed within the predetermined period
due to an uncontrolled program or suchlike, a watchdog reset request is generated by
the watchdog timer.
■ Block Diagram of Watchdog Control Section
Figure 3.12-15 Block Diagram of Watchdog control section
M
Timebase
timer
Edge
P
Detect
X
clr
Watchdog
F/F
Latch
Rese
generation F/F
State decoder
Reset state transition
request signal
State transition
control circuit
Internal reset
CTBRWPRRSRR
■ Activating Watchdog Timer
The watchdog timer starts operation by writi ng to the watchdog control reg ister (WTCR). In this case, th e
interval time for the watchdog timer is set by the WT1 and WT0 bits. In terms of interval time setup, only
the time set by the first writing is valid, and subsequent settings will be ignored.
Once the watchdog timer is initiated, A5H and 5AH must be regularly written to the watchdog reset
postpone register (WPR) by the program.
The flip-flop for watchdog reset memorizes the falling edge of th e tap s elected by t he tim ebase timer if t his
flip-flop is not cleared by the 2nd falling edge, a reset is generated.
Figure 3.12-16 shows the operations of the watchdog timer.
and the next 5AH is not specified. Postponement of the
H
writing is within the period specified by the
H
writing is performed once between them.
H
if writing other than 5AH is performed, the first A5H writing will be invalid.
H
must be written again.
H
■ Timebase Timer
φ 1/2
1
The timerbase timer is used as the timer for the clock supplying to the watchdog timer and timer for the
oscillation stabilization wait time. The operation clo ck φ is twice as large as X0 when GCR CHC is 1, and
is one time as large as X0 when GCR CHC is 0.
Figure 3.12-17 Configuration of Timebase Timer
1/22 1/23 1/ 218 1/219 1/220 1/221
83
CHAPTER 3 CPU
84
CHAPTER 4
External Bus Interface
This chapter describes an outline of the external bus
interface, the register configuration/functions, the bus
operation, and the bus timing, and program examples
for the bus operation are explained.
4.1 Overview of External Bus Interface
4.2 Block Diagram
4.3 Area of Bus Interface
4.4 Bus Interface
4.5 Register of External bus Interface
4.6 Bus Operation
4.7 Bus Timing
4.8 Program Example of External Bus Operation
85
CHAPTER 4 External Bus Interface
4.1Overview of External Bus Interface
The external bus interface controls the external memory and interface with the external
I/O.
■ Feature of External Bus Interface
• 16-b it (64KB) address output
• Only 1 bank can be set by the chip select function
- Capable of setting by the 64KB in the arbitrary position on the logical address space
• Capable of setting a 16-/8-bit bus width
• Insertion of the programm able auto memory wait (maximum for 7 cycles)
• Support for the time division I/O interface of address and data
• Support of little endian mode
86
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.