3.2Core Buses and Interfaces.............................................................................................................................................54
5.2Memory map and register definition.............................................................................................................................63
5.2.1Chip Control register (SIM_CHIPCTL)........................................................................................................ 64
5.2.12Miscellaneous Control register (SIM_MISCTRL)........................................................................................ 77
Chapter 6
Memory-Mapped Divide and Square Root (MMDVSQ)
6.1Chip-specific Information for this Module...................................................................................................................79
6.2.3Modes of operation........................................................................................................................................ 82
6.3External signal description............................................................................................................................................83
6.4Memory map and register definition.............................................................................................................................83
7.1Chip-specific Information for this Module...................................................................................................................97
7.3.3Platform Control Register (MCM_PLACR)..................................................................................................100
7.3.4Compute Operation Control Register (MCM_CPO)..................................................................................... 103
Chapter 8
Bit Manipulation Engine (BME)
8.1Chip-specific Information for this Module...................................................................................................................105
8.2.3Modes of operation........................................................................................................................................ 107
8.3Memory map and register definition.............................................................................................................................107
9.1Chip-specific Information for this Module...................................................................................................................125
10.1Chip-specific information for this module....................................................................................................................131
11.1Chip-specific information for this module....................................................................................................................135
11.4Memory map and register definition.............................................................................................................................140
11.5.3FTM Fault Detection Input / Hardware Triggers and Synchronization.........................................................177
Chapter 12
Direct Memory Access Multiplexer (DMAMUX)
12.1Chip-specific information for this module....................................................................................................................179
12.2.3Modes of operation........................................................................................................................................ 182
12.3External signal description............................................................................................................................................183
12.6.2Enabling and configuring sources..................................................................................................................189
13.1.1eDMA system block diagram........................................................................................................................ 193
13.2Modes of operation.......................................................................................................................................................196
13.3.4Reserved memory and bit fields.....................................................................................................................198
13.3.6Error Status Register (DMA_ES).................................................................................................................. 207
13.4.1eDMA basic data flow................................................................................................................................... 241
13.4.2Fault reporting and handling..........................................................................................................................244
13.5.5Monitoring transfer descriptor status............................................................................................................. 258
14.6Private Peripheral Bus (PPB) memory map..................................................................................................................277
Chapter 15
Flash Acceleration Unit (FAU)
15.1Flash Acceleration Unit (FAU).....................................................................................................................................279
15.1.2Modes of operation........................................................................................................................................ 279
15.1.3External signal description.............................................................................................................................279
15.1.4Memory map and register descriptions..........................................................................................................279
16.1Chip-specific Information for this Module...................................................................................................................283
16.3External signal description............................................................................................................................................288
16.4Memory map and registers............................................................................................................................................289
16.4.1Flash configuration field description............................................................................................................. 289
16.5.5Flash Operation in Low-Power Modes.......................................................................................................... 317
16.5.6Flash memory reads and ignored writes........................................................................................................ 317
16.5.7Read while write (RWW).............................................................................................................................. 317
16.5.8Flash Program and Erase................................................................................................................................318
17.6.10 Module Clocking Information for LPUART, LPSPI, LPI2C, FlexIO and LPIT...........................................366
Chapter 18
System Clock Generator (SCG)
18.1Chip-specific information for this module....................................................................................................................369
18.3.3Clock Status Register (SCG_CSR)................................................................................................................375
19.1.1Features and Modes....................................................................................................................................... 405
19.2RTC Signal Descriptions.............................................................................................................................................. 406
20.1Chip-specific information for this module....................................................................................................................411
20.1.1Information of PCC on this device................................................................................................................ 411
20.4Memory map and register definition.............................................................................................................................413
22.1Chip-specific information for this module....................................................................................................................469
22.1.1Boot ROM Configuration.............................................................................................................................. 469
22.3.5Bootloader Entry Point / API Tree.................................................................................................................477
22.4.2Flash driver API Tree.....................................................................................................................................501
22.4.3Quick demo using Kinetis Flash Driver API................................................................................................. 502
22.4.4Flash driver data structures............................................................................................................................ 503
22.7Kinetis Bootloader Status Error Codes.........................................................................................................................528
Chapter 23
Reset Control Module (RCM)
23.1Chip-specific information for this module....................................................................................................................531
24.2.5Entering and exiting power modes.................................................................................................................554
24.5Module operation in low power modes........................................................................................................................ 556
25.2Modes of operation.......................................................................................................................................................563
25.3Memory map and register descriptions.........................................................................................................................565
25.4.6Debug in low power modes........................................................................................................................... 580
Chapter 26
Power Management Controller (PMC)
26.1Chip-specific Information for this Module...................................................................................................................581
26.4Modes of Operation...................................................................................................................................................... 581
26.4.2Low Power Mode (LPM)...............................................................................................................................582
26.5Low Voltage Detect (LVD) System............................................................................................................................. 582
26.5.1Low Voltage Reset (LVR) Operation............................................................................................................ 582
26.6Memory Map and Register Definition..........................................................................................................................583
26.6.1Low Voltage Detect Status and Control 1 Register (PMC_LVDSC1)..........................................................584
26.6.2Low Voltage Detect Status and Control 2 Register (PMC_LVDSC2)..........................................................585
26.6.3Regulator Status and Control Register (PMC_REGSC)................................................................................586
27.4.2Program Once Field....................................................................................................................................... 591
28.1.2Modes of Operation....................................................................................................................................... 594
28.2EWM Signal Descriptions............................................................................................................................................ 596
29.1Chip-specific information for this module....................................................................................................................605
29.3Memory map and register definition.............................................................................................................................607
29.3.1Watchdog Control and Status Register (WDOG_CS)................................................................................... 608
29.4.3Configuring the Watchdog.............................................................................................................................616
29.4.4Using interrupts to delay resets......................................................................................................................617
29.4.6Functionality in debug and low-power modes...............................................................................................618
29.4.7Fast testing of the watchdog...........................................................................................................................618
29.5.3Refreshing the Watchdog...............................................................................................................................621
30.1.3Modes of operation........................................................................................................................................ 624
30.2Memory map and register descriptions.........................................................................................................................624
30.2.1CRC Data register (CRC_DATA)................................................................................................................. 625
30.3.4CRC result complement.................................................................................................................................631
31.2Debug port pin descriptions..........................................................................................................................................635
31.3SWD status and control registers..................................................................................................................................635
31.3.1MDM-AP status register................................................................................................................................ 637
31.3.2MDM-AP Control register.............................................................................................................................638
31.6Debug in low-power modes..........................................................................................................................................640
31.7Debug and security....................................................................................................................................................... 640
32.1.3Modes of operation........................................................................................................................................ 645
32.2External signal description............................................................................................................................................645
32.3Memory map and register definition.............................................................................................................................646
32.3.3System ROM Memory Map...........................................................................................................................668
33.3Module Signal Description Tables................................................................................................................................684
34.1Chip-specific information for this module....................................................................................................................691
34.1.2Port control and interrupt module features.................................................................................................... 692
34.3.2Modes of operation........................................................................................................................................ 694
34.4External signal description............................................................................................................................................695
34.5Detailed signal description............................................................................................................................................695
34.6Memory map and register definition.............................................................................................................................695
35.1Chip-specific information for this module....................................................................................................................713
35.1.2GPIO accessibility in the memory map......................................................................................................... 713
35.2.2Modes of operation........................................................................................................................................ 714
35.2.3GPIO signal descriptions............................................................................................................................... 714
35.3Memory map and register definition.............................................................................................................................715
35.3.1
35.3.2
35.3.3
35.3.4
35.3.5
35.3.6
35.4FGPIO memory map and register definition................................................................................................................ 720
36.1Chip-specific information for this module....................................................................................................................727
36.3ADC signal descriptions...............................................................................................................................................738
36.3.1Analog Power (VDDA)................................................................................................................................. 739
36.4Memory map and register definitions...........................................................................................................................740
36.4.1
36.4.2
36.4.3
36.4.4
36.4.5
36.4.6
36.4.7
36.4.8
36.4.9
36.4.10
36.4.11
36.4.12
36.4.13
ADC Status and Control Register 1 (ADCx_SC1n)...................................................................................... 742
36.5.1Clock select and divide control......................................................................................................................763
ADC Plus-Side General Calibration Value Register 2 (ADCx_CLP2)......................................................... 757
ADC Plus-Side General Calibration Value Register 1 (ADCx_CLP1)......................................................... 757
ADC Plus-Side General Calibration Value Register 0 (ADCx_CLP0)......................................................... 758
ADC Plus-Side General Calibration Value Register X (ADCx_CLPX)....................................................... 758
ADC Plus-Side General Calibration Value Register 9 (ADCx_CLP9)......................................................... 759
ADC General Calibration Offset Value Register S (ADCx_CLPS_OFS).....................................................760
ADC Plus-Side General Calibration Offset Value Register 3 (ADCx_CLP3_OFS).....................................760
ADC Plus-Side General Calibration Offset Value Register 2 (ADCx_CLP2_OFS).....................................761
ADC Plus-Side General Calibration Offset Value Register 1 (ADCx_CLP1_OFS).....................................761
ADC Plus-Side General Calibration Offset Value Register 0 (ADCx_CLP0_OFS).....................................761
ADC Plus-Side General Calibration Offset Value Register X (ADCx_CLPX_OFS)...................................762
ADC Plus-Side General Calibration Offset Value Register 9 (ADCx_CLP9_OFS).....................................762
36.6.5DMA Support on ADC.................................................................................................................................. 776
36.6.7ADC Trigger Concept – Use Case.................................................................................................................777
36.6.8ADC self-test and calibration scheme............................................................................................................778
Chapter 37
Comparator (CMP)
37.1Chip-specific information for this module....................................................................................................................779
37.4CMP, DAC, and ANMUX diagram..............................................................................................................................786
37.14.1 Zero Crossing Detection................................................................................................................................ 816
CMP Control Register 2 (CMPx_C2)............................................................................................................ 806
37.14.3 Round Robin Mode........................................................................................................................................817
Chapter 38
Programmable Delay Block (PDB)
38.1Chip-specific Information for this Module...................................................................................................................821
38.2.5Modes of operation........................................................................................................................................ 827
38.3PDB signal descriptions................................................................................................................................................827
38.4Memory map and register definition.............................................................................................................................827
38.5.1PDB pre-trigger and trigger outputs...............................................................................................................837
Channel n Control register 1 (PDBx_CHnC1)...............................................................................................833
Channel n Status register (PDBx_CHnS).......................................................................................................834
Channel n Delay 0 register (PDBx_CHnDLY0)............................................................................................835
Channel n Delay 1 register (PDBx_CHnDLY1)............................................................................................836
Pulse-Out n Enable register (PDBx_POEN)..................................................................................................836
Pulse-Out n Delay register (PDBx_POnDLY)...............................................................................................837
38.5.4Updating the delay registers...........................................................................................................................841
38.7.1Using PDB to precisely control ADC conversion......................................................................................... 844
Chapter 39
FlexTimer Module (FTM)
39.1Chip-specific information for this module....................................................................................................................845
39.2.3Modes of operation........................................................................................................................................ 853
39.3FTM signal descriptions............................................................................................................................................... 855
39.4Memory map and register definition.............................................................................................................................855
39.5.14 Software Output Control Mode......................................................................................................................955
39.5.20 Features priority............................................................................................................................................. 965
39.5.24 Capture Test Mode.........................................................................................................................................971
39.5.30 Global Load....................................................................................................................................................989
39.5.31 Global time base (GTB).................................................................................................................................990
39.7.2Reload Point Interrupt....................................................................................................................................1003
39.9.2FTM Hall sensor support............................................................................................................................... 1005
39.9.4FTM Global Time Base................................................................................................................................. 1007
39.9.5FTM BDM and debug halt mode...................................................................................................................1008
Chapter 40
Low-power Periodic Interrupt Timer (LPIT)
40.1Chip-specific Information for this Module...................................................................................................................1009
40.3Modes of operation.......................................................................................................................................................1012
40.4Memory Map and Registers..........................................................................................................................................1013
40.5.3Trigger Control for Timers............................................................................................................................ 1025
Version ID Register (LPITx_VERID)........................................................................................................... 1014
41.1Chip-specific information for this module....................................................................................................................1031
41.2.2Modes of operation........................................................................................................................................ 1034
41.3External signal description............................................................................................................................................1035
41.3.3ALTCLK— alternative clock source for counter.......................................................................................... 1036
41.4Memory Map and Register Descriptions......................................................................................................................1036
41.4.1Pulse Width Timer Control and Status Register (PWT_CS)......................................................................... 1037
41.4.2Pulse Width Timer Control Register (PWT_CR).......................................................................................... 1038
41.4.3Pulse Width Timer Positive Pulse Width Register: High (PWT_PPH).........................................................1039
41.5.1PWT counter and PWT clock pre-scaler........................................................................................................1041
41.5.2Edge detection and capture control................................................................................................................1042
41.6.1Description of reset operation........................................................................................................................1046
41.7.1Description of interrupt operation..................................................................................................................1047
41.9.1Edge detection, capture control and period measurement............................................................................. 1050
Chapter 42
Low Power Timer (LPTMR)
42.1Chip-specific information for this module....................................................................................................................1053
42.2.2Modes of operation........................................................................................................................................ 1055
42.3LPTMR signal descriptions.......................................................................................................................................... 1056
42.3.1Detailed signal descriptions........................................................................................................................... 1056
42.4Memory map and register definition.............................................................................................................................1056
42.5.1LPTMR power and reset................................................................................................................................1061
43.1Chip-specific information for this module....................................................................................................................1067
43.2.2Modes of operation........................................................................................................................................ 1070
43.2.3RTC signal descriptions.................................................................................................................................1070
43.3.1RTC Time Seconds Register (RTC_TSR).....................................................................................................1071
43.3.2RTC Time Prescaler Register (RTC_TPR)....................................................................................................1071
43.3.3RTC Time Alarm Register (RTC_TAR)....................................................................................................... 1072
43.3.4RTC Time Compensation Register (RTC_TCR)...........................................................................................1072
43.3.5RTC Control Register (RTC_CR)..................................................................................................................1074
43.3.6RTC Status Register (RTC_SR).................................................................................................................... 1076
43.4.1Power, clocking, and reset............................................................................................................................. 1082
44.1Chip-specific information for this module....................................................................................................................1089
44.2.4Modes of operation........................................................................................................................................ 1092
44.3Memory Map and Registers..........................................................................................................................................1094
44.3.1
44.3.2
44.3.3
44.3.4
44.3.5
44.3.6
44.3.7
44.3.8
44.3.9
44.3.10
Version ID Register (LPSPIx_VERID)......................................................................................................... 1095
Control Register (LPSPIx_CR)......................................................................................................................1097
Status Register (LPSPIx_SR).........................................................................................................................1098
44.4.1Clocking and Resets.......................................................................................................................................1113
44.4.4Interrupts and DMA Requests........................................................................................................................1121
Transmit Data Register (LPSPIx_TDR)........................................................................................................ 1111
Receive Status Register (LPSPIx_RSR)........................................................................................................ 1112
Receive Data Register (LPSPIx_RDR)..........................................................................................................1113
Chapter 45
Low Power Inter-Integrated Circuit (LPI2C)
45.1Chip-specific information for this module....................................................................................................................1123
45.2.4Modes of operation........................................................................................................................................ 1127
45.3Memory Map and Registers..........................................................................................................................................1128
45.3.1
45.3.2
45.3.3
45.3.4
Version ID Register (LPI2Cx_VERID)......................................................................................................... 1131
45.4.1Clocking and Resets.......................................................................................................................................1161
45.4.4Interrupts and DMA Requests........................................................................................................................1170
Low Power Universal Asynchronous Receiver/Transmitter (LPUART)
46.1Chip-specific information for this module....................................................................................................................1175
46.2.2Modes of operation........................................................................................................................................ 1178
46.4.6Interrupts and status flags.............................................................................................................................. 1219
Chapter 47
Flexible I/O (FlexIO)
47.1Chip-specific Information for this Module...................................................................................................................1221
47.2.4Modes of operation........................................................................................................................................ 1225
47.2.5FlexIO Signal Descriptions............................................................................................................................1225
47.3.3FlexIO Control Register (FLEXIO_CTRL)...................................................................................................1229
47.3.4Pin State Register (FLEXIO_PIN).................................................................................................................1230
47.3.5Shifter Status Register (FLEXIO_SHIFTSTAT)...........................................................................................1231
48.1Chip-specific information for this module....................................................................................................................1269
48.2.2Modes of operation........................................................................................................................................ 1272
48.3External signal description............................................................................................................................................1273
48.4.1TSI General Control and Status Register (TSI_GENCS).............................................................................. 1275
48.4.2TSI DATA Register (TSI_DATA)................................................................................................................ 1278
48.5.2Brief timing and Operation of TSI.................................................................................................................1298
48.5.5Enable TSI module.........................................................................................................................................1303
48.5.6Software and hardware trigger.......................................................................................................................1303
48.5.10 End of scan.....................................................................................................................................................1305
48.5.12 Wake up MCU from low power modes.........................................................................................................1306
48.5.13 DMA function support...................................................................................................................................1306
48.6.2How to use TSI module................................................................................................................................. 1309
This reference manual is intended for system software and hardware developers and
applications programmers who want to develop products with this device. It assumes that
the reader understands operating systems, microprocessor system design, and basic
principles of software and hardware.
1.2
This manual has two main sets of chapters.
1. Chapters in the first set contain information that applies to all components on the
2. Chapters in the second set are organized into functional groupings that detail
1.3
Each module chapter has two main parts:
Organization
chip.
particular areas of functionality.
• Examples of these groupings are clocking, timers, and communication interfaces.
• Each grouping includes chapters that provide a technical description of
individual modules.
Module descriptions
•
Chip-specific: The first section, Chip-specific [module name] information, includes
the number of module instances on the chip and possible implementation differences
between the module instances, such as differences in FIFO depths or the number of
Chapter 49
Enhanced Serial Communication Interface (eSCI)
49.1 Chip-specific eSCI information
This chip has six instances of the eSCI module. Some feature details vary between the
instances.
The following table summarizes the feature differences. The table does not list feature
details that the instances share.
Table 49-1. eSCI instance feature differences
InstanceDMA support
eSCI_A and eSCI_BYes
eSCI_C, eSCI_D, eSCI_E, and eSCI_FNo: descriptions of eSCI DMA functionality do not apply to
these instances
NOTE
For eSCI_D, the single wire feature does not appl y for TX/RX
via PCSA3 because this pad works only as an output.
49.2 Introduction
The eSCI block is an enhanced SCI block wi th a LIN master interface layer and DMA
support. The LIN master layer complies with the specifications LI N 1.3, LIN 2.0, LIN
2.1, and SAE J2602/1.
49.2.1 Bibliography
• LIN Specification Package Revision 1.3; December 12, 2002
• LIN Specification Package Revision 2.0; September 23, 2003
Sample Reference Manual
EXAMPLE
Chip-specific information
that should be read first
Beginning of general
module information
Module descriptions
channels supported. It may also include functional connections between the module
instances and other modules. Read this section first because its content is crucial to
understanding the information in other sections of the chapter.
• General: The subsequent sections provide general information about the module,
including its signals, registers, and functional description.
NOTE
If there is a conflict between the chip-specific module
information (first section) and the general module information
(subsequent sections), the chip-specific information supersedes
the general information.
Figure 1-1. Example: chapter chip-specific information and general module information
This section provides an overvi ew, list of features, and modes of operation for the SWT.
The Software Watchdog Timer (SWT) is a peripheral modul e that can prevent system
lockup in situations such as software getti ng trapped in a loop or if a bus transaction fai ls
to terminate. When enabled, the SWT requires periodi c execution of a watchdog
servicing operation. The servicing operation resets the timer to a speci fied time-out
peri od. I f this servicing action does not occur before the timer expires the SWT generates
an interrupt or hardware reset. The SWT can be configured to generate a reset or interrupt
on an initi al time-out. A reset is always generated on a second consecutive ti me-out.
34.2.1 Overview
accesses by masters without permission. If the RIA bit in the SWT_CR is set then the
SWT generates a system reset on an invalid access otherwise a bus error is generated. If
either the HLK or SLK bits in the SWT_CR are set, then the SWT_CR, SWT_TO,
SWT_WN, and SWT_SK registers are read-only.
The SWT memory map is shown in the following table.
SWT memory map
Address
offset (hex)
Register name
Width
(in bits)
Access Reset value
Section/
page
0SWT Control Register (SWT_CR)32R/W See section 34.4.1/1331
4SWT Interrupt Register (SWT_IR)32R/W 0000_0000h 34.4.2/1334
8SWT Time-out Register (SWT_TO)32R/W See section 34.4.3/1334
The reset val ue for the SWT_CR is impl ementation specif ic.
See the confi guration information.
The SWT_CR contains fields for configuring and controll ing the SWT.
This regi ster is read-only if either the SWT_CR[HLK] or SWT_CR[SL K] bits are set.
Address: 0h base + 0h offset = 0h
Bit 012 3456789 10 11 12 13 14 15
R
MAP0
MAP1
MAP2
MAP3
MAP4
MAP5
MAP6
MAP7
0
W
Reset
0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*
Bit
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
R
0
SMDRIA WND ITR HLK SLK CSL STP FRZ WEN
W
Reset
0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*
* Notes:
The reset value for the SWT_CR is implementation specific. See the configuration information.•
Chapter 34 Software Watchdog Timer (SWT)
Sample Reference Manual
EXAMPLE
Chapter 1 About This Manual
1.3.1Example: chip-specific information that supersedes
content in the same chapter
The example below shows chip-specific information that supersedes general module
information presented later in the chapter. In this case, the chip-specific register reset
values supersede the reset values that appear in the register diagram.
Figure 1-2. Example: chip-specific information that supersedes content in the same
1.3.2
Example: chip-specific information that refers to a different
chapter
The chip-specific information below refers to another chapter's chip-specific information.
In this case, read both sets of chip-specific information before reading further in the
chapter.
TheXBICidentifieseachXBARmaster andslaveintermsofthemaster or slave'sphysicalport number.Seethe"Physicalmaster port"assignmentsinTable9-1andthe"Slaveport"assignmentsinTable9-2.
10.1.2 Unimplemented MCR and ESR fields
10.2 Overview
Sample Reference Manual
Chapter 9
Crossbar Switch (XBAR)
9.1 Chip-specific XBAR information
This chip has one instance of the XBAR module.
9.1.1 XBAR master and slave assignments
The foll owing table l ists the XBAR physical port numbers and l ogical IDs for al l master
ports on this SoC.
• Each port number matches the def ault priority assigned to the correspondi ng physical
master port. This default pri ori ty equals the reset value of the priority fiel d for each
master port in the PRS
n registers.
• A priority value of 0 is the highest priority. There is no "disabled" value for the
priority.
• A Nexus_3 module and core data bus share the same physical master port for each
core.
The logical master ID corresponds to the logical address provided by the master module
and is unique f or each module. The logi cal master IDs are used by the bus masters
connected to the XBAR. The Nexus master is identifi ed by setting the MSB in the 4-bi t
field that supplies the master ID number.
Table 9-1.XBAR master ports and logical master IDs
0Nexus_3_08Nexus_3_0 arbitrates with Core0 data for XBAR port 1Core1 instruction21Core1 data
3
1Nexus_3_19Nexus_3_1 arbitrates with Core1 data for XBAR port 3
Table continues on the next page...
Sample Reference Manual
The Crossbar Integrity Checker (X BIC) verifies the i ntegrity of the crossbar transfers.
For f orward signals (master to slave), it is done by verif ying the integrity of the attribute
information using an 8-bit Error Detection Code (EDC). The EDC detects any single- or
double-bit errors in the attribute information and signals the Fault Collection and Control
Unit (FCCU) when an error is detected. For feedback signals (slave to master), it is done
by comparing the consistency of the signal s during the AHB dataphase.There are three
signals from slave to master, hready, hresp0, and hresp2. If any of the master signals is
different from the slave signals during dataphase, the error will be reported in the Error
Status Register.
On this chi p, the MCR[SE5] and ESR[DPSE5] fields are not implemented. In X BIC
Module Control Register (XBI C_MCR) and XBIC Error Status Regi ster (XBIC_ESR),
these fields are reserved.
EXAMPLE
Register descriptions
Figure 1-3. Example: chip-specific information that refers to a different chapter
1.4
Register descriptions
Module chapters present register information in:
• Memory maps including:
• Addresses
• The name and acronym/abbreviation of each register
• The width of each register (in bits)
• Each register's reset value
• The page number on which each register is described
• Register figures
• Field-description tables
• Associated text
The register figures show the field structure using the conventions in the following figure.
The following suffixes identify different numbering systems:
bBinary number. For example, the binary equivalent of the number 5 is written 101b. In some cases,
dDecimal number. Decimal numbers are followed by this suffix only when the possibility of confusion
hHexadecimal number. For example, the hexadecimal equivalent of the number 60 is written 3Ch. In
1.5.2Typographic notation
The following typographic notation is used throughout this document:
placeholder, xItems in italics are placeholders for information that you provide. Italicized text is also used for
code
Conventions
Numbering systems
This suffixIdentifies a
binary numbers are shown with the prefix 0b.
exists. In general, decimal numbers are shown without a suffix.
some cases, hexadecimal numbers are shown with the prefix 0x.
ExampleDescription
the titles of publications and for emphasis. Plain lowercase letters are also used as
placeholders for single letters and numbers.
Fixed-width type indicates text that must be typed exactly as shown. It is used for instruction
mnemonics, directives, symbols, subcommands, parameters, and operators. Fixed-width type
Information found here provides an overview of this MCU, which is a part of Kinetis Eseries of ARM® Cortex®-M0+ MCUs and product family. It also presents high-level
descriptions of the modules available on the device covered by this document.
2.2
The following figure shows a top-level block diagram of the MCU superset device.
The modules on this device are grouped into functional categories. The following
sections describe the modules assigned to each category in more detail.
The ARM Cortex-M0+ is the member of the Cortex-M Series of processors targeting the
micro-controller market. It is an entry-level 32-bit processor designed for very cost
sensitive, low power applications. The Cortex-M0+ has a 2-stage pipeline von Neumann
architecture. The processor delivers exceptional energy efficiency through extensively
optimized design and provides high-end processing hardware including a single-cycle
multiplier. It also has an I/O port which supports single cycle loads and stores to tightlycoupled peripherals (e.g. GPIO).
The Cortex-M0+ processor implements the ARMv6-M architecture, which is upward
compatible with other Cortex-M profile processors. It is based on the 16-bit Thumb
instruction set and includes Thumb-2 technology (including all but three 16-bit Thumb
opcodes plus seven 32-bit instructions). The Cortex-M0+ instruction set provides the
exceptional performance expected of a modern 32-bit architecture, with a higher code
density than 8-bit and 16-bit microcontrollers.
®
Cortex-M0+ Processor Features
• Thumb instruction set with Thumb-2 technology
• Nested Vectored Interrupt Controller (NVIC)
• Single-cycle 32-bit hardware multiplier
• Single-cycle I/O port
• Serial-Wire Debug port (SWD)
• Breakpoint & Watchpoint Units
• Micro Trace Buffer (MTB)
• 24-bit system tick timer (SysTick)
The detailed architecture and programming model of Cortex-M0+ processor are
discussed in the following documents from ARM.
The Cortex-M0+ processor provides a single system-level interface using AMBA
®
technology to provide memory and peripheral accesses, a single-cycle I/O port for high
speed access to tightly-coupled peripherals (such as GPIO), a NVIC interface for
interrupt handling, a Debug Access Port (DAP) for SWD debug and a Micro Trace
Buffer (MTB) interface for trace.
The following interfaces are implemented on the Cortex-M0+ processor of this device.
The processor supports optional tightly-coupled system components. The following table
lists the specific configuration of the Cortex-M0+ core on this device.
The System Tick Timer's clock source is always the core clock (CORE_CLK) on this
device. This results in the following:
• The CLKSOURCE bit in SysTick Control and Status Register (SYST_CSR) is
always set to select the core clock.
• Because the timing reference (CORE_CLK) is a variable frequency, the TENMS bit
in the SysTick Calibration Value Register (SYST_CALIB) is always zero.
• The NOREF bit in SysTick Calibration Value Register (SYST_CALIB) is always
set, implying that CORE_CLK is the only available source of reference timing.
The ARM Cortex-M0+ processor includes an interrupt controller called the Nested
Vectored Interrupt Controller (NVIC). It is closely coupled to the processor core to
provide outstanding interrupt handling abilities and low latency interrupt processing. The
NVIC supports nested interrupt, dynamic priority changes, interrupt masking and
interrupt tail-chaining. In addition, the NVIC also supports re-locatable vector table and
an external Nonmaskable Interrupt (NMI).
The NVIC registers are located within the processor's internal System Control Space
(SCS) with base address of 0xE000E000. Most of the NVIC registers are accessible only
in privileged mode. The detailed NVIC functionalities and registers descriptions are
discussed in the following documents from ARM web.
• Cortex-M0+ Devices Generic User Guide
• Cortex-M0+ Technical Reference Manual
4.2
The NVIC supports configurable interrupt number and level of priority. The following
sections speficy the exact priority level and interrupt vectors implemented on this device.
The NVIC on this device supports 4 interrupt priority levels. Therefore, the NVIC_IPR
registers contains 2 bits for each interrupt request (IRQ). For example, NVIC_IPR0 is
shown below:
This device supports non-maskable interrupt (NMI) to the NVIC. It is controlled by the
external NMI signal from the pin. The pin which the NMI signal is multiplexed on, must
be configured for the NMI function to generate the non-maskable interrupt request.
4.3
Interrupt channel assignments
The interrupt source assignments are defined in the following table.
• Vector number — the value stored on the stack when an interrupt is serviced.
• IRQ number — non-core interrupt source count, which is the vector number minus
16.
The IRQ number is used within ARM's NVIC documentation.
0x0000_00208––——
0x0000_00249––——
0x0000_002810––——
0x0000_002C11––ARM coreSupervisor call (SVCall)
0x0000_003012––——
0x0000_003413––——
0x0000_003814––ARM corePendable request for system service
0x0000_00401600DMADMA channel 0 or 4 transfer complete
0x0000_00441710DMADMA channel 1 or 5 transfer complete
0x0000_00481820DMADMA channel 2 or 6 transfer complete
0x0000_004C1930DMADMA channel 3 or 7 transfer complete
0x0000_00502041DMADMA error interrupt channels 0-7
0x0000_00542151Flash memorySingle interrupt vector for all sources
0x0000_00582261PMCLow-voltage detect, low-voltage warning
0x0000_005C2371Port control modulePin detect (Port A, E)
0x0000_00602482LPI2C0Single interrupt vector for all sources
0x0000_00642592LPI2C1—
0x0000_006826102LPSPI0Single interrupt vector for all sources
0x0000_006C27112LPSPI1Single interrupt vector for all sources
0x0000_007028123LPUART0Single interrupt vector for all sources
0x0000_007429133LPUART1Single interrupt vector for all sources
0x0000_007830143LPUART2Single interrupt vector for all sources
0x0000_007C31153ADC0—
0x0000_008032164CMP0—
0x0000_008433174FTM0Single interrupt vector for all sources
0x0000_008834184FTM1Single interrupt vector for all sources
0x0000_008C35194FTM2Single interrupt vector for all sources
0x0000_009036205RTCSingle interrupt vector for all sources
0x0000_009437215CMP1—
0x0000_009838225LPITLPIT channel 0-3
0x0000_009C39235FlexIO—
0x0000_00A040246TSI—
0x0000_00A441256PDB0—
0x0000_00A842266Port control modulePin detect (Port B, C, D)
0x0000_00AC43276SCG—
0x0000_00B044287WDOG or EWMBoth watchdog modules share this interrupt.
0x0000_00B445297PWT or LPTMRSingle interrupt vector for all sources
0x0000_00B846307ADC1Single interrupt vector for all sources
0x0000_00BC47317RCMSingle interrupt vector for all sources
1. Indicates the NVIC's interrupt source number.
2. Indicates the NVIC's IPR register number used for this IRQ. The equation to calculate this value is: IRQ div 4
1
NVIC
IPR
register
number
Source moduleSource description
2
4.3.1Determining the bitfield and register location for
configuring a particular interrupt
Suppose you need to configure the low-power timer (LPTMR) interrupt. The following
table is an excerpt of the LPTMR row from Interrupt channel assignments (value number
as example only).
4004_806C Miscellaneous Control register (SIM_MISCTRL)32R/W0000_0000h5.2.12/77
Register name
Width
(in bits)
AccessReset value
Section/
page
5.2.1Chip Control register (SIM_CHIPCTL)
SIM_CHIPCTL contains the controls for selecting PWT alternative clock source, ADC
COCO trigger, trace clock, clock out source, PDB back-to-back mode and ADC
interleave channel.
Address:
Reset
Reset
4004_8000h base + 4h offset = 4004_8004h
Bit31302928272625242322212019181716
R
W
0000000000000000
1514131211109876543210
Bit
R
00
W
0000000000000000
PDB_
BB_
SEL
00
0
EL
RTC32KCLKS
0
INTERLEAV
CLKOUTSEL
CLKOUTDIV
SIM_CHIPCTL field descriptions
FieldDescription
31–20
Reserved
This field is reserved.
This read-only field is reserved and always has the value 0.
00PWT alternative clock is from the TCLK0 pin.
01PWT alternative clock is from the TCLK1 pin.
10PWT alternative clock is from the TCLK2 pin.
11Reserved
This field is reserved.
This read-only field is reserved and always has the value 0.
This field is reserved.
This read-only field is reserved and always has the value 0.
PDB back-to-back select
Selects ADC COCO source as pdb back-to-back mode, see Back-to-back acknowledge connectivity in
PDB Inter-connectivity Information for details.
Chapter 5 System Integration Module (SIM)
12–11
Reserved
10–8
Reserved
7–6
CLKOUTSEL
5–4
CLKOUTDIV
3–2
Reserved
ADC_
INTERLEAVE_
EN
0PDB0 channel 0 back-to-back operation with ADC0 COCO[1:0] and PDB0 channel 1 back-to-back
operation with ADC1 COCO[1:0]
1PDB0 Channel 0 back-to-back operation with COCO[0] of ADC0 and COCO[1] of ADC1 ; PDB0
Channel 1 back-to-back operation with COCO[0] of ADC1 and COCO[1] of ADC0
This field is reserved.
This read-only field is reserved and always has the value 0.
This field is reserved.
This read-only field is reserved and always has the value 0.
00FTM0 external clock driven by TCLK0 pin.
01FTM0 external clock driven by TCLK1 pin.
10FTM0 external clock driven by TCLK2 pin.
11No clock input
23–3
Reserved
This field is reserved.
This read-only field is reserved and always has the value 0.
FTM0FLTxSELFTM0 Fault x Select
Selects the source of FTM0 fault. Every bit means one fault input respectively.
The selected pin must also be configured for the FTM external clock function through the
appropriate Pin Control Register in the Port Control module.
Chapter 5 System Integration Module (SIM)
NOTE:
The pin source for fault must be configured for the FTM module fault function through the
appropriate pin control register in the port control module when it comes from external fault pin.
TRGMUX_FTM0 SELx is corresponding to FTM0 Fault x input.
Bit value = 0: FTM0_FLTx pin
Bit value = 1: TRGMUX_FTM0 out
5.2.3ADC Options Register (SIM_ADCOPT)
Address: 4004_8000h base + 18h offset = 4004_8018h
Bit31302928272625242322212019181716
Reset
R
W
0000000000000000
1514131211109876543210
Bit
00
R
W
Reset
0
EL
ADC1PRETRGS
0
G
ADC1SWPRETR
ADC1TRGSEL
0
EL
ADC0PRETRGS
0
G
ADC0SWPRETR
0000000000000000
ADC0TRGSEL
SIM_ADCOPT field descriptions
FieldDescription
31–22
Reserved
NXP Semiconductors67
This field is reserved.
This read-only field is reserved and always has the value 0.
Data flash / EEPROM backup split . See DEPART bit description in FTFE chapter.
This field is reserved.
This read-only field is reserved and always has the value 0.
Flash Doze
When set, Flash memory is disabled for the duration of Doze mode. An attempt by the DMA or other bus
master to access the Flash when the Flash is disabled will result in a bus error. This bit should be clear
during VLP modes. The Flash will be automatically enabled again at the end of Doze mode so interrupt
vectors do not need to be relocated out of Flash memory. The wakeup time from Doze mode is extended
when this bit is set.
Chapter 5 System Integration Module (SIM)
0Flash remains enabled during Doze mode
1Flash is disabled for the duration of Doze mode
0
FLASHDIS
Flash Disable
Flash accesses are disabled (and generate a bus error) and the Flash memory is placed in a low power
state. This bit should not be changed during VLP modes. Relocate the interrupt vectors out of Flash
memory before disabling the Flash.
Reset values of MAXADDR0 and MAXADDR1 are loaded
during System Reset from Flash IFR.
Address: 4004_8000h base + 50h offset = 4004_8050h
Bit31302928272625242322212019181716
R
0MAXADDR01MAXADDR1
W
Reset
Reset
* Notes:
Reset value loaded during System Reset from Flash IFR.x = Undefined at reset.•
x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*
1514131211109876543210
Bit
R
W
x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*
SIM_FCFG2 field descriptions
FieldDescription
31
Reserved
30–24
MAXADDR0
23
Reserved
22–16
MAXADDR1
ReservedThis field is reserved.
This field is reserved.
This read-only field is reserved and always has the value 0.
Max address block 0
This field concatenated with 13 trailing zeros indicates the first invalid address of program flash (block 0).
For example, if MAXADDR0 = 0x10, the first invalid address of program flash (block 0) is 0x0002_0000.
This would be the MAXADDR0 value for a device with 128 KB program flash in flash block 0.
This field is reserved.
This read-only field is reserved and always has the value 1.
Max address block 1
This field concatenated with 13 trailing zeros indicates the first invalid address of data flash (block 1).
This read-only field is reserved and always has the value 0.
Chapter 6
Memory-Mapped Divide and Square Root (MMDVSQ)
6.1Chip-specific Information for this Module
In this block chapter, PBRIDGE stands for the Peripheral Bridge, with the same meaning
as AIPS-Lite.
6.2
ARM processor cores in the Cortex-M family implementing the ARMv6-M instruction
set architecture do not include hardware support for integer divide operations. The
affected processors include the Cortex-M0+ core. However, in certain deeply embedded
application spaces, hardware support for this class of arithmetic operation (along with an
unsigned square root function) is important to maximize system performance and
minimize device power dissipation. Accordingly, the MMDVSQ module is included in
select microcontrollers, to serve as a memory-mapped co-processor located in a special
address space (within the system memory map) that is accessible only to the processor
core.
The MMDVSQ module supports execution of the integer divide operations defined in the
ARMv7-M instruction set architecture, plus an unsigned integer square root operation.
The supported integer divide operations include 32/32 signed (SDIV) and unsigned
(UDIV) calculations.
6.2.1
Introduction
Features
The key features of the MMDVSQ include:
• Lightweight implementation of 32-bit integer divide and square root arithmetic
operations
• Simple programming model includes input data and result registers plus a control/
status register
• Programming model interface optimized for activation from inline code or software
library call
• "Fast Start" configuration minimizes the memory-mapped register write
overhead
• Supports two methods to determine when result is valid, including software
polling
• Configurable divide-by-zero response
• Pipelined design processes 2 bits per cycle with early termination exit for minimum
execution time
6.2.2
Block diagram
A generic block diagram of the processor core and platform for this class of ultra low-end
microcontrollers is shown in Figure 6-1. The MMDVSQ module’s location as a memorymapped co-processor is highlighted.
The MMDVSQ module does not support any special modes of operation. As a memorymapped device located on a crossbar slave AHB system bus port, MMDVSQ responds
based strictly on memory addresses to its programming model.
All functionality associated with the MMDVSQ module resides in the core platform’s
clock domain; this includes its connections with the crossbar slave port. To minimize
power dissipation, the design supports an architectural clock gate for the entire module,
that is, the MMDVSQ is only clocked when responding to bus requests to its
programming model or is busy performing a calculation.
Chapter 6 Memory-Mapped Divide and Square Root (MMDVSQ)
6.3External signal description
The MMDVSQ module does not directly support any external interfaces.
The internal interface includes a standard 32-bit AHB bus as shown in Figure 6-1.
6.4Memory map and register definition
The MMDVSQ module supports a small number of program-visible registers used for
passing input operands and retrieving the output result plus a configuration/status
register.
The programming model occupies the first 20 bytes of a standard 4 Kb address slot. It
can only be accessed via word-sized (32 bit) accesses. Attempted accesses using smaller
data sizes, reading the write-only location or to reserved space are terminated with an
error.
At any instant in time, the MMDVSQ can perform either a divide or square root
calculation. The basic integer operations supported by the MMDVSQ are:
Dividend (MMDVSQ_DEND)YesNoInput dividend (numerator) for the divide
Divisor (MMDVSQ_DSOR)YesNoInput divisor (denominator) for the divide
Control/Status (MMDVSQ_CSR)YesYesControl for divide, status for divide and square
Result (MMDVSQ_RES)YesYesOutput result
Radicand (MMDVSQ_RCND)NoYesInput "square" data
This register is loaded with the input dividend operand before a divide operation is
initiated. The register is updated by the MMDVSQ hardware during the execution of a
divide or square root calculation. Any memory access (read or write) of the DEND
register while the module is busy during a calculation causes the access to be stalled
(using wait states) until the calculation completes.
This is the input dividend operand for divide calculations.
6.4.2Divisor Register (MMDVSQ_DSOR)
This register is loaded with the input divisor operand before a divide operation is
initiated. If CSR[DFS] = 0, a write to this register inititates a divide operation. Any
memory access (read or write) of the DSOR register while the module is busy during a
calculation causes the access to be stalled (using wait states) until the calculation
completes.
Chapter 6 Memory-Mapped Divide and Square Root (MMDVSQ)
If a divide operation is inititated with DSOR = 0, the hardware signals a divide-by-zero
condition and sets RES = 0 and CSR[DZ] = 1. If CSR[DZE] = 1, an attempted read of the
RES result is error terminated.
This register defines the operating configuration of divide operations and provides status
information. The upper 3 bits provide busy status indicators, while the low-order byte
defines the configuration for divide operations. The read-only status bits in CSR[31:29]
are valid for both divide and square root operations; the configuration and status bit in
CSR[5:0] are only valid for divides. A memory write access of the CSR register while the
module is busy during a calculation causes the access to be stalled (using wait states)
until the calculation completes.
Address:
Reset
F000_4000h base + 8h offset = F000_4008h
Bit31302928272625242322212019181716
R
W
Bit
R
W
DIV
BUSY
0x*x*0000000000000
1514131211109876543210
SQRT
0
0
DZ
DFS
DZEREM
0
USGN
SRT
Reset
* Notes:
x = Undefined at reset.•
0000000000000000
MMDVSQ_CSR field descriptions
FieldDescription
31
BUSY
86NXP Semiconductors
BUSY
This read-only bit is asserted when the MMDVSQ is performing a divide or square root. When an
operation is initiated, the hardware sets this flag. It remains asserted until the operation completes and the
Chapter 6 Memory-Mapped Divide and Square Root (MMDVSQ)
MMDVSQ_CSR field descriptions (continued)
FieldDescription
hardware automatically clears the indicator. This bit can be used to poll the DVSQ’s execution status. The
combined CSR[BUSY, DIV, SQRT] indicators provide an encoded module status:
• If 0b001, then MMDVSQ is idle and the last calculation was a square root
• If 0b010, then MMDVSQ is idle and the last calculation was a divide
• If 0b101, then MMDVSQ is busy processing a square root calculation
• If 0b110, then MMDVSQ is busy processing a divide calculation
The remaining encodings of CSR[BUSY, DIV, SQRT] are reserved.
0MMDVSQ is idle
1MMDVSQ is busy performing a divide or square root calculation
30
DIV
29
SQRT
DIVIDE
Current or last operation was a divide. This read-only indicator bit signals if the current or last operation
performed by the MMDVSQ was a divide.
0Current or last MMDVSQ operation was not a divide
1Current or last MMDVSQ operation was a divide
SQUARE ROOT
Current or last operation was a square root. This read-only indicator bit signals if the current or last
operation performed by the MMDVSQ was a square root.
28–6
Reserved
5
DFS
4
DZ
3
DZE
0Current or last MMDVSQ operation was not a square root
1Current or last MMDVSQ operation was a square root
This field is reserved.
This read-only field is reserved and always has the value 0.
Disable Fast Start
The MMDVSQ supports 2 mechanisms for initiating a divide operation. The default mechanism is a “fast
start” where a write to the DSOR register begins the divide. Alternatively, the start mechanism can begin
after a write to the CSR register with CSR[SRT] set. The CSR[DFS] indicator selects the divide start
mechanism.
0A divide operation is initiated by a write to the DSOR register
1A divide operation is initiated by a write to the CSR register with CSR[SRT] = 1
Divide-by-Zero
This read-only status indicator signals the last divide operation had a zero divisor, that is, DSOR =
0x0000_0000. For this case, RES is set to 0x0000_0000 and this indicator bit set. After a divide-by-zero
operation, a read of the RES register returns either the zero result, or, if CSR[DZE] = 1, terminates the
read with an error. The CSR[DZ] indicator is cleared by the hardware at the beginning of each operation.
0The last divide operation had a non-zero divisor, that is, DSOR != 0
1The last divide operation had a zero divisor, that is, DSOR = 0
Divide-by-Zero-Enable
This indicator configures the MMDVSQ’s response to divide-by-zero calculations. If both CSR[DZ] and
CSR[DZE] are set, then a subsequent read of the RES register is error terminated to signal the processor
of the attempted divide-by-zero.
0Reads of the RES register return the register contents
1If CSR[DZ] = 1, an attempted read of RES register is error terminated to signal a divide-by-zero, else
the register contents are returned
2
REM
1
USGN
0
SRT
REMainder calculation
This indicator selects whether the quotient or the remainder is returned in the RES register. The combined
CSR[REM] and CSR[USGN] bits define four possible divide operations:
• If CSR[REM, USGN] = 0b00, perform a signed divide, returning the quotient
• If CSR[REM, USGN] = 0b01, perform an unsigned divide, returning the quotient
• If CSR[REM, USGN] = 0b10, perform a signed divide, returning the remainder
• If CSR[REM, USGN] = 0b11, perform an unsigned divide, returning the remainder
0Return the quotient in the RES for the divide calculation
1Return the remainder in the RES for the divide calculation
Unsigned calculation
This indicator selects whether a signed (default) or unsigned divide is performed. See the CSR[REM]
description for the encoding of the four possible divide operations.
0Perform a signed divide
1Perform an unsigned divide
Start
When written with a logical one and CSR[DFS] = 1, this flag initiates a divide operation. If written as a
logical one with CSR[DFS] = 0, it is ignored. This bit always reads as a zero. The state of the register write
data defines this bit’s function.
0No operation initiated
1If CSR[DFS] = 1, then initiate a divide calculation, else ignore
Chapter 6 Memory-Mapped Divide and Square Root (MMDVSQ)
6.4.4Result Register (MMDVSQ_RES)
This register is loaded with the result of the divide or square root calculation. It is
updated by the MMDVSQ hardware at the completion of the calculation. When a square
root operation is performed (on an unsigned 32-bit number), the result is limited to a 16bit value with RES[31:16] = 0x0000. Any memory access (read or write) of the RES
register while the module is busy during a calculation causes the access to be stalled
(using wait states) until the calculation completes and the new result written into the
register.
This is the output result for a divide or square root calculation.
6.4.5Radicand Register (MMDVSQ_RCND)
The write-only radicand register is loaded with the input “square” number. A memory
write to the radicand register initiates a square root calculation. While the MMDVSQ
module is busy performing a square root calculation, any memory write access to the
RCND register causes the write access to be stalled (using wait states) until the square
root calculation finishes. Any attempted read of the radicand register terminates with an
error.
This is the input radicand for a square root calculation, that is, the input "square" number.
6.5Functional description
This section details the algorithms, execution times of the MMDVSQ, and the software
interface to the module.
6.5.1
Algorithms
This section provides more details on the integer divide and square root algorithms.
6.5.1.1
6.5.1.1.1
Integer divide including special cases
Overview
The MMDVSQ module implements a "shift, test, and restore" radix-2 algorithm for
unsigned integer divide operations. When performing a signed divide calculation,
negative input operands are converted into 2’s complement positive numbers first, an
unsigned divide performed, and the sign of the results based on the input operand signs,
namely:
• The sign of the remainder is the same as the sign of the dividend
• The quotient is negated if the signs of the dividend and divisor are different
The hardware implementation processes two bits per machine cycle and includes "early
termination" logic where the execution time is data dependent, based on the magnitude of
the positive dividend. See Table 6-4 for more execution time details.
6.5.1.1.2
Special case: Overflow
There is a single "special overflow case" affecting signed integer divides. If the dividend
= 0x8000_0000 and the divisor = 0xFFFF_FFFF, the result of this (-231/-1) operation
cannot be expressed as a 32-bit 2’s complement number. For this case, the MMDVSQ
exactly follows the ARM Cortex-Mx definition and returns 0x8000_0000 (the lower 32
bits of the +231 result) as the quotient with no indication of the overflow condition. If the
remainder is selected as the output of this calculation, it returns 0x0000_0000.
Chapter 6 Memory-Mapped Divide and Square Root (MMDVSQ)
6.5.1.1.3Special case: Divide-by-Zero
For both signed and unsigned divides, if the divisor is zero, the MMDVSQ hardware
detects this condition and the CSR[DZ] indicator set. The quotient result is forced to
0x0000_0000. If the remainder is selected as the output of this calculation, it also returns
0x0000_0000. Additionally, if CSR[DZE] = 1, then an attempted read of the Result
register (RES) is error terminated to provide a simple mechanism to signal software of
the divide-by-zero condition.
6.5.1.2
Integer square root
6.5.1.2.1Overview
The unsigned square root algorithm begins by creating a 32-bit “one-hot” bit vector
signaling the highest power of four of the contents of the Radicand register (RCND). It
then iterates through an algorithm involving magnitude comparisons of the RCND
register versus the working result plus bit vector summation, conditional decrementing of
the radicand, a 1-bit right shift of the result, and a 2-bit right shift of the one-hot bit
vector.
Processing two bits of the radicand per cycle, the result register finishes with the integer
portion of the square root calculation. The module includes early termination logic so that
the execution time is data dependent, based on the magnitude of the input radicand. See
Table 6-5 for more execution time details. Since both algorithms share common hardware
structures, the incremental cost of the square root logic is an extremely small delta to the
basic divide hardware.
The square root algorithm was exhaustively compared (that is, all 232 possible input
values) against the standard GNU C library implementation, which converts the unsigned
integer input into a double-precision floating-point number, calculates the doubleprecision square root and then converts it back into an unsigned integer. Each input value
calculated identical square root results.
6.5.1.2.2
Square root using Q notation
Consider the use of Q notation for square root calculations returning fractional values.
The following description is taken from http://en.wikipedia.org/wiki/Q_(number_format).
Q is a fixed point number format where the number of fractional bits (and optionally the
number of integer bits) is specified. For example, a Q15 number has 15 fractional bits; a
Q1.14 number has 1 integer bit and 14 fractional bits. Q format is often used in
hardware that does not have a floating-point unit and in applications that require
constant resolution.
Q format numbers are (notionally) fixed point numbers (but not actually a number itself);
that is, they are stored and operated upon as regular binary numbers (i.e. signed
integers), thus allowing standard integer hardware/ALU to perform rational number
calculations. The number of integer bits, fractional bits and the underlying word size are
to be chosen by the programmer on an application-specific basis - the programmer's
choices of the foregoing will depend on the range and resolution needed for the numbers.
The machine itself remains oblivious to the notional fixed point representation being
employed - it merely performs integer arithmetic the way it knows how. Ensuring that the
computational results are valid in the Q format representation is the responsibility of the
programmer.
The Q notation is written as Qm.n, where:
•
Q designates that the number is in the Q format notation - the Texas Instruments
representation for signed fixed-point numbers (the “Q” being reminiscent of the
standard symbol for the set of rational numbers).
•
m is the number of bits set aside to designate the two's complement integer portion of
the number, exclusive of the sign bit (therefore if m is not specified it is taken as
zero).
•
n is the number of bits used to designate the fractional portion of the number, i.e. the
number of bits to the right of the binary point. (If n = 0, the Q numbers are integers the degenerate case).
Note that the most significant bit is always designated as the sign bit (the number is
stored as a two's complement number) in order to allow standard arithmetic-logic
hardware to manipulate Q numbers. Representing a signed fixed-point data type in Q
format therefore always requires m+n+1 bits to account for the sign bit. Hence the
smallest machine word size required to accommodate a Qm.n number is m+n+1, with the
Q number left justified in the machine word.
For a given Qm.n format, using an m+n+1 bit signed integer container with n fractional
bits:
Chapter 6 Memory-Mapped Divide and Square Root (MMDVSQ)
For the unsigned integer format used in the MMDVSQ's square root calculation, an
u(nsigned)Qm.n notation requires m+n bits (m+n = 32) for the input radicand. An uQm.n
format produces an uQ(m/2).(n/2) square root. As examples, consider the following
tables involving the square root of 2 and square root of “pi” calculations. As expected, as
the number of fractional bits (n) increases, the error between the calculated square root
and the “actual” result decreases.
Table 6-2. Square Root of 2 Calculations (√2 = 1.4142135623)
The application of the Q notation for square root calculations provides a powerful
extension for these types of fractional numeric computations using fixed-point integer
processing hardware.
6.5.2
Execution times
The MMDVSQ module includes early termination logic to finish both divide and square
root calculations as quickly as possible, based on the magnitude of the input operand.
Accordingly, the execution time for the calculations is data dependent as defined in Table
6-4 and Table 6-5. In this context, the execution time is defined from the register write to
initiate the calculation until the result register has been updated and available to read.
Stated differently, it represents the time CSR[BUSY] is asserted for a given calculation.
In the following two tables, “x” signals a bit with a don’t care value.
Chapter 6 Memory-Mapped Divide and Square Root (MMDVSQ)
6.5.3Software interface
The programming model of the MMDVSQ is organized to be similar to the input
arguments passed to software libraries for integer divide and square root functions.
6.5.3.1Operation activation and result retrieval
The MMDVSQ supports 2 mechanisms for initiating a divide operation:
• The default mechanism is a "fast start" where a write to the DSOR register begins the
divide.
• Alternatively, the start mechanism can begin after a write to the CSR register with
the CSR[SRT] set.
The CSR[DFS] indicator selects the divide start mechanism.
if CSR[DFS] = 0
then a divide is initiated by a write to the DSOR register
else a divide is initiated by a write to the CSR register with CSR[SRT] = 1
A square root calculation is initiated by a write to the RCND register.
For both divide and square root calculations, the result of the operation is retrieved by
reading the RES register. A memory read of this register while the calculation is still
being performed causes the access to be stalled via the insertion of bus wait states until
the new result is loaded into the register. Note a stalled bus cycle cannot be interrupted,
so if system interrupt latency is a concern, the processor should execute a simple wait
loop, for example, polling CSR[BUSY], before reading the RES register. This code
construct is fully interruptible, so interrupt latency is minimized.
6.5.3.2
Context save and restore
Given that multiple memory-mapped register accesses are needed for each divide and
square root calculation, interrupts may occur during the required sequence of operations.
As a result, the MMDVSQ’s programming model can be saved at entry to an interrupt
service routine (ISR) and then restored when redispatching to the interrupted task.
The module’s context can be saved by reading the DEND, DSOR, CSR, and RES
registers and storing them as part of the task state. There is one special consideration for
the task state save. If the last calculation was a zero divide and the divide-by-zero enable
is set (CSR[DZE] = 1), then a read of the RES register is error terminated. To avoid a
zero-divide error termination during a context save, the following sequence can be used:
1. Read DEND, DSOR, and CSR registers and save the values as part of the task state.
3. Read the RES register and save its value as part of the task state.
When restoring the context, special care must be taken to not initiate another divide
calculation. Specifically, CSR[DFS] must be set first before reloading the DEND and
DSOR registers. For example, the following sequence can be used for the context reload:
1. Write 0x0000_0020 to the CSR to disable the fast start mechanism.
2. Reload DEND, DSOR, CSR, and RES registers from the saved state.
Since the original context save of the control/status register is guaranteed to have
CSR[SRT] = 0, there is no divide operation initiated when this register is reloaded in step
A generic block diagram of the processor core and platform for this class of
microcontrollers is shown in the following figure. The MCM module's location is
highlighted.
The Miscellaneous Control Module (MCM) provides a myriad of miscellaneous control
functions.
7.2.1Features
The MCM includes the following features:
• Program-visible information on the platform configuration
• Crossbar master arbitration policy selection
• Flash controller speculation buffer and cache configurations
7.3
Memory map/register descriptions
The memory map and register descriptions found here describe the registers using byte
addresses. The registers can be written only when in supervisor mode.
MCM memory map
Absolute
address
(hex)
F000_3008
F000_300A
F000_300C Platform Control Register (MCM_PLACR)32R/W0000_0250h7.3.3/100
F000_3040Compute Operation Control Register (MCM_CPO)32R/W0000_0000h7.3.4/103
0A bus master connection to AXBS input port n is absent
1A bus master connection to AXBS input port n is present
7.3.3Platform Control Register (MCM_PLACR)
The PLACR register selects the arbitration policy for the crossbar masters and configures
the flash memory controller.
The speculation buffer and cache in the flash memory controller is configurable via
PLACR[15:10 ].
The speculation buffer is enabled only for instructions after reset. It is possible to have
these states for the speculation buffer:
DFCSEFDSDescription
00Speculation buffer is on for instruction
and off for data.
01Speculation buffer is on for instruction
and on for data.
1XSpeculation buffer is off.
The cache in flash controller is enabled and caching both instruction and data type fetches
after reset. It is possible to have these states for the cache: