
32.4.3 Software 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.
32.4.3.1 Operation 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.
32.4.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.
Integer square root
K32 L2A Reference Manual, Rev. 2, 01/2020
866
NXP Semiconductors
Содержание K32 L2A Series
Страница 2: ...K32 L2A Reference Manual Rev 2 01 2020 2 NXP Semiconductors...
Страница 42: ...K32 L2A Reference Manual Rev 2 01 2020 42 NXP Semiconductors...
Страница 122: ...Flash Memory Clock K32 L2A Reference Manual Rev 2 01 2020 122 NXP Semiconductors...
Страница 146: ...Module operation in low power modes K32 L2A Reference Manual Rev 2 01 2020 146 NXP Semiconductors...
Страница 158: ...Debug and security K32 L2A Reference Manual Rev 2 01 2020 158 NXP Semiconductors...
Страница 174: ...Module Signal Description Tables K32 L2A Reference Manual Rev 2 01 2020 174 NXP Semiconductors...
Страница 246: ...Application information K32 L2A Reference Manual Rev 2 01 2020 246 NXP Semiconductors...
Страница 322: ...Kinetis Bootloader Status Error Codes K32 L2A Reference Manual Rev 2 01 2020 322 NXP Semiconductors...
Страница 344: ...Application initialization information K32 L2A Reference Manual Rev 2 01 2020 344 NXP Semiconductors...
Страница 374: ...CMP Trigger Mode K32 L2A Reference Manual Rev 2 01 2020 374 NXP Semiconductors...
Страница 384: ...Functional description K32 L2A Reference Manual Rev 2 01 2020 384 NXP Semiconductors...
Страница 592: ...Application Information K32 L2A Reference Manual Rev 2 01 2020 592 NXP Semiconductors...
Страница 602: ...Initialization and application information K32 L2A Reference Manual Rev 2 01 2020 602 NXP Semiconductors...
Страница 656: ...Functional Description K32 L2A Reference Manual Rev 2 01 2020 656 NXP Semiconductors...
Страница 664: ...Functional Description K32 L2A Reference Manual Rev 2 01 2020 664 NXP Semiconductors...
Страница 744: ...Functional description K32 L2A Reference Manual Rev 2 01 2020 744 NXP Semiconductors...
Страница 762: ...Functional description K32 L2A Reference Manual Rev 2 01 2020 762 NXP Semiconductors...
Страница 806: ...Functional description K32 L2A Reference Manual Rev 2 01 2020 806 NXP Semiconductors...
Страница 868: ...Integer square root K32 L2A Reference Manual Rev 2 01 2020 868 NXP Semiconductors...
Страница 976: ...Functional description K32 L2A Reference Manual Rev 2 01 2020 976 NXP Semiconductors...
Страница 1012: ...Functional description K32 L2A Reference Manual Rev 2 01 2020 1012 NXP Semiconductors...
Страница 1094: ...Functional description K32 L2A Reference Manual Rev 2 01 2020 1094 NXP Semiconductors...
Страница 1132: ...Functional description K32 L2A Reference Manual Rev 2 01 2020 1132 NXP Semiconductors...
Страница 1182: ...Functional description K32 L2A Reference Manual Rev 2 01 2020 1182 NXP Semiconductors...
Страница 1290: ...Functional description K32 L2A Reference Manual Rev 2 01 2020 1290 NXP Semiconductors...
Страница 1344: ...USB Voltage Regulator Module Signal Descriptions K32 L2A Reference Manual Rev 2 01 2020 1344 NXP Semiconductors...
Страница 1356: ...Initialization Application Information K32 L2A Reference Manual Rev 2 01 2020 1356 NXP Semiconductors...