Update repo
This commit is contained in:
1 parent
749dab5721
commit
ce65a0f59a
14950 files changed
+4408250
-1
No files matched your search
@@ -0,0 +1,975 @@
|
||||
;;#############################################################################
|
||||
;;! \file FPUmathTables.asm
|
||||
;;! \brief Tables For FPU math Functions
|
||||
;;! \author N/A
|
||||
;;! \date N/A
|
||||
;;!
|
||||
;; Version: 2.0
|
||||
;;
|
||||
;; Contents: FPUsin and FPUcos Function Table, Size Of Table = 1280x16
|
||||
;; FPUatan2 Function Table, Size Of Table = 452x16
|
||||
;; FPUexp Function Table, Size of Table = 20x16
|
||||
;;
|
||||
;; Revision History:
|
||||
;;+----------+---------------+------------------------------------------------+
|
||||
;;| DATE | AUTHOR | CHANGE |
|
||||
;;+----------+---------------+------------------------------------------------+
|
||||
;;| 01/16/18 | Ritvik Sadana | Added FPU32 symbol names to keep naming |
|
||||
;;| | | consistent with FPU64 symbols. |
|
||||
;;| | | NOTE: Old table symbols are supported for |
|
||||
;;| | | legacy reasons. |
|
||||
;;+----------+---------------+------------------------------------------------+
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
;;==========================================================================
|
||||
;; FPUsin and FPUcos Function Table, Size Of Table = 1280x16
|
||||
;;==========================================================================
|
||||
.if __TI_EABI__
|
||||
.asg FPUsinTable, _FPUsinTable
|
||||
.asg FPUcosTable, _FPUcosTable
|
||||
.asg FPUsinTableEnd, _FPUsinTableEnd
|
||||
.asg FPUcosTableEnd, _FPUcosTableEnd
|
||||
|
||||
.asg FPU32sinTable, _FPU32sinTable
|
||||
.asg FPU32cosTable, _FPU32cosTable
|
||||
.asg FPU32sinTableEnd, _FPU32sinTableEnd
|
||||
.asg FPU32cosTableEnd, _FPU32cosTableEnd
|
||||
.endif
|
||||
|
||||
.def _FPUsinTable
|
||||
.def _FPUcosTable
|
||||
.def _FPUsinTableEnd
|
||||
.def _FPUcosTableEnd
|
||||
|
||||
.def _FPU32sinTable
|
||||
.def _FPU32cosTable
|
||||
.def _FPU32sinTableEnd
|
||||
.def _FPU32cosTableEnd
|
||||
|
||||
.sect "FPUmathTables"
|
||||
|
||||
_FPUsinTable:
|
||||
_FPU32sinTable:
|
||||
.float 0.000000000000 ; sin( 2*pi* 0/512 )
|
||||
.float 0.012271538286 ; sin( 2*pi* 1/512 )
|
||||
.float 0.024541228523 ; sin( 2*pi* 2/512 )
|
||||
.float 0.036807222941 ; sin( 2*pi* 3/512 )
|
||||
.float 0.049067674327 ; sin( 2*pi* 4/512 )
|
||||
.float 0.061320736302 ; sin( 2*pi* 5/512 )
|
||||
.float 0.073564563600 ; sin( 2*pi* 6/512 )
|
||||
.float 0.085797312344 ; sin( 2*pi* 7/512 )
|
||||
.float 0.098017140330 ; sin( 2*pi* 8/512 )
|
||||
.float 0.110222207294 ; sin( 2*pi* 9/512 )
|
||||
.float 0.122410675199 ; sin( 2*pi* 10/512 )
|
||||
.float 0.134580708507 ; sin( 2*pi* 11/512 )
|
||||
.float 0.146730474455 ; sin( 2*pi* 12/512 )
|
||||
.float 0.158858143334 ; sin( 2*pi* 13/512 )
|
||||
.float 0.170961888760 ; sin( 2*pi* 14/512 )
|
||||
.float 0.183039887955 ; sin( 2*pi* 15/512 )
|
||||
.float 0.195090322016 ; sin( 2*pi* 16/512 )
|
||||
.float 0.207111376192 ; sin( 2*pi* 17/512 )
|
||||
.float 0.219101240157 ; sin( 2*pi* 18/512 )
|
||||
.float 0.231058108281 ; sin( 2*pi* 19/512 )
|
||||
.float 0.242980179903 ; sin( 2*pi* 20/512 )
|
||||
.float 0.254865659605 ; sin( 2*pi* 21/512 )
|
||||
.float 0.266712757475 ; sin( 2*pi* 22/512 )
|
||||
.float 0.278519689385 ; sin( 2*pi* 23/512 )
|
||||
.float 0.290284677254 ; sin( 2*pi* 24/512 )
|
||||
.float 0.302005949319 ; sin( 2*pi* 25/512 )
|
||||
.float 0.313681740399 ; sin( 2*pi* 26/512 )
|
||||
.float 0.325310292162 ; sin( 2*pi* 27/512 )
|
||||
.float 0.336889853392 ; sin( 2*pi* 28/512 )
|
||||
.float 0.348418680249 ; sin( 2*pi* 29/512 )
|
||||
.float 0.359895036535 ; sin( 2*pi* 30/512 )
|
||||
.float 0.371317193952 ; sin( 2*pi* 31/512 )
|
||||
.float 0.382683432365 ; sin( 2*pi* 32/512 )
|
||||
.float 0.393992040061 ; sin( 2*pi* 33/512 )
|
||||
.float 0.405241314005 ; sin( 2*pi* 34/512 )
|
||||
.float 0.416429560098 ; sin( 2*pi* 35/512 )
|
||||
.float 0.427555093430 ; sin( 2*pi* 36/512 )
|
||||
.float 0.438616238539 ; sin( 2*pi* 37/512 )
|
||||
.float 0.449611329655 ; sin( 2*pi* 38/512 )
|
||||
.float 0.460538710958 ; sin( 2*pi* 39/512 )
|
||||
.float 0.471396736826 ; sin( 2*pi* 40/512 )
|
||||
.float 0.482183772079 ; sin( 2*pi* 41/512 )
|
||||
.float 0.492898192230 ; sin( 2*pi* 42/512 )
|
||||
.float 0.503538383726 ; sin( 2*pi* 43/512 )
|
||||
.float 0.514102744193 ; sin( 2*pi* 44/512 )
|
||||
.float 0.524589682678 ; sin( 2*pi* 45/512 )
|
||||
.float 0.534997619887 ; sin( 2*pi* 46/512 )
|
||||
.float 0.545324988422 ; sin( 2*pi* 47/512 )
|
||||
.float 0.555570233020 ; sin( 2*pi* 48/512 )
|
||||
.float 0.565731810784 ; sin( 2*pi* 49/512 )
|
||||
.float 0.575808191418 ; sin( 2*pi* 50/512 )
|
||||
.float 0.585797857456 ; sin( 2*pi* 51/512 )
|
||||
.float 0.595699304492 ; sin( 2*pi* 52/512 )
|
||||
.float 0.605511041404 ; sin( 2*pi* 53/512 )
|
||||
.float 0.615231590581 ; sin( 2*pi* 54/512 )
|
||||
.float 0.624859488142 ; sin( 2*pi* 55/512 )
|
||||
.float 0.634393284164 ; sin( 2*pi* 56/512 )
|
||||
.float 0.643831542890 ; sin( 2*pi* 57/512 )
|
||||
.float 0.653172842954 ; sin( 2*pi* 58/512 )
|
||||
.float 0.662415777590 ; sin( 2*pi* 59/512 )
|
||||
.float 0.671558954847 ; sin( 2*pi* 60/512 )
|
||||
.float 0.680600997795 ; sin( 2*pi* 61/512 )
|
||||
.float 0.689540544737 ; sin( 2*pi* 62/512 )
|
||||
.float 0.698376249409 ; sin( 2*pi* 63/512 )
|
||||
.float 0.707106781187 ; sin( 2*pi* 64/512 )
|
||||
.float 0.715730825284 ; sin( 2*pi* 65/512 )
|
||||
.float 0.724247082952 ; sin( 2*pi* 66/512 )
|
||||
.float 0.732654271672 ; sin( 2*pi* 67/512 )
|
||||
.float 0.740951125355 ; sin( 2*pi* 68/512 )
|
||||
.float 0.749136394523 ; sin( 2*pi* 69/512 )
|
||||
.float 0.757208846507 ; sin( 2*pi* 70/512 )
|
||||
.float 0.765167265622 ; sin( 2*pi* 71/512 )
|
||||
.float 0.773010453363 ; sin( 2*pi* 72/512 )
|
||||
.float 0.780737228572 ; sin( 2*pi* 73/512 )
|
||||
.float 0.788346427627 ; sin( 2*pi* 74/512 )
|
||||
.float 0.795836904609 ; sin( 2*pi* 75/512 )
|
||||
.float 0.803207531481 ; sin( 2*pi* 76/512 )
|
||||
.float 0.810457198253 ; sin( 2*pi* 77/512 )
|
||||
.float 0.817584813152 ; sin( 2*pi* 78/512 )
|
||||
.float 0.824589302785 ; sin( 2*pi* 79/512 )
|
||||
.float 0.831469612303 ; sin( 2*pi* 80/512 )
|
||||
.float 0.838224705555 ; sin( 2*pi* 81/512 )
|
||||
.float 0.844853565250 ; sin( 2*pi* 82/512 )
|
||||
.float 0.851355193105 ; sin( 2*pi* 83/512 )
|
||||
.float 0.857728610000 ; sin( 2*pi* 84/512 )
|
||||
.float 0.863972856122 ; sin( 2*pi* 85/512 )
|
||||
.float 0.870086991109 ; sin( 2*pi* 86/512 )
|
||||
.float 0.876070094195 ; sin( 2*pi* 87/512 )
|
||||
.float 0.881921264348 ; sin( 2*pi* 88/512 )
|
||||
.float 0.887639620403 ; sin( 2*pi* 89/512 )
|
||||
.float 0.893224301196 ; sin( 2*pi* 90/512 )
|
||||
.float 0.898674465694 ; sin( 2*pi* 91/512 )
|
||||
.float 0.903989293123 ; sin( 2*pi* 92/512 )
|
||||
.float 0.909167983091 ; sin( 2*pi* 93/512 )
|
||||
.float 0.914209755704 ; sin( 2*pi* 94/512 )
|
||||
.float 0.919113851690 ; sin( 2*pi* 95/512 )
|
||||
.float 0.923879532511 ; sin( 2*pi* 96/512 )
|
||||
.float 0.928506080473 ; sin( 2*pi* 97/512 )
|
||||
.float 0.932992798835 ; sin( 2*pi* 98/512 )
|
||||
.float 0.937339011913 ; sin( 2*pi* 99/512 )
|
||||
.float 0.941544065183 ; sin( 2*pi* 100/512 )
|
||||
.float 0.945607325381 ; sin( 2*pi* 101/512 )
|
||||
.float 0.949528180593 ; sin( 2*pi* 102/512 )
|
||||
.float 0.953306040354 ; sin( 2*pi* 103/512 )
|
||||
.float 0.956940335732 ; sin( 2*pi* 104/512 )
|
||||
.float 0.960430519416 ; sin( 2*pi* 105/512 )
|
||||
.float 0.963776065795 ; sin( 2*pi* 106/512 )
|
||||
.float 0.966976471045 ; sin( 2*pi* 107/512 )
|
||||
.float 0.970031253195 ; sin( 2*pi* 108/512 )
|
||||
.float 0.972939952206 ; sin( 2*pi* 109/512 )
|
||||
.float 0.975702130039 ; sin( 2*pi* 110/512 )
|
||||
.float 0.978317370720 ; sin( 2*pi* 111/512 )
|
||||
.float 0.980785280403 ; sin( 2*pi* 112/512 )
|
||||
.float 0.983105487431 ; sin( 2*pi* 113/512 )
|
||||
.float 0.985277642389 ; sin( 2*pi* 114/512 )
|
||||
.float 0.987301418158 ; sin( 2*pi* 115/512 )
|
||||
.float 0.989176509965 ; sin( 2*pi* 116/512 )
|
||||
.float 0.990902635428 ; sin( 2*pi* 117/512 )
|
||||
.float 0.992479534599 ; sin( 2*pi* 118/512 )
|
||||
.float 0.993906970002 ; sin( 2*pi* 119/512 )
|
||||
.float 0.995184726672 ; sin( 2*pi* 120/512 )
|
||||
.float 0.996312612183 ; sin( 2*pi* 121/512 )
|
||||
.float 0.997290456679 ; sin( 2*pi* 122/512 )
|
||||
.float 0.998118112900 ; sin( 2*pi* 123/512 )
|
||||
.float 0.998795456205 ; sin( 2*pi* 124/512 )
|
||||
.float 0.999322384588 ; sin( 2*pi* 125/512 )
|
||||
.float 0.999698818696 ; sin( 2*pi* 126/512 )
|
||||
.float 0.999924701839 ; sin( 2*pi* 127/512 )
|
||||
_FPUcosTable:
|
||||
_FPU32cosTable:
|
||||
.float 1.000000000000 ; sin( 2*pi* 128/512 )
|
||||
.float 0.999924701839 ; sin( 2*pi* 129/512 )
|
||||
.float 0.999698818696 ; sin( 2*pi* 130/512 )
|
||||
.float 0.999322384588 ; sin( 2*pi* 131/512 )
|
||||
.float 0.998795456205 ; sin( 2*pi* 132/512 )
|
||||
.float 0.998118112900 ; sin( 2*pi* 133/512 )
|
||||
.float 0.997290456679 ; sin( 2*pi* 134/512 )
|
||||
.float 0.996312612183 ; sin( 2*pi* 135/512 )
|
||||
.float 0.995184726672 ; sin( 2*pi* 136/512 )
|
||||
.float 0.993906970002 ; sin( 2*pi* 137/512 )
|
||||
.float 0.992479534599 ; sin( 2*pi* 138/512 )
|
||||
.float 0.990902635428 ; sin( 2*pi* 139/512 )
|
||||
.float 0.989176509965 ; sin( 2*pi* 140/512 )
|
||||
.float 0.987301418158 ; sin( 2*pi* 141/512 )
|
||||
.float 0.985277642389 ; sin( 2*pi* 142/512 )
|
||||
.float 0.983105487431 ; sin( 2*pi* 143/512 )
|
||||
.float 0.980785280403 ; sin( 2*pi* 144/512 )
|
||||
.float 0.978317370720 ; sin( 2*pi* 145/512 )
|
||||
.float 0.975702130039 ; sin( 2*pi* 146/512 )
|
||||
.float 0.972939952206 ; sin( 2*pi* 147/512 )
|
||||
.float 0.970031253195 ; sin( 2*pi* 148/512 )
|
||||
.float 0.966976471045 ; sin( 2*pi* 149/512 )
|
||||
.float 0.963776065795 ; sin( 2*pi* 150/512 )
|
||||
.float 0.960430519416 ; sin( 2*pi* 151/512 )
|
||||
.float 0.956940335732 ; sin( 2*pi* 152/512 )
|
||||
.float 0.953306040354 ; sin( 2*pi* 153/512 )
|
||||
.float 0.949528180593 ; sin( 2*pi* 154/512 )
|
||||
.float 0.945607325380 ; sin( 2*pi* 155/512 )
|
||||
.float 0.941544065183 ; sin( 2*pi* 156/512 )
|
||||
.float 0.937339011913 ; sin( 2*pi* 157/512 )
|
||||
.float 0.932992798835 ; sin( 2*pi* 158/512 )
|
||||
.float 0.928506080473 ; sin( 2*pi* 159/512 )
|
||||
.float 0.923879532511 ; sin( 2*pi* 160/512 )
|
||||
.float 0.919113851690 ; sin( 2*pi* 161/512 )
|
||||
.float 0.914209755703 ; sin( 2*pi* 162/512 )
|
||||
.float 0.909167983090 ; sin( 2*pi* 163/512 )
|
||||
.float 0.903989293123 ; sin( 2*pi* 164/512 )
|
||||
.float 0.898674465694 ; sin( 2*pi* 165/512 )
|
||||
.float 0.893224301195 ; sin( 2*pi* 166/512 )
|
||||
.float 0.887639620403 ; sin( 2*pi* 167/512 )
|
||||
.float 0.881921264348 ; sin( 2*pi* 168/512 )
|
||||
.float 0.876070094195 ; sin( 2*pi* 169/512 )
|
||||
.float 0.870086991109 ; sin( 2*pi* 170/512 )
|
||||
.float 0.863972856122 ; sin( 2*pi* 171/512 )
|
||||
.float 0.857728610000 ; sin( 2*pi* 172/512 )
|
||||
.float 0.851355193105 ; sin( 2*pi* 173/512 )
|
||||
.float 0.844853565250 ; sin( 2*pi* 174/512 )
|
||||
.float 0.838224705555 ; sin( 2*pi* 175/512 )
|
||||
.float 0.831469612302 ; sin( 2*pi* 176/512 )
|
||||
.float 0.824589302785 ; sin( 2*pi* 177/512 )
|
||||
.float 0.817584813152 ; sin( 2*pi* 178/512 )
|
||||
.float 0.810457198253 ; sin( 2*pi* 179/512 )
|
||||
.float 0.803207531481 ; sin( 2*pi* 180/512 )
|
||||
.float 0.795836904609 ; sin( 2*pi* 181/512 )
|
||||
.float 0.788346427627 ; sin( 2*pi* 182/512 )
|
||||
.float 0.780737228572 ; sin( 2*pi* 183/512 )
|
||||
.float 0.773010453363 ; sin( 2*pi* 184/512 )
|
||||
.float 0.765167265622 ; sin( 2*pi* 185/512 )
|
||||
.float 0.757208846506 ; sin( 2*pi* 186/512 )
|
||||
.float 0.749136394523 ; sin( 2*pi* 187/512 )
|
||||
.float 0.740951125355 ; sin( 2*pi* 188/512 )
|
||||
.float 0.732654271672 ; sin( 2*pi* 189/512 )
|
||||
.float 0.724247082951 ; sin( 2*pi* 190/512 )
|
||||
.float 0.715730825284 ; sin( 2*pi* 191/512 )
|
||||
.float 0.707106781186 ; sin( 2*pi* 192/512 )
|
||||
.float 0.698376249409 ; sin( 2*pi* 193/512 )
|
||||
.float 0.689540544737 ; sin( 2*pi* 194/512 )
|
||||
.float 0.680600997795 ; sin( 2*pi* 195/512 )
|
||||
.float 0.671558954847 ; sin( 2*pi* 196/512 )
|
||||
.float 0.662415777590 ; sin( 2*pi* 197/512 )
|
||||
.float 0.653172842954 ; sin( 2*pi* 198/512 )
|
||||
.float 0.643831542890 ; sin( 2*pi* 199/512 )
|
||||
.float 0.634393284164 ; sin( 2*pi* 200/512 )
|
||||
.float 0.624859488142 ; sin( 2*pi* 201/512 )
|
||||
.float 0.615231590580 ; sin( 2*pi* 202/512 )
|
||||
.float 0.605511041404 ; sin( 2*pi* 203/512 )
|
||||
.float 0.595699304492 ; sin( 2*pi* 204/512 )
|
||||
.float 0.585797857456 ; sin( 2*pi* 205/512 )
|
||||
.float 0.575808191418 ; sin( 2*pi* 206/512 )
|
||||
.float 0.565731810783 ; sin( 2*pi* 207/512 )
|
||||
.float 0.555570233019 ; sin( 2*pi* 208/512 )
|
||||
.float 0.545324988422 ; sin( 2*pi* 209/512 )
|
||||
.float 0.534997619887 ; sin( 2*pi* 210/512 )
|
||||
.float 0.524589682678 ; sin( 2*pi* 211/512 )
|
||||
.float 0.514102744193 ; sin( 2*pi* 212/512 )
|
||||
.float 0.503538383726 ; sin( 2*pi* 213/512 )
|
||||
.float 0.492898192230 ; sin( 2*pi* 214/512 )
|
||||
.float 0.482183772079 ; sin( 2*pi* 215/512 )
|
||||
.float 0.471396736826 ; sin( 2*pi* 216/512 )
|
||||
.float 0.460538710958 ; sin( 2*pi* 217/512 )
|
||||
.float 0.449611329654 ; sin( 2*pi* 218/512 )
|
||||
.float 0.438616238538 ; sin( 2*pi* 219/512 )
|
||||
.float 0.427555093430 ; sin( 2*pi* 220/512 )
|
||||
.float 0.416429560097 ; sin( 2*pi* 221/512 )
|
||||
.float 0.405241314005 ; sin( 2*pi* 222/512 )
|
||||
.float 0.393992040061 ; sin( 2*pi* 223/512 )
|
||||
.float 0.382683432365 ; sin( 2*pi* 224/512 )
|
||||
.float 0.371317193952 ; sin( 2*pi* 225/512 )
|
||||
.float 0.359895036535 ; sin( 2*pi* 226/512 )
|
||||
.float 0.348418680249 ; sin( 2*pi* 227/512 )
|
||||
.float 0.336889853392 ; sin( 2*pi* 228/512 )
|
||||
.float 0.325310292162 ; sin( 2*pi* 229/512 )
|
||||
.float 0.313681740399 ; sin( 2*pi* 230/512 )
|
||||
.float 0.302005949319 ; sin( 2*pi* 231/512 )
|
||||
.float 0.290284677254 ; sin( 2*pi* 232/512 )
|
||||
.float 0.278519689385 ; sin( 2*pi* 233/512 )
|
||||
.float 0.266712757475 ; sin( 2*pi* 234/512 )
|
||||
.float 0.254865659604 ; sin( 2*pi* 235/512 )
|
||||
.float 0.242980179903 ; sin( 2*pi* 236/512 )
|
||||
.float 0.231058108280 ; sin( 2*pi* 237/512 )
|
||||
.float 0.219101240157 ; sin( 2*pi* 238/512 )
|
||||
.float 0.207111376192 ; sin( 2*pi* 239/512 )
|
||||
.float 0.195090322016 ; sin( 2*pi* 240/512 )
|
||||
.float 0.183039887955 ; sin( 2*pi* 241/512 )
|
||||
.float 0.170961888760 ; sin( 2*pi* 242/512 )
|
||||
.float 0.158858143334 ; sin( 2*pi* 243/512 )
|
||||
.float 0.146730474455 ; sin( 2*pi* 244/512 )
|
||||
.float 0.134580708507 ; sin( 2*pi* 245/512 )
|
||||
.float 0.122410675199 ; sin( 2*pi* 246/512 )
|
||||
.float 0.110222207294 ; sin( 2*pi* 247/512 )
|
||||
.float 0.098017140329 ; sin( 2*pi* 248/512 )
|
||||
.float 0.085797312344 ; sin( 2*pi* 249/512 )
|
||||
.float 0.073564563599 ; sin( 2*pi* 250/512 )
|
||||
.float 0.061320736302 ; sin( 2*pi* 251/512 )
|
||||
.float 0.049067674327 ; sin( 2*pi* 252/512 )
|
||||
.float 0.036807222941 ; sin( 2*pi* 253/512 )
|
||||
.float 0.024541228523 ; sin( 2*pi* 254/512 )
|
||||
.float 0.012271538286 ; sin( 2*pi* 255/512 )
|
||||
.float -0.000000000000 ; sin( 2*pi* 256/512 )
|
||||
.float -0.012271538286 ; sin( 2*pi* 257/512 )
|
||||
.float -0.024541228523 ; sin( 2*pi* 258/512 )
|
||||
.float -0.036807222942 ; sin( 2*pi* 259/512 )
|
||||
.float -0.049067674328 ; sin( 2*pi* 260/512 )
|
||||
.float -0.061320736302 ; sin( 2*pi* 261/512 )
|
||||
.float -0.073564563600 ; sin( 2*pi* 262/512 )
|
||||
.float -0.085797312345 ; sin( 2*pi* 263/512 )
|
||||
.float -0.098017140330 ; sin( 2*pi* 264/512 )
|
||||
.float -0.110222207294 ; sin( 2*pi* 265/512 )
|
||||
.float -0.122410675199 ; sin( 2*pi* 266/512 )
|
||||
.float -0.134580708507 ; sin( 2*pi* 267/512 )
|
||||
.float -0.146730474456 ; sin( 2*pi* 268/512 )
|
||||
.float -0.158858143334 ; sin( 2*pi* 269/512 )
|
||||
.float -0.170961888761 ; sin( 2*pi* 270/512 )
|
||||
.float -0.183039887955 ; sin( 2*pi* 271/512 )
|
||||
.float -0.195090322016 ; sin( 2*pi* 272/512 )
|
||||
.float -0.207111376192 ; sin( 2*pi* 273/512 )
|
||||
.float -0.219101240157 ; sin( 2*pi* 274/512 )
|
||||
.float -0.231058108281 ; sin( 2*pi* 275/512 )
|
||||
.float -0.242980179903 ; sin( 2*pi* 276/512 )
|
||||
.float -0.254865659605 ; sin( 2*pi* 277/512 )
|
||||
.float -0.266712757475 ; sin( 2*pi* 278/512 )
|
||||
.float -0.278519689385 ; sin( 2*pi* 279/512 )
|
||||
.float -0.290284677255 ; sin( 2*pi* 280/512 )
|
||||
.float -0.302005949319 ; sin( 2*pi* 281/512 )
|
||||
.float -0.313681740399 ; sin( 2*pi* 282/512 )
|
||||
.float -0.325310292162 ; sin( 2*pi* 283/512 )
|
||||
.float -0.336889853392 ; sin( 2*pi* 284/512 )
|
||||
.float -0.348418680250 ; sin( 2*pi* 285/512 )
|
||||
.float -0.359895036535 ; sin( 2*pi* 286/512 )
|
||||
.float -0.371317193952 ; sin( 2*pi* 287/512 )
|
||||
.float -0.382683432365 ; sin( 2*pi* 288/512 )
|
||||
.float -0.393992040061 ; sin( 2*pi* 289/512 )
|
||||
.float -0.405241314005 ; sin( 2*pi* 290/512 )
|
||||
.float -0.416429560098 ; sin( 2*pi* 291/512 )
|
||||
.float -0.427555093430 ; sin( 2*pi* 292/512 )
|
||||
.float -0.438616238539 ; sin( 2*pi* 293/512 )
|
||||
.float -0.449611329655 ; sin( 2*pi* 294/512 )
|
||||
.float -0.460538710958 ; sin( 2*pi* 295/512 )
|
||||
.float -0.471396736826 ; sin( 2*pi* 296/512 )
|
||||
.float -0.482183772079 ; sin( 2*pi* 297/512 )
|
||||
.float -0.492898192230 ; sin( 2*pi* 298/512 )
|
||||
.float -0.503538383726 ; sin( 2*pi* 299/512 )
|
||||
.float -0.514102744193 ; sin( 2*pi* 300/512 )
|
||||
.float -0.524589682679 ; sin( 2*pi* 301/512 )
|
||||
.float -0.534997619887 ; sin( 2*pi* 302/512 )
|
||||
.float -0.545324988422 ; sin( 2*pi* 303/512 )
|
||||
.float -0.555570233020 ; sin( 2*pi* 304/512 )
|
||||
.float -0.565731810784 ; sin( 2*pi* 305/512 )
|
||||
.float -0.575808191418 ; sin( 2*pi* 306/512 )
|
||||
.float -0.585797857457 ; sin( 2*pi* 307/512 )
|
||||
.float -0.595699304493 ; sin( 2*pi* 308/512 )
|
||||
.float -0.605511041405 ; sin( 2*pi* 309/512 )
|
||||
.float -0.615231590581 ; sin( 2*pi* 310/512 )
|
||||
.float -0.624859488143 ; sin( 2*pi* 311/512 )
|
||||
.float -0.634393284164 ; sin( 2*pi* 312/512 )
|
||||
.float -0.643831542890 ; sin( 2*pi* 313/512 )
|
||||
.float -0.653172842954 ; sin( 2*pi* 314/512 )
|
||||
.float -0.662415777590 ; sin( 2*pi* 315/512 )
|
||||
.float -0.671558954847 ; sin( 2*pi* 316/512 )
|
||||
.float -0.680600997796 ; sin( 2*pi* 317/512 )
|
||||
.float -0.689540544737 ; sin( 2*pi* 318/512 )
|
||||
.float -0.698376249409 ; sin( 2*pi* 319/512 )
|
||||
.float -0.707106781187 ; sin( 2*pi* 320/512 )
|
||||
.float -0.715730825284 ; sin( 2*pi* 321/512 )
|
||||
.float -0.724247082952 ; sin( 2*pi* 322/512 )
|
||||
.float -0.732654271673 ; sin( 2*pi* 323/512 )
|
||||
.float -0.740951125355 ; sin( 2*pi* 324/512 )
|
||||
.float -0.749136394524 ; sin( 2*pi* 325/512 )
|
||||
.float -0.757208846507 ; sin( 2*pi* 326/512 )
|
||||
.float -0.765167265623 ; sin( 2*pi* 327/512 )
|
||||
.float -0.773010453363 ; sin( 2*pi* 328/512 )
|
||||
.float -0.780737228572 ; sin( 2*pi* 329/512 )
|
||||
.float -0.788346427627 ; sin( 2*pi* 330/512 )
|
||||
.float -0.795836904609 ; sin( 2*pi* 331/512 )
|
||||
.float -0.803207531481 ; sin( 2*pi* 332/512 )
|
||||
.float -0.810457198253 ; sin( 2*pi* 333/512 )
|
||||
.float -0.817584813152 ; sin( 2*pi* 334/512 )
|
||||
.float -0.824589302785 ; sin( 2*pi* 335/512 )
|
||||
.float -0.831469612303 ; sin( 2*pi* 336/512 )
|
||||
.float -0.838224705555 ; sin( 2*pi* 337/512 )
|
||||
.float -0.844853565250 ; sin( 2*pi* 338/512 )
|
||||
.float -0.851355193105 ; sin( 2*pi* 339/512 )
|
||||
.float -0.857728610000 ; sin( 2*pi* 340/512 )
|
||||
.float -0.863972856122 ; sin( 2*pi* 341/512 )
|
||||
.float -0.870086991109 ; sin( 2*pi* 342/512 )
|
||||
.float -0.876070094196 ; sin( 2*pi* 343/512 )
|
||||
.float -0.881921264348 ; sin( 2*pi* 344/512 )
|
||||
.float -0.887639620403 ; sin( 2*pi* 345/512 )
|
||||
.float -0.893224301196 ; sin( 2*pi* 346/512 )
|
||||
.float -0.898674465694 ; sin( 2*pi* 347/512 )
|
||||
.float -0.903989293124 ; sin( 2*pi* 348/512 )
|
||||
.float -0.909167983091 ; sin( 2*pi* 349/512 )
|
||||
.float -0.914209755704 ; sin( 2*pi* 350/512 )
|
||||
.float -0.919113851690 ; sin( 2*pi* 351/512 )
|
||||
.float -0.923879532511 ; sin( 2*pi* 352/512 )
|
||||
.float -0.928506080473 ; sin( 2*pi* 353/512 )
|
||||
.float -0.932992798835 ; sin( 2*pi* 354/512 )
|
||||
.float -0.937339011913 ; sin( 2*pi* 355/512 )
|
||||
.float -0.941544065183 ; sin( 2*pi* 356/512 )
|
||||
.float -0.945607325381 ; sin( 2*pi* 357/512 )
|
||||
.float -0.949528180593 ; sin( 2*pi* 358/512 )
|
||||
.float -0.953306040354 ; sin( 2*pi* 359/512 )
|
||||
.float -0.956940335732 ; sin( 2*pi* 360/512 )
|
||||
.float -0.960430519416 ; sin( 2*pi* 361/512 )
|
||||
.float -0.963776065796 ; sin( 2*pi* 362/512 )
|
||||
.float -0.966976471045 ; sin( 2*pi* 363/512 )
|
||||
.float -0.970031253195 ; sin( 2*pi* 364/512 )
|
||||
.float -0.972939952206 ; sin( 2*pi* 365/512 )
|
||||
.float -0.975702130039 ; sin( 2*pi* 366/512 )
|
||||
.float -0.978317370720 ; sin( 2*pi* 367/512 )
|
||||
.float -0.980785280403 ; sin( 2*pi* 368/512 )
|
||||
.float -0.983105487431 ; sin( 2*pi* 369/512 )
|
||||
.float -0.985277642389 ; sin( 2*pi* 370/512 )
|
||||
.float -0.987301418158 ; sin( 2*pi* 371/512 )
|
||||
.float -0.989176509965 ; sin( 2*pi* 372/512 )
|
||||
.float -0.990902635428 ; sin( 2*pi* 373/512 )
|
||||
.float -0.992479534599 ; sin( 2*pi* 374/512 )
|
||||
.float -0.993906970002 ; sin( 2*pi* 375/512 )
|
||||
.float -0.995184726672 ; sin( 2*pi* 376/512 )
|
||||
.float -0.996312612183 ; sin( 2*pi* 377/512 )
|
||||
.float -0.997290456679 ; sin( 2*pi* 378/512 )
|
||||
.float -0.998118112900 ; sin( 2*pi* 379/512 )
|
||||
.float -0.998795456205 ; sin( 2*pi* 380/512 )
|
||||
.float -0.999322384588 ; sin( 2*pi* 381/512 )
|
||||
.float -0.999698818696 ; sin( 2*pi* 382/512 )
|
||||
.float -0.999924701839 ; sin( 2*pi* 383/512 )
|
||||
.float -1.000000000000 ; sin( 2*pi* 384/512 )
|
||||
.float -0.999924701839 ; sin( 2*pi* 385/512 )
|
||||
.float -0.999698818696 ; sin( 2*pi* 386/512 )
|
||||
.float -0.999322384588 ; sin( 2*pi* 387/512 )
|
||||
.float -0.998795456205 ; sin( 2*pi* 388/512 )
|
||||
.float -0.998118112900 ; sin( 2*pi* 389/512 )
|
||||
.float -0.997290456679 ; sin( 2*pi* 390/512 )
|
||||
.float -0.996312612183 ; sin( 2*pi* 391/512 )
|
||||
.float -0.995184726672 ; sin( 2*pi* 392/512 )
|
||||
.float -0.993906970002 ; sin( 2*pi* 393/512 )
|
||||
.float -0.992479534599 ; sin( 2*pi* 394/512 )
|
||||
.float -0.990902635428 ; sin( 2*pi* 395/512 )
|
||||
.float -0.989176509965 ; sin( 2*pi* 396/512 )
|
||||
.float -0.987301418158 ; sin( 2*pi* 397/512 )
|
||||
.float -0.985277642389 ; sin( 2*pi* 398/512 )
|
||||
.float -0.983105487431 ; sin( 2*pi* 399/512 )
|
||||
.float -0.980785280403 ; sin( 2*pi* 400/512 )
|
||||
.float -0.978317370720 ; sin( 2*pi* 401/512 )
|
||||
.float -0.975702130038 ; sin( 2*pi* 402/512 )
|
||||
.float -0.972939952205 ; sin( 2*pi* 403/512 )
|
||||
.float -0.970031253194 ; sin( 2*pi* 404/512 )
|
||||
.float -0.966976471045 ; sin( 2*pi* 405/512 )
|
||||
.float -0.963776065795 ; sin( 2*pi* 406/512 )
|
||||
.float -0.960430519415 ; sin( 2*pi* 407/512 )
|
||||
.float -0.956940335732 ; sin( 2*pi* 408/512 )
|
||||
.float -0.953306040354 ; sin( 2*pi* 409/512 )
|
||||
.float -0.949528180593 ; sin( 2*pi* 410/512 )
|
||||
.float -0.945607325380 ; sin( 2*pi* 411/512 )
|
||||
.float -0.941544065183 ; sin( 2*pi* 412/512 )
|
||||
.float -0.937339011912 ; sin( 2*pi* 413/512 )
|
||||
.float -0.932992798835 ; sin( 2*pi* 414/512 )
|
||||
.float -0.928506080473 ; sin( 2*pi* 415/512 )
|
||||
.float -0.923879532511 ; sin( 2*pi* 416/512 )
|
||||
.float -0.919113851690 ; sin( 2*pi* 417/512 )
|
||||
.float -0.914209755703 ; sin( 2*pi* 418/512 )
|
||||
.float -0.909167983090 ; sin( 2*pi* 419/512 )
|
||||
.float -0.903989293123 ; sin( 2*pi* 420/512 )
|
||||
.float -0.898674465694 ; sin( 2*pi* 421/512 )
|
||||
.float -0.893224301195 ; sin( 2*pi* 422/512 )
|
||||
.float -0.887639620403 ; sin( 2*pi* 423/512 )
|
||||
.float -0.881921264348 ; sin( 2*pi* 424/512 )
|
||||
.float -0.876070094195 ; sin( 2*pi* 425/512 )
|
||||
.float -0.870086991109 ; sin( 2*pi* 426/512 )
|
||||
.float -0.863972856121 ; sin( 2*pi* 427/512 )
|
||||
.float -0.857728610000 ; sin( 2*pi* 428/512 )
|
||||
.float -0.851355193105 ; sin( 2*pi* 429/512 )
|
||||
.float -0.844853565250 ; sin( 2*pi* 430/512 )
|
||||
.float -0.838224705555 ; sin( 2*pi* 431/512 )
|
||||
.float -0.831469612302 ; sin( 2*pi* 432/512 )
|
||||
.float -0.824589302785 ; sin( 2*pi* 433/512 )
|
||||
.float -0.817584813151 ; sin( 2*pi* 434/512 )
|
||||
.float -0.810457198252 ; sin( 2*pi* 435/512 )
|
||||
.float -0.803207531480 ; sin( 2*pi* 436/512 )
|
||||
.float -0.795836904609 ; sin( 2*pi* 437/512 )
|
||||
.float -0.788346427626 ; sin( 2*pi* 438/512 )
|
||||
.float -0.780737228572 ; sin( 2*pi* 439/512 )
|
||||
.float -0.773010453363 ; sin( 2*pi* 440/512 )
|
||||
.float -0.765167265622 ; sin( 2*pi* 441/512 )
|
||||
.float -0.757208846506 ; sin( 2*pi* 442/512 )
|
||||
.float -0.749136394523 ; sin( 2*pi* 443/512 )
|
||||
.float -0.740951125355 ; sin( 2*pi* 444/512 )
|
||||
.float -0.732654271672 ; sin( 2*pi* 445/512 )
|
||||
.float -0.724247082951 ; sin( 2*pi* 446/512 )
|
||||
.float -0.715730825284 ; sin( 2*pi* 447/512 )
|
||||
.float -0.707106781186 ; sin( 2*pi* 448/512 )
|
||||
.float -0.698376249409 ; sin( 2*pi* 449/512 )
|
||||
.float -0.689540544737 ; sin( 2*pi* 450/512 )
|
||||
.float -0.680600997795 ; sin( 2*pi* 451/512 )
|
||||
.float -0.671558954847 ; sin( 2*pi* 452/512 )
|
||||
.float -0.662415777590 ; sin( 2*pi* 453/512 )
|
||||
.float -0.653172842953 ; sin( 2*pi* 454/512 )
|
||||
.float -0.643831542890 ; sin( 2*pi* 455/512 )
|
||||
.float -0.634393284163 ; sin( 2*pi* 456/512 )
|
||||
.float -0.624859488142 ; sin( 2*pi* 457/512 )
|
||||
.float -0.615231590580 ; sin( 2*pi* 458/512 )
|
||||
.float -0.605511041404 ; sin( 2*pi* 459/512 )
|
||||
.float -0.595699304492 ; sin( 2*pi* 460/512 )
|
||||
.float -0.585797857456 ; sin( 2*pi* 461/512 )
|
||||
.float -0.575808191418 ; sin( 2*pi* 462/512 )
|
||||
.float -0.565731810783 ; sin( 2*pi* 463/512 )
|
||||
.float -0.555570233019 ; sin( 2*pi* 464/512 )
|
||||
.float -0.545324988422 ; sin( 2*pi* 465/512 )
|
||||
.float -0.534997619887 ; sin( 2*pi* 466/512 )
|
||||
.float -0.524589682678 ; sin( 2*pi* 467/512 )
|
||||
.float -0.514102744193 ; sin( 2*pi* 468/512 )
|
||||
.float -0.503538383725 ; sin( 2*pi* 469/512 )
|
||||
.float -0.492898192229 ; sin( 2*pi* 470/512 )
|
||||
.float -0.482183772079 ; sin( 2*pi* 471/512 )
|
||||
.float -0.471396736826 ; sin( 2*pi* 472/512 )
|
||||
.float -0.460538710958 ; sin( 2*pi* 473/512 )
|
||||
.float -0.449611329654 ; sin( 2*pi* 474/512 )
|
||||
.float -0.438616238538 ; sin( 2*pi* 475/512 )
|
||||
.float -0.427555093430 ; sin( 2*pi* 476/512 )
|
||||
.float -0.416429560097 ; sin( 2*pi* 477/512 )
|
||||
.float -0.405241314005 ; sin( 2*pi* 478/512 )
|
||||
.float -0.393992040061 ; sin( 2*pi* 479/512 )
|
||||
.float -0.382683432365 ; sin( 2*pi* 480/512 )
|
||||
.float -0.371317193951 ; sin( 2*pi* 481/512 )
|
||||
.float -0.359895036535 ; sin( 2*pi* 482/512 )
|
||||
.float -0.348418680249 ; sin( 2*pi* 483/512 )
|
||||
.float -0.336889853392 ; sin( 2*pi* 484/512 )
|
||||
.float -0.325310292162 ; sin( 2*pi* 485/512 )
|
||||
.float -0.313681740399 ; sin( 2*pi* 486/512 )
|
||||
.float -0.302005949319 ; sin( 2*pi* 487/512 )
|
||||
.float -0.290284677254 ; sin( 2*pi* 488/512 )
|
||||
.float -0.278519689385 ; sin( 2*pi* 489/512 )
|
||||
.float -0.266712757475 ; sin( 2*pi* 490/512 )
|
||||
.float -0.254865659604 ; sin( 2*pi* 491/512 )
|
||||
.float -0.242980179903 ; sin( 2*pi* 492/512 )
|
||||
.float -0.231058108280 ; sin( 2*pi* 493/512 )
|
||||
.float -0.219101240156 ; sin( 2*pi* 494/512 )
|
||||
.float -0.207111376192 ; sin( 2*pi* 495/512 )
|
||||
.float -0.195090322016 ; sin( 2*pi* 496/512 )
|
||||
.float -0.183039887955 ; sin( 2*pi* 497/512 )
|
||||
.float -0.170961888760 ; sin( 2*pi* 498/512 )
|
||||
.float -0.158858143333 ; sin( 2*pi* 499/512 )
|
||||
.float -0.146730474455 ; sin( 2*pi* 500/512 )
|
||||
.float -0.134580708507 ; sin( 2*pi* 501/512 )
|
||||
.float -0.122410675199 ; sin( 2*pi* 502/512 )
|
||||
.float -0.110222207293 ; sin( 2*pi* 503/512 )
|
||||
.float -0.098017140329 ; sin( 2*pi* 504/512 )
|
||||
.float -0.085797312344 ; sin( 2*pi* 505/512 )
|
||||
.float -0.073564563599 ; sin( 2*pi* 506/512 )
|
||||
.float -0.061320736302 ; sin( 2*pi* 507/512 )
|
||||
.float -0.049067674327 ; sin( 2*pi* 508/512 )
|
||||
.float -0.036807222941 ; sin( 2*pi* 509/512 )
|
||||
.float -0.024541228523 ; sin( 2*pi* 510/512 )
|
||||
.float -0.012271538285 ; sin( 2*pi* 511/512 )
|
||||
_FPU32sinTableEnd:
|
||||
_FPUsinTableEnd:
|
||||
.float 0.000000000000 ; sin( 2*pi* 512/512 )
|
||||
.float 0.012271538286 ; sin( 2*pi* 513/512 )
|
||||
.float 0.024541228523 ; sin( 2*pi* 514/512 )
|
||||
.float 0.036807222942 ; sin( 2*pi* 515/512 )
|
||||
.float 0.049067674328 ; sin( 2*pi* 516/512 )
|
||||
.float 0.061320736303 ; sin( 2*pi* 517/512 )
|
||||
.float 0.073564563600 ; sin( 2*pi* 518/512 )
|
||||
.float 0.085797312345 ; sin( 2*pi* 519/512 )
|
||||
.float 0.098017140330 ; sin( 2*pi* 520/512 )
|
||||
.float 0.110222207294 ; sin( 2*pi* 521/512 )
|
||||
.float 0.122410675200 ; sin( 2*pi* 522/512 )
|
||||
.float 0.134580708508 ; sin( 2*pi* 523/512 )
|
||||
.float 0.146730474456 ; sin( 2*pi* 524/512 )
|
||||
.float 0.158858143334 ; sin( 2*pi* 525/512 )
|
||||
.float 0.170961888761 ; sin( 2*pi* 526/512 )
|
||||
.float 0.183039887956 ; sin( 2*pi* 527/512 )
|
||||
.float 0.195090322017 ; sin( 2*pi* 528/512 )
|
||||
.float 0.207111376193 ; sin( 2*pi* 529/512 )
|
||||
.float 0.219101240157 ; sin( 2*pi* 530/512 )
|
||||
.float 0.231058108281 ; sin( 2*pi* 531/512 )
|
||||
.float 0.242980179904 ; sin( 2*pi* 532/512 )
|
||||
.float 0.254865659605 ; sin( 2*pi* 533/512 )
|
||||
.float 0.266712757475 ; sin( 2*pi* 534/512 )
|
||||
.float 0.278519689385 ; sin( 2*pi* 535/512 )
|
||||
.float 0.290284677255 ; sin( 2*pi* 536/512 )
|
||||
.float 0.302005949320 ; sin( 2*pi* 537/512 )
|
||||
.float 0.313681740399 ; sin( 2*pi* 538/512 )
|
||||
.float 0.325310292163 ; sin( 2*pi* 539/512 )
|
||||
.float 0.336889853393 ; sin( 2*pi* 540/512 )
|
||||
.float 0.348418680250 ; sin( 2*pi* 541/512 )
|
||||
.float 0.359895036535 ; sin( 2*pi* 542/512 )
|
||||
.float 0.371317193952 ; sin( 2*pi* 543/512 )
|
||||
.float 0.382683432365 ; sin( 2*pi* 544/512 )
|
||||
.float 0.393992040061 ; sin( 2*pi* 545/512 )
|
||||
.float 0.405241314005 ; sin( 2*pi* 546/512 )
|
||||
.float 0.416429560098 ; sin( 2*pi* 547/512 )
|
||||
.float 0.427555093431 ; sin( 2*pi* 548/512 )
|
||||
.float 0.438616238539 ; sin( 2*pi* 549/512 )
|
||||
.float 0.449611329655 ; sin( 2*pi* 550/512 )
|
||||
.float 0.460538710959 ; sin( 2*pi* 551/512 )
|
||||
.float 0.471396736826 ; sin( 2*pi* 552/512 )
|
||||
.float 0.482183772080 ; sin( 2*pi* 553/512 )
|
||||
.float 0.492898192230 ; sin( 2*pi* 554/512 )
|
||||
.float 0.503538383726 ; sin( 2*pi* 555/512 )
|
||||
.float 0.514102744194 ; sin( 2*pi* 556/512 )
|
||||
.float 0.524589682679 ; sin( 2*pi* 557/512 )
|
||||
.float 0.534997619887 ; sin( 2*pi* 558/512 )
|
||||
.float 0.545324988422 ; sin( 2*pi* 559/512 )
|
||||
.float 0.555570233020 ; sin( 2*pi* 560/512 )
|
||||
.float 0.565731810784 ; sin( 2*pi* 561/512 )
|
||||
.float 0.575808191418 ; sin( 2*pi* 562/512 )
|
||||
.float 0.585797857457 ; sin( 2*pi* 563/512 )
|
||||
.float 0.595699304493 ; sin( 2*pi* 564/512 )
|
||||
.float 0.605511041405 ; sin( 2*pi* 565/512 )
|
||||
.float 0.615231590581 ; sin( 2*pi* 566/512 )
|
||||
.float 0.624859488143 ; sin( 2*pi* 567/512 )
|
||||
.float 0.634393284164 ; sin( 2*pi* 568/512 )
|
||||
.float 0.643831542890 ; sin( 2*pi* 569/512 )
|
||||
.float 0.653172842954 ; sin( 2*pi* 570/512 )
|
||||
.float 0.662415777591 ; sin( 2*pi* 571/512 )
|
||||
.float 0.671558954847 ; sin( 2*pi* 572/512 )
|
||||
.float 0.680600997796 ; sin( 2*pi* 573/512 )
|
||||
.float 0.689540544737 ; sin( 2*pi* 574/512 )
|
||||
.float 0.698376249409 ; sin( 2*pi* 575/512 )
|
||||
.float 0.707106781187 ; sin( 2*pi* 576/512 )
|
||||
.float 0.715730825284 ; sin( 2*pi* 577/512 )
|
||||
.float 0.724247082952 ; sin( 2*pi* 578/512 )
|
||||
.float 0.732654271673 ; sin( 2*pi* 579/512 )
|
||||
.float 0.740951125355 ; sin( 2*pi* 580/512 )
|
||||
.float 0.749136394524 ; sin( 2*pi* 581/512 )
|
||||
.float 0.757208846507 ; sin( 2*pi* 582/512 )
|
||||
.float 0.765167265623 ; sin( 2*pi* 583/512 )
|
||||
.float 0.773010453363 ; sin( 2*pi* 584/512 )
|
||||
.float 0.780737228572 ; sin( 2*pi* 585/512 )
|
||||
.float 0.788346427627 ; sin( 2*pi* 586/512 )
|
||||
.float 0.795836904609 ; sin( 2*pi* 587/512 )
|
||||
.float 0.803207531481 ; sin( 2*pi* 588/512 )
|
||||
.float 0.810457198253 ; sin( 2*pi* 589/512 )
|
||||
.float 0.817584813152 ; sin( 2*pi* 590/512 )
|
||||
.float 0.824589302785 ; sin( 2*pi* 591/512 )
|
||||
.float 0.831469612303 ; sin( 2*pi* 592/512 )
|
||||
.float 0.838224705555 ; sin( 2*pi* 593/512 )
|
||||
.float 0.844853565250 ; sin( 2*pi* 594/512 )
|
||||
.float 0.851355193106 ; sin( 2*pi* 595/512 )
|
||||
.float 0.857728610001 ; sin( 2*pi* 596/512 )
|
||||
.float 0.863972856122 ; sin( 2*pi* 597/512 )
|
||||
.float 0.870086991109 ; sin( 2*pi* 598/512 )
|
||||
.float 0.876070094196 ; sin( 2*pi* 599/512 )
|
||||
.float 0.881921264349 ; sin( 2*pi* 600/512 )
|
||||
.float 0.887639620403 ; sin( 2*pi* 601/512 )
|
||||
.float 0.893224301196 ; sin( 2*pi* 602/512 )
|
||||
.float 0.898674465694 ; sin( 2*pi* 603/512 )
|
||||
.float 0.903989293124 ; sin( 2*pi* 604/512 )
|
||||
.float 0.909167983091 ; sin( 2*pi* 605/512 )
|
||||
.float 0.914209755704 ; sin( 2*pi* 606/512 )
|
||||
.float 0.919113851690 ; sin( 2*pi* 607/512 )
|
||||
.float 0.923879532511 ; sin( 2*pi* 608/512 )
|
||||
.float 0.928506080473 ; sin( 2*pi* 609/512 )
|
||||
.float 0.932992798835 ; sin( 2*pi* 610/512 )
|
||||
.float 0.937339011913 ; sin( 2*pi* 611/512 )
|
||||
.float 0.941544065183 ; sin( 2*pi* 612/512 )
|
||||
.float 0.945607325381 ; sin( 2*pi* 613/512 )
|
||||
.float 0.949528180593 ; sin( 2*pi* 614/512 )
|
||||
.float 0.953306040354 ; sin( 2*pi* 615/512 )
|
||||
.float 0.956940335732 ; sin( 2*pi* 616/512 )
|
||||
.float 0.960430519416 ; sin( 2*pi* 617/512 )
|
||||
.float 0.963776065796 ; sin( 2*pi* 618/512 )
|
||||
.float 0.966976471045 ; sin( 2*pi* 619/512 )
|
||||
.float 0.970031253195 ; sin( 2*pi* 620/512 )
|
||||
.float 0.972939952206 ; sin( 2*pi* 621/512 )
|
||||
.float 0.975702130039 ; sin( 2*pi* 622/512 )
|
||||
.float 0.978317370720 ; sin( 2*pi* 623/512 )
|
||||
.float 0.980785280403 ; sin( 2*pi* 624/512 )
|
||||
.float 0.983105487431 ; sin( 2*pi* 625/512 )
|
||||
.float 0.985277642389 ; sin( 2*pi* 626/512 )
|
||||
.float 0.987301418158 ; sin( 2*pi* 627/512 )
|
||||
.float 0.989176509965 ; sin( 2*pi* 628/512 )
|
||||
.float 0.990902635428 ; sin( 2*pi* 629/512 )
|
||||
.float 0.992479534599 ; sin( 2*pi* 630/512 )
|
||||
.float 0.993906970002 ; sin( 2*pi* 631/512 )
|
||||
.float 0.995184726672 ; sin( 2*pi* 632/512 )
|
||||
.float 0.996312612183 ; sin( 2*pi* 633/512 )
|
||||
.float 0.997290456679 ; sin( 2*pi* 634/512 )
|
||||
.float 0.998118112900 ; sin( 2*pi* 635/512 )
|
||||
.float 0.998795456205 ; sin( 2*pi* 636/512 )
|
||||
.float 0.999322384588 ; sin( 2*pi* 637/512 )
|
||||
.float 0.999698818696 ; sin( 2*pi* 638/512 )
|
||||
.float 0.999924701839 ; sin( 2*pi* 639/512 )
|
||||
.float 1.000000000000 ; sin( 2*pi* 640/512 )
|
||||
_FPU32cosTableEnd:
|
||||
_FPUcosTableEnd:
|
||||
|
||||
;;==========================================================================
|
||||
;;FPUatan2 Function Table, Size Of Table = 388x16
|
||||
;;==========================================================================
|
||||
.if __TI_EABI__
|
||||
.asg FPUatan2HalfPITable, _FPUatan2HalfPITable
|
||||
.asg FPUatan2Table, _FPUatan2Table
|
||||
.asg FPUatan2TableEnd, _FPUatan2TableEnd
|
||||
|
||||
.asg FPU32atan2HalfPITable, _FPU32atan2HalfPITable
|
||||
.asg FPU32atan2Table, _FPU32atan2Table
|
||||
.asg FPU32atan2TableEnd, _FPU32atan2TableEnd
|
||||
|
||||
.endif
|
||||
.def _FPUatan2HalfPITable
|
||||
.def _FPUatan2Table
|
||||
.def _FPUatan2TableEnd
|
||||
|
||||
.def _FPU32atan2HalfPITable
|
||||
.def _FPU32atan2Table
|
||||
.def _FPU32atan2TableEnd
|
||||
|
||||
.sect "FPUmathTables"
|
||||
|
||||
_FPUatan2HalfPITable:
|
||||
_FPU32atan2HalfPITable:
|
||||
.float 2.0 ; 2.0
|
||||
.float 1.570796327 ; PI/2
|
||||
|
||||
_FPUatan2Table:
|
||||
_FPU32atan2Table:
|
||||
.float 0.000000000000 ; 0 x0 = 0.000000000000 -> a0 = 0.000000000000
|
||||
.float 1.000040679675 ; 0 x1 = 0.007812500000 -> a1 = 1.000040679675
|
||||
.float -0.007811069750 ; 0 x2 = 0.015625000000 -> a2 = -0.007811069750
|
||||
.float -0.000003807022 ; 1 x0 = 0.015625000000 -> a0 = -0.000003807022
|
||||
.float 1.000528067772 ; 1 x1 = 0.023437500000 -> a1 = 1.000528067772
|
||||
.float -0.023410345493 ; 1 x2 = 0.031250000000 -> a2 = -0.023410345493
|
||||
.float -0.000018968310 ; 2 x0 = 0.031250000000 -> a0 = -0.000018968310
|
||||
.float 1.001498568106 ; 2 x1 = 0.039062500000 -> a1 = 1.001498568106
|
||||
.float -0.038941197075 ; 2 x2 = 0.046875000000 -> a2 = -0.038941197075
|
||||
.float -0.000052831927 ; 3 x0 = 0.046875000000 -> a0 = -0.000052831927
|
||||
.float 1.002943680965 ; 3 x1 = 0.054687500000 -> a1 = 1.002943680965
|
||||
.float -0.054358563160 ; 3 x2 = 0.062500000000 -> a2 = -0.054358563160
|
||||
.float -0.000112417996 ; 4 x0 = 0.062500000000 -> a0 = -0.000112417996
|
||||
.float 1.004850785788 ; 4 x1 = 0.070312500000 -> a1 = 1.004850785788
|
||||
.float -0.069618206649 ; 4 x2 = 0.078125000000 -> a2 = -0.069618206649
|
||||
.float -0.000204295885 ; 5 x0 = 0.078125000000 -> a0 = -0.000204295885
|
||||
.float 1.007203293243 ; 5 x1 = 0.085937500000 -> a1 = 1.007203293243
|
||||
.float -0.084677028723 ; 5 x2 = 0.093750000000 -> a2 = -0.084677028723
|
||||
.float -0.000334469493 ; 6 x0 = 0.093750000000 -> a0 = -0.000334469493
|
||||
.float 1.009980843501 ; 6 x1 = 0.101562500000 -> a1 = 1.009980843501
|
||||
.float -0.099493367628 ; 6 x2 = 0.109375000000 -> a2 = -0.099493367628
|
||||
.float -0.000508272606 ; 7 x0 = 0.109375000000 -> a0 = -0.000508272606
|
||||
.float 1.013159547023 ; 7 x1 = 0.117187500000 -> a1 = 1.013159547023
|
||||
.float -0.114027278430 ; 7 x2 = 0.125000000000 -> a2 = -0.114027278430
|
||||
.float -0.000730276035 ; 8 x0 = 0.125000000000 -> a0 = -0.000730276035
|
||||
.float 1.016712263449 ; 8 x1 = 0.132812500000 -> a1 = 1.016712263449
|
||||
.float -0.128240790343 ; 8 x2 = 0.140625000000 -> a2 = -0.128240790343
|
||||
.float -0.001004207980 ; 9 x0 = 0.140625000000 -> a0 = -0.001004207980
|
||||
.float 1.020608913557 ; 9 x1 = 0.148437500000 -> a1 = 1.020608913557
|
||||
.float -0.142098138715 ; 9 x2 = 0.156250000000 -> a2 = -0.142098138715
|
||||
.float -0.001332888717 ; 10 x0 = 0.156250000000 -> a0 = -0.001332888717
|
||||
.float 1.024816818801 ; 10 x1 = 0.164062500000 -> a1 = 1.024816818801
|
||||
.float -0.155565969259 ; 10 x2 = 0.171875000000 -> a2 = -0.155565969259
|
||||
.float -0.001718180431 ; 11 x0 = 0.171875000000 -> a0 = -0.001718180431
|
||||
.float 1.029301062569 ; 11 x1 = 0.179687500000 -> a1 = 1.029301062569
|
||||
.float -0.168613512667 ; 11 x2 = 0.187500000000 -> a2 = -0.168613512667
|
||||
.float -0.002160952612 ; 12 x0 = 0.187500000000 -> a0 = -0.002160952612
|
||||
.float 1.034024867135 ; 12 x1 = 0.195312500000 -> a1 = 1.034024867135
|
||||
.float -0.181212728329 ; 12 x2 = 0.203125000000 -> a2 = -0.181212728329
|
||||
.float -0.002661063159 ; 13 x0 = 0.203125000000 -> a0 = -0.002661063159
|
||||
.float 1.038949980222 ; 13 x1 = 0.210937500000 -> a1 = 1.038949980222
|
||||
.float -0.193338416410 ; 13 x2 = 0.218750000000 -> a2 = -0.193338416410
|
||||
.float -0.003217354977 ; 14 x0 = 0.218750000000 -> a0 = -0.003217354977
|
||||
.float 1.044037065160 ; 14 x1 = 0.226562500000 -> a1 = 1.044037065160
|
||||
.float -0.204968298146 ; 14 x2 = 0.234375000000 -> a2 = -0.204968298146
|
||||
.float -0.003827667546 ; 15 x0 = 0.234375000000 -> a0 = -0.003827667546
|
||||
.float 1.049246088868 ; 15 x1 = 0.242187500000 -> a1 = 1.049246088868
|
||||
.float -0.216083064706 ; 15 x2 = 0.250000000000 -> a2 = -0.216083064706
|
||||
.float -0.004488862702 ; 16 x0 = 0.250000000000 -> a0 = -0.004488862702
|
||||
.float 1.054536702192 ; 16 x1 = 0.257812500000 -> a1 = 1.054536702192
|
||||
.float -0.226666395507 ; 16 x2 = 0.265625000000 -> a2 = -0.226666395507
|
||||
.float -0.005196863579 ; 17 x0 = 0.265625000000 -> a0 = -0.005196863579
|
||||
.float 1.059868607573 ; 17 x1 = 0.273437500000 -> a1 = 1.059868607573
|
||||
.float -0.236704947279 ; 17 x2 = 0.281250000000 -> a2 = -0.236704947279
|
||||
.float -0.005946705500 ; 18 x0 = 0.281250000000 -> a0 = -0.005946705500
|
||||
.float 1.065201909527 ; 18 x1 = 0.289062500000 -> a1 = 1.065201909527
|
||||
.float -0.246188315613 ; 18 x2 = 0.296875000000 -> a2 = -0.246188315613
|
||||
.float -0.006732597422 ; 19 x0 = 0.296875000000 -> a0 = -0.006732597422
|
||||
.float 1.070497443994 ; 19 x1 = 0.304687500000 -> a1 = 1.070497443994
|
||||
.float -0.255108971022 ; 19 x2 = 0.312500000000 -> a2 = -0.255108971022
|
||||
.float -0.007547992413 ; 20 x0 = 0.312500000000 -> a0 = -0.007547992413
|
||||
.float 1.075717083222 ; 20 x1 = 0.320312500000 -> a1 = 1.075717083222
|
||||
.float -0.263462171840 ; 20 x2 = 0.328125000000 -> a2 = -0.263462171840
|
||||
.float -0.008385665599 ; 21 x0 = 0.328125000000 -> a0 = -0.008385665599
|
||||
.float 1.080824013499 ; 21 x1 = 0.335937500000 -> a1 = 1.080824013499
|
||||
.float -0.271245856476 ; 21 x2 = 0.343750000000 -> a2 = -0.271245856476
|
||||
.float -0.009237797924 ; 22 x0 = 0.343750000000 -> a0 = -0.009237797924
|
||||
.float 1.085782983693 ; 22 x1 = 0.351562500000 -> a1 = 1.085782983693
|
||||
.float -0.278460517693 ; 22 x2 = 0.359375000000 -> a2 = -0.278460517693
|
||||
.float -0.010096064139 ; 23 x0 = 0.359375000000 -> a0 = -0.010096064139
|
||||
.float 1.090560523211 ; 23 x1 = 0.367187500000 -> a1 = 1.090560523211
|
||||
.float -0.285109061650 ; 23 x2 = 0.375000000000 -> a2 = -0.285109061650
|
||||
.float -0.010951723407 ; 24 x0 = 0.375000000000 -> a0 = -0.010951723407
|
||||
.float 1.095125128557 ; 24 x1 = 0.382812500000 -> a1 = 1.095125128557
|
||||
.float -0.291196654447 ; 24 x2 = 0.390625000000 -> a2 = -0.291196654447
|
||||
.float -0.011795711029 ; 25 x0 = 0.390625000000 -> a0 = -0.011795711029
|
||||
.float 1.099447418304 ; 25 x1 = 0.398437500000 -> a1 = 1.099447418304
|
||||
.float -0.296730558920 ; 25 x2 = 0.406250000000 -> a2 = -0.296730558920
|
||||
.float -0.012618729873 ; 26 x0 = 0.406250000000 -> a0 = -0.012618729873
|
||||
.float 1.103500256784 ; 26 x1 = 0.414062500000 -> a1 = 1.103500256784
|
||||
.float -0.301719964310 ; 26 x2 = 0.421875000000 -> a2 = -0.301719964310
|
||||
.float -0.013411340199 ; 27 x0 = 0.421875000000 -> a0 = -0.013411340199
|
||||
.float 1.107258847274 ; 27 x1 = 0.429687500000 -> a1 = 1.107258847274
|
||||
.float -0.306175811325 ; 27 x2 = 0.437500000000 -> a2 = -0.306175811325
|
||||
.float -0.014164046711 ; 28 x0 = 0.437500000000 -> a0 = -0.014164046711
|
||||
.float 1.110700795887 ; 28 x1 = 0.445312500000 -> a1 = 1.110700795887
|
||||
.float -0.310110614947 ; 28 x2 = 0.453125000000 -> a2 = -0.310110614947
|
||||
.float -0.014867381831 ; 29 x0 = 0.453125000000 -> a0 = -0.014867381831
|
||||
.float 1.113806147717 ; 29 x1 = 0.460937500000 -> a1 = 1.113806147717
|
||||
.float -0.313538287176 ; 29 x2 = 0.468750000000 -> a2 = -0.313538287176
|
||||
.float -0.015511984298 ; 30 x0 = 0.468750000000 -> a0 = -0.015511984298
|
||||
.float 1.116557397059 ; 30 x1 = 0.476562500000 -> a1 = 1.116557397059
|
||||
.float -0.316473961655 ; 30 x2 = 0.484375000000 -> a2 = -0.316473961655
|
||||
.float -0.016088672395 ; 31 x0 = 0.484375000000 -> a0 = -0.016088672395
|
||||
.float 1.118939473766 ; 31 x1 = 0.492187500000 -> a1 = 1.118939473766
|
||||
.float -0.318933821948 ; 31 x2 = 0.500000000000 -> a2 = -0.318933821948
|
||||
.float -0.016588511229 ; 32 x0 = 0.500000000000 -> a0 = -0.016588511229
|
||||
.float 1.120939707956 ; 32 x1 = 0.507812500000 -> a1 = 1.120939707956
|
||||
.float -0.320934934991 ; 32 x2 = 0.515625000000 -> a2 = -0.320934934991
|
||||
.float -0.017002873645 ; 33 x0 = 0.515625000000 -> a0 = -0.017002873645
|
||||
.float 1.122547775367 ; 33 x1 = 0.523437500000 -> a1 = 1.122547775367
|
||||
.float -0.322495091022 ; 33 x2 = 0.531250000000 -> a2 = -0.322495091022
|
||||
.float -0.017323494499 ; 34 x0 = 0.531250000000 -> a0 = -0.017323494499
|
||||
.float 1.123755625749 ; 34 x1 = 0.539062500000 -> a1 = 1.123755625749
|
||||
.float -0.323632651068 ; 34 x2 = 0.546875000000 -> a2 = -0.323632651068
|
||||
.float -0.017542518140 ; 35 x0 = 0.546875000000 -> a0 = -0.017542518140
|
||||
.float 1.124557396633 ; 35 x1 = 0.554687500000 -> a1 = 1.124557396633
|
||||
.float -0.324366402860 ; 35 x2 = 0.562500000000 -> a2 = -0.324366402860
|
||||
.float -0.017652539065 ; 36 x0 = 0.562500000000 -> a0 = -0.017652539065
|
||||
.float 1.124949314810 ; 36 x1 = 0.570312500000 -> a1 = 1.124949314810
|
||||
.float -0.324715425833 ; 36 x2 = 0.578125000000 -> a2 = -0.324715425833
|
||||
.float -0.017646635823 ; 37 x0 = 0.578125000000 -> a0 = -0.017646635823
|
||||
.float 1.124929587773 ; 37 x1 = 0.585937500000 -> a1 = 1.124929587773
|
||||
.float -0.324698965683 ; 37 x2 = 0.593750000000 -> a2 = -0.324698965683
|
||||
.float -0.017518398344 ; 38 x0 = 0.593750000000 -> a0 = -0.017518398344
|
||||
.float 1.124498287266 ; 38 x1 = 0.601562500000 -> a1 = 1.124498287266
|
||||
.float -0.324336318787 ; 38 x2 = 0.609375000000 -> a2 = -0.324336318787
|
||||
.float -0.017261948920 ; 39 x0 = 0.609375000000 -> a0 = -0.017261948920
|
||||
.float 1.123657226955 ; 39 x1 = 0.617187500000 -> a1 = 1.123657226955
|
||||
.float -0.323646726613 ; 39 x2 = 0.625000000000 -> a2 = -0.323646726613
|
||||
.float -0.016871957164 ; 40 x0 = 0.625000000000 -> a0 = -0.016871957164
|
||||
.float 1.122409836098 ; 40 x1 = 0.632812500000 -> a1 = 1.122409836098
|
||||
.float -0.322649280139 ; 40 x2 = 0.640625000000 -> a2 = -0.322649280139
|
||||
.float -0.016343649294 ; 41 x0 = 0.640625000000 -> a0 = -0.016343649294
|
||||
.float 1.120761030918 ; 41 x1 = 0.648437500000 -> a1 = 1.120761030918
|
||||
.float -0.321362834119 ; 41 x2 = 0.656250000000 -> a2 = -0.321362834119
|
||||
.float -0.015672812166 ; 42 x0 = 0.656250000000 -> a0 = -0.015672812166
|
||||
.float 1.118717085258 ; 42 x1 = 0.664062500000 -> a1 = 1.118717085258
|
||||
.float -0.319805931024 ; 42 x2 = 0.671875000000 -> a2 = -0.319805931024
|
||||
.float -0.014855792451 ; 43 x0 = 0.671875000000 -> a0 = -0.014855792451
|
||||
.float 1.116285501852 ; 43 x1 = 0.679687500000 -> a1 = 1.116285501852
|
||||
.float -0.317996734279 ; 43 x2 = 0.687500000000 -> a2 = -0.317996734279
|
||||
.float -0.013889491441 ; 44 x0 = 0.687500000000 -> a0 = -0.013889491441
|
||||
.float 1.113474885484 ; 44 x1 = 0.695312500000 -> a1 = 1.113474885484
|
||||
.float -0.315952970460 ; 44 x2 = 0.703125000000 -> a2 = -0.315952970460
|
||||
.float -0.012771355912 ; 45 x0 = 0.703125000000 -> a0 = -0.012771355912
|
||||
.float 1.110294819035 ; 45 x1 = 0.710937500000 -> a1 = 1.110294819035
|
||||
.float -0.313691879968 ; 45 x2 = 0.718750000000 -> a2 = -0.313691879968
|
||||
.float -0.011499365513 ; 46 x0 = 0.718750000000 -> a0 = -0.011499365513
|
||||
.float 1.106755743329 ; 46 x1 = 0.726562500000 -> a1 = 1.106755743329
|
||||
.float -0.311230175714 ; 46 x2 = 0.734375000000 -> a2 = -0.311230175714
|
||||
.float -0.010072017131 ; 47 x0 = 0.734375000000 -> a0 = -0.010072017131
|
||||
.float 1.102868841531 ; 47 x1 = 0.742187500000 -> a1 = 1.102868841531
|
||||
.float -0.308584009287 ; 47 x2 = 0.750000000000 -> a2 = -0.308584009287
|
||||
.float -0.008488306656 ; 48 x0 = 0.750000000000 -> a0 = -0.008488306656
|
||||
.float 1.098645928648 ; 48 x1 = 0.757812500000 -> a1 = 1.098645928648
|
||||
.float -0.305768944066 ; 48 x2 = 0.765625000000 -> a2 = -0.305768944066
|
||||
.float -0.006747708579 ; 49 x0 = 0.765625000000 -> a0 = -0.006747708579
|
||||
.float 1.094099346648 ; 49 x1 = 0.773437500000 -> a1 = 1.094099346648
|
||||
.float -0.302799934724 ; 49 x2 = 0.781250000000 -> a2 = -0.302799934724
|
||||
.float -0.004850153815 ; 50 x0 = 0.781250000000 -> a0 = -0.004850153815
|
||||
.float 1.089241865523 ; 50 x1 = 0.789062500000 -> a1 = 1.089241865523
|
||||
.float -0.299691312610 ; 50 x2 = 0.796875000000 -> a2 = -0.299691312610
|
||||
.float -0.002796006119 ; 51 x0 = 0.796875000000 -> a0 = -0.002796006119
|
||||
.float 1.084086590517 ; 51 x1 = 0.804687500000 -> a1 = 1.084086590517
|
||||
.float -0.296456776409 ; 51 x2 = 0.812500000000 -> a2 = -0.296456776409
|
||||
.float -0.000586037441 ; 52 x0 = 0.812500000000 -> a0 = -0.000586037441
|
||||
.float 1.078646875666 ; 52 x1 = 0.820312500000 -> a1 = 1.078646875666
|
||||
.float -0.293109387609 ; 52 x2 = 0.828125000000 -> a2 = -0.293109387609
|
||||
.float 0.001778597452 ; 53 x0 = 0.828125000000 -> a0 = 0.001778597452
|
||||
.float 1.072936243727 ; 53 x1 = 0.835937500000 -> a1 = 1.072936243727
|
||||
.float -0.289661570229 ; 53 x2 = 0.843750000000 -> a2 = -0.289661570229
|
||||
.float 0.004296386804 ; 54 x0 = 0.843750000000 -> a0 = 0.004296386804
|
||||
.float 1.066968312440 ; 54 x1 = 0.851562500000 -> a1 = 1.066968312440
|
||||
.float -0.286125114351 ; 54 x2 = 0.859375000000 -> a2 = -0.286125114351
|
||||
.float 0.006965487894 ; 55 x0 = 0.859375000000 -> a0 = 0.006965487894
|
||||
.float 1.060756727064 ; 55 x1 = 0.867187500000 -> a1 = 1.060756727064
|
||||
.float -0.282511182960 ; 55 x2 = 0.875000000000 -> a2 = -0.282511182960
|
||||
.float 0.009783753017 ; 56 x0 = 0.875000000000 -> a0 = 0.009783753017
|
||||
.float 1.054315099009 ; 56 x1 = 0.882812500000 -> a1 = 1.054315099009
|
||||
.float -0.278830321668 ; 56 x2 = 0.890625000000 -> a2 = -0.278830321668
|
||||
.float 0.012748755207 ; 57 x0 = 0.890625000000 -> a0 = 0.012748755207
|
||||
.float 1.047656950440 ; 57 x1 = 0.898437500000 -> a1 = 1.047656950440
|
||||
.float -0.275092470943 ; 57 x2 = 0.906250000000 -> a2 = -0.275092470943
|
||||
.float 0.015857813546 ; 58 x0 = 0.906250000000 -> a0 = 0.015857813546
|
||||
.float 1.040795664582 ; 58 x1 = 0.914062500000 -> a1 = 1.040795664582
|
||||
.float -0.271306980411 ; 58 x2 = 0.921875000000 -> a2 = -0.271306980411
|
||||
.float 0.019108017893 ; 59 x0 = 0.921875000000 -> a0 = 0.019108017893
|
||||
.float 1.033744441476 ; 59 x1 = 0.929687500000 -> a1 = 1.033744441476
|
||||
.float -0.267482624928 ; 59 x2 = 0.937500000000 -> a2 = -0.267482624928
|
||||
.float 0.022496252887 ; 60 x0 = 0.937500000000 -> a0 = 0.022496252887
|
||||
.float 1.026516258989 ; 60 x1 = 0.945312500000 -> a1 = 1.026516258989
|
||||
.float -0.263627622089 ; 60 x2 = 0.953125000000 -> a2 = -0.263627622089
|
||||
.float 0.026019221162 ; 61 x0 = 0.953125000000 -> a0 = 0.026019221162
|
||||
.float 1.019123838651 ; 61 x1 = 0.960937500000 -> a1 = 1.019123838651
|
||||
.float -0.259749650860 ; 61 x2 = 0.968750000000 -> a2 = -0.259749650860
|
||||
.float 0.029673465636 ; 62 x0 = 0.968750000000 -> a0 = 0.029673465636
|
||||
.float 1.011579616186 ; 62 x1 = 0.976562500000 -> a1 = 1.011579616186
|
||||
.float -0.255855871106 ; 62 x2 = 0.984375000000 -> a2 = -0.255855871106
|
||||
.float 0.033455390838 ; 63 x0 = 0.984375000000 -> a0 = 0.033455390838
|
||||
.float 1.003895716322 ; 63 x1 = 0.992187500000 -> a1 = 1.003895716322
|
||||
.float -0.251952943763 ; 63 x2 = 1.000000000000 -> a2 = -0.251952943763
|
||||
.float 0.037361283212 ; 64 x0 = 1.000000000000 -> a0 = 0.037361283212
|
||||
.float 0.996083931611 ; 64 x1 = 1.007812500000 -> a1 = 0.996083931611
|
||||
.float -0.248047051426 ; 64 x2 = 1.015625000000 -> a2 = -0.248047051426
|
||||
_FPU32atan2TableEnd:
|
||||
_FPUatan2TableEnd:
|
||||
|
||||
;; End of File
|
||||
@@ -0,0 +1,128 @@
|
||||
; acos_f32.asm - assembly implementation of acosf for FPU32 with TMU
|
||||
;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
|
||||
; C prototype: extern float acosf(float theta)
|
||||
; argument 1 = theta : [R0H] input [-1 : +1]
|
||||
; return = [R0H] angle in radians [-pi : +pi]
|
||||
|
||||
.if __TI_EABI__
|
||||
.asg acosf, _acos
|
||||
.endif
|
||||
.global _acos
|
||||
|
||||
.if (__TI_EABI__ = 0)
|
||||
; For TI COFF double and float are the same size, so atanf() and atan()
|
||||
; should be the same function
|
||||
.global _acosf
|
||||
|
||||
.align 2
|
||||
_acosf:
|
||||
.endif
|
||||
_acos:
|
||||
.asmfunc
|
||||
.if (.TMS320C2800_TMU0 = 1)
|
||||
MOV32 *SP++, R7H ; push R7H
|
||||
ABSF32 R1H, R0H ; phi = |theta|
|
||||
MPYF32 R2H, R0H, R0H ; R2H = phi^2
|
||||
MOVIZF32 R7H, #1.0 ; R7H = 1.0f
|
||||
SUBF32 R2H, R7H, R2H ; R2H = 1 - phi^2
|
||||
NOP
|
||||
CMPF32 R1H, R7H ; test |theta| > 1
|
||||
MOVST0 NF, ZF ; copy flags
|
||||
SB acos_nan, GT ; NaN
|
||||
SQRTF32 R2H, R2H ; R2H = sqrt(1 = phi^2)
|
||||
CMPF32 R0H, #0.0 ; test sgn(theta)
|
||||
MOV32 *SP++, STF ; push flags
|
||||
NOP
|
||||
NOP
|
||||
DIVF32 R2H, R2H, R1H ; R2H = acos_v = sqrt(1 = phi^2) / phi
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
DIVF32 R3H, R7H, R2H ; R3H = 1 / acos_v
|
||||
MOVF32 R1H, #1.570796327 ; R1H = pi / 2
|
||||
NOP
|
||||
NOP
|
||||
ATANPUF32 R0H, R2H ; R0H = atan(acos_v)
|
||||
ATANPUF32 R3H, R3H ; R3H = atan(1 / acos_v)
|
||||
NOP
|
||||
NOP
|
||||
MPY2PIF32 R0H, R0H ; R0H = 2*pi*atan(acos_v)
|
||||
MPY2PIF32 R3H, R3H ; R3H = 2*pi*atan(1 / acos_v)
|
||||
NOP
|
||||
NOP
|
||||
SUBF32 R3H, R1H, R3H ; R3H = (pi/2) - 2*pi*atan(1 / acos_v)
|
||||
CMPF32 R2H, R7H ; set flags on acos_v
|
||||
MOV32 R0H, R3H, GT ; select accos_b
|
||||
MOV32 STF, *--SP ; pop flags
|
||||
MOVST0 NF ; copy NF flag
|
||||
SB acos_end, GEQ ; branch if (theta >= 0)
|
||||
MOVF32 R1H, 3.141592654 ; R1H = pi
|
||||
SUBF32 R0H, R1H, R0H ; R0H = pi - acos_b
|
||||
acos_end:
|
||||
MOV32 R7H, *--SP, UNC ; pop R7H
|
||||
LRETR
|
||||
acos_nan:
|
||||
MOVIZ R0H, #0x7FC0 ; R0H = NaN
|
||||
MOV32 R7H, *--SP, UNC ; pop R7H
|
||||
LRETR
|
||||
.else
|
||||
.wmsg "WARNING - TMU0 NOT PRESENT: _acosf NOT BUILT"
|
||||
LRETR
|
||||
.endif
|
||||
.endasmfunc
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
|
||||
.end
|
||||
|
||||
; end of file
|
||||
@@ -0,0 +1,125 @@
|
||||
; asin_f32.asm - assembly implementation of arcsin on FPU32 with TMU
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
|
||||
; C prototype: extern float asinf(float theta)
|
||||
; argument 1 = theta : [R0H] input [-1 : +1]
|
||||
; return = [R0H] angle in radians [-pi : +pi]
|
||||
|
||||
.if __TI_EABI__
|
||||
.asg asinf, _asin
|
||||
.endif
|
||||
.global _asin
|
||||
|
||||
.if (__TI_EABI__ = 0)
|
||||
; For TI COFF double and float are the same size, so atanf() and atan()
|
||||
; should be the same function
|
||||
.global _asinf
|
||||
|
||||
.align 2
|
||||
_asinf:
|
||||
.endif
|
||||
_asin:
|
||||
.asmfunc
|
||||
.if (.TMS320C2800_TMU0 = 1)
|
||||
MOV32 *SP++, R7H ; push R7H
|
||||
ABSF32 R1H, R0H ; phi = |theta|
|
||||
MPYF32 R2H, R0H, R0H ; R2H = phi^2
|
||||
MOVIZF32 R7H, #1.0 ; R7H = 1.0f
|
||||
SUBF32 R2H, R7H, R2H ; R2H = 1 - phi^2
|
||||
NOP
|
||||
CMPF32 R1H, R7H ; test for (|theta| > 1)
|
||||
MOVST0 NF, ZF ; copy flags
|
||||
SB asin_nan, GT ; NaN
|
||||
SQRTF32 R2H, R2H ; R2H = sqrt(1 = phi^2)
|
||||
CMPF32 R0H, #0.0 ; test sgn(theta)
|
||||
MOV32 *SP++, STF ; push flags
|
||||
NOP
|
||||
NOP
|
||||
DIVF32 R2H, R1H, R2H ; R2H = asin_v = phi / sqrt(1 = phi^2)
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
DIVF32 R3H, R7H, R2H ; R3H = 1 / asin_v
|
||||
MOVF32 R1H, #1.570796327 ; R1H = pi / 2
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
ATANPUF32 R0H, R2H ; R0H = atan(asin_v)
|
||||
ATANPUF32 R3H, R3H ; R3H = atan(1 / asin_v)
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
MPY2PIF32 R0H, R0H ; R0H = 2*pi*atan(asin_v)
|
||||
MPY2PIF32 R3H, R3H ; R3H = 2*pi*atan(1 / asin_v)
|
||||
NOP
|
||||
NOP
|
||||
SUBF32 R3H, R1H, R3H ; R3H = (pi/2) - 2*pi*atan(1 / asin_v)
|
||||
CMPF32 R2H, R7H ; set flags on asin_v
|
||||
MOV32 R0H, R3H, GT ; select asin
|
||||
MOV32 STF, *--SP ; pop flags
|
||||
NEGF32 R0H, R0H, LT ; set sign
|
||||
MOV32 R7H, *--SP, UNC ; pop R7H
|
||||
LRETR
|
||||
asin_nan:
|
||||
MOVIZ R0H, #0x7FC0 ; R0H = NaN
|
||||
MOV32 R7H, *--SP, UNC ; pop R7H
|
||||
LRETR
|
||||
.else
|
||||
.wmsg "WARNING - TMU0 NOT PRESENT: _asinf NOT BUILT"
|
||||
LRETR
|
||||
.endif
|
||||
.endasmfunc
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
|
||||
.end
|
||||
|
||||
; end of file
|
||||
@@ -0,0 +1,196 @@
|
||||
;;#############################################################################
|
||||
;;! \file source/fpu32/atan2_f32.asm
|
||||
;;!
|
||||
;;! \brief Fast atan2 function for the C28x + Floating-Point Unit.
|
||||
;;! \author N/A
|
||||
;;! \date N/A
|
||||
;;
|
||||
;; DESCRIPTION:
|
||||
;;
|
||||
;; This function computes a 32-bit floating point atan2 given a
|
||||
;; Y, X input. This function uses the FPU math tables to
|
||||
;; compute the atan2 resulting angle.
|
||||
;;
|
||||
;; FUNCTIONS:
|
||||
;;
|
||||
;; float32 atan2f (float32 Y, float32 X)
|
||||
;;
|
||||
;; ASSUMPTIONS:
|
||||
;;
|
||||
;; * FPU32atan2Table and FPU32atan2Table are linked into the project.
|
||||
;;
|
||||
;; ALGORITHM:
|
||||
;; The algorithm steps to calculate the "atan2" of the given
|
||||
;; input X and Y is as follows:
|
||||
;;
|
||||
;; Step(1): if( abs(X) >= abs(Y) )
|
||||
;; Numerator = abs(Y)
|
||||
;; Denominator = abs(X)
|
||||
;; else
|
||||
;; Numerator = abs(X)
|
||||
;; Denominator = abs(Y)
|
||||
;;
|
||||
;; Step(2): Ratio = Numerator/Denominator
|
||||
;;
|
||||
;; Note: Ratio range = 0.0 to 1.0
|
||||
;;
|
||||
;; Step(3): Use the upper 6-bits of the "Ratio" value as an
|
||||
;; index into the table to obtain the coefficients
|
||||
;; for a second order equation:
|
||||
;;
|
||||
;; _FPU32atan2Table:
|
||||
;; CoeffA0[0]
|
||||
;; CoeffA1[0]
|
||||
;; CoeffA2[0]
|
||||
;; .
|
||||
;; .
|
||||
;; CoeffA0[63]
|
||||
;; CoeffA1[63]
|
||||
;; CoeffA2[63]
|
||||
;;
|
||||
;; Step(4): Calculate the angle using the folowing equation:
|
||||
;;
|
||||
;; arctan(Ratio) = A0 + A1*Ratio + A2*Ratio*Ratio
|
||||
;; arctan(Ratio) = A0 + Ratio(A1 + A2*Ratio)
|
||||
;;
|
||||
;; Step(5): The final angle is determined as follows:
|
||||
;;
|
||||
;; if( X >= 0 and Y >= 0 and abs(X) >= abs(Y) )
|
||||
;; Angle = arctan(abs(Y)/abs(X))
|
||||
;; if( X >= 0 and Y >= 0 and abs(X) < abs(Y) )
|
||||
;; Angle = PI/2 - arctan(abs(X)/abs(Y))
|
||||
;; if( X < 0 and Y >= 0 and abs(X) < abs(Y) )
|
||||
;; Angle = PI/2 + arctan(abs(X)/abs(Y))
|
||||
;; if( X < 0 and Y >= 0 and abs(X) >= abs(Y) )
|
||||
;; Angle = PI - arctan(abs(Y)/abs(X))
|
||||
;; if( Y < 0 )
|
||||
;; Angle = -Angle
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
.page
|
||||
.if __TI_EABI__
|
||||
.asg FPU32atan2HalfPITable, _FPU32atan2HalfPITable
|
||||
.asg FPU32atan2Table, _FPU32atan2Table
|
||||
.asg atan2f, _atan2
|
||||
.endif
|
||||
.global _atan2
|
||||
.ref _FPU32atan2HalfPITable
|
||||
.ref _FPU32atan2Table
|
||||
.text
|
||||
|
||||
.if (__TI_EABI__ = 0)
|
||||
; For TI COFF double and float are the same size, so atan2f() and
|
||||
; atan2() should be the same function
|
||||
.global _atan2f
|
||||
_atan2f:
|
||||
.endif
|
||||
_atan2:
|
||||
.asmfunc
|
||||
MOV32 *SP++,R4H ; Save on entry register
|
||||
; R0H = Y on entry
|
||||
; R1H = X on entry
|
||||
; Perform Step (1):
|
||||
ABSF32 R3H, R0H ; (1) R3H = abs(Y)
|
||||
ABSF32 R4H, R1H ; (1) R4H = abs(X)
|
||||
MINF32 R3H, R4H ; (1) R3H = Numerator = min(abs(Y),abs(X))
|
||||
|| MOV32 R4H, R3H ; (1) R4H = Denominator = max(abs(Y),abs(X))
|
||||
; Perform Step (2) and (3):
|
||||
EINVF32 R2H, R4H ; (2) R2H = Ye = Estimate(1/Numerator)
|
||||
TESTTF LEQ ; (5) Set TF if abs(X) >= abs(Y)
|
||||
MPYF32 R0H, R2H, R4H ; (2) R0H = Ye*B
|
||||
|| MOV32 *SP++, R0H ; Store Y (*-SP[2] = Y)
|
||||
MPYF32 R1H, R2H, R3H ; (3) R1H = 16-bit accurate estimate
|
||||
|| MOV32 *SP++,R1H ; Store X (*-SP[4] = Y, *-SP[2] = X)
|
||||
SUBF32 R0H, #2.0, R0H ; (2) R0H = 2.0 - Ye*B
|
||||
MPYF32 R1H, R1H, 64.0 ; (3) 64 = Elements In Table
|
||||
MPYF32 R2H, R2H, R0H ; (2) R2H = Ye = Ye*(2.0 - Ye*B) (first estimate)
|
||||
F32TOUI16 R1H, R1H ; (3) R1H = int(64*ratio) (16-bit accurate)
|
||||
MPYF32 R0H, R2H, R4H ; (2) R0H = Ye*B
|
||||
MOVL XAR7, #_FPU32atan2Table+4 ; (3) Point to A2
|
||||
SUBF32 R0H, #2.0, R0H ; (2) R0H = 2.0 - Ye*B
|
||||
MOVL XAR6, #_FPU32atan2Table+2 ; Point to A1
|
||||
MOV32 ACC, R1H ; (3) ACC = int(64*Ratio)
|
||||
MPY P, @AL, #6 ; (3) P = 6 * int(64*Ratio)
|
||||
MOVZ AR0, @PL ; (3) AR0 = _FPU32atan2Table index
|
||||
MPYF32 R2H, R2H, R0H ; (2) R2H = Ye = Ye*(2.0 - Ye*B)
|
||||
MOVL XAR5, #_FPU32atan2Table ; Point to A0
|
||||
MPYF32 R0H, R3H, R2H ; (2) R0H = Ratio = A*Ye = A/B
|
||||
; Perform Step (4):
|
||||
; arctan(Ratio) = A0 + Ratio(A1 + A2*Ratio)
|
||||
MOV32 R1H, *+XAR7[AR0] ; (4) R1H = A2
|
||||
MPYF32 R3H, R1H, R0H ; (4) R3H = A2*Ratio
|
||||
|| MOV32 R1H, *+XAR6[AR0] ; (4) R1H = A1
|
||||
MOVL XAR7, #_FPU32atan2HalfPITable ; (5) *XAR7[2] == pi/2
|
||||
ADDF32 R3H, R1H, R3H ; (4) R3H = A1 + A2*Ratio
|
||||
|| MOV32 R4H, *+XAR5[AR0] ; (4) R4H = A0
|
||||
MOV32 R1H, *+XAR7[2], UNC ; (5) R1H = pi/2 (no flag change)
|
||||
MPYF32 R3H, R0H, R3H ; (4) R3H = Ratio*(A1 + A2*Ratio)
|
||||
NOP
|
||||
ADDF32 R0H, R4H, R3H ; (4) R0H = arctan(Ratio) = A0 + Ratio(A1 + A2*Ratio)
|
||||
|| MOV32 R2H, *--SP ; (5) R2H = X (set/clear NF,ZF for use below)
|
||||
; Perform Step (5):
|
||||
NEGF32 R3H, R1H, UNC ; (5) R3H = -pi/2 (no flag change)
|
||||
MOV32 R0H, R2H, EQ ; (5) if (X == 0), R0H = 0
|
||||
NEGF32 R0H, R0H, GEQ ; (5) if (X >= 0) R0H flip sign of atan(Ratio)
|
||||
NEGF32 R0H, R0H, TF ; (5) if (abs(X) >= abs(Y)) flip sign of atan(Ratio)
|
||||
NEGF32 R3H, R3H, LT ; (5) if (X < 0) R3H = pi/2
|
||||
ADDF32 R3H, R3H, R1H ; (5) R3H = R3H + pi/2
|
||||
; if (X < 0) R3H = pi
|
||||
; if (X > 0) R3H = 0
|
||||
|| MOV32 R2H, *--SP ; (5) R2H = Y (set/clear NF,ZF)
|
||||
MOV32 R4H, *--SP, UNC ; Restore save on entry register (no flag change)
|
||||
MOV32 R3H, R1H, NTF ; (5) if(abs(X) < abs(Y) R3H = pi/2
|
||||
ADDF32 R0H, R0H, R3H ; R0H = Angle
|
||||
NOP
|
||||
NEGF32 R0H, R0H, LT ; if (Y < 0) Angle = -Angle
|
||||
LRETR
|
||||
.endasmfunc
|
||||
|
||||
|
||||
;; End of File
|
||||
@@ -0,0 +1,184 @@
|
||||
;;#############################################################################
|
||||
;;! \file source/fpu32/atan_f32.asm
|
||||
;;!
|
||||
;;! \brief Fast atan function for the C28x + Floating-Point Unit.
|
||||
;;! \author N/A
|
||||
;;! \date N/A
|
||||
;;
|
||||
;; DESCRIPTION:
|
||||
;;
|
||||
;; This function computes a 32-bit floating point atan given a
|
||||
;; Y input. This function uses the FPU math tables to
|
||||
;; compute the atan resulting angle.
|
||||
;;
|
||||
;; FUNCTIONS:
|
||||
;;
|
||||
;; float32 atanf (float32 Y)
|
||||
;;
|
||||
;; ASSUMPTIONS:
|
||||
;;
|
||||
;; * FPU32atan2Table and FPU32atan2Table are linked into the project.
|
||||
;;
|
||||
;; ALGORITHM:
|
||||
;; Step(1): if( 1.0 >= abs(Y) )
|
||||
;; Numerator = abs(Y)
|
||||
;; Denominator = 1.0
|
||||
;; else
|
||||
;; Numerator = 1.0
|
||||
;; Denominator = abs(Y)
|
||||
;;
|
||||
;; Step(2): Ratio = Numerator/Denominator
|
||||
;;
|
||||
;; Note: Ratio range = 0.0 to 1.0
|
||||
;;
|
||||
;; Step(3): Use the upper 6-bits of the "Ratio" value as an
|
||||
;; index into the table to obtain the coefficients
|
||||
;; for a second order equation:
|
||||
;;
|
||||
;; _FPU32atan2Table:
|
||||
;; CoeffA0[0]
|
||||
;; CoeffA1[0]
|
||||
;; CoeffA2[0]
|
||||
;; .
|
||||
;; .
|
||||
;; CoeffA0[63]
|
||||
;; CoeffA1[63]
|
||||
;; CoeffA2[63]
|
||||
;;
|
||||
;; Step(4): Calculate the angle using the folowing equation:
|
||||
;;
|
||||
;; arctan(Ratio) = A0 + A1*Ratio + A2*Ratio*Ratio
|
||||
;; arctan(Ratio) = A0 + Ratio(A1 + A2*Ratio)
|
||||
;;
|
||||
;; Step(5): The final angle is determined as follows:
|
||||
;;
|
||||
;; if( Y >= 0 and 1.0 >= abs(Y) )
|
||||
;; Angle = arctan(abs(Y)/1.0)
|
||||
;; if( Y >= 0 and 1.0 < abs(Y) )
|
||||
;; Angle = PI/2 - arctan(1.0/abs(Y))
|
||||
;; if( Y < 0 )
|
||||
;; Angle = -Angle
|
||||
;;
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
.page
|
||||
.if __TI_EABI__
|
||||
.asg atanf, _atan
|
||||
.asg FPU32atan2HalfPITable, _FPU32atan2HalfPITable
|
||||
.asg FPU32atan2Table, _FPU32atan2Table
|
||||
.endif
|
||||
.global _atan
|
||||
.ref _FPU32atan2HalfPITable
|
||||
.ref _FPU32atan2Table
|
||||
.text
|
||||
|
||||
.if (__TI_EABI__ = 0)
|
||||
; For TI COFF double and float are the same size, so atanf() and atan()
|
||||
; should be the same function
|
||||
.global _atanf
|
||||
_atanf:
|
||||
.endif
|
||||
_atan:
|
||||
.asmfunc
|
||||
MOV32 *SP++,R4H ; Save on entry register
|
||||
; R0H = Y on entry
|
||||
; Perform Step (1):
|
||||
ABSF32 R3H, R0H ; (1) R3H = abs(Y)
|
||||
MOVIZ R4H, #0x3F80 ; R4H = 1.0
|
||||
|
||||
MINF32 R3H, R4H ; (1) R3H = Numerator = min(abs(Y),1.0)
|
||||
|| MOV32 R4H, R3H ; (1) R4H = Denominator = max(abs(Y),1.0)
|
||||
|
||||
; Perform Step (2) and (3):
|
||||
EINVF32 R2H, R4H ; (2) R2H = Ye = Estimate(1/Numerator)
|
||||
TESTTF LEQ ; (5) Set TF if 1.0 >= abs(Y)
|
||||
MPYF32 R0H, R2H, R4H ; (2) R0H = Ye*B
|
||||
|| MOV32 *SP++, R0H ; Store Y (*-SP[2] = Y)
|
||||
MPYF32 R1H, R2H, R3H ; (3) R1H = 16-bit accurate estimate
|
||||
SUBF32 R0H, #2.0, R0H ; (2) R0H = 2.0 - Ye*B
|
||||
MPYF32 R1H, R1H, 64.0 ; (3) 64 = Elements In Table
|
||||
MPYF32 R2H, R2H, R0H ; (2) R2H = Ye = Ye*(2.0 - Ye*B) (first estimate)
|
||||
F32TOUI16 R1H, R1H ; (3) R1H = int(64*ratio) (16-bit accurate)
|
||||
MPYF32 R0H, R2H, R4H ; (2) R0H = Ye*B
|
||||
MOVL XAR7, #_FPU32atan2Table+4 ; (3) Point to A2
|
||||
SUBF32 R0H, #2.0, R0H ; (2) R0H = 2.0 - Ye*B
|
||||
MOVL XAR6, #_FPU32atan2Table+2 ; Point to A1
|
||||
MOV32 ACC, R1H ; (3) ACC = int(64*Ratio)
|
||||
MPY P, @AL, #6 ; (3) P = 6 * int(64*Ratio)
|
||||
MOVZ AR0, @PL ; (3) AR0 = _FPU32atan2Table index
|
||||
MPYF32 R2H, R2H, R0H ; (2) R2H = Ye = Ye*(2.0 - Ye*B)
|
||||
MOVL XAR5, #_FPU32atan2Table ; Point to A0
|
||||
MPYF32 R0H, R3H, R2H ; (2) R0H = Ratio = A*Ye = A/B
|
||||
; Perform Step (4):
|
||||
; arctan(Ratio) = A0 + Ratio(A1 + A2*Ratio)
|
||||
MOV32 R1H, *+XAR7[AR0] ; (4) R1H = A2
|
||||
MPYF32 R3H, R1H, R0H ; (4) R3H = A2*Ratio
|
||||
|| MOV32 R1H, *+XAR6[AR0] ; (4) R1H = A1
|
||||
MOVL XAR7, #_FPU32atan2HalfPITable ; (5) *XAR7[2] == pi/2
|
||||
ADDF32 R3H, R1H, R3H ; (4) R3H = A1 + A2*Ratio
|
||||
|| MOV32 R4H, *+XAR5[AR0] ; (4) R4H = A0
|
||||
MOV32 R1H, *+XAR7[2], UNC ; (5) R1H = pi/2 (no flag change)
|
||||
MPYF32 R3H, R0H, R3H ; (4) R3H = Ratio*(A1 + A2*Ratio)
|
||||
NOP
|
||||
ADDF32 R0H, R4H, R3H ; (4) R0H = arctan(Ratio) = A0 + Ratio(A1 + A2*Ratio)
|
||||
|
||||
; Perform Step (5):
|
||||
ZERO R3H
|
||||
NEGF32 R0H, R0H, UNC ; (5) R0H = flip sign of atan(Ratio)
|
||||
NEGF32 R0H, R0H, TF ; (5) if (1.0 >= abs(Y)) flip sign of atan(Ratio)
|
||||
MOV32 R2H, *--SP ; (5) R2H = Y (set/clear NF,ZF)
|
||||
MOV32 R4H, *--SP, UNC ; Restore save on entry register (no flag change)
|
||||
MOV32 R3H, R1H, NTF ; (5) if(1.0 < abs(Y) R3H = pi/2, else R3H = 0.0
|
||||
ADDF32 R0H, R0H, R3H ; R0H = Angle
|
||||
NOP
|
||||
NEGF32 R0H, R0H, LT ; if (Y < 0) Angle = -Angle
|
||||
LRETR
|
||||
.endasmfunc
|
||||
|
||||
;; End of File
|
||||
@@ -0,0 +1,143 @@
|
||||
;;#############################################################################
|
||||
;;! \file source/fpu32/cos_f32.asm
|
||||
;;!
|
||||
;;! \brief Fast cos function for the C28x + Floating-Point Unit.
|
||||
;;! \author N/A
|
||||
;;! \date N/A
|
||||
;;
|
||||
;; DESCRIPTION:
|
||||
;;
|
||||
;; This function computes a 32-bit floating point cos given a
|
||||
;; radian input. This function uses the FPU math tables to
|
||||
;; compute the cos.
|
||||
;;
|
||||
;; FUNCTIONS:
|
||||
;;
|
||||
;; float32 cosf (float32 radian)
|
||||
;;
|
||||
;; ASSUMPTIONS:
|
||||
;;
|
||||
;; * FPU32sinTable and FPU32cosTable are linked into the project.
|
||||
;;
|
||||
;; ALGORITHM:
|
||||
;;
|
||||
;; The cos value is calculated as follows:
|
||||
;;
|
||||
;; 1) The offset into a 512 word sin/cos table is calculated:
|
||||
;; k = 0x1FF & (int(Radian*512/(2*pi)))
|
||||
;;
|
||||
;;
|
||||
;; 2) The fractional component between table samples is
|
||||
;; calculated:
|
||||
;; x = fract(Radian*512/2*pi) * (2*pi)/512
|
||||
;;
|
||||
;; 3) The output sine value is calculated as follows:
|
||||
;;
|
||||
;; cos(Radian) = C(k) + x*(-S(k) + x*(-0.5*C(k) + 0.166667*x*S(k)))
|
||||
;;
|
||||
;; sin(Radian) = S(k) + x*(C(k) + x*(-0.5*S(k) - 0.166667*x*C(k)))
|
||||
;;
|
||||
;; where S(k) = Sin table value at offset "k"
|
||||
;; C(k) = Cos table value at offset "k"
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
.page
|
||||
.if __TI_EABI__
|
||||
.asg cosf, _cos
|
||||
.asg FPU32sinTable, _FPU32sinTable
|
||||
.asg FPU32cosTable, _FPU32cosTable
|
||||
.endif
|
||||
.global _cos
|
||||
.ref _FPU32sinTable
|
||||
.ref _FPU32cosTable
|
||||
.text
|
||||
.if (__TI_EABI__ = 0)
|
||||
; For TI COFF double and float are the same size, so cosf() and
|
||||
; cos() should be the same function
|
||||
.global _cosf
|
||||
_cosf:
|
||||
.endif
|
||||
_cos: .asmfunc ; R0H = Radian (on entry)
|
||||
MOVIZ R1H,#0x42A2 ; R1H = 512/(2*pi) = 512/6.28318531 = 81.4873309
|
||||
MOVXI R1H,#0xF983
|
||||
MPYF32 R0H, R0H, R1H ; R0H = Radian * 512/(2*pi)
|
||||
MOVIZ R2H,#0x3C49 ; R2H = (2*pi)/512 = 6.28318531/512
|
||||
MOVXI R2H,#0x0FDB ; = 0x3C490FDB or 0.012271846644531
|
||||
F32TOI32 R1H, R0H ; R1H = int(Radian * 512/(2*pi))
|
||||
MOVL XAR6,#_FPU32sinTable
|
||||
MOVL XAR7,#_FPU32cosTable
|
||||
MOV32 ACC, R1H ; ACC = int(Radian *512/(2*pi))
|
||||
AND @AL,#0x1FF
|
||||
LSL AL,#1
|
||||
MOVZ AR0,@AL ; AR0 = Index into "sin/cos" table = k
|
||||
FRACF32 R0H, R0H ; R0H = fract(Radian*512/(2*pi))
|
||||
MOVIZ R3H,#0x3E2A ; R3H = 0.166667 (0x3E2AAAAB)
|
||||
MOVXI R3H,#0xAAAB
|
||||
MPYF32 R2H, R0H, R2H ; R2H = x = fract(Radian*512/(2*pi)) * (2*pi)/512
|
||||
|| MOV32 R1H,*+XAR6[AR0] ; R1H = S(k)
|
||||
MPYF32 R3H, R3H, R1H ; R3H = .166*C(k)
|
||||
|| MOV32 R0H,*+XAR7[AR0] ; R0H = C(k)
|
||||
MPYF32 R0H, -0.5, R0H ; R0H = -.5*C(k)
|
||||
MPYF32 R3H, R2H, R3H ; R1H = x*0.166667*S(k)
|
||||
NOP
|
||||
ADDF32 R0H, R0H, R3H ; R0H = -.5*C(k) + 0.166667*x*S(k)
|
||||
NOP
|
||||
MPYF32 R3H, R2H, R0H ; R3H = x*(-.5*C(k) + 0.166667*x*S(k))
|
||||
|| MOV32 R1H, *+XAR6[AR0] ; R1H = S(k)
|
||||
NOP
|
||||
SUBF32 R3H, R3H, R1H ; R3H = -S(k) + x*(-.5*C(k) + 0.166667*x*S(k))
|
||||
NOP
|
||||
MPYF32 R3H, R2H, R3H ; R3H = x*(-S(k) + x*(-.5*C(k) + 0.166667*x*S(k)))
|
||||
|| MOV32 R0H, *+XAR7[AR0] ; R0H = C(k)
|
||||
NOP
|
||||
ADDF32 R0H, R0H, R3H ; R0H = cos(Radian) = C(k) + x*(-S(k) + x*(-.5*C(k) + 0.166667*x*S(k)))
|
||||
LRETR
|
||||
.endasmfunc
|
||||
|
||||
;; End of File
|
||||
@@ -0,0 +1,111 @@
|
||||
;;#############################################################################
|
||||
;;! \file source/fpu32/div_f32.asm
|
||||
;;!
|
||||
;;! \brief Fast 32-bit floating-point division for the C28x + Floating-Point
|
||||
;;! Unit.
|
||||
;;! \author N/A
|
||||
;;! \date N/A
|
||||
;;
|
||||
;; DESCRIPTION:
|
||||
;;
|
||||
;; This function computes a 32-bit floating point division A/B.
|
||||
;;
|
||||
;; FUNCTIONS:
|
||||
;;
|
||||
;; This funciton (FS$$DIV) will be called when 32-bit floating point
|
||||
;; division is performed. That is:
|
||||
;;
|
||||
;; float32 A,B,Y;
|
||||
;; ...
|
||||
;; <A & B initalized>
|
||||
;; ...
|
||||
;; Y = A/B; // Call to FS$$DIV
|
||||
;;
|
||||
;; ASSUMPTIONS:
|
||||
;;
|
||||
;;
|
||||
;; ALGORITHM:
|
||||
;;
|
||||
;; Ye = Estimate(1/B);
|
||||
;; Ye = Ye*(2.0 - Ye*B)
|
||||
;; Ye = Ye*(2.0 - Ye*B)
|
||||
;; Y = A*Ye
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
.page
|
||||
.text
|
||||
.if __TI_EABI__
|
||||
.asg __c28xabi_divf, FS$$DIV
|
||||
.endif
|
||||
.global FS$$DIV
|
||||
|
||||
FS$$DIV:
|
||||
|
||||
EINVF32 R2H, R1H ; R2H = Ye = Estimate(1/B)
|
||||
CMPF32 R0H, #0.0 ; Check if A == 0
|
||||
MPYF32 R3H, R2H, R1H ; R3H = Ye*B
|
||||
NOP
|
||||
SUBF32 R3H, #2.0, R3H ; R3H = 2.0 - Ye*B
|
||||
NOP
|
||||
MPYF32 R2H, R2H, R3H ; R2H = Ye = Ye*(2.0 - Ye*B)
|
||||
NOP
|
||||
; Next line: if commented out: 0.0/0.0 = 0.0
|
||||
; if not commented: 0.0/0.0 = infinity
|
||||
; MOV32 R2H, R0H, EQ ; If A == 0.0, Ye = 0.0
|
||||
MPYF32 R3H, R2H, R1H ; R3H = Ye*B
|
||||
CMPF32 R1H, #0.0 ; Check if B == 0.0
|
||||
SUBF32 R3H, #2.0, R3H ; R3H = 2.0 - Ye*B
|
||||
NEGF32 R0H, R0H, EQ ; Fixes sign for A/0.0
|
||||
MPYF32 R2H, R2H, R3H ; R2H = Ye = Ye*(2.0 - Ye*B)
|
||||
NOP
|
||||
MPYF32 R0H, R0H, R2H ; R0H = Y = A*Ye = A/B
|
||||
LRETR
|
||||
.endasmfunc
|
||||
|
||||
;; End of File
|
||||
@@ -0,0 +1,205 @@
|
||||
;;#############################################################################
|
||||
;;! \file source/fpu32/exp_f32.asm
|
||||
;;!
|
||||
;;! \brief Fast single precision exponent for the C28x + FPU32
|
||||
;;! \author Vishal Coelho
|
||||
;;! \date 01/19/2017
|
||||
;;
|
||||
;; DESCRIPTION:
|
||||
;;
|
||||
;; This function computes the 32-bit floating point exp(x)
|
||||
;;
|
||||
;; FUNCTIONS:
|
||||
;;
|
||||
;; This funciton will be called whenever the standard C library function
|
||||
;; exp() is called.
|
||||
;;
|
||||
;; float32 X,Y;
|
||||
;; ...
|
||||
;; <X initalized>
|
||||
;; ...
|
||||
;; Y = expf(X);
|
||||
;;
|
||||
;; ASSUMPTIONS:
|
||||
;;
|
||||
;; ALGORITHM:
|
||||
;;
|
||||
;; 1. calculate the absolute of x, |x|
|
||||
;; 2. Separate the integer and fractional portion of the input
|
||||
;; 3. Get e^integer(x) from the table
|
||||
;; 4. Calculate e^(fraction) by using the Taylor series expansion for
|
||||
;; exponents
|
||||
;; x
|
||||
;; e = 1 + x*(1+x/2*(1+x/3*(1+x/4*(1+x/5*(1+x/6*(1+x/7)+...)))))
|
||||
;;
|
||||
;; 5. The result, $e^{x} = e^{integer}*e^{fraction}$
|
||||
;; 6. If x was negative, calculate the inverse of the result
|
||||
;;
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
|
||||
;; external references
|
||||
.if __TI_EABI__
|
||||
.asg expf, _exp
|
||||
.asg FPU32expTable, _FPU32expTable
|
||||
.asg FPU32expTableCoeff, _FPU32expTableCoeff
|
||||
.endif
|
||||
|
||||
.ref _FPU32expTable
|
||||
.ref _FPU32expTableCoeff
|
||||
|
||||
;;*****************************************************************************
|
||||
;; Register Usage:
|
||||
;; XAR0: pointer to the lookup table | R0H : x, argument
|
||||
;; XAR1: pointer to the exp coeffs | R1H : x_f
|
||||
;; XAR2: storing the lookup tabe index | R2H :
|
||||
;; | R3H :
|
||||
;; | R4H : x_i, index into lookup table
|
||||
;;
|
||||
;; Stack Usage:
|
||||
;;
|
||||
;; |_______|<- Stack Pointer (SP)
|
||||
;; |_______|<- R4H (SP-2)
|
||||
;; |_______|<- rpc calling function (SP-4)
|
||||
;;
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.global _exp
|
||||
.sect ".text"
|
||||
.if (__TI_EABI__ = 0)
|
||||
; For TI COFF double and float are the same size, so expf() and
|
||||
; exp() should be the same function
|
||||
.global _expf
|
||||
_expf:
|
||||
.endif
|
||||
_exp: .asmfunc
|
||||
;;-----------------------------------------------------------------------------
|
||||
;; Context Save
|
||||
;;-----------------------------------------------------------------------------
|
||||
MOV32 *SP++,R4H
|
||||
; [20200310] these two instructions added to protect XAR1 & XAR2
|
||||
PUSH XAR1
|
||||
PUSH XAR2
|
||||
;;-----------------------------------------------------------------------------
|
||||
;; The algorithm
|
||||
;;-----------------------------------------------------------------------------
|
||||
MOV32 R4H, R0H ; R4H = x (may set ZF, NF)
|
||||
TESTTF LT ; (x < 0.0)? TF = 1: TF = 0
|
||||
ABSF32 R4H, R0H ; R4H = |x|
|
||||
FRACF32 R1H, R4H ; *| R1H = frac(|x|) or x_f
|
||||
MOVL XAR1, #_FPU32expTableCoeff
|
||||
; 1| XAR1 -> FPU32expTableCoeff[0]
|
||||
MOV32 R2H, *XAR1++ ; R2H = 1/7
|
||||
MPYF32 R2H, R2H, R1H ; *| R2H = x_f/7
|
||||
|| MOV32 R3H, *XAR1++ ; | R3H = 1/6
|
||||
MPYF32 R3H, R1H, R3H ; 1|*| R3H = x_f/6
|
||||
|| MOV32 R0H, *XAR1++ ; | | R0H = 1/5
|
||||
ADDF32 R2H, #1.0, R2H ; *|1| R2H = 1+x_f/7
|
||||
MPYF32 R4H, #2.0, R4H ; 1|*| R4H = 2*x_i
|
||||
MPYF32 R2H, R3H, R2H ; *|1| R2H = x_f/6*(1+x_f/7)
|
||||
MPYF32 R0H, R1H, R0H ; 1|*| R0H = x_f/5
|
||||
|| MOV32 R3H, *XAR1++ ; | | R3H = 1/4
|
||||
ADDF32 R2H, #1.0, R2H ; *|1| R2H = 1+x_f/6*(1+x_f/7)
|
||||
F32TOI32 R4H, R4H ; 1|*| R4H = 2*x_i
|
||||
MPYF32 R2H, R0H, R2H ; *|1| R2H = x_f/5*(1+x_f/6*(1+x_f/7))
|
||||
MPYF32 R3H, R1H, R3H ; 1|*| R3H = x_f/4
|
||||
|| MOV32 R0H, *XAR1++ ; | | R0H = 1/3
|
||||
ADDF32 R2H, #1.0, R2H ; *|1| R2H = 1+x_f/5*(1+x_f/6*(1+x_f/7))
|
||||
MOV32 XAR2, R4H ; 1| XAR2 = sizeof(float)*x_i
|
||||
MOVL XAR0, #_FPU32expTable ; 1| XAR0 -> FPU32expTable[0]
|
||||
; R2H = x_f/4*(1+x_f/5*(1+x_f/6*(1+x_f/7)))
|
||||
MPYF32 R2H, R3H, R2H ; *|
|
||||
MPYF32 R0H, R1H, R0H ; 1|*| R0H = x_f/3
|
||||
; R2H = 1+x_f/4*(1+x_f/5*(1+x_f/6*(1+x_f/7)))
|
||||
ADDF32 R2H, #1.0, R2H ; *|1|
|
||||
MOV32 R3H, *XAR1++ ; 1| R3H = 1/2
|
||||
; R2H = x_f/3*(1+x_f/4*(1+x_f/5*(1+x_f/6*(1+x_f/7))))
|
||||
MPYF32 R2H, R0H, R2H ; *|
|
||||
MPYF32 R3H, R1H, R3H ; 1|*| R3H = x_f/2
|
||||
; R2H = 1+x_f/3*(1+x_f/4*(1+x_f/5*(1+x_f/6*(1+x_f/7))))
|
||||
MOVL ACC, XAR0 ; *|1|
|
||||
ADDF32 R2H, #1.0, R2H ; *|1|
|
||||
ADDL ACC, @XAR2 ; 1| ACC->FPU32expTable[x_i]
|
||||
; R2H = x_f/2*(1+x_f/3*(1+x_f/4*(1+x_f/5*(1+x_f/6*(1+x_f/7)))))
|
||||
MPYF32 R2H, R3H, R2H ; *|
|
||||
MOVL XAR0, ACC ; 1| XAR0->FPU32expTable[x_i]
|
||||
; R2H = 1+x_f/2*(1+x_f/3*(1+x_f/4*(1+x_f/5*(1+x_f/6*(1+x_f/7)))))
|
||||
ADDF32 R2H, #1.0, R2H ; *|
|
||||
; [20200310] these two instructions added to protect XAR1 & XAR2
|
||||
POP XAR2 ; 1| restore XAR2
|
||||
POP XAR1 ; 1| restore XAR1
|
||||
MOV32 R4H, *--SP ; 1| restore R4H
|
||||
; R2H = x_f*(1+x_f/2*(1+x_f/3*(1+x_f/4*(1+x_f/5*(1+x_f/6*(1+x_f/7))))))
|
||||
MPYF32 R2H, R1H, R2H ; *|
|
||||
MOV32 R1H, *XAR0 ; 1| R1H = FPU32expTable[x_i]
|
||||
; R2H = 1+x_f*(1+x_f/2*(1+x_f/3*(1+x_f/4*(1+x_f/5*(1+x_f/6*(1+x_f/7))))))
|
||||
ADDF32 R2H, #1.0, R2H ; *|
|
||||
NOP ; 1|
|
||||
MPYF32 R2H, R1H, R2H ; *| R2H = e^x = e^(x_i)*e^(x_f)
|
||||
NOP ; 1|
|
||||
EINVF32 R1H, R2H ; *| R1H = Ye = 1/e^x
|
||||
NOP ; 1|
|
||||
MPYF32 R3H, R1H, R2H ; *| R3H = Ye*e^x
|
||||
NOP ; 1|
|
||||
SUBF32 R3H, #2.0, R3H ; *| R3H = 2.0 - Ye*e^x
|
||||
NOP ; 1|
|
||||
MPYF32 R1H, R1H, R3H ; *| R1H = Yee = Ye*(2.0 - Ye*e^x)
|
||||
NOP ; 1|
|
||||
MPYF32 R3H, R1H, R2H ; *| R3H = Yee*e^x
|
||||
NOP ; 1|
|
||||
SUBF32 R3H, #2.0, R3H ; *| R3H = 2.0 - Yee*e^x
|
||||
NOP ; 1|
|
||||
MPYF32 R0H, R1H, R3H ; *| R0H = Yeee = Yee*(2.0-Yee*e^x)
|
||||
NOP ; 1|
|
||||
MOV32 R0H, R2H, NTF ; | R0H = e^x if TF = 0
|
||||
LRETR
|
||||
.endasmfunc
|
||||
|
||||
|
||||
;; End of File
|
||||
@@ -0,0 +1,176 @@
|
||||
;;#############################################################################
|
||||
;;! \file exptable_f32.asm
|
||||
;;! \brief Exponent Lookup Table (89)
|
||||
;;! \author Vishal Coelho
|
||||
;;! \date 19-Jan-2017
|
||||
;;!
|
||||
;; Revision History:
|
||||
;;+----------+---------------+------------------------------------------------+
|
||||
;;| DATE | AUTHOR | CHANGE |
|
||||
;;+----------+---------------+------------------------------------------------+
|
||||
;;| 01/16/18 | Ritvik Sadana | Modified symbol names to keep naming |
|
||||
;;| | | consistent with FPU64 symbols. |
|
||||
;;+----------+---------------+------------------------------------------------+
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
.if __TI_EABI__
|
||||
.asg FPU32expTableCoeff, _FPU32expTableCoeff
|
||||
.asg FPU32expTableCoeffEnd, _FPU32expTableCoeffEnd
|
||||
.asg FPU32expTable, _FPU32expTable
|
||||
.asg FPU32expTableEnd, _FPU32expTableEnd
|
||||
.endif
|
||||
.def _FPU32expTableCoeff
|
||||
.def _FPU32expTableCoeffEnd
|
||||
.def _FPU32expTable
|
||||
.def _FPU32expTableEnd
|
||||
|
||||
.sect "FPUmathTables"
|
||||
|
||||
_FPU32expTableCoeff:
|
||||
.float 0.1428571428571 ; 1/7
|
||||
.float 0.1666666666667 ; 1/6
|
||||
.float 0.2000000000000 ; 1/5
|
||||
.float 0.2500000000000 ; 1/4
|
||||
.float 0.3333333333333 ; 1/3
|
||||
.float 0.5000000000000 ; 1/2
|
||||
_FPU32expTableCoeffEnd:
|
||||
|
||||
_FPU32expTable:
|
||||
.float 1.0000000000000e+00 ; exp( 0)
|
||||
.float 2.7182817459106e+00 ; exp( 1)
|
||||
.float 7.3890562057495e+00 ; exp( 2)
|
||||
.float 2.0085536956787e+01 ; exp( 3)
|
||||
.float 5.4598152160645e+01 ; exp( 4)
|
||||
.float 1.4841316223145e+02 ; exp( 5)
|
||||
.float 4.0342880249023e+02 ; exp( 6)
|
||||
.float 1.0966331787109e+03 ; exp( 7)
|
||||
.float 2.9809580078125e+03 ; exp( 8)
|
||||
.float 8.1030839843750e+03 ; exp( 9)
|
||||
.float 2.2026464843750e+04 ; exp( 10)
|
||||
.float 5.9874140625000e+04 ; exp( 11)
|
||||
.float 1.6275479687500e+05 ; exp( 12)
|
||||
.float 4.4241337500000e+05 ; exp( 13)
|
||||
.float 1.2026042500000e+06 ; exp( 14)
|
||||
.float 3.2690175000000e+06 ; exp( 15)
|
||||
.float 8.8861110000000e+06 ; exp( 16)
|
||||
.float 2.4154952000000e+07 ; exp( 17)
|
||||
.float 6.5659968000000e+07 ; exp( 18)
|
||||
.float 1.7848230400000e+08 ; exp( 19)
|
||||
.float 4.8516518400000e+08 ; exp( 20)
|
||||
.float 1.3188157440000e+09 ; exp( 21)
|
||||
.float 3.5849128960000e+09 ; exp( 22)
|
||||
.float 9.7448038400000e+09 ; exp( 23)
|
||||
.float 2.6489122816000e+10 ; exp( 24)
|
||||
.float 7.2004902912000e+10 ; exp( 25)
|
||||
.float 1.9572962099200e+11 ; exp( 26)
|
||||
.float 5.3204824883200e+11 ; exp( 27)
|
||||
.float 1.4462570987520e+12 ; exp( 28)
|
||||
.float 3.9313342464000e+12 ; exp( 29)
|
||||
.float 1.0686474223616e+13 ; exp( 30)
|
||||
.float 2.9048849825792e+13 ; exp( 31)
|
||||
.float 7.8962956959744e+13 ; exp( 32)
|
||||
.float 2.1464357430886e+14 ; exp( 33)
|
||||
.float 5.8346171059405e+14 ; exp( 34)
|
||||
.float 1.5860134450299e+15 ; exp( 35)
|
||||
.float 4.3112315318436e+15 ; exp( 36)
|
||||
.float 1.1719142537167e+16 ; exp( 37)
|
||||
.float 3.1855931348222e+16 ; exp( 38)
|
||||
.float 8.6593404045099e+16 ; exp( 39)
|
||||
.float 2.3538527034042e+17 ; exp( 40)
|
||||
.float 6.3984347447611e+17 ; exp( 41)
|
||||
.float 1.7392749753422e+18 ; exp( 42)
|
||||
.float 4.7278395262973e+18 ; exp( 43)
|
||||
.float 1.2851599879818e+19 ; exp( 44)
|
||||
.float 3.4934270576908e+19 ; exp( 45)
|
||||
.float 9.4961195300688e+19 ; exp( 46)
|
||||
.float 2.5813128932181e+20 ; exp( 47)
|
||||
.float 7.0167362905576e+20 ; exp( 48)
|
||||
.float 1.9073464997854e+21 ; exp( 49)
|
||||
.float 5.1847054576655e+21 ; exp( 50)
|
||||
.float 1.4093490364499e+22 ; exp( 51)
|
||||
.float 3.8310081899410e+22 ; exp( 52)
|
||||
.float 1.0413759887482e+23 ; exp( 53)
|
||||
.float 2.8307533984544e+23 ; exp( 54)
|
||||
.float 7.6947854714906e+23 ; exp( 55)
|
||||
.float 2.0916594490409e+24 ; exp( 56)
|
||||
.float 5.6857200220030e+24 ; exp( 57)
|
||||
.float 1.5455390078758e+25 ; exp( 58)
|
||||
.float 4.2012104528050e+25 ; exp( 59)
|
||||
.float 1.1420073962419e+26 ; exp( 60)
|
||||
.float 3.1042977826582e+26 ; exp( 61)
|
||||
.float 8.4383568232726e+26 ; exp( 62)
|
||||
.float 2.2937831182341e+27 ; exp( 63)
|
||||
.float 6.2351494320497e+27 ; exp( 64)
|
||||
.float 1.6948892066757e+28 ; exp( 65)
|
||||
.float 4.6071865476425e+28 ; exp( 66)
|
||||
.float 1.2523631854447e+29 ; exp( 67)
|
||||
.float 3.4042761729011e+29 ; exp( 68)
|
||||
.float 9.2537816213739e+29 ; exp( 69)
|
||||
.float 2.5154387003559e+30 ; exp( 70)
|
||||
.float 6.8376711375563e+30 ; exp( 71)
|
||||
.float 1.8586717056324e+31 ; exp( 72)
|
||||
.float 5.0523935602179e+31 ; exp( 73)
|
||||
.float 1.3733829622695e+32 ; exp( 74)
|
||||
.float 3.7332418496475e+32 ; exp( 75)
|
||||
.float 1.0148004187492e+33 ; exp( 76)
|
||||
.float 2.7585135499700e+33 ; exp( 77)
|
||||
.float 7.4984169815783e+33 ; exp( 78)
|
||||
.float 2.0382810254658e+34 ; exp( 79)
|
||||
.float 5.5406224846768e+34 ; exp( 80)
|
||||
.float 1.5060972626944e+35 ; exp( 81)
|
||||
.float 4.0939968518217e+35 ; exp( 82)
|
||||
.float 1.1128637275465e+36 ; exp( 83)
|
||||
.float 3.0250773415263e+36 ; exp( 84)
|
||||
.float 8.2230123930183e+36 ; exp( 85)
|
||||
.float 2.2352465286716e+37 ; exp( 86)
|
||||
.float 6.0760303473996e+37 ; exp( 87)
|
||||
.float 1.6516362661361e+38 ; exp( 88)
|
||||
_FPU32expTableEnd:
|
||||
|
||||
;; End of File
|
||||
@@ -0,0 +1,108 @@
|
||||
;;#############################################################################
|
||||
;;! \file source/fpu32/isqrt_f32.asm
|
||||
;;!
|
||||
;;! \brief Fast 32-bit floating-point 1.0/sqrt(X) for the C28x + Floating-Point Unit.
|
||||
;;! \author N/A
|
||||
;;! \date N/A
|
||||
;;
|
||||
;;
|
||||
;;DESCRIPTION:
|
||||
;;
|
||||
;; This function computes a 32-bit floating point (1.0)/sqrt(X)
|
||||
;; Note: This function is not part of the normal RTS library.
|
||||
;;
|
||||
;;FUNCTIONS:
|
||||
;;
|
||||
;; float32 isqrtf(float32 X)
|
||||
;;
|
||||
;;ASSUMPTIONS:
|
||||
;;
|
||||
;;
|
||||
;;ALGORITHM:
|
||||
;;
|
||||
;; Ye = Estimate(1/sqrt(X));
|
||||
;; Ye = Ye*(1.5 - Ye*Ye*X*0.5)
|
||||
;; Y = Ye*(1.5 - Ye*Ye*X*0.5)
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
.page
|
||||
.if __TI_EABI__
|
||||
.asg isqrtf, _isqrt
|
||||
.endif
|
||||
.global _isqrt
|
||||
.text
|
||||
.if (__TI_EABI__ = 0)
|
||||
; For TI COFF double and float are the same size, so isqrtf() and
|
||||
; isqrt() should be the same function
|
||||
.global _isqrtf
|
||||
_isqrtf:
|
||||
.endif
|
||||
_isqrt:
|
||||
EISQRTF32 R1H,R0H ; R1H = Ye = Estimate(1/sqrt(X))
|
||||
MPYF32 R2H,R0H,#0.5 ; R2H = X*0.5
|
||||
MPYF32 R3H,R1H,R1H ; R3H = Ye*Ye
|
||||
NOP
|
||||
MPYF32 R3H,R3H,R2H ; R3H = Ye*Ye*X*0.5
|
||||
NOP
|
||||
SUBF32 R3H,#1.5,R3H ; R3H = 1.5 - Ye*Ye*X*0.5
|
||||
NOP
|
||||
MPYF32 R1H,R1H,R3H ; R2H = Ye = Ye*(1.5 - Ye*Ye*X*0.5)
|
||||
NOP
|
||||
|
||||
MPYF32 R3H,R1H,R2H ; R3H = Ye*X*0.5
|
||||
NOP
|
||||
MPYF32 R3H,R1H,R3H ; R3H = Ye*Ye*X*0.5
|
||||
NOP
|
||||
SUBF32 R3H,#1.5,R3H ; R3H = 1.5 - Ye*Ye*X*0.5
|
||||
NOP
|
||||
MPYF32 R0H,R1H,R3H ; R0H = Ye = Ye*(1.5 - Ye*Ye*X*0.5)
|
||||
LRETR
|
||||
.endasmfunc
|
||||
|
||||
;; End of File
|
||||
@@ -0,0 +1,222 @@
|
||||
;;#############################################################################
|
||||
;;! \file source/fpu32/log_f32.asm
|
||||
;;!
|
||||
;;! \brief Fast single precision natural logarithm for the C28x + FPU32
|
||||
;;! \author Vishal Coelho
|
||||
;;! \date 01/26/2017
|
||||
;;
|
||||
;; DESCRIPTION:
|
||||
;;
|
||||
;; This function computes the 32-bit floating point logarithm log(x)
|
||||
;;
|
||||
;; FUNCTIONS:
|
||||
;;
|
||||
;; This funciton will be called whenever the standard C library function
|
||||
;; log() is called.
|
||||
;;
|
||||
;; float32 X,Y;
|
||||
;; ...
|
||||
;; <X initalized>
|
||||
;; ...
|
||||
;; Y = logf(X);
|
||||
;;
|
||||
;; ASSUMPTIONS:
|
||||
;;
|
||||
;; ALGORITHM:
|
||||
;;
|
||||
;; 1. calculate the absolute of x, |x|
|
||||
;; 2. A floating point number is represented as X=[S]1.M*2^E where S is the
|
||||
;; sign bit, M the mantissa, and E the biased exponent. The natural
|
||||
;; logarithm of such a number is given by
|
||||
;;
|
||||
;; log(X) = log(1.M) + E*log(2)$$
|
||||
;;
|
||||
;; 3. Separate the exponent of the input, store it as a float.
|
||||
;; 4. Separate the mantissa (1.M), and then the fractional portion Xm = M
|
||||
;; 5. Subtract the bias from the exponent and multiply by log(2)
|
||||
;; 6. Calculate log(1.M) using the polynomial approximation
|
||||
;;
|
||||
;; log(1 + M) = a0 + M*(a1 + M*a2)$$
|
||||
;;
|
||||
;; 7. The result is $log(1+M) + E*log(2)$, where E is now the unbiased exponent
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
|
||||
;; external references
|
||||
.if __TI_EABI__
|
||||
.asg FPU32logTable, _FPU32logTable
|
||||
.asg FPU32LOG2, _FPU32LOG2
|
||||
.asg logf, _log
|
||||
.endif
|
||||
.ref _FPU32logTable
|
||||
.ref _FPU32LOG2
|
||||
|
||||
;;*****************************************************************************
|
||||
;; Register Usage:
|
||||
;; XAR0: pointer to the lookup table | R0H : x, argument
|
||||
;;
|
||||
;; Stack Usage:
|
||||
;;
|
||||
;; |_______|<- Stack Pointer (SP)
|
||||
;; |_______|<- LF_X_EXP_U (SP-1)-----> Local Frame
|
||||
;; |_______|<- LF_ABS_X_H (SP-2) |
|
||||
;; |_______|<- LF_ABS_X_L|LF_ABS_X|LF_X_MANT (SP-3)----
|
||||
;; |_______|<- rpc calling function (SP-4)
|
||||
;;
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.global _log
|
||||
.sect ".text"
|
||||
|
||||
LOG_TBL_SZ .set 0x4200 ;32(entries)
|
||||
.if (__TI_EABI__ = 0)
|
||||
; For TI COFF double and float are the same size, so logf() and
|
||||
; log() should be the same function
|
||||
.global _logf
|
||||
_logf:
|
||||
.endif
|
||||
_log: .asmfunc
|
||||
.asg 3, LF_SIZE
|
||||
.asg *-SP[1], LF_X_EXP_U
|
||||
.asg *-SP[2], LF_ABS_X_H
|
||||
.asg *-SP[3], LF_ABS_X_L
|
||||
.asg *-SP[3], LF_ABS_X
|
||||
.asg *-SP[3], LF_X_MANT
|
||||
|
||||
;;-----------------------------------------------------------------------------
|
||||
;; Context Save
|
||||
;;-----------------------------------------------------------------------------
|
||||
; The stack pointer is aligned to an even address by the calling function
|
||||
ADDB SP, #LF_SIZE
|
||||
;;-----------------------------------------------------------------------------
|
||||
;; The algorithm
|
||||
;;-----------------------------------------------------------------------------
|
||||
MOV32 LF_ABS_X, R0H ;
|
||||
;-----PIPELINE STALL=3 CYC-------;
|
||||
MOV ACC, LF_ABS_X_H << 9 ; AH = x.exp
|
||||
SUB AH, #127 ; = x.exp - SP_BIAS
|
||||
|
||||
;; ANDing the argument with 0x3FFFFFFF will zero out the sign bit, which
|
||||
;; is equivalent to doing the absolute operation, and the most significant
|
||||
;; exponent bit while ORing with 0x3F800000 will set the exponent to
|
||||
;; 127 (single) or 1023 (double)
|
||||
;;
|
||||
;; Consider 10 = 1.25x2^3. In single precision float the leading 1 of the
|
||||
;; significand is implicit and the exponent is biased around 127, so its
|
||||
;; physical representation is
|
||||
;; 31|30 23|22 0|
|
||||
;; +-+---------------+-------------------------------------------+
|
||||
;; |0|1|0|0|0|0|0|1|0|0|1|0 ........... 0|
|
||||
;; +-+---------------+-------------------------------------------+
|
||||
;; S| biased exp | mantissa |
|
||||
;; | E = 127+3=131 | 0.25 |
|
||||
;;
|
||||
;; X & 0x3FFFFFFF
|
||||
;; 31|30 23|22 0|
|
||||
;; +-+---------------+-------------------------------------------+
|
||||
;; |0|0|0|0|0|0|0|1|0|0|1|0 ........... 0|
|
||||
;; +-+---------------+-------------------------------------------+
|
||||
;; S| biased exp | mantissa |
|
||||
;; | E = 2 | 0.25 |
|
||||
;; (X & 0x3FFFFFFF) | 0x3F800000
|
||||
;; 31|30 23|22 0|
|
||||
;; +-+---------------+-------------------------------------------+
|
||||
;; |0|0|1|1|1|1|1|1|1|0|1|0 ........... 0|
|
||||
;; +-+---------------+-------------------------------------------+
|
||||
;; S| biased exp | mantissa |
|
||||
;; | E = 127 | 0.25 |
|
||||
;; Now the value of this float (after removing exponent bias)
|
||||
;; = 1.25 * 2^(127-127(BIAS)) = 1.25
|
||||
;; We have extracted just the mantissa (or significand)
|
||||
AND LF_ABS_X_H, #0x3FFF ; (x&0x3FFFFFFF)|0x3F800000
|
||||
OR LF_ABS_X_H, #0x3F80
|
||||
;-----PIPELINE STALL=3 CYC-------;
|
||||
MOV32 R0H, LF_X_MANT ; R0H = |x|.mant
|
||||
FRACF32 R0H, R0H ; *| = frac(|x|.mant) or Xm
|
||||
MOV LF_X_EXP_U, AH ; 1|
|
||||
MPYF32 R2H, R0H, #LOG_TBL_SZ
|
||||
; *| R2H = |x|.mant*TBL_SZ*3*szof(float)
|
||||
I16TOF32 R1H, LF_X_EXP_U ; 1|*| R1H = exp_unbiased
|
||||
F32TOUI16 R2H, R2H ; *|1| R2H = (int)(Xm*32.0)
|
||||
MOVW DP, #_FPU32LOG2 ; 1|
|
||||
MOV16 LF_X_MANT, R2H ;
|
||||
MOV AL, #_FPU32logTable+6
|
||||
.if __TI_EABI__
|
||||
;; The assembler does the addition of FPU32logTable and 6 prior to
|
||||
;; taking the high word
|
||||
MOV AH, #$HI16(FPU32logTable)+6
|
||||
.else
|
||||
MOV AH, #((_FPU32logTable+6)>>16)
|
||||
.endif
|
||||
ADD ACC, LF_X_MANT << #2 ; ACC += 4*(int)(Xm*32.0)
|
||||
ADD ACC, LF_X_MANT << #1 ; += 2*(int)(Xm*32.0)
|
||||
; ACC -> FPU32logTable[idx].A2+2
|
||||
MOVL XAR0, ACC ; XAR0 -> FPU32logTable[idx].A2+2
|
||||
MOV32 R2H, *--XAR0 ; R2H = A2
|
||||
MPYF32 R3H, R0H, R2H ; *| R3H = Xm*A2
|
||||
MOV32 R2H, *--XAR0 ; 1| R2H = A1
|
||||
ADDF32 R3H, R2H, R3H ; *| R3H = A1 + Xm*A2
|
||||
MOV32 R2H, @_FPU32LOG2 ; 1| R2H = log(2)
|
||||
MPYF32 R3H, R0H, R3H ; *| R3H = Xm*(A1+Xm*A2)
|
||||
|| MOV32 R0H, *--XAR0 ; | R0H = A0
|
||||
MPYF32 R1H, R2H, R1H ; 1|*| R1H = log(2)*exp_unbiased
|
||||
ADDF32 R3H, R0H, R3H ; *|1| R3H = A0 + Xm*(A1+Xm*A2)
|
||||
SUBB SP, #LF_SIZE ; 1| deallocate local frame
|
||||
ADDF32 R0H, R1H, R3H ; *| R0H = log_exp+log_mant
|
||||
NOP ; 1|
|
||||
LRETR
|
||||
.endasmfunc
|
||||
.unasg LF_SIZE
|
||||
.unasg LF_X_EXP_U
|
||||
.unasg LF_ABS_X_H
|
||||
.unasg LF_ABS_X_L
|
||||
.unasg LF_ABS_X
|
||||
.unasg LF_X_MANT
|
||||
|
||||
;; End of File
|
||||
@@ -0,0 +1,192 @@
|
||||
;;#############################################################################
|
||||
;;! \file logtable_f32.asm
|
||||
;;! \brief Natural Logarithm Lookup Table (32)
|
||||
;;! \author Vishal Coelho
|
||||
;;! \date 30-Jan-2017
|
||||
;;!
|
||||
;; Revision History:
|
||||
;;+----------+---------------+------------------------------------------------+
|
||||
;;| DATE | AUTHOR | CHANGE |
|
||||
;;+----------+---------------+------------------------------------------------+
|
||||
;;| 01/16/18 | Ritvik Sadana | Modified symbol names to keep naming |
|
||||
;;| | | consistent with FPU64 symbols. |
|
||||
;;+----------+---------------+------------------------------------------------+
|
||||
;;| 02/13/18 | Ritvik Sadana | Modified table values to match with CLA table |
|
||||
;;| | | as advised by Alex T. |
|
||||
;;+----------+---------------+------------------------------------------------+
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
.if __TI_EABI__
|
||||
.asg FPU32LOG2, _FPU32LOG2
|
||||
.asg FPU32INVLOG10, _FPU32INVLOG10
|
||||
.asg FPU32EXPBIAS, _FPU32EXPBIAS
|
||||
.asg FPU32LOG_TABLE_MASK1, _FPU32LOG_TABLE_MASK1
|
||||
.asg FPU32LOG_TABLE_MASK2, _FPU32LOG_TABLE_MASK2
|
||||
.asg FPU32logTable, _FPU32logTable
|
||||
.asg FPU32logTableEnd, _FPU32logTableEnd
|
||||
.endif
|
||||
.def _FPU32LOG2
|
||||
.def _FPU32INVLOG10
|
||||
.def _FPU32EXPBIAS
|
||||
.def _FPU32LOG_TABLE_MASK1
|
||||
.def _FPU32LOG_TABLE_MASK2
|
||||
.def _FPU32logTable
|
||||
.def _FPU32logTableEnd
|
||||
|
||||
.sect "FPUmathTables"
|
||||
|
||||
_FPU32LOG2: .float 0.693147180559 ;
|
||||
_FPU32INVLOG10: .float 0.4342944819032;
|
||||
_FPU32EXPBIAS: .float 127.0 ;
|
||||
_FPU32LOG_TABLE_MASK1: .long 0x3FFFFFFF ;
|
||||
_FPU32LOG_TABLE_MASK2: .long 0x3F800000 ;
|
||||
|
||||
_FPU32logTable:
|
||||
.float 0 ;
|
||||
.float 1 ;
|
||||
.float -0.5 ;
|
||||
.float 9.49154e-06 ;
|
||||
.float 0.999081726 ;
|
||||
.float -0.470156107 ;
|
||||
.float 7.09886e-05 ;
|
||||
.float 0.996539792 ;
|
||||
.float -0.442906574 ;
|
||||
.float 0.000224404 ;
|
||||
.float 0.992653061 ;
|
||||
.float -0.417959184 ;
|
||||
.float 0.000499085 ;
|
||||
.float 0.987654321 ;
|
||||
.float -0.395061728 ;
|
||||
.float 0.000916122 ;
|
||||
.float 0.981738495 ;
|
||||
.float -0.373995617 ;
|
||||
.float 0.001490146 ;
|
||||
.float 0.975069252 ;
|
||||
.float -0.354570637 ;
|
||||
.float 0.00223074 ;
|
||||
.float 0.967784352 ;
|
||||
.float -0.336620644 ;
|
||||
.float 0.003143551 ;
|
||||
.float 0.96 ;
|
||||
.float -0.32 ;
|
||||
.float 0.004231167 ;
|
||||
.float 0.951814396 ;
|
||||
.float -0.304580607 ;
|
||||
.float 0.005493806 ;
|
||||
.float 0.943310658 ;
|
||||
.float -0.290249433 ;
|
||||
.float 0.00692987 ;
|
||||
.float 0.934559221 ;
|
||||
.float -0.276906436 ;
|
||||
.float 0.008536376 ;
|
||||
.float 0.925619835 ;
|
||||
.float -0.26446281 ;
|
||||
.float 0.010309303 ;
|
||||
.float 0.91654321 ;
|
||||
.float -0.252839506 ;
|
||||
.float 0.012243868 ;
|
||||
.float 0.907372401 ;
|
||||
.float -0.241965974 ;
|
||||
.float 0.014334741 ;
|
||||
.float 0.898143957 ;
|
||||
.float -0.231779086 ;
|
||||
.float 0.016576219 ;
|
||||
.float 0.888888889 ;
|
||||
.float -0.222222222 ;
|
||||
.float 0.018962363 ;
|
||||
.float 0.879633486 ;
|
||||
.float -0.213244481 ;
|
||||
.float 0.021487103 ;
|
||||
.float 0.8704 ;
|
||||
.float -0.2048 ;
|
||||
.float 0.024144324 ;
|
||||
.float 0.861207228 ;
|
||||
.float -0.196847366 ;
|
||||
.float 0.026927934 ;
|
||||
.float 0.852071006 ;
|
||||
.float -0.189349112 ;
|
||||
.float 0.02983191 ;
|
||||
.float 0.843004628 ;
|
||||
.float -0.182271271 ;
|
||||
.float 0.032850339 ;
|
||||
.float 0.834019204 ;
|
||||
.float -0.17558299 ;
|
||||
.float 0.035977448 ;
|
||||
.float 0.825123967 ;
|
||||
.float -0.169256198 ;
|
||||
.float 0.039207625 ;
|
||||
.float 0.816326531 ;
|
||||
.float -0.163265306 ;
|
||||
.float 0.042535433 ;
|
||||
.float 0.807633118 ;
|
||||
.float -0.15758695 ;
|
||||
.float 0.045955621 ;
|
||||
.float 0.799048751 ;
|
||||
.float -0.152199762 ;
|
||||
.float 0.049463133 ;
|
||||
.float 0.79057742 ;
|
||||
.float -0.147084171 ;
|
||||
.float 0.053053104 ;
|
||||
.float 0.782222222 ;
|
||||
.float -0.142222222 ;
|
||||
.float 0.056720869 ;
|
||||
.float 0.773985488 ;
|
||||
.float -0.13759742 ;
|
||||
.float 0.060461958 ;
|
||||
.float 0.765868887 ;
|
||||
.float -0.133194589 ;
|
||||
.float 0.064272091 ;
|
||||
.float 0.75787352 ;
|
||||
.float -0.128999748 ;
|
||||
.float 0.068147181 ;
|
||||
.float 0.75 ;
|
||||
.float -0.125 ;
|
||||
_FPU32logTableEnd:
|
||||
|
||||
;; End of File
|
||||
@@ -0,0 +1,90 @@
|
||||
;;#############################################################################
|
||||
;;! \file source/fpu32/memcpy_fastrts.asm
|
||||
;;!
|
||||
;;! \brief Fast memcpy
|
||||
;;! \author N/A
|
||||
;;! \date N/A
|
||||
;;
|
||||
;;
|
||||
;;DESCRIPTION:
|
||||
;;
|
||||
;; This function does a fast memory copy
|
||||
;; Note: This function is not part of the normal RTS library.
|
||||
;;
|
||||
;;FUNCTIONS:
|
||||
;;
|
||||
;; void memcpy_fastrts(void *dst, void *src, uint16_t num_words)
|
||||
;;
|
||||
;;ASSUMPTIONS:
|
||||
;;
|
||||
;;
|
||||
;;ALGORITHM:
|
||||
;;
|
||||
;;
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
;; dst: XAR4
|
||||
;; src: XAR5
|
||||
;; num_bytes: AL
|
||||
|
||||
.page
|
||||
.if __TI_EABI__
|
||||
.asg memcpy_fastrts, _memcpy_fastrts
|
||||
.endif
|
||||
.global _memcpy_fastrts
|
||||
.text
|
||||
_memcpy_fastrts:
|
||||
MOVL XAR7, @XAR5
|
||||
DEC @AL
|
||||
RPT @AL
|
||||
|| PREAD *XAR4++, *XAR7
|
||||
LRETR
|
||||
.endasmfunc
|
||||
|
||||
;; End of File
|
||||
@@ -0,0 +1,327 @@
|
||||
;;#############################################################################
|
||||
;;! \file source/fpu32/pow_f32.asm
|
||||
;;!
|
||||
;;! \brief Fast single precision power function for the C28x + FPU32
|
||||
;;! \author Vishal Coelho
|
||||
;;! \date 02/07/2017
|
||||
;;
|
||||
;; DESCRIPTION:
|
||||
;;
|
||||
;; This function computes the 32-bit floating point power, powf(x, y)
|
||||
;;
|
||||
;; FUNCTIONS:
|
||||
;;
|
||||
;; This funciton will be called whenever the standard C library function
|
||||
;; powf() is called.
|
||||
;;
|
||||
;; float32 X,Y,Z;
|
||||
;; ...
|
||||
;; <X & Y initalized>
|
||||
;; ...
|
||||
;; Z = powf(X, Y);
|
||||
;;
|
||||
;; ASSUMPTIONS:
|
||||
;;
|
||||
;; ALGORITHM:
|
||||
;;
|
||||
;; We calculate x^y as exp(y*log(x))
|
||||
;;
|
||||
;; 1. calculate the absolute of x, |x|
|
||||
;; 2. A floating point number is represented as X=[S]1.M*2^E where S is the
|
||||
;; sign bit, M the mantissa, and E the biased exponent. The natural
|
||||
;; logarithm of such a number is given by
|
||||
;;
|
||||
;; log(X) = log(1.M) + E*log(2)$$
|
||||
;;
|
||||
;; 3. Separate the exponent of the input, store it as a float.
|
||||
;; 4. Separate the mantissa (1.M), and then the fractional portion Xm = M
|
||||
;; 5. Subtract the bias from the exponent and multiply by log(2)
|
||||
;; 6. Calculate log(1.M) using the polynomial approximation
|
||||
;;
|
||||
;; log(1 + M) = a0 + M*(a1 + M*a2)$$
|
||||
;;
|
||||
;; 7. The result is $x' = log(1+M) + E*log(2)$, where E is now the unbiased exponent
|
||||
;; 8. calculate the absolute of x', |x'|
|
||||
;; 9. Separate the integer and fractional portion of the input
|
||||
;; 10. Get e^integer(x') from the table
|
||||
;; 11. Calculate e^(fraction) by using the Taylor series expansion for
|
||||
;; exponents
|
||||
;; x
|
||||
;; e = 1 + x*(1+x/2*(1+x/3*(1+x/4*(1+x/5*(1+x/6*(1+x/7)+...)))))
|
||||
;;
|
||||
;; 12. The result, $e^{x'} = e^{integer}*e^{fraction}$
|
||||
;; 13. If x' was negative, calculate the inverse of the result
|
||||
;;
|
||||
;; Group: C2000
|
||||
;; Target Family: C28x+FPU32
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
|
||||
;; external references
|
||||
.if __TI_EABI__
|
||||
.asg FPU32LOG2, _FPU32LOG2
|
||||
.asg FPU32logTable, _FPU32logTable
|
||||
.asg FPU32expTable, _FPU32expTable
|
||||
.asg FPU32expTableCoeff, _FPU32expTableCoeff
|
||||
.asg powf, _pow
|
||||
.endif
|
||||
.ref _FPU32logTable
|
||||
.ref _FPU32LOG2
|
||||
.ref _FPU32expTable
|
||||
.ref _FPU32expTableCoeff
|
||||
|
||||
;;*****************************************************************************
|
||||
;; Register Usage:
|
||||
;; XAR0: pointer to the lookup table | R0H : x, base
|
||||
;; XAR1: pointer to the exp coeffs | R1H : y, exponent
|
||||
;; XAR2: storing the lookup tabe index
|
||||
;; Stack Usage:
|
||||
;;
|
||||
;; |_______|<- Stack Pointer (SP)
|
||||
;; |_______|<- LF_X_EXP_U (SP-1)-----> Local Frame
|
||||
;; |_______|<- LF_ABS_X_H (SP-2) |
|
||||
;; |_______|<- LF_ABS_X_L|LF_ABS_X|LF_X_MANT (SP-3)----
|
||||
;; |_______|<- R4H (SP-5)
|
||||
;; |_______|<- rpc calling function (SP-7)
|
||||
;;
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.global _pow
|
||||
.sect ".text"
|
||||
|
||||
LOG_TBL_SZ .set 0x4200 ;32(entries)
|
||||
|
||||
.if (__TI_EABI__ = 0)
|
||||
; For TI COFF double and float are the same size, so powf() and
|
||||
; pow() should be the same function
|
||||
.global _powf
|
||||
_powf:
|
||||
.endif
|
||||
_pow:
|
||||
.asmfunc
|
||||
.asg 3, LF_SIZE
|
||||
.asg *-SP[1], LF_X_EXP_U
|
||||
.asg *-SP[2], LF_ABS_X_H
|
||||
.asg *-SP[3], LF_ABS_X_L
|
||||
.asg *-SP[3], LF_ABS_X
|
||||
.asg *-SP[3], LF_X_MANT
|
||||
|
||||
;;-----------------------------------------------------------------------------
|
||||
;; Context Save
|
||||
;;-----------------------------------------------------------------------------
|
||||
; The stack pointer is aligned to an even address by the calling function
|
||||
MOV32 *SP++,R4H
|
||||
; [20200310] these two instructions added to protect XAR1 & XAR2
|
||||
PUSH XAR1
|
||||
PUSH XAR2
|
||||
ADDB SP, #LF_SIZE
|
||||
;;-----------------------------------------------------------------------------
|
||||
;; The log(x) algorithm
|
||||
;;-----------------------------------------------------------------------------
|
||||
MOV32 R4H, R1H ; save y
|
||||
MOV32 LF_ABS_X, R0H ;
|
||||
;-----PIPELINE STALL=3 CYC-------;
|
||||
MOV ACC, LF_ABS_X_H << 9 ; AH = x.exp
|
||||
SUB AH, #127 ; = x.exp - SP_BIAS
|
||||
|
||||
;; ANDing the argument with 0x3FFFFFFF will zero out the sign bit, which
|
||||
;; is equivalent to doing the absolute operation, and the most significant
|
||||
;; exponent bit while ORing with 0x3F800000 will set the exponent to
|
||||
;; 127 (single) or 1023 (double)
|
||||
;;
|
||||
;; Consider 10 = 1.25x2^3. In single precision float the leading 1 of the
|
||||
;; significand is implicit and the exponent is biased around 127, so its
|
||||
;; physical representation is
|
||||
;; 31|30 23|22 0|
|
||||
;; +-+---------------+-------------------------------------------+
|
||||
;; |0|1|0|0|0|0|0|1|0|0|1|0 ........... 0|
|
||||
;; +-+---------------+-------------------------------------------+
|
||||
;; S| biased exp | mantissa |
|
||||
;; | E = 127+3=131 | 0.25 |
|
||||
;;
|
||||
;; X & 0x3FFFFFFF
|
||||
;; 31|30 23|22 0|
|
||||
;; +-+---------------+-------------------------------------------+
|
||||
;; |0|0|0|0|0|0|0|1|0|0|1|0 ........... 0|
|
||||
;; +-+---------------+-------------------------------------------+
|
||||
;; S| biased exp | mantissa |
|
||||
;; | E = 2 | 0.25 |
|
||||
;; (X & 0x3FFFFFFF) | 0x3F800000
|
||||
;; 31|30 23|22 0|
|
||||
;; +-+---------------+-------------------------------------------+
|
||||
;; |0|0|1|1|1|1|1|1|1|0|1|0 ........... 0|
|
||||
;; +-+---------------+-------------------------------------------+
|
||||
;; S| biased exp | mantissa |
|
||||
;; | E = 127 | 0.25 |
|
||||
;; Now the value of this float (after removing exponent bias)
|
||||
;; = 1.25 * 2^(127-127(BIAS)) = 1.25
|
||||
;; We have extracted just the mantissa (or significand)
|
||||
AND LF_ABS_X_H, #0x3FFF ; (x&0x3FFFFFFF)|0x3F800000
|
||||
OR LF_ABS_X_H, #0x3F80
|
||||
;-----PIPELINE STALL=3 CYC-------;
|
||||
MOV32 R0H, LF_X_MANT ; R0H = |x|.mant
|
||||
FRACF32 R0H, R0H ; *| = frac(|x|.mant) or Xm
|
||||
MOV LF_X_EXP_U, AH ; 1|
|
||||
MPYF32 R2H, R0H, #LOG_TBL_SZ
|
||||
; *| R2H = |x|.mant*TBL_SZ*3*szof(float)
|
||||
I16TOF32 R1H, LF_X_EXP_U ; 1|*| R1H = exp_unbiased
|
||||
F32TOUI16 R2H, R2H ; *|1| R2H = (int)(Xm*32.0)
|
||||
MOVW DP, #_FPU32LOG2 ; 1|
|
||||
MOV16 LF_X_MANT, R2H ;
|
||||
MOV AL, #_FPU32logTable+6
|
||||
.if __TI_EABI__
|
||||
;; The assembler does the addition of FPU32logTable and 6 prior to
|
||||
;; taking the high word
|
||||
MOV AH, #$HI16(FPU32logTable)+6
|
||||
.else
|
||||
MOV AH, #((_FPU32logTable+6)>>16)
|
||||
.endif
|
||||
ADD ACC, LF_X_MANT << #2 ; ACC += 4*(int)(Xm*32.0)
|
||||
ADD ACC, LF_X_MANT << #1 ; += 2*(int)(Xm*32.0)
|
||||
; ACC -> FPU32logTable[idx].A2+2
|
||||
MOVL XAR0, ACC ; XAR0 -> FPU32logTable[idx].A2+2
|
||||
MOV32 R2H, *--XAR0 ; R2H = A2
|
||||
MPYF32 R3H, R0H, R2H ; *| R3H = Xm*A2
|
||||
MOV32 R2H, *--XAR0 ; 1| R2H = A1
|
||||
ADDF32 R3H, R2H, R3H ; *| R3H = A1 + Xm*A2
|
||||
MOV32 R2H, @_FPU32LOG2 ; 1| R2H = log(2)
|
||||
MPYF32 R3H, R0H, R3H ; *| R3H = Xm*(A1+Xm*A2)
|
||||
|| MOV32 R0H, *--XAR0 ; | R0H = A0
|
||||
MPYF32 R1H, R2H, R1H ; 1|*| R1H = log(2)*exp_unbiased
|
||||
ADDF32 R3H, R0H, R3H ; *|1| R3H = A0 + Xm*(A1+Xm*A2)
|
||||
SUBB SP, #LF_SIZE ; 1| deallocate local frame
|
||||
ADDF32 R0H, R1H, R3H ; *| R0H = log_exp+log_mant
|
||||
NOP ; 1|
|
||||
;;-----------------------------------------------------------------------------
|
||||
;; y*log(x)
|
||||
;;-----------------------------------------------------------------------------
|
||||
MPYF32 R0H, R4H, R0H ; *| R0H = y*log(x)
|
||||
NOP ; 1|
|
||||
;;-----------------------------------------------------------------------------
|
||||
;; The exp(y*log(x)) algorithm
|
||||
;;-----------------------------------------------------------------------------
|
||||
MOV32 R4H, R0H ; R4H = x (may set ZF, NF)
|
||||
TESTTF LT ; (x < 0.0)? TF = 1: TF = 0
|
||||
ABSF32 R4H, R0H ; R4H = |x|
|
||||
FRACF32 R1H, R4H ; *| R1H = frac(|x|) or x_f
|
||||
MOVL XAR1, #_FPU32expTableCoeff
|
||||
; 1| XAR1 -> FPU32expTableCoeff[0]
|
||||
MOV32 R2H, *XAR1++ ; R2H = 1/7
|
||||
MPYF32 R2H, R2H, R1H ; *| R2H = x_f/7
|
||||
|| MOV32 R3H, *XAR1++ ; | R3H = 1/6
|
||||
MPYF32 R3H, R1H, R3H ; 1|*| R3H = x_f/6
|
||||
|| MOV32 R0H, *XAR1++ ; | | R0H = 1/5
|
||||
ADDF32 R2H, #1.0, R2H ; *|1| R2H = 1+x_f/7
|
||||
MPYF32 R4H, #2.0, R4H ; 1|*| R4H = 2*x_i
|
||||
MPYF32 R2H, R3H, R2H ; *|1| R2H = x_f/6*(1+x_f/7)
|
||||
MPYF32 R0H, R1H, R0H ; 1|*| R0H = x_f/5
|
||||
|| MOV32 R3H, *XAR1++ ; | | R3H = 1/4
|
||||
ADDF32 R2H, #1.0, R2H ; *|1| R2H = 1+x_f/6*(1+x_f/7)
|
||||
F32TOI32 R4H, R4H ; 1|*| R4H = 2*x_i
|
||||
MPYF32 R2H, R0H, R2H ; *|1| R2H = x_f/5*(1+x_f/6*(1+x_f/7))
|
||||
MPYF32 R3H, R1H, R3H ; 1|*| R3H = x_f/4
|
||||
|| MOV32 R0H, *XAR1++ ; | | R0H = 1/3
|
||||
ADDF32 R2H, #1.0, R2H ; *|1| R2H = 1+x_f/5*(1+x_f/6*(1+x_f/7))
|
||||
MOV32 XAR2, R4H ; 1| ACC = sizeof(float)*x_i
|
||||
MOVL XAR0, #_FPU32expTable ; 1| XAR0 -> FPU32expTable[0]
|
||||
; R2H = x_f/4*(1+x_f/5*(1+x_f/6*(1+x_f/7)))
|
||||
MPYF32 R2H, R3H, R2H ; *|
|
||||
MPYF32 R0H, R1H, R0H ; 1|*| R0H = x_f/3
|
||||
; R2H = 1+x_f/4*(1+x_f/5*(1+x_f/6*(1+x_f/7)))
|
||||
ADDF32 R2H, #1.0, R2H ; *|1|
|
||||
MOV32 R3H, *XAR1++ ; 1| R3H = 1/2
|
||||
; R2H = x_f/3*(1+x_f/4*(1+x_f/5*(1+x_f/6*(1+x_f/7))))
|
||||
MPYF32 R2H, R0H, R2H ; *|
|
||||
MPYF32 R3H, R1H, R3H ; 1|*| R3H = x_f/2
|
||||
; R2H = 1+x_f/3*(1+x_f/4*(1+x_f/5*(1+x_f/6*(1+x_f/7))))
|
||||
MOVL ACC, XAR0 ; *|1|
|
||||
ADDF32 R2H, #1.0, R2H ; *|1|
|
||||
; R2H = x_f/2*(1+x_f/3*(1+x_f/4*(1+x_f/5*(1+x_f/6*(1+x_f/7)))))
|
||||
ADDL ACC, @XAR2 ; 1| ACC->FPU32expTable[x_i]
|
||||
MPYF32 R2H, R3H, R2H ; *|
|
||||
MOVL XAR0, ACC ; 1| XAR0->FPU32expTable[x_i]
|
||||
; R2H = 1+x_f/2*(1+x_f/3*(1+x_f/4*(1+x_f/5*(1+x_f/6*(1+x_f/7)))))
|
||||
ADDF32 R2H, #1.0, R2H ; *|
|
||||
; [20200310] these two instructions added to protect XAR1 & XAR2
|
||||
POP XAR2 ; 1| restore XAR2
|
||||
POP XAR1 ; 1| restore XAR1
|
||||
MOV32 R4H, *--SP ; 1| restore R4H
|
||||
; R2H = x_f*(1+x_f/2*(1+x_f/3*(1+x_f/4*(1+x_f/5*(1+x_f/6*(1+x_f/7))))))
|
||||
MPYF32 R2H, R1H, R2H ; *|
|
||||
MOV32 R1H, *XAR0 ; 1| R1H = FPU32expTable[x_i]
|
||||
; R2H = 1+x_f*(1+x_f/2*(1+x_f/3*(1+x_f/4*(1+x_f/5*(1+x_f/6*(1+x_f/7))))))
|
||||
ADDF32 R2H, #1.0, R2H ; *|
|
||||
NOP ; 1|
|
||||
MPYF32 R2H, R1H, R2H ; *| R2H = e^x = e^(x_i)*e^(x_f)
|
||||
NOP ; 1|
|
||||
EINVF32 R1H, R2H ; *| R1H = Ye = 1/e^x
|
||||
NOP ; 1|
|
||||
MPYF32 R3H, R1H, R2H ; *| R3H = Ye*e^x
|
||||
NOP ; 1|
|
||||
SUBF32 R3H, #2.0, R3H ; *| R3H = 2.0 - Ye*e^x
|
||||
NOP ; 1|
|
||||
MPYF32 R1H, R1H, R3H ; *| R1H = Yee = Ye*(2.0 - Ye*e^x)
|
||||
NOP ; 1|
|
||||
MPYF32 R3H, R1H, R2H ; *| R3H = Yee*e^x
|
||||
NOP ; 1|
|
||||
SUBF32 R3H, #2.0, R3H ; *| R3H = 2.0 - Yee*e^x
|
||||
NOP ; 1|
|
||||
MPYF32 R0H, R1H, R3H ; *| R0H = Yeee = Yee*(2.0-Yee*e^x)
|
||||
NOP ; 1|
|
||||
MOV32 R0H, R2H, NTF ; | R0H = e^x if TF = 0
|
||||
LRETR
|
||||
.endasmfunc
|
||||
.unasg LF_SIZE
|
||||
.unasg LF_X_EXP_U
|
||||
.unasg LF_ABS_X_H
|
||||
.unasg LF_ABS_X_L
|
||||
.unasg LF_ABS_X
|
||||
.unasg LF_X_MANT
|
||||
|
||||
;; End of File
|
||||
@@ -0,0 +1,144 @@
|
||||
;;#############################################################################
|
||||
;;! \file source/fpu32/sin_f32.asm
|
||||
;;!
|
||||
;;! \brief Fast sin function for the C28x + Floating-Point Unit.
|
||||
;;! \author N/A
|
||||
;;! \date N/A
|
||||
;;
|
||||
;; DESCRIPTION:
|
||||
;;
|
||||
;; This function computes a 32-bit floating point sin given a
|
||||
;; radian input. This function uses the FPU math tables to
|
||||
;; compute the sin.
|
||||
;;
|
||||
;; FUNCTIONS:
|
||||
;;
|
||||
;; float32 sinf (float32 radian)
|
||||
;;
|
||||
;; ASSUMPTIONS:
|
||||
;;
|
||||
;; * FPU32sinTable and FPU32cosTable are linked into the project.
|
||||
;;
|
||||
;; ALGORITHM:
|
||||
;;
|
||||
;; The sin value is calculated as follows:
|
||||
;;
|
||||
;; 1) The offset into a 512 word sin/cos table is calculated:
|
||||
;;
|
||||
;; k = 0x1FF & (int(Radian*512/(2*pi)))
|
||||
;;
|
||||
;;
|
||||
;; 2) The fractional component between table samples is
|
||||
;; calculated:
|
||||
;;
|
||||
;; x = fract(Radian*512/2*pi) * (2*pi)/512
|
||||
;;
|
||||
;; 3) The output sine value is calculated as follows:
|
||||
;;
|
||||
;; sin(Radian) = S(k) + x*(C(k) + x*(-0.5*S(k) - 0.166667*x*C(k)))
|
||||
;;
|
||||
;; where S(k) = Sin table value at offset "k"
|
||||
;; C(k) = Cos table value at offset "k"
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
.page
|
||||
.if __TI_EABI__
|
||||
.asg sinf, _sin
|
||||
.asg FPU32sinTable, _FPU32sinTable
|
||||
.asg FPU32cosTable, _FPU32cosTable
|
||||
.endif
|
||||
.global _sin
|
||||
.ref _FPU32sinTable
|
||||
.ref _FPU32cosTable
|
||||
.text
|
||||
.if (__TI_EABI__ = 0)
|
||||
; For TI COFF double and float are the same size, so sinf() and
|
||||
; sin() should be the same function
|
||||
.global _sinf
|
||||
_sinf:
|
||||
.endif
|
||||
_sin: ; R0H = Radian (on entry)
|
||||
.asmfunc
|
||||
MOVIZ R1H,#0x42A2 ; R1H = 512/(2*pi) = 512/6.28318531 = 81.4873309
|
||||
MOVXI R1H,#0xF983
|
||||
MPYF32 R0H, R0H, R1H ; R0H = Radian * 512/(2*pi)
|
||||
MOVIZ R2H,#0x3C49 ; R2H = (2*pi)/512 = 6.28318531/512
|
||||
MOVXI R2H,#0x0FDB ; = 0x3C490FDB or 0.012271846644531
|
||||
F32TOI32 R1H, R0H ; R1H = int(Radian * 512/(2*pi))
|
||||
MOVL XAR6,#_FPU32cosTable
|
||||
MOVL XAR7,#_FPU32sinTable
|
||||
MOV32 ACC, R1H ; ACC = int(Radian *512/(2*pi))
|
||||
AND @AL,#0x1FF
|
||||
LSL AL,#1
|
||||
MOVZ AR0,@AL ; AR0 = Index into "sin/cos" table = k
|
||||
FRACF32 R0H, R0H ; R0H = fract(Radian*512/(2*pi))
|
||||
MOVIZ R3H,#0x3E2A ; R3H = 0.166667 (0x3E2AAAAB)
|
||||
MOVXI R3H,#0xAAAB
|
||||
MPYF32 R2H, R0H, R2H ; R2H = x = fract(Radian*512/(2*pi)) * (2*pi)/512
|
||||
|| MOV32 R1H,*+XAR6[AR0] ; R1H = C(k)
|
||||
MPYF32 R3H, R3H, R1H ; R3H = 0.166667*C(k)
|
||||
|| MOV32 R0H,*+XAR7[AR0] ; R0H = S(k)
|
||||
MPYF32 R0H, -0.5, R0H ; R0H = -.5*S(k)
|
||||
MPYF32 R3H, R2H, R3H ; R1H = x*0.166667*C(k)
|
||||
NOP
|
||||
SUBF32 R0H, R0H, R3H ; R0H = -.5*S(k) - 0.166667*x*C(k)
|
||||
NOP
|
||||
MPYF32 R3H, R2H, R0H ; R3H = x*(-.5*S(k) - 0.166667*x*C(k))
|
||||
|| MOV32 R1H, *+XAR6[AR0] ; R1H = C(k)
|
||||
NOP
|
||||
ADDF32 R3H, R1H, R3H ; R3H = C(k) + x*(-.5*S(k) - 0.166667*x*C(k))
|
||||
NOP
|
||||
MPYF32 R3H, R2H, R3H ; R3H = x*(C(k) + x*(-.5*S(k) - 0.166667*x*C(k)))
|
||||
|| MOV32 R0H, *+XAR7[AR0] ; R0H = S(k)
|
||||
NOP
|
||||
ADDF32 R0H, R0H, R3H ; R0H = sin(Radian) = S(k) + x*(C(k) + x*(-.5*S(k) - 0.166667*x*C(k)))
|
||||
LRETR
|
||||
.endasmfunc
|
||||
|
||||
;; End of File
|
||||
@@ -0,0 +1,170 @@
|
||||
;;#############################################################################
|
||||
;;! \file source/fpu32/sincos_f32.asm
|
||||
;;!
|
||||
;;! \brief Fast combined sin and cos function for the C28x + Floating-Point
|
||||
;;! Unit.
|
||||
;;! \author N/A
|
||||
;;! \date N/A
|
||||
;;
|
||||
;; DESCRIPTION:
|
||||
;;
|
||||
;; This function computes a 32-bit floating point sin and cos given a
|
||||
;; radian input. This function uses the FPU math tables to
|
||||
;; compute the sin and cos.
|
||||
;;
|
||||
;; FUNCTIONS:
|
||||
;;
|
||||
;; void sincosf (float32 radian, float32* PtrSin, float32* PtrCos)
|
||||
;;
|
||||
;; ASSUMPTIONS:
|
||||
;;
|
||||
;; * FPU32sinTable and FPU32cosTable are linked into the project.
|
||||
;;
|
||||
;; ALGORITHM:
|
||||
;;
|
||||
;; The sin and cos values are calculated as follows:
|
||||
;;
|
||||
;; 1) The offset into a 512 word sin/cos table is calculated:
|
||||
;;
|
||||
;; k = 0x1FF & (int(Radian*512/(2*pi)))
|
||||
;;
|
||||
;;
|
||||
;; 2) The fractional component between table samples is
|
||||
;; calculated:
|
||||
;;
|
||||
;; x = fract(Radian*512/2*pi) * (2*pi)/512
|
||||
;;
|
||||
;; 3) The output values are calculated as follows:
|
||||
;;
|
||||
;; sin(Radian) = S(k) + x*( C(k) + x*(-0.5*S(k) - x*0.166667*C(k)))
|
||||
;; cos(Radian) = C(k) + x*(-S(k) + x*(-0.5*C(k) + x*0.166667*S(k)))
|
||||
;;
|
||||
;; where S(k) = Sin table value at offset "k"
|
||||
;; C(k) = Cos table value at offset "k"
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
.page
|
||||
.if __TI_EABI__
|
||||
.asg sincosf, _sincos
|
||||
.asg FPU32sinTable, _FPU32sinTable
|
||||
.asg FPU32cosTable, _FPU32cosTable
|
||||
.endif
|
||||
.global _sincos
|
||||
.ref _FPU32sinTable
|
||||
.ref _FPU32cosTable
|
||||
.text
|
||||
.if (__TI_EABI__ = 0)
|
||||
; For TI COFF double and float are the same size, so sincosf() and
|
||||
; sincos() should be the same function
|
||||
.global _sincosf
|
||||
_sincosf:
|
||||
.endif
|
||||
_sincos: ; On entry: R0H = Radian, XAR4 = PtrSin, XAR5 = PtrCos
|
||||
.asmfunc
|
||||
MOVIZ R1H,#0x42A2 ; R1H = 512/(2*pi) = 512/6.28318531 = 81.4873309
|
||||
MOVXI R1H,#0xF983
|
||||
|
||||
MPYF32 R0H, R0H, R1H ; R0H = Radian * 512/(2*pi)
|
||||
|| MOV32 *SP++, R4H ; store R4H on the stack
|
||||
|
||||
MOVIZ R2H,#0x3C49 ; R2H = (2*pi)/512 = 6.28318531/512
|
||||
MOVXI R2H,#0x0FDB ; = 0x3C490FDB or 0.012271846644531
|
||||
F32TOI32 R1H, R0H ; R1H = int(Radian * 512/(2*pi))
|
||||
MOVL XAR6,#_FPU32cosTable
|
||||
MOVL XAR7,#_FPU32sinTable
|
||||
MOV32 ACC, R1H ; ACC = int(Radian *512/(2*pi))
|
||||
AND @AL,#0x1FF
|
||||
LSL AL,#1
|
||||
MOVZ AR0,@AL ; AR0 = Index into "sin/cos" table = k
|
||||
FRACF32 R0H, R0H ; R0H = fract(Radian*512/(2*pi))
|
||||
MOVIZ R1H,#0x3E2A ; R1H = 0.166667 (0x3E2AAAAB)
|
||||
MOVXI R1H,#0xAAAB
|
||||
|
||||
MPYF32 R0H, R0H, R2H ; R0H = x = fract(Radian*512/(2*pi)) * (2*pi)/512
|
||||
|| MOV32 R3H, *+XAR6[AR0] ; R3H = C(k)
|
||||
|
||||
MPYF32 R2H, R1H, R3H ; R2H = 0.166667*C(k)
|
||||
|| MOV32 R4H, *+XAR7[AR0] ; R4H = S(k)
|
||||
|
||||
MPYF32 R1H, R1H, R4H ; R1H = 0.166667*S(k)
|
||||
MPYF32 R2H, R0H, R2H ; R2H = x*0.166667*C(k)
|
||||
|
||||
MPYF32 R4H, -0.5, R4H ; R4H = -0.5*S(k)
|
||||
MPYF32 R3H, -0.5, R3H ; R3H = -0.5*C(k)
|
||||
|
||||
MPYF32 R1H, R0H, R1H ; R1H = x*0.166667*S(k)
|
||||
|| SUBF32 R2H, R4H, R2H ; R2H = -0.5*S(k) - x*0.166667*C(k)
|
||||
|
||||
MOV32 R4H, *+XAR6[AR0] ; R4H = C(k)
|
||||
|
||||
ADDF32 R1H, R3H, R1H ; R1H = -0.5*C(k) + x*0.166667*S(k)
|
||||
|| MOV32 R3H, *+XAR7[AR0] ; R3H = S(k)
|
||||
|
||||
MPYF32 R2H, R0H, R2H ; R2H = x*(-0.5*S(k) - x*0.166667*C(k))
|
||||
MPYF32 R1H, R0H, R1H ; R1H = x*(-0.5*C(k) + x*0.166667*S(k))
|
||||
ADDF32 R2H, R4H, R2H ; R2H = C(k) + x*(-0.5*S(k) - x*0.166667*C(k))
|
||||
SUBF32 R1H, R1H, R3H ; R1H = -S(k) + x*(-0.5*C(k) + x*0.166667*S(k))
|
||||
|
||||
MPYF32 R2H, R0H, R2H ; R2H = x*(C(k) + x*(-0.5*S(k) - x*0.166667*C(k)))
|
||||
|| MOV32 R4H, *+XAR7[AR0] ; R4H = S(k)
|
||||
|
||||
MPYF32 R1H, R0H, R1H ; R1H = x*(-S(k) + x*(-0.5*C(k) + x*0.166667*S(k)))
|
||||
|| MOV32 R3H, *+XAR6[AR0] ; R3H = C(k)
|
||||
|
||||
ADDF32 R2H, R4H, R2H ; R2H = S(k) + x*(C(k) + x*(-0.5*S(k) - x*0.166667*C(k)))
|
||||
|| MOV32 R4H, *--SP ; Restore R4H from the stack
|
||||
|
||||
ADDF32 R1H, R3H, R1H ; R1H = C(k) + x*(-S(k) + x*(-0.5*C(k) + x*0.166667*S(k)))
|
||||
|
||||
MOV32 *XAR4, R2H ; *PtrSin = R2H
|
||||
MOV32 *XAR5, R1H ; *PtrCos = R1H
|
||||
|
||||
LRETR
|
||||
|
||||
;; End of File
|
||||
@@ -0,0 +1,113 @@
|
||||
;;#############################################################################
|
||||
;;! \file source/fpu32/sqrt_f32.asm
|
||||
;;!
|
||||
;;! \brief Fast 32-bit floating-point sqrt for the C28x + Floating-Point Unit.
|
||||
;;! \author N/A
|
||||
;;! \date N/A
|
||||
;;
|
||||
;; DESCRIPTION:
|
||||
;;
|
||||
;; This function computes a 32-bit floating point sqrt..
|
||||
;;
|
||||
;; FUNCTIONS:
|
||||
;;
|
||||
;; float32 sqrtf(float32 X)
|
||||
;;
|
||||
;; ASSUMPTIONS:
|
||||
;;
|
||||
;;
|
||||
;; ALGORITHM:
|
||||
;;
|
||||
;; Ye = Estimate(1/sqrt(X));
|
||||
;; Ye = Ye*(1.5 - Ye*Ye*X*0.5)
|
||||
;; Ye = Ye*(1.5 - Ye*Ye*X*0.5)
|
||||
;; Y = sqrt(X) = X*Ye
|
||||
;;
|
||||
;; Group: C2000
|
||||
;; Target Family: C28x+FPU32
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
.page
|
||||
.if __TI_EABI__
|
||||
.asg sqrtf, _sqrt
|
||||
.endif
|
||||
.global _sqrt
|
||||
.text
|
||||
.if (__TI_EABI__ = 0)
|
||||
; For TI COFF double and float are the same size, so sqrtf() and sqrt()
|
||||
; should be the same function
|
||||
.global _sqrtf
|
||||
_sqrtf:
|
||||
.endif
|
||||
_sqrt:
|
||||
; R0H = X on entry
|
||||
EISQRTF32 R1H, R0H ; R1H = Ye = Estimate(1/sqrt(X))
|
||||
MPYF32 R2H, R0H, #0.5 ; R2H = X*0.5
|
||||
MPYF32 R3H, R1H, R1H ; R3H = Ye*Ye
|
||||
NOP
|
||||
MPYF32 R3H, R3H, R2H ; R3H = Ye*Ye*X*0.5
|
||||
NOP
|
||||
SUBF32 R3H, #1.5, R3H ; R3H = 1.5 - Ye*Ye*X*0.5
|
||||
NOP
|
||||
MPYF32 R1H, R1H, R3H ; R2H = Ye = Ye*(1.5 - Ye*Ye*X*0.5)
|
||||
NOP
|
||||
MPYF32 R3H, R1H, R2H ; R3H = Ye*X*0.5
|
||||
NOP
|
||||
MPYF32 R3H, R1H, R3H ; R3H = Ye*Ye*X*0.5
|
||||
NOP
|
||||
SUBF32 R3H, #1.5, R3H ; R3H = 1.5 - Ye*Ye*X*0.5
|
||||
CMPF32 R0H, #0.0 ; Check if X == 0
|
||||
MPYF32 R1H, R1H, R3H ; R2H = Ye = Ye*(1.5 - Ye*Ye*X*0.5)
|
||||
NOP
|
||||
MOV32 R1H, R0H, EQ ; If X is zero, change the Ye estimate to 0
|
||||
MPYF32 R0H, R0H, R1H ; R0H = Y = X*Ye = sqrt(X)
|
||||
LRETR
|
||||
.endasmfunc
|
||||
|
||||
;; End of File
|
||||
@@ -0,0 +1,324 @@
|
||||
;;#############################################################################
|
||||
;;! \file source/fpu64/atan2_f64.asm
|
||||
;;!
|
||||
;;! \brief Fast arctangent2 function for the C28x + FPU64
|
||||
;;! \author Vishal Coelho
|
||||
;;! \date 03/04/2016
|
||||
;;
|
||||
;; DESCRIPTION:
|
||||
;;
|
||||
;; This function computes a 64-bit floating point arctangent given two
|
||||
;; numerical inputs. This function uses the FPU64 math tables to
|
||||
;; compute the atan.
|
||||
;;
|
||||
;; FUNCTIONS:
|
||||
;;
|
||||
;; float64 atan2 (float64 Y, float64 X)
|
||||
;;
|
||||
;; ASSUMPTIONS:
|
||||
;;
|
||||
;; * FPU64atan2Table is linked into the project.
|
||||
;;
|
||||
;; ALGORITHM:
|
||||
;; Step(1): if( abs(X) >= abs(Y) )
|
||||
;; Numerator = abs(Y)
|
||||
;; Denominator = abs(X)
|
||||
;; else
|
||||
;; Numerator = abs(X)
|
||||
;; Denominator = abs(Y)
|
||||
;;
|
||||
;; Step(2): Ratio = Numerator/Denominator
|
||||
;;
|
||||
;; Note: Ratio range = 0.0 to 1.0
|
||||
;;
|
||||
;; Step(3): Use the upper 6-bits of the "Ratio" value as an
|
||||
;; index into the table to obtain the coefficients
|
||||
;; for a second order equation:
|
||||
;;
|
||||
;; _FPU64atan2Table:
|
||||
;; CoeffA0[0]
|
||||
;; CoeffA1[0]
|
||||
;; CoeffA2[0]
|
||||
;; .
|
||||
;; .
|
||||
;; CoeffA0[63]
|
||||
;; CoeffA1[63]
|
||||
;; CoeffA2[63]
|
||||
;;
|
||||
;; Step(4): Calculate the angle using the folowing equation:
|
||||
;;
|
||||
;; arctan(Ratio) = A0 + A1*Ratio + A2*Ratio*Ratio
|
||||
;; arctan(Ratio) = A0 + Ratio(A1 + A2*Ratio)
|
||||
;;
|
||||
;; Step(5): The final angle is determined as follows:
|
||||
;;
|
||||
;; if( X >= 0 and Y >= 0 and abs(X) >= abs(Y) )
|
||||
;; Angle = arctan(abs(Y)/abs(X))
|
||||
;; if( X >= 0 and Y >= 0 and abs(X) < abs(Y) )
|
||||
;; Angle = PI/2 - arctan(abs(X)/abs(Y))
|
||||
;; if( X < 0 and Y >= 0 and abs(X) < abs(Y) )
|
||||
;; Angle = PI/2 + arctan(abs(X)/abs(Y))
|
||||
;; if( X < 0 and Y >= 0 and abs(X) >= abs(Y) )
|
||||
;; Angle = PI - arctan(abs(Y)/abs(X))
|
||||
;; if( Y < 0 )
|
||||
;; Angle = -Angle
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
|
||||
;; the includes
|
||||
.cdecls C, LIST, "fastrts.h"
|
||||
|
||||
;; external references
|
||||
.if __TI_EABI__
|
||||
.asg FPU64atan2HalfPITable, _FPU64atan2HalfPITable
|
||||
.asg FPU64atan2Table, _FPU64atan2Table
|
||||
.asg atan2, _atan2l
|
||||
.endif
|
||||
.ref _FPU64atan2HalfPITable
|
||||
.ref _FPU64atan2Table
|
||||
|
||||
;;*****************************************************************************
|
||||
;; Register Usage:
|
||||
;; AR0 : index into the arctan table
|
||||
;; XAR1 :
|
||||
;; XAR2 : points to table entries A0.L
|
||||
;; XAR3 : points to table entries A0.H
|
||||
;; XAR4 : points to table entries A1.L
|
||||
;; XAR5 : points to table entries A1.H
|
||||
;; XAR6 : points to table entries A2.L
|
||||
;; XAR7 : points to table entries A2.H & PI/2
|
||||
;;
|
||||
;; Stack Usage:
|
||||
;;
|
||||
;; |_______|<- Stack Pointer (SP)
|
||||
;; |_______|<- R1H (SP-2) ------>Local Frame
|
||||
;; |_______|<- R0H (SP-4) ----+
|
||||
;; |_______|<- R4H (SP-6)
|
||||
;; |_______|<- XAR3 (SP-8)
|
||||
;; |_______|<- XAR2 (SP-10)
|
||||
;; |_______|<- rpc calling function (SP-12)
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.global _atan2l
|
||||
.sect ".text"
|
||||
_atan2l:
|
||||
.asmfunc
|
||||
.asg XAR2, P_A0_L
|
||||
.asg XAR3, P_A0_H
|
||||
.asg XAR4, P_A1_L
|
||||
.asg XAR5, P_A1_H
|
||||
.asg XAR6, P_A2_L
|
||||
.asg XAR7, P_A2_H
|
||||
.asg XAR7, PI_O_2
|
||||
.if CONVERT_F32_TO_F64 == 1
|
||||
F32TOF64 R0, R0H ; convert argument to double precision
|
||||
.endif
|
||||
;;-----------------------------------------------------------------------------
|
||||
;; Context Save
|
||||
;;-----------------------------------------------------------------------------
|
||||
PUSH XAR2
|
||||
PUSH XAR3
|
||||
MOV32 *SP++, R4H
|
||||
|
||||
;;-----------------------------------------------------------------------------
|
||||
;; atan2
|
||||
;;-----------------------------------------------------------------------------
|
||||
; Perform Step (1):
|
||||
; R0 = Y (on entry)
|
||||
; R1 = X (on entry)
|
||||
ABSF64 R3, R0 ; R3 = abs(Y)
|
||||
ABSF64 R4, R1 ; R4 = abs(X)
|
||||
MINF64 R3, R4 ; R3 = Numerator = min(abs(Y),abs(X))
|
||||
|| MOV64 R4, R3 ; R4 = Denominator = max(abs(Y),abs(X))
|
||||
;<<VC160304 looks like a NOP is required here for EINVF64 to work properly>>
|
||||
.if 1
|
||||
NOP
|
||||
.endif
|
||||
; Perform Step (2) and (3):
|
||||
EINVF64 R2, R4 ; *| R2 = Ye = Estimate(1/Numerator)
|
||||
TESTTF LEQ ; 1| Set TF if abs(X) >= abs(Y)
|
||||
MPYF64 R0, R2, R4 ; *| R0H = Ye*B
|
||||
|| MOV32 *SP++, R0H ; | Store Y (*-SP[4] = Y.H)
|
||||
MPYF64 R1, R2, R3 ; 1|*| R1 = 16-bit accurate estimate
|
||||
|| MOV32 *SP++, R1H ; | | Store X (*-SP[2] = X.H)
|
||||
; Points to A2.L 2|1|
|
||||
MOVL P_A2_L, #_FPU64atan2Table+8
|
||||
SUBF64 R0, #2.0, R0 ; *|2| R0 = 2.0 - Ye*B
|
||||
MPYF64 R1, R1, #64.0 ; 1|*| 64 = Elements In Table
|
||||
; Points to A2.H 2|1|
|
||||
MOVL P_A2_H, #_FPU64atan2Table+10
|
||||
; R2 = Ye = Ye*(2.0 - Ye*B) (first estimate)
|
||||
MPYF64 R2, R2, R0 ; *|2|
|
||||
; R1H = int32_t(64*ratio) (32-bit accurate)
|
||||
F64TOUI32 R1H, R1 ; 1|*|
|
||||
; Points to A1.L 2|1|
|
||||
MOVL P_A1_L, #_FPU64atan2Table+4
|
||||
MPYF64 R0, R2, R4 ; *| R0= Ye*B
|
||||
; Points to A1.H 1|
|
||||
MOVL P_A1_H, #_FPU64atan2Table+6
|
||||
MOV32 ACC, R1H ; 2| ACC = int(64*Ratio)
|
||||
SUBF64 R0, #2.0, R0 ; *| R0 = 2.0 - Ye*B
|
||||
NOP ; 1|
|
||||
MPY P, @AL, #12 ; 2| P = 12 * int(64*Ratio)
|
||||
MPYF64 R2, R2, R0 ; *| R2 = Ye = Ye*(2.0 - Ye*B)
|
||||
MOVZ AR0, @PL ; 1| AR0 = _FPU64atan2Table index
|
||||
; Points to A0.L 2|
|
||||
MOVL P_A0_L, #_FPU64atan2Table
|
||||
MPYF64 R0, R2, R4 ; *| R0= Ye*B
|
||||
; Points to A0.H 1|
|
||||
MOVL P_A0_H, #_FPU64atan2Table+2
|
||||
NOP ; 2|
|
||||
SUBF64 R0, #2.0, R0 ; *| R0 = 2.0 - Ye*B
|
||||
NOP ; 1|
|
||||
NOP ; 2|
|
||||
MPYF64 R2, R2, R0 ; *| R2 = Ye = Ye*(2.0 - Ye*B)
|
||||
NOP ; 1|
|
||||
NOP ; 2|
|
||||
MPYF64 R0, R2, R4 ; *| R0= Ye*B
|
||||
NOP ; 1|
|
||||
NOP ; 2|
|
||||
SUBF64 R0, #2.0, R0 ; *| R0 = 2.0 - Ye*B
|
||||
NOP ; 1|
|
||||
NOP ; 2|
|
||||
MPYF64 R2, R2, R0 ; *| R2 = Ye = Ye*(2.0 - Ye*B)
|
||||
MOV32 R4L, *+P_A0_L[AR0] ; 1| R4 = A0
|
||||
MOV32 R4H, *+P_A0_H[AR0] ; 2|
|
||||
|
||||
MPYF64 R0, R3, R2 ; *| R0 = Ratio = A*Ye = A/B
|
||||
; Perform Step (4):
|
||||
; arctan(Ratio) = A0 + Ratio(A1 + A2*Ratio)
|
||||
MOV32 R1L, *+P_A2_L[AR0] ; 1| R1 = A2
|
||||
MOV32 R1H, *+P_A2_H[AR0] ; 2|
|
||||
MPYF64 R3, R1, R0 ; *| R3 = A2*Ratio
|
||||
|| MOV32 R1L, *+P_A1_L[AR0] ; | R1 = A1
|
||||
MOV32 R1H, *+P_A1_H[AR0] ; 1|
|
||||
; *XAR7[2] == pi/2 ; 2|
|
||||
MOVL XAR7, #_FPU64atan2HalfPITable
|
||||
ADDF64 R3, R1, R3 ; *| R3 = A1 + A2*Ratio
|
||||
MOV32 R1L, *+PI_O_2[4] ; 1| R1 = pi/2 (no flag change)
|
||||
MOV32 R1H, *+PI_O_2[6] ; 2|
|
||||
MPYF64 R3, R0, R3 ; *| R3 = Ratio*(A1 + A2*Ratio)
|
||||
NOP ; 1|
|
||||
NOP ; 2|
|
||||
; R0 = arctan(Ratio) = A0 + Ratio(A1 + A2*Ratio)
|
||||
ADDF64 R0, R4, R3 ; *|
|
||||
; <<VC160304
|
||||
; we only care about the leading 32-bits as they contain the sign and
|
||||
; exponent; the sign bit will set/clear the NF while the exponent sets
|
||||
; the ZF when its value is 0 - we dont care about a non-zero mantissa in
|
||||
; this case since we treat subnormal numbers as 0 anyway
|
||||
; VC160304>>
|
||||
MOV32 R2H, *--SP ; 1| R2H = X.H(set/clear NF,ZF for use below)
|
||||
; Perform Step (5):
|
||||
NEGF64 R3, R1, UNC ; 2| R3 = -pi/2 (no flag change)
|
||||
MOV64 R0, R2, EQ ; if(X == 0), R0 = 0
|
||||
NEGF64 R0, R0, GEQ ; if(X >= 0) flip sign of R0(atan(Ratio))
|
||||
NEGF64 R0, R0, TF ; if (abs(X) >= abs(Y)) flip sign of
|
||||
; atan(Ratio)
|
||||
NEGF64 R3, R3, LT ; if(X < 0) R3 = pi/2
|
||||
ADDF64 R3, R3, R1 ; *| R3 = R3 + pi/2
|
||||
; | if (X < 0) R3 = pi
|
||||
; | if (X > 0) R3 = 0
|
||||
MOV32 R2H, *--SP ; 1| R2H = Y.H (set/clear NF,ZF)
|
||||
;;-----------------------------------------------------------------------------
|
||||
;; Context Restore (and final operations)
|
||||
;;-----------------------------------------------------------------------------
|
||||
MOV32 R4H, *--SP, UNC ; 2|
|
||||
MOV64 R3, R1, NTF ; if(abs(X) < abs(Y) R3 = pi/2
|
||||
ADDF64 R0, R0, R3 ; 2|*| R0 = Angle
|
||||
; Restore save on entry registers
|
||||
POP XAR3 ; |1|
|
||||
POP XAR2 ; |2|
|
||||
NEGF64 R0, R0, LT ; if (Y < 0) Angle = -Angle
|
||||
|
||||
LRETR
|
||||
.unasg P_A0_L
|
||||
.unasg P_A0_H
|
||||
.unasg P_A1_L
|
||||
.unasg P_A1_H
|
||||
.unasg P_A2_L
|
||||
.unasg P_A2_H
|
||||
.unasg PI_O_2
|
||||
.endasmfunc
|
||||
|
||||
;;*****************************************************************************
|
||||
;; This function will run the function above taking the address of the input
|
||||
;; and output as arguments
|
||||
;;
|
||||
;; Register Usage:
|
||||
;; XAR4 : points to the destination argument
|
||||
;; XAR5 : points to the first source argument
|
||||
;;
|
||||
;; Stack Usage:
|
||||
;;
|
||||
;; |_______|<- Stack Pointer (SP)
|
||||
;; |_______|<- XAR4 (SP-2)
|
||||
;; |_______|<- rpc (SP-4)
|
||||
;; |_______|<- p_src2 (SP-6)
|
||||
;;
|
||||
;;*****************************************************************************
|
||||
.if __TI_EABI__
|
||||
.asg run_atan2, _run_atan2
|
||||
.endif
|
||||
.global _run_atan2
|
||||
.sect ".text"
|
||||
_run_atan2: .asmfunc
|
||||
PUSH XAR4
|
||||
MOV32 R0L, *+XAR5[0]
|
||||
MOV32 R0H, *+XAR5[2]
|
||||
MOVL XAR5, *-SP[6] ; XAR5 -> pointer to the second source argument
|
||||
MOV32 R1L, *+XAR5[0]
|
||||
MOV32 R1H, *+XAR5[2]
|
||||
LCR #_atan2l
|
||||
POP XAR4
|
||||
MOV32 *+XAR4[0], R0L
|
||||
MOV32 *+XAR4[2], R0H
|
||||
LRETR
|
||||
.endasmfunc
|
||||
;; End of File
|
||||
@@ -0,0 +1,144 @@
|
||||
;;#############################################################################
|
||||
;;! \file atan2table_f64.asm
|
||||
;;! \brief Arctangent Lookup Table (256)
|
||||
;;! \author Vishal Coelho
|
||||
;;! \date 03-Mar-2016
|
||||
;;!
|
||||
;; Revision History:
|
||||
;;+----------+---------------+------------------------------------------------+
|
||||
;;| DATE | AUTHOR | CHANGE |
|
||||
;;+----------+---------------+------------------------------------------------+
|
||||
;;| 01/16/18 | Ritvik Sadana | Changed symbol names to avoid conflicts with |
|
||||
;;| | | FPU32 symbols. |
|
||||
;;+----------+---------------+------------------------------------------------+
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
.if __TI_EABI__
|
||||
.asg FPU64atan2HalfPITable, _FPU64atan2HalfPITable
|
||||
.asg FPU64atan2Table, _FPU64atan2Table
|
||||
.asg FPU64atan2TableEnd, _FPU64atan2TableEnd
|
||||
.endif
|
||||
.def _FPU64atan2HalfPITable
|
||||
.def _FPU64atan2Table
|
||||
.def _FPU64atan2TableEnd
|
||||
|
||||
.sect "FPU64mathTables"
|
||||
|
||||
_FPU64atan2HalfPITable:
|
||||
.xldouble 2.0000000000000
|
||||
.xldouble 1.5707963267949
|
||||
_FPU64atan2Table:
|
||||
.xldouble 0.0000000000000, 1.0000406796754, -0.0078110697504 ; 0 -> a0 a1 a2
|
||||
.xldouble -0.0000038070221, 1.0005280677716, -0.0234103454930 ; 1 -> a0 a1 a2
|
||||
.xldouble -0.0000189683103, 1.0014985681064, -0.0389411970749 ; 2 -> a0 a1 a2
|
||||
.xldouble -0.0000528319270, 1.0029436809648, -0.0543585631597 ; 3 -> a0 a1 a2
|
||||
.xldouble -0.0001124179960, 1.0048507857875, -0.0696182066495 ; 4 -> a0 a1 a2
|
||||
.xldouble -0.0002042958852, 1.0072032932429, -0.0846770287235 ; 5 -> a0 a1 a2
|
||||
.xldouble -0.0003344694932, 1.0099808435012, -0.0994933676284 ; 6 -> a0 a1 a2
|
||||
.xldouble -0.0005082726057, 1.0131595470233, -0.1140272784299 ; 7 -> a0 a1 a2
|
||||
.xldouble -0.0007302760352, 1.0167122634486, -0.1282407903432 ; 8 -> a0 a1 a2
|
||||
.xldouble -0.0010042079796, 1.0206089135568, -0.1420981387153 ; 9 -> a0 a1 a2
|
||||
.xldouble -0.0013328887174, 1.0248168188011, -0.1555659692585 ; 10 -> a0 a1 a2
|
||||
.xldouble -0.0017181804313, 1.0293010625688, -0.1686135126670 ; 11 -> a0 a1 a2
|
||||
.xldouble -0.0021609526118, 1.0340248671352, -0.1812127283288 ; 12 -> a0 a1 a2
|
||||
.xldouble -0.0026610631593, 1.0389499802219, -0.1933384164099 ; 13 -> a0 a1 a2
|
||||
.xldouble -0.0032173549768, 1.0440370651602, -0.2049682981460 ; 14 -> a0 a1 a2
|
||||
.xldouble -0.0038276675461, 1.0492460888683, -0.2160830647060 ; 15 -> a0 a1 a2
|
||||
.xldouble -0.0044888627021, 1.0545367021923, -0.2266663955068 ; 16 -> a0 a1 a2
|
||||
.xldouble -0.0051968635789, 1.0598686075727, -0.2367049472787 ; 17 -> a0 a1 a2
|
||||
.xldouble -0.0059467055004, 1.0652019095265, -0.2461883156129 ; 18 -> a0 a1 a2
|
||||
.xldouble -0.0067325974217, 1.0704974439939, -0.2551089710223 ; 19 -> a0 a1 a2
|
||||
.xldouble -0.0075479924132, 1.0757170832221, -0.2634621718398 ; 20 -> a0 a1 a2
|
||||
.xldouble -0.0083856655986, 1.0808240134986, -0.2712458564756 ; 21 -> a0 a1 a2
|
||||
.xldouble -0.0092377979239, 1.0857829836932, -0.2784605176930 ; 22 -> a0 a1 a2
|
||||
.xldouble -0.0100960641391, 1.0905605232115, -0.2851090616505 ; 23 -> a0 a1 a2
|
||||
.xldouble -0.0109517234066, 1.0951251285570, -0.2911966544475 ; 24 -> a0 a1 a2
|
||||
.xldouble -0.0117957110286, 1.0994474183038, -0.2967305589200 ; 25 -> a0 a1 a2
|
||||
.xldouble -0.0126187298731, 1.1035002567840, -0.3017199643105 ; 26 -> a0 a1 a2
|
||||
.xldouble -0.0134113401986, 1.1072588472740, -0.3061758113249 ; 27 -> a0 a1 a2
|
||||
.xldouble -0.0141640467111, 1.1107007958875, -0.3101106149475 ; 28 -> a0 a1 a2
|
||||
.xldouble -0.0148673818311, 1.1138061477170, -0.3135382871760 ; 29 -> a0 a1 a2
|
||||
.xldouble -0.0155119842982, 1.1165573970591, -0.3164739616554 ; 30 -> a0 a1 a2
|
||||
.xldouble -0.0160886723953, 1.1189394737663, -0.3189338219481 ; 31 -> a0 a1 a2
|
||||
.xldouble -0.0165885112292, 1.1209397079557, -0.3209349349913 ; 32 -> a0 a1 a2
|
||||
.xldouble -0.0170028736449, 1.1225477753665, -0.3224950910217 ; 33 -> a0 a1 a2
|
||||
.xldouble -0.0173234944993, 1.1237556257493, -0.3236326510678 ; 34 -> a0 a1 a2
|
||||
.xldouble -0.0175425181404, 1.1245573966328, -0.3243664028596 ; 35 -> a0 a1 a2
|
||||
.xldouble -0.0176525390650, 1.1249493148104, -0.3247154258333 ; 36 -> a0 a1 a2
|
||||
.xldouble -0.0176466358231, 1.1249295877727, -0.3246989656827 ; 37 -> a0 a1 a2
|
||||
.xldouble -0.0175183983443, 1.1244982872665, -0.3243363187867 ; 38 -> a0 a1 a2
|
||||
.xldouble -0.0172619489202, 1.1236572269554, -0.3236467266133 ; 39 -> a0 a1 a2
|
||||
.xldouble -0.0168719571636, 1.1224098360981, -0.3226492801386 ; 40 -> a0 a1 a2
|
||||
.xldouble -0.0163436492943, 1.1207610309185, -0.3213628341191 ; 41 -> a0 a1 a2
|
||||
.xldouble -0.0156728121663, 1.1187170852579, -0.3198059310243 ; 42 -> a0 a1 a2
|
||||
.xldouble -0.0148557924513, 1.1162855018516, -0.3179967342794 ; 43 -> a0 a1 a2
|
||||
.xldouble -0.0138894914410, 1.1134748854835, -0.3159529704599 ; 44 -> a0 a1 a2
|
||||
.xldouble -0.0127713559110, 1.1102948190320, -0.3136918799664 ; 45 -> a0 a1 a2
|
||||
.xldouble -0.0114993655128, 1.1067557433290, -0.3112301757137 ; 46 -> a0 a1 a2
|
||||
.xldouble -0.0100720171306, 1.1028688415306, -0.3085840092872 ; 47 -> a0 a1 a2
|
||||
.xldouble -0.0084883066548, 1.0986459286453, -0.3057689440639 ; 48 -> a0 a1 a2
|
||||
.xldouble -0.0067477085786, 1.0940993466476, -0.3027999347241 ; 49 -> a0 a1 a2
|
||||
.xldouble -0.0048501538149, 1.0892418655233, -0.2996913126099 ; 50 -> a0 a1 a2
|
||||
.xldouble -0.0027960061186, 1.0840865905167, -0.2964567764093 ; 51 -> a0 a1 a2
|
||||
.xldouble -0.0005860374406, 1.0786468756663, -0.2931093876086 ; 52 -> a0 a1 a2
|
||||
.xldouble 0.0017785974517, 1.0729362437272, -0.2896615702293 ; 53 -> a0 a1 a2
|
||||
.xldouble 0.0042963868040, 1.0669683124404, -0.2861251143513 ; 54 -> a0 a1 a2
|
||||
.xldouble 0.0069654878940, 1.0607567270642, -0.2825111829598 ; 55 -> a0 a1 a2
|
||||
.xldouble 0.0097837530165, 1.0543150990086, -0.2788303216685 ; 56 -> a0 a1 a2
|
||||
.xldouble 0.0127487552067, 1.0476569504397, -0.2750924709426 ; 57 -> a0 a1 a2
|
||||
.xldouble 0.0158578135459, 1.0407956645818, -0.2713069804113 ; 58 -> a0 a1 a2
|
||||
.xldouble 0.0191080178933, 1.0337444414765, -0.2674826249277 ; 59 -> a0 a1 a2
|
||||
.xldouble 0.0224962528869, 1.0265162589889, -0.2636276220892 ; 60 -> a0 a1 a2
|
||||
.xldouble 0.0260192211618, 1.0191238386511, -0.2597496508597 ; 61 -> a0 a1 a2
|
||||
.xldouble 0.0296734656363, 1.0115796161864, -0.2558558711062 ; 62 -> a0 a1 a2
|
||||
.xldouble 0.0334553908381, 1.0038957163225, -0.2519529437632 ; 63 -> a0 a1 a2
|
||||
.xldouble 0.0373612832121, 0.9960839316110, -0.2480470514256 ; 64 -> a0 a1 a2
|
||||
_FPU64atan2TableEnd:
|
||||
|
||||
;; End of File
|
||||
@@ -0,0 +1,309 @@
|
||||
;;#############################################################################
|
||||
;;! \file source/fpu64/atan_f64.asm
|
||||
;;!
|
||||
;;! \brief Fast arctangent function for the C28x + FPU64
|
||||
;;! \author Vishal Coelho
|
||||
;;! \date 03/02/2016
|
||||
;;
|
||||
;; DESCRIPTION:
|
||||
;;
|
||||
;; This function computes a 64-bit floating point arctangent given a
|
||||
;; numerical input. This function uses the FPU64 math tables to
|
||||
;; compute the atan.
|
||||
;;
|
||||
;; FUNCTIONS:
|
||||
;;
|
||||
;; float64 atan (float64 Y)
|
||||
;;
|
||||
;; ASSUMPTIONS:
|
||||
;;
|
||||
;; * FPU64atan2Table is linked into the project.
|
||||
;;
|
||||
;; ALGORITHM:
|
||||
;; Step(1): if( 1.0 >= abs(Y) )
|
||||
;; Numerator = abs(Y)
|
||||
;; Denominator = 1.0
|
||||
;; else
|
||||
;; Numerator = 1.0
|
||||
;; Denominator = abs(Y)
|
||||
;;
|
||||
;; Step(2): Ratio = Numerator/Denominator
|
||||
;;
|
||||
;; Note: Ratio range = 0.0 to 1.0
|
||||
;;
|
||||
;; Step(3): Use the upper 6-bits of the "Ratio" value as an
|
||||
;; index into the table to obtain the coefficients
|
||||
;; for a second order equation:
|
||||
;;
|
||||
;; _FPU64atan2Table:
|
||||
;; CoeffA0[0]
|
||||
;; CoeffA1[0]
|
||||
;; CoeffA2[0]
|
||||
;; .
|
||||
;; .
|
||||
;; CoeffA0[63]
|
||||
;; CoeffA1[63]
|
||||
;; CoeffA2[63]
|
||||
;;
|
||||
;; Step(4): Calculate the angle using the folowing equation:
|
||||
;;
|
||||
;; arctan(Ratio) = A0 + A1*Ratio + A2*Ratio*Ratio
|
||||
;; arctan(Ratio) = A0 + Ratio(A1 + A2*Ratio)
|
||||
;;
|
||||
;; Step(5): The final angle is determined as follows:
|
||||
;;
|
||||
;; if( Y >= 0 and 1.0 >= abs(Y) )
|
||||
;; Angle = arctan(abs(Y)/1.0)
|
||||
;; if( Y >= 0 and 1.0 < abs(Y) )
|
||||
;; Angle = PI/2 - arctan(1.0/abs(Y))
|
||||
;; if( Y < 0 )
|
||||
;; Angle = -Angle
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
|
||||
;; the includes
|
||||
.cdecls C, LIST, "fastrts.h"
|
||||
|
||||
;; external references
|
||||
.if __TI_EABI__
|
||||
.asg FPU64atan2HalfPITable, _FPU64atan2HalfPITable
|
||||
.asg FPU64atan2Table, _FPU64atan2Table
|
||||
.asg atan, _atanl
|
||||
.endif
|
||||
.ref _FPU64atan2HalfPITable
|
||||
.ref _FPU64atan2Table
|
||||
|
||||
;;*****************************************************************************
|
||||
;; Register Usage:
|
||||
;; AR0 : index into the arctan table
|
||||
;; XAR1 :
|
||||
;; XAR2 : points to table entries A0.L
|
||||
;; XAR3 : points to table entries A0.H
|
||||
;; XAR4 : points to table entries A1.L
|
||||
;; XAR5 : points to table entries A1.H
|
||||
;; XAR6 : points to table entries A2.L
|
||||
;; XAR7 : points to table entries A2.H & PI/2
|
||||
;;
|
||||
;; Stack Usage:
|
||||
;;
|
||||
;; |_______|<- Stack Pointer (SP)
|
||||
;; |_______|<- R0H (SP-2) ------>Local Frame
|
||||
;; |_______|<- R4H (SP-4)
|
||||
;; |_______|<- XAR3 (SP-6)
|
||||
;; |_______|<- XAR2 (SP-8)
|
||||
;; |_______|<- rpc calling function (SP-10)
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.global _atanl
|
||||
.sect ".text"
|
||||
_atanl:
|
||||
.asmfunc
|
||||
.asg XAR2, P_A0_L
|
||||
.asg XAR3, P_A0_H
|
||||
.asg XAR4, P_A1_L
|
||||
.asg XAR5, P_A1_H
|
||||
.asg XAR6, P_A2_L
|
||||
.asg XAR7, P_A2_H
|
||||
.asg XAR7, PI_O_2
|
||||
.if CONVERT_F32_TO_F64 == 1
|
||||
F32TOF64 R0, R0H ; convert argument to double precision
|
||||
.endif
|
||||
;;-----------------------------------------------------------------------------
|
||||
;; Context Save
|
||||
;;-----------------------------------------------------------------------------
|
||||
PUSH XAR2
|
||||
PUSH XAR3
|
||||
MOV32 *SP++, R4H
|
||||
|
||||
;;-----------------------------------------------------------------------------
|
||||
;; atan
|
||||
;;-----------------------------------------------------------------------------
|
||||
; Perform Step (1): R0 = Y (on entry)
|
||||
ABSF64 R3, R0 ; R3 = abs(Y)
|
||||
ZERO R4
|
||||
MOVIZ R4H, #0x3FF0 ; R4 = 1.0
|
||||
|
||||
MINF64 R3, R4 ; R3 = Numerator = min(abs(Y),1.0)
|
||||
|| MOV64 R4, R3 ; R4 = Denominator = max(abs(Y),1.0)
|
||||
;<<VC160304 looks like a NOP is required here for EINVF64 to work properly>>
|
||||
.if 0
|
||||
NOP
|
||||
.endif
|
||||
; Perform Step (2) and (3):
|
||||
NOP
|
||||
EINVF64 R2, R4 ; *| R2 = Ye = Estimate(1/Numerator)
|
||||
TESTTF LEQ ; 1| Set TF if 1.0 >= abs(Y)
|
||||
MPYF64 R0, R2, R4 ; *| R0H = Ye*B
|
||||
|| MOV32 *SP++, R0H ; | Store Y (*-SP[2] = Y.H)
|
||||
MPYF64 R1, R2, R3 ; 1|*| R1 = 16-bit accurate estimate
|
||||
; Points to A2.L 2|1|
|
||||
MOVL P_A2_L, #_FPU64atan2Table+8
|
||||
SUBF64 R0, #2.0, R0 ; *|2| R0 = 2.0 - Ye*B
|
||||
MPYF64 R1, R1, #64.0 ; 1|*| 64 = Elements In Table
|
||||
; Points to A2.H 2|1|
|
||||
MOVL P_A2_H, #_FPU64atan2Table+10
|
||||
; R2 = Ye = Ye*(2.0 - Ye*B) (first estimate)
|
||||
MPYF64 R2, R2, R0 ; *|2|
|
||||
; R1H = int32_t(64*ratio) (32-bit accurate)
|
||||
F64TOUI32 R1H, R1 ; 1|*|
|
||||
; Points to A1.L 2|1|
|
||||
MOVL P_A1_L, #_FPU64atan2Table+4
|
||||
MPYF64 R0, R2, R4 ; *| R0= Ye*B
|
||||
; Points to A1.H 1|
|
||||
MOVL P_A1_H, #_FPU64atan2Table+6
|
||||
MOV32 ACC, R1H ; 2| ACC = int(64*Ratio)
|
||||
SUBF64 R0, #2.0, R0 ; *| R0 = 2.0 - Ye*B
|
||||
NOP ; 1|
|
||||
MPY P, @AL, #12 ; 2| P = 12 * int(64*Ratio)
|
||||
MPYF64 R2, R2, R0 ; *| R2 = Ye = Ye*(2.0 - Ye*B)
|
||||
MOVZ AR0, @PL ; 1| AR0 = _FPU64atan2Table index
|
||||
; Points to A0.L 2|
|
||||
MOVL P_A0_L, #_FPU64atan2Table
|
||||
MPYF64 R0, R2, R4 ; *| R0= Ye*B
|
||||
; Points to A0.H 1|
|
||||
MOVL P_A0_H, #_FPU64atan2Table+2
|
||||
NOP ; 2|
|
||||
SUBF64 R0, #2.0, R0 ; *| R0 = 2.0 - Ye*B
|
||||
NOP ; 1|
|
||||
NOP ; 2|
|
||||
MPYF64 R2, R2, R0 ; *| R2 = Ye = Ye*(2.0 - Ye*B)
|
||||
NOP ; 1|
|
||||
NOP ; 2|
|
||||
MPYF64 R0, R2, R4 ; *| R0= Ye*B
|
||||
NOP ; 1|
|
||||
NOP ; 2|
|
||||
SUBF64 R0, #2.0, R0 ; *| R0 = 2.0 - Ye*B
|
||||
NOP ; 1|
|
||||
NOP ; 2|
|
||||
MPYF64 R2, R2, R0 ; *| R2 = Ye = Ye*(2.0 - Ye*B)
|
||||
MOV32 R4L, *+P_A0_L[AR0] ; 1| R4 = A0
|
||||
MOV32 R4H, *+P_A0_H[AR0] ; 2|
|
||||
|
||||
MPYF64 R0, R3, R2 ; *| R0 = Ratio = A*Ye = A/B
|
||||
; Perform Step (4):
|
||||
; arctan(Ratio) = A0 + Ratio(A1 + A2*Ratio)
|
||||
MOV32 R1L, *+P_A2_L[AR0] ; 1| R1 = A2
|
||||
MOV32 R1H, *+P_A2_H[AR0] ; 2|
|
||||
MPYF64 R3, R1, R0 ; *| R3 = A2*Ratio
|
||||
|| MOV32 R1L, *+P_A1_L[AR0] ; | R1 = A1
|
||||
MOV32 R1H, *+P_A1_H[AR0] ; 1|
|
||||
; *XAR7[2] == pi/2 ; 2|
|
||||
MOVL XAR7, #_FPU64atan2HalfPITable
|
||||
ADDF64 R3, R1, R3 ; *| R3 = A1 + A2*Ratio
|
||||
MOV32 R1L, *+PI_O_2[4] ; 1| R1 = pi/2 (no flag change)
|
||||
MOV32 R1H, *+PI_O_2[6] ; 2|
|
||||
MPYF64 R3, R0, R3 ; *| R3 = Ratio*(A1 + A2*Ratio)
|
||||
NOP ; 1|
|
||||
NOP ; 2|
|
||||
; R0 = arctan(Ratio) = A0 + Ratio(A1 + A2*Ratio)
|
||||
ADDF64 R0, R4, R3 ; *|
|
||||
NOP ; 1|
|
||||
; Perform Step (5):
|
||||
ZERO R3 ; 2|
|
||||
NEGF64 R0, R0, UNC ; R0 = flip sign of atan(Ratio)
|
||||
NEGF64 R0, R0, TF ; if (1.0 >= abs(Y)) flip sign of atan(Ratio)
|
||||
|
||||
; <<VC160303
|
||||
; we only care about the leading 32-bits as they contain the sign and
|
||||
; exponent; the sign bit will set/clear the NF while the exponent sets
|
||||
; the ZF when its value is 0 - we dont care about a non-zero mantissa in
|
||||
; this case since we treat subnormal numbers as 0 anyway
|
||||
; VC160303>>
|
||||
MOV32 R2H, *--SP ; R2H = Y.H (set/clear NF,ZF)
|
||||
|
||||
MOV64 R3, R1, NTF ; if(1.0 < abs(Y) R3 = pi/2, else R3 = 0.0
|
||||
ADDF64 R0, R0, R3 ; *| R0 = Angle
|
||||
;;-----------------------------------------------------------------------------
|
||||
;; Context Restore (and final operations)
|
||||
;;-----------------------------------------------------------------------------
|
||||
; Restore save on entry registers
|
||||
MOV32 R4H, *--SP, UNC ; 1|
|
||||
POP XAR3 ; 2|
|
||||
NEGF64 R0, R0, LT ; if (Y < 0) Angle = -Angle
|
||||
POP XAR2
|
||||
LRETR
|
||||
.unasg P_A0_L
|
||||
.unasg P_A0_H
|
||||
.unasg P_A1_L
|
||||
.unasg P_A1_H
|
||||
.unasg P_A2_L
|
||||
.unasg P_A2_H
|
||||
.unasg PI_O_2
|
||||
.endasmfunc
|
||||
|
||||
;;*****************************************************************************
|
||||
;; This function will run the function above taking the address of the input
|
||||
;; and output as arguments
|
||||
;;
|
||||
;; Register Usage:
|
||||
;; XAR4 : points to the destination argument
|
||||
;; XAR5 : points to the source argument
|
||||
;;
|
||||
;; Stack Usage:
|
||||
;;
|
||||
;; |_______|<- Stack Pointer (SP)
|
||||
;; |_______|<- XAR4 (SP-2)
|
||||
;;
|
||||
;;*****************************************************************************
|
||||
.if __TI_EABI__
|
||||
.asg run_atan, _run_atan
|
||||
.endif
|
||||
.global _run_atan
|
||||
.sect ".text"
|
||||
_run_atan: .asmfunc
|
||||
PUSH XAR4
|
||||
MOV32 R0L, *+XAR5[0]
|
||||
MOV32 R0H, *+XAR5[2]
|
||||
LCR #_atanl
|
||||
POP XAR4
|
||||
MOV32 *+XAR4[0], R0L
|
||||
MOV32 *+XAR4[2], R0H
|
||||
LRETR
|
||||
.endasmfunc
|
||||
;; End of File
|
||||
@@ -0,0 +1,234 @@
|
||||
;;#############################################################################
|
||||
;;! \file source/fpu64/cordic_cos_f64.asm
|
||||
;;!
|
||||
;;! \brief CORDIC cos function for the C28x + FPU64
|
||||
;;! \author Vishal Coelho
|
||||
;;! \date 12/16/2016
|
||||
;;
|
||||
;; DESCRIPTION:
|
||||
;;
|
||||
;; This function computes a 64-bit floating point cos given a
|
||||
;; radian input. This function uses the CORDIC rotation mode to
|
||||
;; compute the cos.
|
||||
;;
|
||||
;; FUNCTIONS:
|
||||
;;
|
||||
;; float64u_t CORDIC_F64_cos(hnd_CORDIC_t hC, float64u_t theta)
|
||||
;;
|
||||
;; where CORDIC_F64_Handle is defined as:
|
||||
;; typedef CORDIC_F64 *CORDIC_F64_Handle;
|
||||
;;
|
||||
;; and CORDIC_F64 is a structure,
|
||||
;; typedef struct _CORDIC_F64_
|
||||
;; {
|
||||
;; int64_t *x_i; //!< pointer to x coordinate
|
||||
;; int64_t *y_i; //!< pointer to y coordinate
|
||||
;; int64_t *z_i; //!< pointer to mode dependent angle (or
|
||||
;; //! angular error)
|
||||
;; uint16_t N; //!< number of CORDIC iterations (max = 64)
|
||||
;; const int64_t *atanTable; //!< Pointer to the atan(2^-i) table
|
||||
;; void (*runKernel)(void *); //!< CORDIC kernel
|
||||
;; }CORDIC_F64;
|
||||
;;
|
||||
;; ASSUMPTIONS:
|
||||
;;
|
||||
;; * CORDIC_F64 tables and constants are linked into the project.
|
||||
;; * the runKernel is set to the rotation kernel
|
||||
;; * N >= 26 as the scale factor does not change beyond
|
||||
;; IQ61(1/sqrt(1 + 2^(-2* 25)))
|
||||
;;
|
||||
;; ALGORITHM:
|
||||
;;
|
||||
;; The cos value is calculated as follows:
|
||||
;;
|
||||
;; 1. The argument theta is converted to IQ61 (from float)
|
||||
;; 2. set z to theta in the object and call the rotation kernel
|
||||
;; 0
|
||||
;; 3. The x is the cosine of the angle. Convert this angle back to float
|
||||
;; i
|
||||
;; and return
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
;; the includes
|
||||
.cdecls C, LIST, "fastrts.h"
|
||||
|
||||
;; external references
|
||||
.if __TI_EABI__
|
||||
.asg CORDIC_F64_PI_O_2, _CORDIC_F64_PI_O_2
|
||||
.asg CORDIC_F64_PI, _CORDIC_F64_PI
|
||||
.asg CORDIC_F64_3PI_O_2, _CORDIC_F64_3PI_O_2
|
||||
.asg CORDIC_F64_2PI, _CORDIC_F64_2PI
|
||||
.asg CORDIC_F64_scaleFactor, _CORDIC_F64_scaleFactor
|
||||
.asg CORDIC_F64_cos, _CORDIC_F64_cos
|
||||
.endif
|
||||
.ref _CORDIC_F64_PI_O_2
|
||||
.ref _CORDIC_F64_PI
|
||||
.ref _CORDIC_F64_3PI_O_2
|
||||
.ref _CORDIC_F64_2PI
|
||||
.ref _CORDIC_F64_scaleFactor
|
||||
;;*****************************************************************************
|
||||
;; Register Usage:
|
||||
;; AR0 : index into the scale tablea
|
||||
;; XAR4 : pointer to the object
|
||||
;; XAR5 : pointer to the angle, theta | pointer to x_i
|
||||
;; XAR6 : return value address | pointer to y_i
|
||||
;; XAR7 : kernel pointer | pointer to z_i
|
||||
;;
|
||||
;; Stack Usage:
|
||||
;;
|
||||
;; |_______|<- Stack Pointer (SP)
|
||||
;; |_______|<- XAR6 (SP-2)
|
||||
;; |_______|<- rpc calling function (SP-4)
|
||||
;;
|
||||
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.global _CORDIC_F64_cos
|
||||
.sect ".text"
|
||||
_CORDIC_F64_cos:
|
||||
.asmfunc
|
||||
.asg *+XAR5[0] , ARG_THETA_L
|
||||
.asg *+XAR5[2] , ARG_THETA_H
|
||||
.asg XAR5 , X_I
|
||||
.asg XAR6 , Y_I
|
||||
.asg XAR7 , Z_I
|
||||
.asg XAR7 , KERNELPTR
|
||||
.asg *XAR4++ , OBJ_PTR_XI
|
||||
.asg *XAR4++ , OBJ_PTR_YI
|
||||
.asg *XAR4++ , OBJ_PTR_ZI
|
||||
.asg *+XAR4[0] , OBJ_N
|
||||
.asg *+XAR4[2] , OBJ_PTR_ATANTBL
|
||||
.asg *+XAR4[4] , OBJ_PTR_KERNEL
|
||||
;;-----------------------------------------------------------------------------
|
||||
;; The Cosine Function
|
||||
;;-----------------------------------------------------------------------------
|
||||
PUSH XAR6 ; save the address of the return
|
||||
; value on the stack
|
||||
MOV32 R0L, ARG_THETA_L ; R0 = theta
|
||||
MOV32 R0H, ARG_THETA_H
|
||||
MOVL X_I, OBJ_PTR_XI ; XAR5 -> x_i
|
||||
MOVL Y_I, OBJ_PTR_YI ; XAR6 -> y_i
|
||||
MOVL Z_I, OBJ_PTR_ZI ; XAR7 -> z_i
|
||||
ABSF64 R0, R0 ; R0 = |theta|
|
||||
MOVW DP, #_CORDIC_F64_scaleFactor
|
||||
; ACC:P = scaleFactor
|
||||
MOVL P, @_CORDIC_F64_scaleFactor
|
||||
MOVL ACC, @_CORDIC_F64_scaleFactor + 2
|
||||
_CORDIC_F64_sin_pi_o_2:
|
||||
MOV32 R2L, @_CORDIC_F64_PI_O_2; R2 = pi/2
|
||||
MOV32 R2H, @_CORDIC_F64_PI_O_2 + 2
|
||||
CMPF64 R0, R2 ; if (|theta|<=pi/2)
|
||||
MOVST0 ZF, NF ; jmp convertArg
|
||||
BF _CORDIC_F64_sin_convertArg, LEQ
|
||||
_CORDIC_F64_sin_pi:
|
||||
MOV32 R2L, @_CORDIC_F64_PI ; R2 = pi
|
||||
MOV32 R2H, @_CORDIC_F64_PI + 2
|
||||
CMPF64 R0, R2 ; elseif (|theta|<=pi)
|
||||
MOVST0 ZF, NF
|
||||
BF _CORDIC_F64_sin_3pi_o_2, GT
|
||||
SUBF64 R0, R2, R0 ; R0 = pi - |theta|
|
||||
NEG64 ACC:P ; ACC:P = -scaleFactor
|
||||
BF _CORDIC_F64_sin_convertArg, UNC
|
||||
_CORDIC_F64_sin_3pi_o_2:
|
||||
; R1 = 3*pi/2
|
||||
MOV32 R1L, @_CORDIC_F64_3PI_O_2
|
||||
MOV32 R1H, @_CORDIC_F64_3PI_O_2 + 2
|
||||
CMPF64 R0, R1 ; elseif (|theta|<=3*pi/2)
|
||||
MOVST0 ZF, NF
|
||||
BF _CORDIC_F64_sin_2pi, GT
|
||||
SUBF64 R0, R0, R2 ; R0 = |theta| - pi
|
||||
NEG64 ACC:P ; ACC:P = -scaleFactor
|
||||
BF _CORDIC_F64_sin_convertArg, UNC
|
||||
_CORDIC_F64_sin_2pi:
|
||||
; R2 = 2*pi
|
||||
MOV32 R2L, @_CORDIC_F64_2PI
|
||||
MOV32 R2H, @_CORDIC_F64_2PI + 2
|
||||
SUBF64 R0, R2, R0 ; *| R0 = 2*pi - |theta|
|
||||
_CORDIC_F64_sin_convertArg:
|
||||
MOVL *+X_I[0], P ; 1| set x_i to scaleFactor
|
||||
MOVL *+X_I[2], ACC ; 2|
|
||||
MPYF64 R0, R0, #0x43C0 ; *| R0 = R0*2^61
|
||||
ZERO R1 ; 1|
|
||||
MOV32 *+Y_I[0], R1H ; 2| zero out y_i
|
||||
F64TOI64 R0, R0 ; *| R0 = IQ61(theta)
|
||||
MOV32 *+Y_I[2], R1H ; 1|
|
||||
MOV32 *+Z_I[0], R0L ; z_i = IQ61(theta)
|
||||
MOV32 *+Z_I[2], R0H
|
||||
MOVL KERNELPTR, OBJ_PTR_KERNEL
|
||||
; XAR7 -> kernel
|
||||
SUBB XAR4, #6 ; rewind object pointer
|
||||
|
||||
;; Call the rotation kernel
|
||||
LCR *KERNELPTR
|
||||
; XAR6 -> x_i (IQ61)
|
||||
MOV32 R0L, *+X_I[0] ; R0 = IQ61(cos(theta))
|
||||
MOV32 R0H, *+X_I[2]
|
||||
I64TOF64 R0, R0 ; *| R0 = cos(theta) * 2^61
|
||||
NOP ; 1|
|
||||
MPYF64 R0, R0, #0x3C20 ; *| R0 = R0 * 2^-61
|
||||
NOP ; 1|
|
||||
POP XAR6 ; 2| XAR6 -> addr(return value)
|
||||
MOV32 *+XAR6[0], R0L
|
||||
MOV32 *+XAR6[2], R0H
|
||||
LRETR
|
||||
.endasmfunc
|
||||
.unasg ARG_THETA_L
|
||||
.unasg ARG_THETA_H
|
||||
.unasg X_I
|
||||
.unasg Y_I
|
||||
.unasg Z_I
|
||||
.unasg KERNELPTR
|
||||
.unasg OBJ_PTR_XI
|
||||
.unasg OBJ_PTR_YI
|
||||
.unasg OBJ_PTR_ZI
|
||||
.unasg OBJ_N
|
||||
.unasg OBJ_PTR_ATANTBL
|
||||
.unasg OBJ_PTR_KERNEL
|
||||
|
||||
;; End of File
|
||||
@@ -0,0 +1,280 @@
|
||||
;;#############################################################################
|
||||
;;! \file source/fpu64/cordic_rotation_f64.asm
|
||||
;;!
|
||||
;;! \brief CORDIC Rotation Kernel for the C28x + FPU64
|
||||
;;! \author Vishal Coelho
|
||||
;;! \date 11/14/2016
|
||||
;;
|
||||
;; DESCRIPTION:
|
||||
;;
|
||||
;; This function implements the rotation kernel (CORDIC) in 64-bit double
|
||||
;; precision floating point.
|
||||
;;
|
||||
;; FUNCTIONS:
|
||||
;;
|
||||
;; void CORDIC_F64_rotationKernel(CORDIC_F64_Handle hC)
|
||||
;;
|
||||
;; where CORDIC_F64_Handle is defined as:
|
||||
;; typedef CORDIC_F64 *CORDIC_F64_Handle;
|
||||
;;
|
||||
;; and CORDIC_F64 is a structure,
|
||||
;; typedef struct _CORDIC_F64_
|
||||
;; {
|
||||
;; int64_t *x_i; //!< pointer to x coordinate
|
||||
;; int64_t *y_i; //!< pointer to y coordinate
|
||||
;; int64_t *z_i; //!< pointer to mode dependent angle (or
|
||||
;; //! angular error)
|
||||
;; uint16_t N; //!< number of CORDIC iterations (max = 64)
|
||||
;; const int64_t *atanTable; //!< Pointer to the atan(2^-i) table
|
||||
;; void (*runKernel)(void *); //!< CORDIC kernel
|
||||
;; }CORDIC_F64;
|
||||
;;
|
||||
;; ASSUMPTIONS:
|
||||
;;
|
||||
;; * CORDIC_F64 tables and constants are linked into the project.
|
||||
;;
|
||||
;; ALGORITHM:
|
||||
;;
|
||||
;; The CORDIC algorithm is run for N iterations. We start with the
|
||||
;; following parameters
|
||||
;;
|
||||
;; x = 1/K = 0.6072529350088812561694, where
|
||||
;; 0
|
||||
;; __inf 1
|
||||
;; K = || -----------------
|
||||
;; n=0 sqrt(1 + 2^(-2n))
|
||||
;;
|
||||
;; y = 0, z = theta (angle in radians)
|
||||
;; 0 0
|
||||
;;
|
||||
;; The *Non Restoring Decomposition* algorithm proceeds as follows:
|
||||
;; -n
|
||||
;; x = x - d * y * 2
|
||||
;; n+1 n n n
|
||||
;; -n
|
||||
;; y = y + d * x * 2
|
||||
;; n+1 n n n
|
||||
;; -n
|
||||
;; z = z - d * arctan(2 )
|
||||
;; n+1 n n
|
||||
;;
|
||||
;; 1 if z >= 0,
|
||||
;; where d = n
|
||||
;; n -1 otherwise
|
||||
;;
|
||||
;;
|
||||
;; Note that |theta| <= theta and
|
||||
;; max
|
||||
;;
|
||||
;; -- inf -k
|
||||
;; theta = > arctan(2 ) = 1.7432866204723400035...
|
||||
;; max -- k=0
|
||||
;;
|
||||
;; Once N iterations are complete we would have rotated our initial
|
||||
;; vector by the angle theta (within some error tolerance); the x and
|
||||
;; y components of the resultant vector are the cosine and sine of theta
|
||||
;; respectively
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
;; the includes
|
||||
.cdecls C, LIST, "fastrts.h"
|
||||
|
||||
;; external references
|
||||
.if __TI_EABI__
|
||||
.asg CORDIC_F64_atanTable, _CORDIC_F64_atanTable
|
||||
.asg CORDIC_F64_scaleTable, _CORDIC_F64_scaleTable
|
||||
.asg CORDIC_F64_rotationKernel, _CORDIC_F64_rotationKernel
|
||||
.endif
|
||||
.ref _CORDIC_F64_atanTable
|
||||
.ref _CORDIC_F64_scaleTable
|
||||
|
||||
;;*****************************************************************************
|
||||
;; Register Usage:
|
||||
;; AR0 : number of CORDIC iterations
|
||||
;; XAR1 : pointer to the arctan table
|
||||
;; XAR2 : temporary 32-bit storage
|
||||
;; XAR4 : pointer to the object
|
||||
;; XAR5 : pointer to x_i
|
||||
;; XAR6 : pointer to y_i
|
||||
;; XAR7 : pointer to z_i
|
||||
;; ACC:P : coordinate to be shifted, z_i
|
||||
;; T : shift amount (0 - 63)
|
||||
;;
|
||||
;; Stack Usage:
|
||||
;;
|
||||
;; |_______|<- Stack Pointer (SP)
|
||||
;; |_______|<- rpc calling function (SP-2)
|
||||
;;
|
||||
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.global _CORDIC_F64_rotationKernel
|
||||
.sect ".text"
|
||||
_CORDIC_F64_rotationKernel:
|
||||
.asmfunc
|
||||
.asg XAR1 , ATANTBL
|
||||
.asg XAR5 , X_I
|
||||
.asg XAR6 , Y_I
|
||||
.asg XAR7 , Z_I
|
||||
.asg *XAR4++ , OBJ_PTR_XI
|
||||
.asg *XAR4++ , OBJ_PTR_YI
|
||||
.asg *+XAR4[0] , OBJ_PTR_ZI
|
||||
.asg *+XAR4[2] , OBJ_N
|
||||
.asg *+XAR4[4] , OBJ_PTR_ATANTBL
|
||||
.asg *+XAR4[6] , OBJ_PTR_SCALETBL
|
||||
;;-----------------------------------------------------------------------------
|
||||
;; Context Save
|
||||
;;-----------------------------------------------------------------------------
|
||||
PUSH XAR1
|
||||
PUSH XAR2
|
||||
SETC OVM ; allows for negation with saturation
|
||||
;;-----------------------------------------------------------------------------
|
||||
;; Rotation Kernel
|
||||
;;-----------------------------------------------------------------------------
|
||||
|
||||
MOVL X_I, OBJ_PTR_XI ; XAR5 -> x_i
|
||||
MOVL Y_I, OBJ_PTR_YI ; XAR6 -> y_i
|
||||
MOVL Z_I, OBJ_PTR_ZI ; XAR7 -> z_i
|
||||
MOVZ AR0, OBJ_N ; AR0 = N
|
||||
SUBB XAR0, #1 ; = N - 1
|
||||
MOVL ATANTBL, OBJ_PTR_ATANTBL ; XAR1 -> arctan table
|
||||
|
||||
MOV T, #0
|
||||
|
||||
_CORDIC_F64_rotationKernel_loop:
|
||||
MOVB AL, #0xAA, OV ; dummy move clear V when set
|
||||
MOVL P, *+Z_I[0] ; ACC:P = z_i
|
||||
MOVL ACC, *+Z_I[2]
|
||||
CMP64 ACC:P ; set Z if ACC:P = 0
|
||||
SB _CORDIC_F64_rotationKernel_clockwise, LT
|
||||
|
||||
_CORDIC_F64_rotationKernel_counterClockwise:
|
||||
;; z_i = z_i - atantbl[i]
|
||||
SUBUL P, *ATANTBL++ ; z_i.low -= atantbl[i].low
|
||||
SUBBL ACC, *ATANTBL++ ; z_i.hi -= (atantbl[i].hi + ~C)
|
||||
MOVL *+Z_I[0], P ; save z_n
|
||||
MOVL *+Z_I[2], ACC
|
||||
|
||||
;; x_n = x_i - (y_i >> i)
|
||||
MOVL P, *+Y_I[0] ; ACC:P = y_i
|
||||
MOVL ACC, *+Y_I[2]
|
||||
ASR64 ACC:P, T ; ACC:P = y_i >> i
|
||||
NEG64 ACC:P ; = -(y_i >> i)
|
||||
ADDUL P, *+X_I[0] ; P = -(y_i >> i).low + x_i.low
|
||||
ADDCL ACC, *+X_I[2] ; ACC = -(y_i >> i).hi + x_i.hi + C
|
||||
MOVL XAR2, P ; save P temporarily
|
||||
|
||||
;; y_n = y_i + (x_i >> i)
|
||||
MOVL P, *+X_I[0] ; ACC:P = x_i
|
||||
MOVL *+X_I[0], XAR2
|
||||
MOVL XAR2, ACC ; save ACC temporarily
|
||||
MOVL ACC, *+X_I[2]
|
||||
MOVL *+X_I[2], XAR2 ; save x_n (x_i for next iteration)
|
||||
ASR64 ACC:P, T ; ACC:P = x_i >> i
|
||||
ADDUL P, *+Y_I[0] ; P = (x_i >> i).low + y_i.low
|
||||
ADDCL ACC, *+Y_I[2] ; ACC = (x_i >> i).hi + y_i.hi + C
|
||||
MOVL *+Y_I[0], P ; save y_n (y_i for next iteration)
|
||||
MOVL *+Y_I[2], ACC
|
||||
_CORDIC_F64_rotationKernel_counterClockwiseEnd:
|
||||
INC T
|
||||
BANZ _CORDIC_F64_rotationKernel_loop, AR0--
|
||||
BF _CORDIC_F64_rotationKernel_loopEnd, UNC
|
||||
|
||||
_CORDIC_F64_rotationKernel_clockwise:
|
||||
;; z_i = z_i + atantbl[i]
|
||||
ADDUL P, *ATANTBL++ ; z_i.low += atantbl[i].low
|
||||
ADDCL ACC, *ATANTBL++ ; z_i.hi += (atantbl[i].hi + C)
|
||||
MOVL *+Z_I[0], P
|
||||
MOVL *+Z_I[2], ACC
|
||||
|
||||
;; x_n = x_i + (y_i >> i)
|
||||
MOVL P, *+Y_I[0] ; ACC:P = y_i
|
||||
MOVL ACC, *+Y_I[2]
|
||||
ASR64 ACC:P, T ; ACC:P = y_i >> i
|
||||
ADDUL P, *+X_I[0] ; P = (y_i >> i).low + x_i.low
|
||||
ADDCL ACC, *+X_I[2] ; ACC = (y_i >> i).hi + x_i.hi + C
|
||||
MOVL XAR2, P ; save P temporarily
|
||||
|
||||
;; y_n = y_i - (x_i >> i)
|
||||
MOVL P, *+X_I[0] ; ACC:P = x_i
|
||||
MOVL *+X_I[0], XAR2
|
||||
MOVL XAR2, ACC ; save ACC temporarily
|
||||
MOVL ACC, *+X_I[2]
|
||||
MOVL *+X_I[2], XAR2 ; save new x_i
|
||||
ASR64 ACC:P, T ; ACC:P = x_i >> i
|
||||
NEG64 ACC:P ; = -(x_i >> i)
|
||||
ADDUL P, *+Y_I[0] ; P = -(x_i >> i).low + y_i.low
|
||||
ADDCL ACC, *+Y_I[2] ; ACC = -(x_i >> i).hi + y_i.hi + C
|
||||
MOVL *+Y_I[0], P ; save new y_i
|
||||
MOVL *+Y_I[2], ACC
|
||||
|
||||
_CORDIC_F64_rotationKernel_clockwiseEnd:
|
||||
INC T
|
||||
BANZ _CORDIC_F64_rotationKernel_loop, AR0--
|
||||
|
||||
_CORDIC_F64_rotationKernel_loopEnd:
|
||||
;;-----------------------------------------------------------------------------
|
||||
;; Context Restore
|
||||
;;-----------------------------------------------------------------------------
|
||||
CLRC OVM ; compiler expects OVM = 0
|
||||
POP XAR2
|
||||
POP XAR1
|
||||
LRETR
|
||||
.endasmfunc
|
||||
.unasg ATANTBL
|
||||
.unasg X_I
|
||||
.unasg Y_I
|
||||
.unasg Z_I
|
||||
.unasg OBJ_PTR_XI
|
||||
.unasg OBJ_PTR_YI
|
||||
.unasg OBJ_PTR_ZI
|
||||
.unasg OBJ_N
|
||||
.unasg OBJ_PTR_ATANTBL
|
||||
.unasg OBJ_PTR_SCALETBL
|
||||
;; End of File
|
||||
@@ -0,0 +1,238 @@
|
||||
;;#############################################################################
|
||||
;;! \file source/fpu64/cordic_sin_f64.asm
|
||||
;;!
|
||||
;;! \brief CORDIC sin function for the C28x + FPU64
|
||||
;;! \author Vishal Coelho
|
||||
;;! \date 12/15/2016
|
||||
;;
|
||||
;; DESCRIPTION:
|
||||
;;
|
||||
;; This function computes a 64-bit floating point sin given a
|
||||
;; radian input. This function uses the CORDIC rotation mode to
|
||||
;; compute the sin.
|
||||
;;
|
||||
;; FUNCTIONS:
|
||||
;;
|
||||
;; float64u_t CORDIC_F64_sin(hnd_CORDIC_t hC, float64u_t theta)
|
||||
;;
|
||||
;; where CORDIC_F64_Handle is defined as:
|
||||
;; typedef CORDIC_F64 *CORDIC_F64_Handle;
|
||||
;;
|
||||
;; and CORDIC_F64 is a structure,
|
||||
;; typedef struct _CORDIC_F64_
|
||||
;; {
|
||||
;; int64_t *x_i; //!< pointer to x coordinate
|
||||
;; int64_t *y_i; //!< pointer to y coordinate
|
||||
;; int64_t *z_i; //!< pointer to mode dependent angle (or
|
||||
;; //! angular error)
|
||||
;; uint16_t N; //!< number of CORDIC iterations (max = 64)
|
||||
;; const int64_t *atanTable; //!< Pointer to the atan(2^-i) table
|
||||
;; void (*runKernel)(void *); //!< CORDIC kernel
|
||||
;; }CORDIC_F64;
|
||||
;;
|
||||
;; ASSUMPTIONS:
|
||||
;;
|
||||
;; * CORDIC_F64 tables and constants are linked into the project.
|
||||
;; * the runKernel is set to the rotation kernel
|
||||
;; * N >= 26 as the scale factor does not change beyond
|
||||
;; IQ61(1/sqrt(1 + 2^(-2* 25)))
|
||||
;;
|
||||
;; ALGORITHM:
|
||||
;;
|
||||
;; The sin value is calculated as follows:
|
||||
;;
|
||||
;; 1. The argument theta is converted to IQ61 (from float)
|
||||
;; 2. set z to theta in the object and call the rotation kernel
|
||||
;; 0
|
||||
;; 3. The y is the sine of the angle. Convert this angle back to float
|
||||
;; i
|
||||
;; and return
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
;; the includes
|
||||
.cdecls C, LIST, "fastrts.h"
|
||||
|
||||
;; external references
|
||||
.if __TI_EABI__
|
||||
.asg CORDIC_F64_PI_O_2, _CORDIC_F64_PI_O_2
|
||||
.asg CORDIC_F64_PI, _CORDIC_F64_PI
|
||||
.asg CORDIC_F64_3PI_O_2, _CORDIC_F64_3PI_O_2
|
||||
.asg CORDIC_F64_2PI, _CORDIC_F64_2PI
|
||||
.asg CORDIC_F64_scaleFactor, _CORDIC_F64_scaleFactor
|
||||
.asg CORDIC_F64_sin, _CORDIC_F64_sin
|
||||
.endif
|
||||
.ref _CORDIC_F64_PI_O_2
|
||||
.ref _CORDIC_F64_PI
|
||||
.ref _CORDIC_F64_3PI_O_2
|
||||
.ref _CORDIC_F64_2PI
|
||||
.ref _CORDIC_F64_scaleFactor
|
||||
;;*****************************************************************************
|
||||
;; Register Usage:
|
||||
;; AR0 : index into the scale tablea
|
||||
;; XAR4 : pointer to the object
|
||||
;; XAR5 : pointer to the angle, theta | pointer to x_i
|
||||
;; XAR6 : return value address | pointer to y_i
|
||||
;; XAR7 : kernel pointer | pointer to z_i
|
||||
;;
|
||||
;; Stack Usage:
|
||||
;;
|
||||
;; |_______|<- Stack Pointer (SP)
|
||||
;; |_______|<- XAR6 (SP-2)
|
||||
;; |_______|<- rpc calling function (SP-4)
|
||||
;;
|
||||
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.global _CORDIC_F64_sin
|
||||
.sect ".text"
|
||||
_CORDIC_F64_sin:
|
||||
.asmfunc
|
||||
.asg *+XAR5[0] , ARG_THETA_L
|
||||
.asg *+XAR5[2] , ARG_THETA_H
|
||||
.asg XAR5 , X_I
|
||||
.asg XAR6 , Y_I
|
||||
.asg XAR7 , Z_I
|
||||
.asg XAR7 , KERNELPTR
|
||||
.asg *XAR4++ , OBJ_PTR_XI
|
||||
.asg *XAR4++ , OBJ_PTR_YI
|
||||
.asg *XAR4++ , OBJ_PTR_ZI
|
||||
.asg *+XAR4[0] , OBJ_N
|
||||
.asg *+XAR4[2] , OBJ_PTR_ATANTBL
|
||||
.asg *+XAR4[4] , OBJ_PTR_KERNEL
|
||||
;;-----------------------------------------------------------------------------
|
||||
;; The Sine Function
|
||||
;;-----------------------------------------------------------------------------
|
||||
PUSH XAR6 ; save the address of the return
|
||||
; value on the stack
|
||||
MOV32 R0L, ARG_THETA_L ; R0 = theta
|
||||
MOV32 R0H, ARG_THETA_H
|
||||
TESTTF LT ; TF = sign(theta)
|
||||
MOVL X_I, OBJ_PTR_XI ; XAR5 -> x_i
|
||||
MOVL Y_I, OBJ_PTR_YI ; XAR6 -> y_i
|
||||
MOVL Z_I, OBJ_PTR_ZI ; XAR7 -> z_i
|
||||
ABSF64 R0, R0 ; R0 = |theta|
|
||||
MOVW DP, #_CORDIC_F64_scaleFactor
|
||||
; ACC:P = scaleFactor
|
||||
MOVL P, @_CORDIC_F64_scaleFactor
|
||||
MOVL ACC, @_CORDIC_F64_scaleFactor + 2
|
||||
_CORDIC_F64_sin_pi_o_2:
|
||||
MOV32 R2L, @_CORDIC_F64_PI_O_2; R2 = pi/2
|
||||
MOV32 R2H, @_CORDIC_F64_PI_O_2 + 2
|
||||
CMPF64 R0, R2 ; if (|theta|<=pi/2)
|
||||
MOVST0 ZF, NF ; jmp convertArg
|
||||
BF _CORDIC_F64_sin_convertArg, LEQ
|
||||
_CORDIC_F64_sin_pi:
|
||||
MOV32 R2L, @_CORDIC_F64_PI ; R2 = pi
|
||||
MOV32 R2H, @_CORDIC_F64_PI + 2
|
||||
CMPF64 R0, R2 ; elseif (|theta|<=pi)
|
||||
MOVST0 ZF, NF
|
||||
BF _CORDIC_F64_sin_3pi_o_2, GT
|
||||
TESTTF NTF ; TF = TF ^ 1
|
||||
SUBF64 R0, R2, R0 ; R0 = pi - |theta|
|
||||
NEG64 ACC:P ; ACC:P = -scaleFactor
|
||||
BF _CORDIC_F64_sin_convertArg, UNC
|
||||
_CORDIC_F64_sin_3pi_o_2:
|
||||
; R1 = 3*pi/2
|
||||
MOV32 R1L, @_CORDIC_F64_3PI_O_2
|
||||
MOV32 R1H, @_CORDIC_F64_3PI_O_2 + 2
|
||||
CMPF64 R0, R1 ; elseif (|theta|<=3*pi/2)
|
||||
MOVST0 ZF, NF
|
||||
BF _CORDIC_F64_sin_2pi, GT
|
||||
SUBF64 R0, R0, R2 ; R0 = |theta| - pi
|
||||
NEG64 ACC:P ; ACC:P = -scaleFactor
|
||||
BF _CORDIC_F64_sin_convertArg, UNC
|
||||
_CORDIC_F64_sin_2pi:
|
||||
TESTTF NTF ; TF = TF ^ 1
|
||||
; R2 = 2*pi
|
||||
MOV32 R2L, @_CORDIC_F64_2PI
|
||||
MOV32 R2H, @_CORDIC_F64_2PI + 2
|
||||
SUBF64 R0, R2, R0 ; *| R0 = 2*pi - |theta|
|
||||
_CORDIC_F64_sin_convertArg:
|
||||
MOVL *+X_I[0], P ; 1| set x_i to scaleFactor
|
||||
MOVL *+X_I[2], ACC ; 2|
|
||||
MPYF64 R0, R0, #0x43C0 ; *| R0 = R0*2^61
|
||||
ZERO R1 ; 1|
|
||||
MOV32 *+Y_I[0], R1H ; 2| zero out y_i
|
||||
F64TOI64 R0, R0 ; *| R0 = IQ61(theta)
|
||||
MOV32 *+Y_I[2], R1H ; 1|
|
||||
MOV32 *+Z_I[0], R0L ; z_i = IQ61(theta)
|
||||
MOV32 *+Z_I[2], R0H
|
||||
MOVL KERNELPTR, OBJ_PTR_KERNEL
|
||||
; XAR7 -> kernel
|
||||
SUBB XAR4, #6 ; rewind object pointer
|
||||
|
||||
;; Call the rotation kernel
|
||||
LCR *KERNELPTR
|
||||
; XAR6 -> y_i (IQ61)
|
||||
MOV32 R0L, *+Y_I[0] ; R0 = IQ61(sin(theta))
|
||||
MOV32 R0H, *+Y_I[2]
|
||||
I64TOF64 R0, R0 ; *| R0 = sin(theta) * 2^61
|
||||
NOP ; 1|
|
||||
MPYF64 R0, R0, #0x3C20 ; *| R0 = R0 * 2^-61
|
||||
NOP ; 1|
|
||||
POP XAR6 ; 2| XAR6 -> addr(return value)
|
||||
NEGF64 R0, R0, TF
|
||||
MOV32 *+XAR6[0], R0L
|
||||
MOV32 *+XAR6[2], R0H
|
||||
LRETR
|
||||
.endasmfunc
|
||||
.unasg ARG_THETA_L
|
||||
.unasg ARG_THETA_H
|
||||
.unasg X_I
|
||||
.unasg Y_I
|
||||
.unasg Z_I
|
||||
.unasg KERNELPTR
|
||||
.unasg OBJ_PTR_XI
|
||||
.unasg OBJ_PTR_YI
|
||||
.unasg OBJ_PTR_ZI
|
||||
.unasg OBJ_N
|
||||
.unasg OBJ_PTR_ATANTBL
|
||||
.unasg OBJ_PTR_KERNEL
|
||||
|
||||
;; End of File
|
||||
@@ -0,0 +1,153 @@
|
||||
;;#############################################################################
|
||||
;;! \file cordic_tables_f64.asm
|
||||
;;! \brief CORDIC Tables (64)
|
||||
;;! \author Vishal Coelho
|
||||
;;! \date 15-Nov-2016
|
||||
;;!
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
.if __TI_EABI__
|
||||
.asg CORDIC_F64_atanTable, _CORDIC_F64_atanTable
|
||||
.asg CORDIC_F64_atanTableEnd, _CORDIC_F64_atanTableEnd
|
||||
.asg CORDIC_F64_PI_O_2, _CORDIC_F64_PI_O_2
|
||||
.asg CORDIC_F64_PI, _CORDIC_F64_PI
|
||||
.asg CORDIC_F64_3PI_O_2, _CORDIC_F64_3PI_O_2
|
||||
.asg CORDIC_F64_2PI, _CORDIC_F64_2PI
|
||||
.asg CORDIC_F64_scaleFactor, _CORDIC_F64_scaleFactor
|
||||
.endif
|
||||
.def _CORDIC_F64_atanTable
|
||||
.def _CORDIC_F64_atanTableEnd
|
||||
|
||||
.sect "FPU64mathTables"
|
||||
.align 2
|
||||
_CORDIC_F64_atanTable:
|
||||
.long 0x442D1800, 0x1921FB54 ; IQ61(arctan(2^- 0))
|
||||
.long 0xB0DDA780, 0x0ED63382 ; IQ61(arctan(2^- 1))
|
||||
.long 0x4B203740, 0x07D6DD7E ; IQ61(arctan(2^- 2))
|
||||
.long 0x5585EDC0, 0x03FAB753 ; IQ61(arctan(2^- 3))
|
||||
.long 0x72CFDEA0, 0x01FF55BB ; IQ61(arctan(2^- 4))
|
||||
.long 0xDD4BB128, 0x00FFEAAD ; IQ61(arctan(2^- 5))
|
||||
.long 0x6EEDCA6C, 0x007FFD55 ; IQ61(arctan(2^- 6))
|
||||
.long 0xAB77752E, 0x003FFFAA ; IQ61(arctan(2^- 7))
|
||||
.long 0x555BBBB7, 0x001FFFF5 ; IQ61(arctan(2^- 8))
|
||||
.long 0xAAAADDDE, 0x000FFFFE ; IQ61(arctan(2^- 9))
|
||||
.long 0xD55556EF, 0x0007FFFF ; IQ61(arctan(2^- 10))
|
||||
.long 0xFAAAAAB8, 0x0003FFFF ; IQ61(arctan(2^- 11))
|
||||
.long 0xFF555556, 0x0001FFFF ; IQ61(arctan(2^- 12))
|
||||
.long 0xFFEAAAAB, 0x0000FFFF ; IQ61(arctan(2^- 13))
|
||||
.long 0xFFFD5555, 0x00007FFF ; IQ61(arctan(2^- 14))
|
||||
.long 0xFFFFAAAB, 0x00003FFF ; IQ61(arctan(2^- 15))
|
||||
.long 0xFFFFF555, 0x00001FFF ; IQ61(arctan(2^- 16))
|
||||
.long 0xFFFFFEAB, 0x00000FFF ; IQ61(arctan(2^- 17))
|
||||
.long 0xFFFFFFD5, 0x000007FF ; IQ61(arctan(2^- 18))
|
||||
.long 0xFFFFFFFB, 0x000003FF ; IQ61(arctan(2^- 19))
|
||||
.long 0xFFFFFFFF, 0x000001FF ; IQ61(arctan(2^- 20))
|
||||
.long 0x00000000, 0x00000100 ; IQ61(arctan(2^- 21))
|
||||
.long 0x00000000, 0x00000080 ; IQ61(arctan(2^- 22))
|
||||
.long 0x00000000, 0x00000040 ; IQ61(arctan(2^- 23))
|
||||
.long 0x00000000, 0x00000020 ; IQ61(arctan(2^- 24))
|
||||
.long 0x00000000, 0x00000010 ; IQ61(arctan(2^- 25))
|
||||
.long 0x00000000, 0x00000008 ; IQ61(arctan(2^- 26))
|
||||
.long 0x00000000, 0x00000004 ; IQ61(arctan(2^- 27))
|
||||
.long 0x00000000, 0x00000002 ; IQ61(arctan(2^- 28))
|
||||
.long 0x00000000, 0x00000001 ; IQ61(arctan(2^- 29))
|
||||
.long 0x80000000, 0x00000000 ; IQ61(arctan(2^- 30))
|
||||
.long 0x40000000, 0x00000000 ; IQ61(arctan(2^- 31))
|
||||
.long 0x20000000, 0x00000000 ; IQ61(arctan(2^- 32))
|
||||
.long 0x10000000, 0x00000000 ; IQ61(arctan(2^- 33))
|
||||
.long 0x08000000, 0x00000000 ; IQ61(arctan(2^- 34))
|
||||
.long 0x04000000, 0x00000000 ; IQ61(arctan(2^- 35))
|
||||
.long 0x02000000, 0x00000000 ; IQ61(arctan(2^- 36))
|
||||
.long 0x01000000, 0x00000000 ; IQ61(arctan(2^- 37))
|
||||
.long 0x00800000, 0x00000000 ; IQ61(arctan(2^- 38))
|
||||
.long 0x00400000, 0x00000000 ; IQ61(arctan(2^- 39))
|
||||
.long 0x00200000, 0x00000000 ; IQ61(arctan(2^- 40))
|
||||
.long 0x00100000, 0x00000000 ; IQ61(arctan(2^- 41))
|
||||
.long 0x00080000, 0x00000000 ; IQ61(arctan(2^- 42))
|
||||
.long 0x00040000, 0x00000000 ; IQ61(arctan(2^- 43))
|
||||
.long 0x00020000, 0x00000000 ; IQ61(arctan(2^- 44))
|
||||
.long 0x00010000, 0x00000000 ; IQ61(arctan(2^- 45))
|
||||
.long 0x00008000, 0x00000000 ; IQ61(arctan(2^- 46))
|
||||
.long 0x00004000, 0x00000000 ; IQ61(arctan(2^- 47))
|
||||
.long 0x00002000, 0x00000000 ; IQ61(arctan(2^- 48))
|
||||
.long 0x00001000, 0x00000000 ; IQ61(arctan(2^- 49))
|
||||
.long 0x00000800, 0x00000000 ; IQ61(arctan(2^- 50))
|
||||
.long 0x00000400, 0x00000000 ; IQ61(arctan(2^- 51))
|
||||
.long 0x00000200, 0x00000000 ; IQ61(arctan(2^- 52))
|
||||
.long 0x00000100, 0x00000000 ; IQ61(arctan(2^- 53))
|
||||
.long 0x00000080, 0x00000000 ; IQ61(arctan(2^- 54))
|
||||
.long 0x00000040, 0x00000000 ; IQ61(arctan(2^- 55))
|
||||
.long 0x00000020, 0x00000000 ; IQ61(arctan(2^- 56))
|
||||
.long 0x00000010, 0x00000000 ; IQ61(arctan(2^- 57))
|
||||
.long 0x00000008, 0x00000000 ; IQ61(arctan(2^- 58))
|
||||
.long 0x00000004, 0x00000000 ; IQ61(arctan(2^- 59))
|
||||
.long 0x00000002, 0x00000000 ; IQ61(arctan(2^- 60))
|
||||
.long 0x00000001, 0x00000000 ; IQ61(arctan(2^- 61))
|
||||
.long 0x00000001, 0x00000000 ; IQ61(arctan(2^- 62))
|
||||
.long 0x00000000, 0x00000000 ; IQ61(arctan(2^- 63))
|
||||
_CORDIC_F64_atanTableEnd:
|
||||
|
||||
.sect "FPU64mathTables"
|
||||
.align 2
|
||||
.def _CORDIC_F64_scaleFactor
|
||||
_CORDIC_F64_scaleFactor:
|
||||
.long 0x086BCD00, 0x136E9DB5 ; IQ61(1/sqrt(1 + 2^(-2* 63)))
|
||||
.def _CORDIC_F64_PI_O_2
|
||||
_CORDIC_F64_PI_O_2:
|
||||
.long 0x54442D18, 0x3FF921FB
|
||||
.def _CORDIC_F64_PI
|
||||
_CORDIC_F64_PI:
|
||||
.long 0x54442D18, 0x400921FB
|
||||
.def _CORDIC_F64_3PI_O_2
|
||||
_CORDIC_F64_3PI_O_2:
|
||||
.long 0x7F3321D2, 0x4012D97C
|
||||
.def _CORDIC_F64_2PI
|
||||
_CORDIC_F64_2PI:
|
||||
.long 0x54442D18, 0x401921FB
|
||||
;; End of File
|
||||
@@ -0,0 +1,291 @@
|
||||
;;#############################################################################
|
||||
;;! \file source/fpu64/cos_f64.asm
|
||||
;;!
|
||||
;;! \brief Fast cos function for the C28x + FPU64
|
||||
;;! \author Vishal Coelho
|
||||
;;! \date 01/05/2016
|
||||
;;
|
||||
;;+---------------------------------------------------------------------------+
|
||||
;;| DATE | AUTHOR | CHANGE |
|
||||
;;+---------------------------------------------------------------------------+
|
||||
;;| 170213 | V.C. | Using 5 term taylor series expansion for better error |
|
||||
;;| | | tolerance |
|
||||
;;+---------------------------------------------------------------------------+
|
||||
;;
|
||||
;; DESCRIPTION:
|
||||
;;
|
||||
;; This function computes a 64-bit floating point cos given a
|
||||
;; radian input. This function uses the FPU math tables to
|
||||
;; compute the sin.
|
||||
;;
|
||||
;; FUNCTIONS:
|
||||
;;
|
||||
;; float64 cos (float64 radian)
|
||||
;;
|
||||
;; ASSUMPTIONS:
|
||||
;;
|
||||
;; * FPU64sinTable and FPU64cosTable are linked into the project.
|
||||
;; * angle is in radians
|
||||
;;
|
||||
;; ALGORITHM:
|
||||
;;
|
||||
;; The cos value is calculated as follows:
|
||||
;;
|
||||
;; 1) The offset into a 512 entry sin/cos table is calculated:
|
||||
;;
|
||||
;; k = 0x1FF & (int(Radian*512/(2*pi)))
|
||||
;;
|
||||
;;
|
||||
;; 2) The fractional component between table samples is
|
||||
;; calculated:
|
||||
;;
|
||||
;; x = fract(Radian*512/2*pi) * (2*pi)/512
|
||||
;;
|
||||
;; 3) The output cosine value is calculated as follows:
|
||||
;;
|
||||
;; cos(Radian) = C(k) + x*(-1.0*S(k) +
|
||||
;; x*(-0.5*C(k) +
|
||||
;; x*( 0.166666666666667*S(k) +
|
||||
;; x*( 0.041666666666667*C(k) +
|
||||
;; x*(-0.008333333333333*S(k))))));
|
||||
;;
|
||||
;; where S(k) = Sin table value at offset "k"
|
||||
;; C(k) = Cos table value at offset "k"
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
|
||||
;; the includes
|
||||
.cdecls C, LIST, "fastrts.h"
|
||||
|
||||
;; external references
|
||||
.if __TI_EABI__
|
||||
.asg FPU64sinTable, _FPU64sinTable
|
||||
.asg FPU64cosTable, _FPU64cosTable
|
||||
.asg FPU64sincos_TABLE_SIZE_O_TWOPI, _FPU64sincos_TABLE_SIZE_O_TWOPI
|
||||
.asg FPU64sincos_TWOPI_O_TABLE_SIZE, _FPU64sincos_TWOPI_O_TABLE_SIZE
|
||||
.asg FPU64sincos_Coef1, _FPU64sincos_Coef1
|
||||
.asg FPU64sincos_Coef2, _FPU64sincos_Coef2
|
||||
.asg FPU64sincos_Coef3, _FPU64sincos_Coef3
|
||||
.asg FPU64sincos_Coef4, _FPU64sincos_Coef4
|
||||
.asg cos, _cosl
|
||||
.endif
|
||||
|
||||
.ref _FPU64sinTable
|
||||
.ref _FPU64cosTable
|
||||
.ref _FPU64sincos_TABLE_SIZE_O_TWOPI
|
||||
.ref _FPU64sincos_TWOPI_O_TABLE_SIZE
|
||||
.ref _FPU64sincos_Coef1
|
||||
.ref _FPU64sincos_Coef2
|
||||
.ref _FPU64sincos_Coef3
|
||||
.ref _FPU64sincos_Coef4
|
||||
;;*****************************************************************************
|
||||
;; Register Usage:
|
||||
;; AR0 : index into the sin/cos tables
|
||||
;; XAR4 : points to the head of the cosine table
|
||||
;; XAR5 : points to the head of the cosine table + 2
|
||||
;; XAR6 : points to the head of the sine table
|
||||
;; XAR7 : points to the head of the sine table + 2
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.global _cosl
|
||||
.sect ".text"
|
||||
_cosl: .asmfunc ; R0 = Radian (on entry)
|
||||
.asg XAR4, P_COS_L
|
||||
.asg XAR5, P_COS_H
|
||||
.asg XAR6, P_SIN_L
|
||||
.asg XAR7, P_SIN_H
|
||||
.if CONVERT_F32_TO_F64 == 1
|
||||
F32TOF64 R0, R0H ; convert argument to double precision
|
||||
.endif
|
||||
MOVW DP, #_FPU64sincos_TABLE_SIZE_O_TWOPI
|
||||
; R1 = 512/(2*pi) = 512/6.283185307179586
|
||||
; = 81.487330863050417
|
||||
; = 0x40545f306dc9c883
|
||||
MOV32 R1L, @_FPU64sincos_TABLE_SIZE_O_TWOPI
|
||||
MOV32 R1H, @_FPU64sincos_TABLE_SIZE_O_TWOPI + 2
|
||||
|
||||
MPYF64 R0, R0, R1 ; *| R0 = angle * 512/(2*pi)
|
||||
|| MOV32 R3L, @_FPU64sincos_Coef4
|
||||
; | R1 = 8.3333333333333e-3
|
||||
; | = 0x3f81111111111111
|
||||
MOV32 R2L, @_FPU64sincos_TWOPI_O_TABLE_SIZE
|
||||
; 1| R2 = (2*pi)/512
|
||||
; | = 0.012271846303085
|
||||
; 2| = 0x3f8921fb54442d18
|
||||
MOV32 R2H, @_FPU64sincos_TWOPI_O_TABLE_SIZE + 2
|
||||
F64TOI64 R1, R0 ; *| R1 = int(angle * 512/(2*pi))
|
||||
MOVL P_COS_L, #_FPU64cosTable
|
||||
; 1|
|
||||
MOVL P_COS_H, #_FPU64cosTable+2
|
||||
MOVL P_SIN_L, #_FPU64sinTable
|
||||
MOVL P_SIN_H, #_FPU64sinTable+2
|
||||
MOV32 ACC, R1L ; ACC = int(angle *512/(2*pi))
|
||||
AND @AL, #0x1FF
|
||||
LSL AL, #2
|
||||
MOVZ AR0,@AL ; AR0 = Index into "sin/cos" table = k
|
||||
FRACF64 R0, R0 ; *| R0 = fract(angle*512/(2*pi))
|
||||
; 1|
|
||||
MOV32 R3H, @_FPU64sincos_Coef4 + 2
|
||||
|
||||
; R0 = x = frac(angle*512/(2*pi)) * (2*pi)/512
|
||||
MPYF64 R0, R0, R2 ; *|
|
||||
|| MOV32 R1L, *+P_SIN_L[AR0] ; | R1 = S(k)
|
||||
MOV32 R1H, *+P_SIN_H[AR0] ; 1|
|
||||
MPYF64 R1, R1, R3 ; 2|*| R1 = 8.3333333333333e-3*S(k)
|
||||
|| MOV32 R2L, @_FPU64sincos_Coef3
|
||||
; | | R2 = 0.041666666666667
|
||||
; |1| = 0x3fa5555555555555
|
||||
MOV32 R2H, @_FPU64sincos_Coef3 + 2
|
||||
MOV32 R3L, *+P_COS_L[AR0] ; |2| R3 = C(k)
|
||||
MPYF64 R1, R0, R1 ; *| | R1 = x*(8.3333333333333e-3*S(k))
|
||||
|| MOV32 R3H, *+P_COS_H[AR0] ; | |
|
||||
MPYF64 R2, R2, R3 ; 1|*| R2 = 0.041666666666667*C(k)
|
||||
|| MOV32 R3L, @_FPU64sincos_Coef2
|
||||
; | | R3 = 0.166666666666667
|
||||
; 2|1| = 0x3fc5555555555555
|
||||
MOV32 R3H, @_FPU64sincos_Coef2 + 2
|
||||
NOP ; |2|
|
||||
; R1 = 0.041666666666667*C(k) - x*(8.3333333333333e-3*S(k))
|
||||
SUBF64 R1, R2, R1 ; *| |
|
||||
|| MOV32 R2L, *+P_SIN_L[AR0] ; | | R2 = S(k)
|
||||
MOV32 R2H, *+P_SIN_H[AR0] ; 1| |
|
||||
MPYF64 R2, R3, R2 ; 2|*| R2 = 0.166666666666667*S(k)
|
||||
|| MOV32 R3L, *+P_COS_L[AR0] ; | | R3 = C(k)
|
||||
; R1 = x*(0.041666666666667*C(k) - x*(8.3333333333333e-3*S(k)))
|
||||
MPYF64 R1, R0, R1 ; *|1|
|
||||
|| MOV32 R3H, *+P_COS_H[AR0] ; | |
|
||||
NOP ; 1|2|
|
||||
NOP ; 2| |
|
||||
; R1 = 0.166666666666667*S(k) + x*(0.041666666666667*C(k)
|
||||
; - x*(8.3333333333333e-3*S(k)))
|
||||
ADDF64 R1, R1, R2 ; *| |
|
||||
|| MOV32 R2L, @_FPU64sincos_Coef1
|
||||
; | | R2 = 0.5
|
||||
; 1| | = 0x3fe0000000000000
|
||||
MOV32 R2H, @_FPU64sincos_Coef1 + 2
|
||||
MPYF64 R2, R2, R3 ; 2|*| R2 = 0.5*C(k)
|
||||
|| MOV32 R3L, *+P_SIN_L[AR0] ; | | R3 = S(k)
|
||||
; R1 = x*(0.166666666666667*S(k) + x*(0.041666666666667*C(k)
|
||||
; - x*(8.3333333333333e-3*S(k))))
|
||||
MPYF64 R1, R0, R1 ; *|1|
|
||||
|| MOV32 R3H, *+P_SIN_H[AR0] ; | |
|
||||
NOP ; 1|2|
|
||||
NOP ; 2| |
|
||||
; R1 = -0.5*C(k) + x*(0.166666666666667*S(k)
|
||||
; + x*(0.041666666666667*C(k)
|
||||
; - x*(8.3333333333333e-3*S(k))))
|
||||
SUBF64 R1, R1, R2 ; *| |
|
||||
|| MOV32 R2L, *+P_COS_L[AR0] ; | | R2 = C(k)
|
||||
MOV32 R2H, *+P_COS_H[AR0] ; 1| |
|
||||
NOP ; 2| |
|
||||
; R1 = x*(-0.5*C(k) + x*(0.166666666666667*S(k)
|
||||
; + x*(0.041666666666667*C(k)
|
||||
; - x*(8.3333333333333e-3*S(k)))))
|
||||
MPYF64 R1, R0, R1 ; *| |
|
||||
NOP ; 1| |
|
||||
NOP ; 2| |
|
||||
; R1 = -S(k) + x*(-0.5*C(k)
|
||||
; + x*(0.166666666666667*S(k)
|
||||
; + x*(0.041666666666667*C(k)
|
||||
; - x*(8.3333333333333e-3*S(k)))))
|
||||
SUBF64 R1, R1, R3 ; *| |
|
||||
NOP ; 1| |
|
||||
NOP ; 2| |
|
||||
; R0 = x*(-S(k) + x*(-0.5*C(k)
|
||||
; + x*(0.166666666666667*S(k)
|
||||
; + x*(0.041666666666667*C(k)
|
||||
; - x*(8.3333333333333e-3*S(k))))))
|
||||
MPYF64 R0, R0, R1 ; *| |
|
||||
NOP ; 1| |
|
||||
NOP ; 2| |
|
||||
; R0 = C(k) + x*(-S(k)
|
||||
; + x*(-0.5*C(k)
|
||||
; + x*(0.166666666666667*S(k)
|
||||
; + x*(0.041666666666667*C(k)
|
||||
; - x*(8.3333333333333e-3*S(k))))))
|
||||
ADDF64 R0, R2, R0 ; *| |
|
||||
NOP ; 1| |
|
||||
NOP ; 2| |
|
||||
LRETR
|
||||
.unasg P_COS_L
|
||||
.unasg P_COS_H
|
||||
.unasg P_SIN_L
|
||||
.unasg P_SIN_H
|
||||
.endasmfunc
|
||||
|
||||
;;*****************************************************************************
|
||||
;; This function will run the function above taking the address of the input
|
||||
;; and output as arguments
|
||||
;;
|
||||
;; Register Usage:
|
||||
;; XAR4 : points to the destination argument
|
||||
;; XAR5 : points to the source argument
|
||||
;;
|
||||
;; Stack Usage:
|
||||
;;
|
||||
;; |_______|<- Stack Pointer (SP)
|
||||
;; |_______|<- XAR4 (SP-2)
|
||||
;;
|
||||
;;*****************************************************************************
|
||||
.if __TI_EABI__
|
||||
.asg run_cos, _run_cos
|
||||
.endif
|
||||
.global _run_cos
|
||||
.sect ".text"
|
||||
_run_cos: .asmfunc
|
||||
PUSH XAR4
|
||||
MOV32 R0L, *+XAR5[0]
|
||||
MOV32 R0H, *+XAR5[2]
|
||||
LCR #_cosl
|
||||
POP XAR4
|
||||
MOV32 *+XAR4[0], R0L
|
||||
MOV32 *+XAR4[2], R0H
|
||||
LRETR
|
||||
.endasmfunc
|
||||
;; End of File
|
||||
@@ -0,0 +1,174 @@
|
||||
;;#############################################################################
|
||||
;;! \file source/fpu64/div_f64.asm
|
||||
;;!
|
||||
;;! \brief Fast double precision division for the C28x + FPU64
|
||||
;;! \author Vishal Coelho
|
||||
;;! \date 01/04/2016
|
||||
;;
|
||||
;; DESCRIPTION:
|
||||
;;
|
||||
;; This function computes the 64-bit floating point division of A/B
|
||||
;;
|
||||
;; FUNCTIONS:
|
||||
;;
|
||||
;; This funciton (FD$$DIV) will be called when 64-bit floating point
|
||||
;; division is performed. That is:
|
||||
;;
|
||||
;; float64 A,B,Y;
|
||||
;; ...
|
||||
;; <A & B initalized>
|
||||
;; ...
|
||||
;; Y = A/B; // Call to FD$$DIV
|
||||
;;
|
||||
;; ASSUMPTIONS:
|
||||
;;
|
||||
;; ALGORITHM:
|
||||
;;
|
||||
;; Ye = Estimate(1/B);
|
||||
;; Ye' = Ye*(2.0 - Ye*B)
|
||||
;; Ye'' = Ye'*(2.0 - Ye'*B)
|
||||
;; Ye''' = Ye''*(2.0 - Ye''*B)
|
||||
;; Ye'''' = Ye'''*(2.0 - Ye'''*B)
|
||||
;; Y = A*Ye''''
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
|
||||
;; the includes
|
||||
.cdecls C, LIST, "fastrts.h"
|
||||
|
||||
;;*****************************************************************************
|
||||
;; Register Usage:
|
||||
;; R0 : A, the dividend
|
||||
;; R1 : B, the divisor
|
||||
;; R2 : Ye, first estimate of 1/B (all successive estimates Ye', Ye'' ...)
|
||||
;; R3 : 2.0 - Ye*B (all successive estimates Ye', Ye'' ...)
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.global FD$$DIV
|
||||
.sect ".text"
|
||||
.if __TI_EABI__
|
||||
.asg __c28xabi_div, FD$$DIV
|
||||
.endif
|
||||
FD$$DIV: .asmfunc
|
||||
.if CONVERT_F32_TO_F64 == 1
|
||||
F32TOF64 R0, R0H ; convert A to double precision
|
||||
F32TOF64 R1, R1H ; convert B to double precision
|
||||
.endif
|
||||
EINVF64 R2, R1 ; *| R2 = Ye = Estimate(1/B)
|
||||
NOP ; 1|
|
||||
CMPF64 R0, #0.0 ; if A == 0, set ZF, NF
|
||||
RPTB #FD$$DIV_loop, #2 ; run loop 3 times
|
||||
MPYF64 R3, R2, R1 ; *| R3 = Ye*B
|
||||
NOP ; 1|
|
||||
NOP ; 2|
|
||||
SUBF64 R3, #2.0, R3 ; *| R3 = 2.0 - Ye*B
|
||||
NOP ; 1|
|
||||
NOP ; 2|
|
||||
MPYF64 R2, R2, R3 ; *| R2 = Ye = Ye*(2.0 - Ye*B)
|
||||
NOP ; 1|
|
||||
NOP ; 2|
|
||||
FD$$DIV_loop:
|
||||
;;-----------------------------------------------------------------------------
|
||||
;; if ZERO_BY_ZERO_EQ_ZERO == 1, then 0.0/0.0 = 0.0
|
||||
;; if ZERO_BY_ZERO_EQ_INF == 1, then 0.0/0.0 = Infinity
|
||||
;;-----------------------------------------------------------------------------
|
||||
.if ZERO_BY_ZERO_EQ_INF == 1
|
||||
MOV64 R2, R0, EQ ; If A == 0.0, Ye''' = 0.0
|
||||
.endif
|
||||
MPYF64 R3, R2, R1 ; *| R3 = Ye'''*B
|
||||
CMPF64 R1, #0.0 ; 1| if B == 0, set ZF, NF
|
||||
NOP ; 2|
|
||||
SUBF64 R3, #2.0, R3 ; *| R3 = 2.0 - Ye'''*B
|
||||
NEGF64 R0, R0, EQ ; 1| Fixes sign for A/0.0
|
||||
NOP ; 2|
|
||||
MPYF64 R2, R2, R3 ; *| R2 = Ye'''' = Ye'''*(2.0 - Ye'''*B)
|
||||
NOP ; 1|
|
||||
NOP ; 2|
|
||||
MPYF64 R0, R0, R2 ; * | R0 = Y = A*Ye'''' = A/B
|
||||
LRETR ; 1,2|
|
||||
.endasmfunc
|
||||
|
||||
|
||||
;;*****************************************************************************
|
||||
;; This function will run the function above taking the address of the input
|
||||
;; and output as arguments
|
||||
;;
|
||||
;; Register Usage:
|
||||
;; XAR4 : points to the destination argument
|
||||
;; XAR5 : points to the source argument A
|
||||
;; XAR6 : points to the source argument B
|
||||
;;
|
||||
;; Stack Usage:
|
||||
;;
|
||||
;; |_______|
|
||||
;; |_______|<- Stack Pointer (SP)
|
||||
;; |_______|<- rpc calling function (SP-2)
|
||||
;; |_______|<- Argument pointer B (SP-4)
|
||||
;;
|
||||
|
||||
;;*****************************************************************************
|
||||
.if __TI_EABI__
|
||||
.asg run_div, _run_div
|
||||
.endif
|
||||
.global _run_div
|
||||
.sect ".text"
|
||||
_run_div: .asmfunc
|
||||
.asg *-SP[4], PTR_TO_ARG_B
|
||||
MOV32 R0L, *+XAR5[0]
|
||||
MOV32 R0H, *+XAR5[2]
|
||||
MOVL XAR6, PTR_TO_ARG_B
|
||||
MOV32 R1L, *+XAR6[0]
|
||||
MOV32 R1H, *+XAR6[2]
|
||||
LCR #FD$$DIV
|
||||
MOV32 *+XAR4[0], R0L
|
||||
MOV32 *+XAR4[2], R0H
|
||||
LRETR
|
||||
.unasg PTR_TO_ARG_B
|
||||
.endasmfunc
|
||||
;; End of File
|
||||
@@ -0,0 +1,142 @@
|
||||
;;#############################################################################
|
||||
;;! \file source/fpu64/fid_f64byf64.asm
|
||||
;;!
|
||||
;;! \brief Double Precision Division
|
||||
;;! \author Vishal Coelho
|
||||
;;! \date 04/18/2016
|
||||
;;
|
||||
;; DESCRIPTION:
|
||||
;;
|
||||
;; This function performs a 64-bit double precision division ()
|
||||
;;
|
||||
;; FUNCTIONS:
|
||||
;;
|
||||
;; void FID_f64byf64(long double *p_num, long double *p_den,
|
||||
;; long double *p_quo)
|
||||
;;
|
||||
;; ASSUMPTIONS:
|
||||
;;
|
||||
;; ALGORITHM:
|
||||
;;
|
||||
;; The algorithm used is a slow division method (Restoring division)
|
||||
;; see https://en.wikipedia.org/wiki/Division_algorithm#Restoring_division
|
||||
;;
|
||||
;; Let N be the dividend (numerator), D the divisor (denominator), T a
|
||||
;; temporary variable, i the bit index and loop iterator
|
||||
;;
|
||||
;; S = sign(num)^sign(den) -- extract the sign of the quotient
|
||||
;; E_q = E_n - E_d - 1023 -- get the unbiased exponent of the quotient
|
||||
;; D = D << 1 -- shift divisor up 1
|
||||
;; Q = 0 -- start with a quotient of 0
|
||||
;; loop i = 56:-1:0
|
||||
;; T = (N << 1) - D -- shift up dividend and subtract divisor
|
||||
;; if(T >= 0) -- if the difference is positive
|
||||
;; N = T & 0x003FF..FFUL ---- numerator = T(53:0)
|
||||
;; Q = Q << 1 + 1 ---- shift quotient up and add 1
|
||||
;; else -- else
|
||||
;; N = (N << 1) + Q(63) ---- shift up numerator, tack on MSb of quotient
|
||||
;; Q = Q << 1 ---- shift up quotient
|
||||
;; end
|
||||
;; endloop
|
||||
;; The final operation would be to round and shift down the quotient, insert
|
||||
;; the sign and exponent to get the final value
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
|
||||
|
||||
;;*****************************************************************************
|
||||
;; Register Usage:
|
||||
;; R0H : exponent of the quotient
|
||||
;; R1 : quotient
|
||||
;; R2 : dividend
|
||||
;; R3 : divisor
|
||||
;; XAR4 : pointer to dividend (numerator)
|
||||
;; XAR5 : pointer to divisor (denominator)
|
||||
;;
|
||||
;; Stack Usage:
|
||||
;;
|
||||
;; |_______|<- Stack Pointer (SP)
|
||||
;; |_______|<- rpc calling function (SP-2)
|
||||
;; |_______|<- pointer to quotient (SP-4)
|
||||
;;
|
||||
;; cycles = 4(call) + 28(body) + 4(return)
|
||||
;; = 36
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.if __TI_EABI__
|
||||
.asg FID_f64byf64, _FID_f64byf64
|
||||
.endif
|
||||
.global _FID_f64byf64
|
||||
.sect ".text"
|
||||
_FID_f64byf64:
|
||||
.asmfunc
|
||||
.asg *-SP[4], PTR_QUOTIENT
|
||||
|
||||
MOV32 R2L, *+XAR4[0] ; [R2] = dividend
|
||||
MOV32 R2H, *+XAR4[2]
|
||||
MOV32 R3L, *+XAR5[0] ; [R3] = divisor
|
||||
MOV32 R3H, *+XAR5[2]
|
||||
PREDIVF64 R0H, R2, R1, R3
|
||||
.asg 1, N
|
||||
.loop
|
||||
SUBC3F64 R2, R1, R3
|
||||
.break N == 19
|
||||
.eval N + 1, N
|
||||
.endloop
|
||||
POSTDIVF64 R1, R0H
|
||||
MOVL XAR4, PTR_QUOTIENT
|
||||
MOV32 *+XAR4[0], R1L ; Save quotient
|
||||
MOV32 *+XAR4[2], R1H
|
||||
LRETR
|
||||
|
||||
.unasg N
|
||||
.unasg PTR_QUOTIENT
|
||||
.endasmfunc
|
||||
|
||||
;; End of File
|
||||
@@ -0,0 +1,274 @@
|
||||
;;#############################################################################
|
||||
;;! \file source/fpu64/fid_i16byi16.asm
|
||||
;;!
|
||||
;;! \brief Signed Integer (16-bit) Division
|
||||
;;! \author Vishal Coelho
|
||||
;;! \date 03/30/2016
|
||||
;;
|
||||
;; DESCRIPTION:
|
||||
;;
|
||||
;; This function performs a 16-bit signed division (truncated, modulo or
|
||||
;; euclidean)
|
||||
;;
|
||||
;; FUNCTIONS:
|
||||
;;
|
||||
;; void FID_i16byi16_t(int16_t *p_num_rem, int16_t *p_den_quo)
|
||||
;; void FID_i16byi16_m(int16_t *p_num_rem, int16_t *p_den_quo)
|
||||
;; void FID_i16byi16_e(int16_t *p_num_rem, int16_t *p_den_quo)
|
||||
;;
|
||||
;; ASSUMPTIONS:
|
||||
;;
|
||||
;; ALGORITHM:
|
||||
;;
|
||||
;; The algorithm used is a slow division method (Restoring division)
|
||||
;; see https://en.wikipedia.org/wiki/Division_algorithm#Restoring_division
|
||||
;;
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
|
||||
|
||||
;;*****************************************************************************
|
||||
;; Truncated Division
|
||||
;;
|
||||
;; Let N be the dividend, D the divisor, T a temporary variable and P
|
||||
;; the partial remainder of each iteration, i the bit index and loop iterator
|
||||
;; F.TF = sign(num) ^ sign(den)
|
||||
;; F.NI = sign(num)
|
||||
;; N = |N| , D = |D|
|
||||
;; R = 0 -- start with a remainder of 0
|
||||
;; loop i = 15:-1:0
|
||||
;; T = (R << 1) + N(i) - D -- shift up remainder, tack on MSb of numerator
|
||||
;; -- subtract divisor
|
||||
;; if(T >= 0) -- if the difference is positive
|
||||
;; R = T & 0xFFFFFFFF ---- remainder = T
|
||||
;; N = N << 1 + 1 ---- shift numerator up and add 1 (quotient)
|
||||
;; else -- else
|
||||
;; R = (R << 1) + N(15) ---- shift up remainder, tack on MSb of numerator
|
||||
;; N = N << 1 ---- shift up numerator
|
||||
;; end
|
||||
;; endloop -- after 16 such iterations N has the quotient
|
||||
;; -- and R the remainder
|
||||
;; if(F.TF == 1), Q = -Q -- The quotient is in the variable that
|
||||
;; -- previously held the numerator
|
||||
;; if(F.NI == 1), R = -R -- In truncating division remainder follows the
|
||||
;; -- sign of the dividend
|
||||
;; Register Usage:
|
||||
;; R1H : dividend (quotient)
|
||||
;; R2H : remainder
|
||||
;; R3H : divisor
|
||||
;; XAR4: pointer to dividend (numerator) and subsequently remainders
|
||||
;; XAR5: pointer to divisor (denominator) and subsequently quotient
|
||||
;;
|
||||
;; cycles = 4(call) + 17(body) + 4(return)
|
||||
;; = 25
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.if __TI_EABI__
|
||||
.asg FID_i16byi16_t, _FID_i16byi16_t
|
||||
.endif
|
||||
.global _FID_i16byi16_t
|
||||
.sect ".text"
|
||||
_FID_i16byi16_t:
|
||||
.asmfunc
|
||||
SETC SXM ; turn on sign-extenstion
|
||||
MOV ACC, *+XAR5[0] ; ACC = [S:divisor]
|
||||
MOV32 R3H, ACC ; *| R3H = divisor
|
||||
MOV ACC, *+XAR4[0] << #16 ; 1| ACC = [dividend:0]
|
||||
MOV32 R1H, ACC ; 2|*|R1H = dividend
|
||||
NOP ; 3|1|alignment cycles
|
||||
NOP ; 4|2|alignment cycles
|
||||
NOP ; |3|alignment cycles
|
||||
NOP ; |4|alignment cycles
|
||||
ABSI32DIV32 R2H, R1H, R3H
|
||||
.asg 1, N
|
||||
.loop
|
||||
SUBC4UI32 R2H, R1H, R3H
|
||||
.break N == 4
|
||||
.eval N + 1, N
|
||||
.endloop
|
||||
NEGI32DIV32 R1H, R2H
|
||||
MOV16 *+XAR5[0], R1H ; Save quotient
|
||||
MOV16 *+XAR4[0], R2H ; Save remainder
|
||||
LRETR
|
||||
.unasg N
|
||||
.endasmfunc
|
||||
|
||||
;;*****************************************************************************
|
||||
;; Modulo (Floored) Division
|
||||
;;
|
||||
;; F.TF = sign(num) ^ sign(den)
|
||||
;; F.NI = sign(num)
|
||||
;; N = |N| , D = |D|
|
||||
;; R = 0 -- start with a remainder of 0
|
||||
;; loop i = 15:-1:0
|
||||
;; T = (R << 1) + N(i) - D -- shift up remainder, tack on MSb of numerator
|
||||
;; -- subtract divisor
|
||||
;; if(T >= 0) -- if the difference is positive
|
||||
;; R = T & 0xFFFFFFFF ---- remainder = T
|
||||
;; N = N << 1 + 1 ---- shift numerator up and add 1 (quotient)
|
||||
;; else -- else
|
||||
;; R = (R << 1) + N(i) ---- shift up remainder, tack on MSb of numerator
|
||||
;; N = N << 1 ---- shift up numerator
|
||||
;; end
|
||||
;; endloop -- after 16 such iterations N has the quotient
|
||||
;; -- and R the remainder
|
||||
;; if(rem != 0)F.ZI = 0
|
||||
;; if(F.TF == 1 && F.ZI==0),
|
||||
;; Q += 1 -- The quotient is in the variable that
|
||||
;; R = D - R -- previously held the numerator
|
||||
;; if(F.TF == 1) Q = -Q
|
||||
;; if(F.NI ^ F.TF) R = -R -- In module division remainder follows the
|
||||
;; -- sign of the divisor
|
||||
;; Register Usage:
|
||||
;; R1H : dividend (quotient)
|
||||
;; R2H : remainder
|
||||
;; R3H : divisor
|
||||
;; XAR4: pointer to dividend (numerator) and subsequently remainders
|
||||
;; XAR5: pointer to divisor (denominator) and subsequently quotient
|
||||
;;
|
||||
;; cycles = 4(call) + 17(body) + 4(return)
|
||||
;; = 25
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.if __TI_EABI__
|
||||
.asg FID_i16byi16_m, _FID_i16byi16_m
|
||||
.endif
|
||||
.global _FID_i16byi16_m
|
||||
.sect ".text"
|
||||
_FID_i16byi16_m:
|
||||
SETC SXM ; turn on sign-extenstion
|
||||
MOV ACC, *+XAR5[0] ; ACC = [S:divisor]
|
||||
MOV32 R3H, ACC ; *| R3H = divisor
|
||||
MOV ACC, *+XAR4[0] << #16 ; 1| ACC = [dividend:0]
|
||||
MOV32 R1H, ACC ; 2|*|R1H = dividend
|
||||
NOP ; 3|1|alignment cycles
|
||||
NOP ; 4|2|alignment cycles
|
||||
NOP ; |3|alignment cycles
|
||||
NOP ; |4|alignment cycles
|
||||
ABSI32DIV32 R2H, R1H, R3H
|
||||
.asg 1, N
|
||||
.loop
|
||||
SUBC4UI32 R2H, R1H, R3H
|
||||
.break N == 4
|
||||
.eval N + 1, N
|
||||
.endloop
|
||||
MNEGI32DIV32 R1H, R2H, R3H
|
||||
MOV16 *+XAR5[0], R1H ; Save quotient
|
||||
MOV16 *+XAR4[0], R2H ; Save remainder
|
||||
LRETR
|
||||
.unasg N
|
||||
.endasmfunc
|
||||
|
||||
|
||||
;;*****************************************************************************
|
||||
;; Euclidean Division
|
||||
;;
|
||||
;; F.TF = sign(num) ^ sign(den)
|
||||
;; F.NI = sign(num)
|
||||
;; N = |N| , D = |D|
|
||||
;; R = 0 -- start with a remainder of 0
|
||||
;; loop i = 15:-1:0
|
||||
;; T = (R << 1) + N(i) - D -- shift up remainder, tack on MSb of numerator
|
||||
;; -- subtract divisor
|
||||
;; if(T >= 0) -- if the difference is positive
|
||||
;; R = T & 0xFFFFFFFF ---- remainder = T
|
||||
;; N = N << 1 + 1 ---- shift numerator up and add 1 (quotient)
|
||||
;; else -- else
|
||||
;; R = (R << 1) + N(i) ---- shift up remainder, tack on MSb of numerator
|
||||
;; N = N << 1 ---- shift up numerator
|
||||
;; end
|
||||
;; endloop -- after 16 such iterations N has the quotient
|
||||
;; -- and R the remainder
|
||||
;; if(rem != 0)F.ZI = 0
|
||||
;; if(F.NI == 1 && F.ZI==0),
|
||||
;; Q += 1 -- The quotient is in the variable that
|
||||
;; R = D - R -- previously held the numerator
|
||||
;; if(F.TF == 1) Q = -Q -- In euclidean division remainder is always
|
||||
;; -- positive
|
||||
;; Register Usage:
|
||||
;; R1H : dividend (quotient)
|
||||
;; R2H : remainder
|
||||
;; R3H : divisor
|
||||
;; XAR4: pointer to dividend (numerator) and subsequently remainders
|
||||
;; XAR5: pointer to divisor (denominator) and subsequently quotient
|
||||
;;
|
||||
;; cycles = 4(call) + 17(body) + 4(return)
|
||||
;; = 25
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.if __TI_EABI__
|
||||
.asg FID_i16byi16_e, _FID_i16byi16_e
|
||||
.endif
|
||||
.global _FID_i16byi16_e
|
||||
.sect ".text"
|
||||
_FID_i16byi16_e:
|
||||
.asmfunc
|
||||
SETC SXM ; turn on sign-extenstion
|
||||
MOV ACC, *+XAR5[0] ; ACC = [S:divisor]
|
||||
MOV32 R3H, ACC ; *| R3H = divisor
|
||||
MOV ACC, *+XAR4[0] << #16 ; 1| ACC = [dividend:0]
|
||||
MOV32 R1H, ACC ; 2|*|R1H = dividend
|
||||
NOP ; 3|1|alignment cycles
|
||||
NOP ; 4|2|alignment cycles
|
||||
NOP ; |3|alignment cycles
|
||||
NOP ; |4|alignment cycles
|
||||
ABSI32DIV32 R2H, R1H, R3H
|
||||
.asg 1, N
|
||||
.loop
|
||||
SUBC4UI32 R2H, R1H, R3H
|
||||
.break N == 4
|
||||
.eval N + 1, N
|
||||
.endloop
|
||||
ENEGI32DIV32 R1H, R2H, R3H
|
||||
MOV16 *+XAR5[0], R1H ; Save quotient
|
||||
MOV16 *+XAR4[0], R2H ; Save remainder
|
||||
LRETR
|
||||
.unasg N
|
||||
.endasmfunc
|
||||
;; End of File
|
||||
@@ -0,0 +1,270 @@
|
||||
;;#############################################################################
|
||||
;;! \file source/fpu64/fid_i32byi16.asm
|
||||
;;!
|
||||
;;! \brief Signed Integer (32-bit)/ Signed short (16-bit) Division
|
||||
;;! \author Vishal Coelho
|
||||
;;! \date 04/15/2016
|
||||
;;
|
||||
;; DESCRIPTION:
|
||||
;;
|
||||
;; This function performs a 32/16-bit signed division (truncated, modulo or
|
||||
;; euclidean)
|
||||
;;
|
||||
;; FUNCTIONS:
|
||||
;;
|
||||
;; void FID_i32byi16_t(int32_t *p_num_rem, int32_t *p_den_quo)
|
||||
;; void FID_i32byi16_m(int32_t *p_num_rem, int32_t *p_den_quo)
|
||||
;; void FID_i32byi16_e(int32_t *p_num_rem, int32_t *p_den_quo)
|
||||
;;
|
||||
;; ASSUMPTIONS:
|
||||
;;
|
||||
;; ALGORITHM:
|
||||
;;
|
||||
;; The algorithm used is a slow division method (Restoring division)
|
||||
;; see https://en.wikipedia.org/wiki/Division_algorithm#Restoring_division
|
||||
;;
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
|
||||
|
||||
;;*****************************************************************************
|
||||
;; Truncated Division
|
||||
;;
|
||||
;; Let N be the dividend, D the divisor, T a temporary variable and P
|
||||
;; the partial remainder of each iteration, i the bit index and loop iterator
|
||||
;; F.TF = sign(num) ^ sign(den)
|
||||
;; F.NI = sign(num)
|
||||
;; N = |N| , D = |D|
|
||||
;; R = 0 -- start with a remainder of 0
|
||||
;; loop i = 31:-1:0
|
||||
;; T = (R << 1) + N(i) - D -- shift up remainder, tack on MSb of numerator
|
||||
;; -- subtract divisor
|
||||
;; if(T >= 0) -- if the difference is positive
|
||||
;; R = T & 0xFFFFFFFF ---- remainder = T
|
||||
;; N = N << 1 + 1 ---- shift numerator up and add 1 (quotient)
|
||||
;; else -- else
|
||||
;; R = (R << 1) + N(31) ---- shift up remainder, tack on MSb of numerator
|
||||
;; N = N << 1 ---- shift up numerator
|
||||
;; end
|
||||
;; endloop -- after 32 such iterations N has the quotient
|
||||
;; -- and R the remainder
|
||||
;; if(F.TF == 1), Q = -Q -- The quotient is in the variable that
|
||||
;; -- previously held the numerator
|
||||
;; if(F.NI == 1), R = -R -- In truncating division remainder follows the
|
||||
;; -- sign of the dividend
|
||||
;; Register Usage:
|
||||
;; R1H : dividend (quotient)
|
||||
;; R2H : remainder
|
||||
;; R3H : divisor
|
||||
;; XAR4: pointer to dividend (numerator) and subsequently remainders
|
||||
;; XAR5: pointer to divisor (denominator) and subsequently quotient
|
||||
;;
|
||||
;; cycles = 4(call) + 19(body) + 4(return)
|
||||
;; = 27
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.if __TI_EABI__
|
||||
.asg FID_i32byi16_t, _FID_i32byi16_t
|
||||
.endif
|
||||
.global _FID_i32byi16_t
|
||||
.sect ".text"
|
||||
_FID_i32byi16_t:
|
||||
.asmfunc
|
||||
SETC SXM ; Turn on sign extension
|
||||
MOV ACC, *+XAR5[0] ; ACC = [S:divisor]
|
||||
MOV32 R3H, ACC ; *| R3H = divisor
|
||||
MOV32 R1H, *+XAR4[0] ; 1| R1H = dividend
|
||||
MOV *+XAR4[2], #0 ; 2| clear out high word of the remainder
|
||||
NOP ; 3| alignment cycle
|
||||
NOP ; 4| alignment cycle
|
||||
ABSI32DIV32 R2H, R1H, R3H
|
||||
.asg 1, N
|
||||
.loop
|
||||
SUBC4UI32 R2H, R1H, R3H
|
||||
.break N == 8
|
||||
.eval N + 1, N
|
||||
.endloop
|
||||
NEGI32DIV32 R1H, R2H
|
||||
MOV32 *+XAR5[0], R1H ; Save quotient
|
||||
MOV32 *+XAR4[0], R2H ; Save remainder
|
||||
LRETR
|
||||
.unasg N
|
||||
.endasmfunc
|
||||
|
||||
;;*****************************************************************************
|
||||
;; Modulo (Floored) Division
|
||||
;;
|
||||
;; F.TF = sign(num) ^ sign(den)
|
||||
;; F.NI = sign(num)
|
||||
;; N = |N| , D = |D|
|
||||
;; R = 0 -- start with a remainder of 0
|
||||
;; loop i = 31:-1:0
|
||||
;; T = (R << 1) + N(i) - D -- shift up remainder, tack on MSb of numerator
|
||||
;; -- subtract divisor
|
||||
;; if(T >= 0) -- if the difference is positive
|
||||
;; R = T & 0xFFFFFFFF ---- remainder = T
|
||||
;; N = N << 1 + 1 ---- shift numerator up and add 1 (quotient)
|
||||
;; else -- else
|
||||
;; R = (R << 1) + N(i) ---- shift up remainder, tack on MSb of numerator
|
||||
;; N = N << 1 ---- shift up numerator
|
||||
;; end
|
||||
;; endloop -- after 32 such iterations N has the quotient
|
||||
;; -- and R the remainder
|
||||
;; if(rem != 0)F.ZI = 0
|
||||
;; if(F.TF == 1 && F.ZI==0),
|
||||
;; Q += 1 -- The quotient is in the variable that
|
||||
;; R = D - R -- previously held the numerator
|
||||
;; if(F.TF == 1) Q = -Q
|
||||
;; if(F.NI ^ F.TF) R = -R -- In module division remainder follows the
|
||||
;; -- sign of the divisor
|
||||
;; Register Usage:
|
||||
;; R1H : dividend (quotient)
|
||||
;; R2H : remainder
|
||||
;; R3H : divisor
|
||||
;; XAR4: pointer to dividend (numerator) and subsequently remainders
|
||||
;; XAR5: pointer to divisor (denominator) and subsequently quotient
|
||||
;;
|
||||
;; cycles = 4(call) + 19(body) + 4(return)
|
||||
;; = 27
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.if __TI_EABI__
|
||||
.asg FID_i32byi16_m, _FID_i32byi16_m
|
||||
.endif
|
||||
.global _FID_i32byi16_m
|
||||
.sect ".text"
|
||||
_FID_i32byi16_m:
|
||||
.asmfunc
|
||||
SETC SXM ; Turn on sign extension
|
||||
MOV ACC, *+XAR5[0] ; ACC = [S:divisor]
|
||||
MOV32 R3H, ACC ; *| R3H = divisor
|
||||
MOV32 R1H, *+XAR4[0] ; 1| R1H = dividend
|
||||
MOV *+XAR4[2], #0 ; 2| clear out high word of the remainder
|
||||
NOP ; 3| alignment cycle
|
||||
NOP ; 4| alignment cycle
|
||||
ABSI32DIV32 R2H, R1H, R3H
|
||||
.asg 1, N
|
||||
.loop
|
||||
SUBC4UI32 R2H, R1H, R3H
|
||||
.break N == 8
|
||||
.eval N + 1, N
|
||||
.endloop
|
||||
MNEGI32DIV32 R1H, R2H, R3H
|
||||
MOV32 *+XAR5[0], R1H ; Save quotient
|
||||
MOV32 *+XAR4[0], R2H ; Save remainder
|
||||
LRETR
|
||||
.unasg N
|
||||
.endasmfunc
|
||||
|
||||
|
||||
;;*****************************************************************************
|
||||
;; Euclidean Division
|
||||
;;
|
||||
;; F.TF = sign(num) ^ sign(den)
|
||||
;; F.NI = sign(num)
|
||||
;; N = |N| , D = |D|
|
||||
;; R = 0 -- start with a remainder of 0
|
||||
;; loop i = 31:-1:0
|
||||
;; T = (R << 1) + N(i) - D -- shift up remainder, tack on MSb of numerator
|
||||
;; -- subtract divisor
|
||||
;; if(T >= 0) -- if the difference is positive
|
||||
;; R = T & 0xFFFFFFFF ---- remainder = T
|
||||
;; N = N << 1 + 1 ---- shift numerator up and add 1 (quotient)
|
||||
;; else -- else
|
||||
;; R = (R << 1) + N(i) ---- shift up remainder, tack on MSb of numerator
|
||||
;; N = N << 1 ---- shift up numerator
|
||||
;; end
|
||||
;; endloop -- after 32 such iterations N has the quotient
|
||||
;; -- and R the remainder
|
||||
;; if(rem != 0)F.ZI = 0
|
||||
;; if(F.NI == 1 && F.ZI==0),
|
||||
;; Q += 1 -- The quotient is in the variable that
|
||||
;; R = D - R -- previously held the numerator
|
||||
;; if(F.TF == 1) Q = -Q -- In euclidean division remainder is always
|
||||
;; -- positive
|
||||
;; Register Usage:
|
||||
;; R1H : dividend (quotient)
|
||||
;; R2H : remainder
|
||||
;; R3H : divisor
|
||||
;; XAR4: pointer to dividend (numerator) and subsequently remainders
|
||||
;; XAR5: pointer to divisor (denominator) and subsequently quotient
|
||||
;;
|
||||
;; cycles = 4(call) + 19(body) + 4(return)
|
||||
;; = 27
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.if __TI_EABI__
|
||||
.asg FID_i32byi16_e, _FID_i32byi16_e
|
||||
.endif
|
||||
.global _FID_i32byi16_e
|
||||
.sect ".text"
|
||||
_FID_i32byi16_e:
|
||||
.asmfunc
|
||||
SETC SXM ; Turn on sign extension
|
||||
MOV ACC, *+XAR5[0] ; ACC = [S:divisor]
|
||||
MOV32 R3H, ACC ; *| R3H = divisor
|
||||
MOV32 R1H, *+XAR4[0] ; 1| R1H = dividend
|
||||
MOV *+XAR4[2], #0 ; 2| clear out high word of the remainder
|
||||
NOP ; 3| alignment cycle
|
||||
NOP ; 4| alignment cycle
|
||||
ABSI32DIV32 R2H, R1H, R3H
|
||||
.asg 1, N
|
||||
.loop
|
||||
SUBC4UI32 R2H, R1H, R3H
|
||||
.break N == 8
|
||||
.eval N + 1, N
|
||||
.endloop
|
||||
ENEGI32DIV32 R1H, R2H, R3H
|
||||
MOV32 *+XAR5[0], R1H ; Save quotient
|
||||
MOV32 *+XAR4[0], R2H ; Save remainder
|
||||
LRETR
|
||||
.unasg N
|
||||
.endasmfunc
|
||||
|
||||
;; End of File
|
||||
@@ -0,0 +1,254 @@
|
||||
;;#############################################################################
|
||||
;;! \file source/fpu64/fid_i32byi32.asm
|
||||
;;!
|
||||
;;! \brief Signed Integer (32-bit) Division
|
||||
;;! \author Vishal Coelho
|
||||
;;! \date 03/30/2016
|
||||
;;
|
||||
;; DESCRIPTION:
|
||||
;;
|
||||
;; This function performs a 32-bit signed division (truncated, modulo or
|
||||
;; euclidean)
|
||||
;;
|
||||
;; FUNCTIONS:
|
||||
;;
|
||||
;; void FID_i32byi32_t(int32_t *p_num_rem, int32_t *p_den_quo)
|
||||
;; void FID_i32byi32_m(int32_t *p_num_rem, int32_t *p_den_quo)
|
||||
;; void FID_i32byi32_e(int32_t *p_num_rem, int32_t *p_den_quo)
|
||||
;;
|
||||
;; ASSUMPTIONS:
|
||||
;;
|
||||
;; ALGORITHM:
|
||||
;;
|
||||
;; The algorithm used is a slow division method (Restoring division)
|
||||
;; see https://en.wikipedia.org/wiki/Division_algorithm#Restoring_division
|
||||
;;
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
|
||||
|
||||
;;*****************************************************************************
|
||||
;; Truncated Division
|
||||
;;
|
||||
;; Let N be the dividend, D the divisor, T a temporary variable and P
|
||||
;; the partial remainder of each iteration, i the bit index and loop iterator
|
||||
;; F.TF = sign(num) ^ sign(den)
|
||||
;; F.NI = sign(num)
|
||||
;; N = |N| , D = |D|
|
||||
;; R = 0 -- start with a remainder of 0
|
||||
;; loop i = 31:-1:0
|
||||
;; T = (R << 1) + N(i) - D -- shift up remainder, tack on MSb of numerator
|
||||
;; -- subtract divisor
|
||||
;; if(T >= 0) -- if the difference is positive
|
||||
;; R = T & 0xFFFFFFFF ---- remainder = T
|
||||
;; N = N << 1 + 1 ---- shift numerator up and add 1 (quotient)
|
||||
;; else -- else
|
||||
;; R = (R << 1) + N(31) ---- shift up remainder, tack on MSb of numerator
|
||||
;; N = N << 1 ---- shift up numerator
|
||||
;; end
|
||||
;; endloop -- after 32 such iterations N has the quotient
|
||||
;; -- and R the remainder
|
||||
;; if(F.TF == 1), Q = -Q -- The quotient is in the variable that
|
||||
;; -- previously held the numerator
|
||||
;; if(F.NI == 1), R = -R -- In truncating division remainder follows the
|
||||
;; -- sign of the dividend
|
||||
;; Register Usage:
|
||||
;; R1H : dividend (quotient)
|
||||
;; R2H : remainder
|
||||
;; R3H : divisor
|
||||
;; XAR4: pointer to dividend (numerator) and subsequently remainders
|
||||
;; XAR5: pointer to divisor (denominator) and subsequently quotient
|
||||
;;
|
||||
;; cycles = 4(call) + 14(body) + 4(return)
|
||||
;; = 22
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.if __TI_EABI__
|
||||
.asg FID_i32byi32_t, _FID_i32byi32_t
|
||||
.endif
|
||||
.global _FID_i32byi32_t
|
||||
.sect ".text"
|
||||
_FID_i32byi32_t:
|
||||
.asmfunc
|
||||
MOV32 R1H, *+XAR4[0] ; R1H = dividend
|
||||
MOV32 R3H, *+XAR5[0] ; R3H = divisor
|
||||
ABSI32DIV32 R2H, R1H, R3H
|
||||
.asg 1, N
|
||||
.loop
|
||||
SUBC4UI32 R2H, R1H, R3H
|
||||
.break N == 8
|
||||
.eval N + 1, N
|
||||
.endloop
|
||||
NEGI32DIV32 R1H, R2H
|
||||
MOV32 *+XAR5[0], R1H ; Save quotient
|
||||
MOV32 *+XAR4[0], R2H ; Save remainder
|
||||
LRETR
|
||||
.unasg N
|
||||
.endasmfunc
|
||||
|
||||
;;*****************************************************************************
|
||||
;; Modulo (Floored) Division
|
||||
;;
|
||||
;; F.TF = sign(num) ^ sign(den)
|
||||
;; F.NI = sign(num)
|
||||
;; N = |N| , D = |D|
|
||||
;; R = 0 -- start with a remainder of 0
|
||||
;; loop i = 31:-1:0
|
||||
;; T = (R << 1) + N(i) - D -- shift up remainder, tack on MSb of numerator
|
||||
;; -- subtract divisor
|
||||
;; if(T >= 0) -- if the difference is positive
|
||||
;; R = T & 0xFFFFFFFF ---- remainder = T
|
||||
;; N = N << 1 + 1 ---- shift numerator up and add 1 (quotient)
|
||||
;; else -- else
|
||||
;; R = (R << 1) + N(i) ---- shift up remainder, tack on MSb of numerator
|
||||
;; N = N << 1 ---- shift up numerator
|
||||
;; end
|
||||
;; endloop -- after 32 such iterations N has the quotient
|
||||
;; -- and R the remainder
|
||||
;; if(rem != 0)F.ZI = 0
|
||||
;; if(F.TF == 1 && F.ZI==0),
|
||||
;; Q += 1 -- The quotient is in the variable that
|
||||
;; R = D - R -- previously held the numerator
|
||||
;; if(F.TF == 1) Q = -Q
|
||||
;; if(F.NI ^ F.TF) R = -R -- In module division remainder follows the
|
||||
;; -- sign of the divisor
|
||||
;; Register Usage:
|
||||
;; R1H : dividend (quotient)
|
||||
;; R2H : remainder
|
||||
;; R3H : divisor
|
||||
;; XAR4: pointer to dividend (numerator) and subsequently remainders
|
||||
;; XAR5: pointer to divisor (denominator) and subsequently quotient
|
||||
;;
|
||||
;; cycles = 4(call) + 14(body) + 4(return)
|
||||
;; = 22
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.if __TI_EABI__
|
||||
.asg FID_i32byi32_m, _FID_i32byi32_m
|
||||
.endif
|
||||
.global _FID_i32byi32_m
|
||||
.sect ".text"
|
||||
_FID_i32byi32_m:
|
||||
.asmfunc
|
||||
MOV32 R1H, *+XAR4[0] ; R1H = dividend
|
||||
MOV32 R3H, *+XAR5[0] ; R3H = divisor
|
||||
ABSI32DIV32 R2H, R1H, R3H
|
||||
.asg 1, N
|
||||
.loop
|
||||
SUBC4UI32 R2H, R1H, R3H
|
||||
.break N == 8
|
||||
.eval N + 1, N
|
||||
.endloop
|
||||
MNEGI32DIV32 R1H, R2H, R3H
|
||||
MOV32 *+XAR5[0], R1H ; Save quotient
|
||||
MOV32 *+XAR4[0], R2H ; Save remainder
|
||||
LRETR
|
||||
.unasg N
|
||||
.endasmfunc
|
||||
|
||||
|
||||
;;*****************************************************************************
|
||||
;; Euclidean Division
|
||||
;;
|
||||
;; F.TF = sign(num) ^ sign(den)
|
||||
;; F.NI = sign(num)
|
||||
;; N = |N| , D = |D|
|
||||
;; R = 0 -- start with a remainder of 0
|
||||
;; loop i = 31:-1:0
|
||||
;; T = (R << 1) + N(i) - D -- shift up remainder, tack on MSb of numerator
|
||||
;; -- subtract divisor
|
||||
;; if(T >= 0) -- if the difference is positive
|
||||
;; R = T & 0xFFFFFFFF ---- remainder = T
|
||||
;; N = N << 1 + 1 ---- shift numerator up and add 1 (quotient)
|
||||
;; else -- else
|
||||
;; R = (R << 1) + N(i) ---- shift up remainder, tack on MSb of numerator
|
||||
;; N = N << 1 ---- shift up numerator
|
||||
;; end
|
||||
;; endloop -- after 32 such iterations N has the quotient
|
||||
;; -- and R the remainder
|
||||
;; if(rem != 0)F.ZI = 0
|
||||
;; if(F.NI == 1 && F.ZI==0),
|
||||
;; Q += 1 -- The quotient is in the variable that
|
||||
;; R = D - R -- previously held the numerator
|
||||
;; if(F.TF == 1) Q = -Q -- In euclidean division remainder is always
|
||||
;; -- positive
|
||||
;; Register Usage:
|
||||
;; R1H : dividend (quotient)
|
||||
;; R2H : remainder
|
||||
;; R3H : divisor
|
||||
;; XAR4: pointer to dividend (numerator) and subsequently remainders
|
||||
;; XAR5: pointer to divisor (denominator) and subsequently quotient
|
||||
;;
|
||||
;; cycles = 4(call) + 14(body) + 4(return)
|
||||
;; = 22
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.if __TI_EABI__
|
||||
.asg FID_i32byi32_e, _FID_i32byi32_e
|
||||
.endif
|
||||
.global _FID_i32byi32_e
|
||||
.sect ".text"
|
||||
_FID_i32byi32_e:
|
||||
.asmfunc
|
||||
MOV32 R1H, *+XAR4[0] ; R1H = dividend
|
||||
MOV32 R3H, *+XAR5[0] ; R3H = divisor
|
||||
ABSI32DIV32 R2H, R1H, R3H
|
||||
.asg 1, N
|
||||
.loop
|
||||
SUBC4UI32 R2H, R1H, R3H
|
||||
.break N == 8
|
||||
.eval N + 1, N
|
||||
.endloop
|
||||
ENEGI32DIV32 R1H, R2H, R3H
|
||||
MOV32 *+XAR5[0], R1H ; Save quotient
|
||||
MOV32 *+XAR4[0], R2H ; Save remainder
|
||||
LRETR
|
||||
.unasg N
|
||||
.endasmfunc
|
||||
;; End of File
|
||||
@@ -0,0 +1,132 @@
|
||||
;;#############################################################################
|
||||
;;! \file source/fpu64/fid_i32byui32.asm
|
||||
;;!
|
||||
;;! \brief Signed Integer (32-bit) Division
|
||||
;;! \author Vishal Coelho
|
||||
;;! \date 03/30/2016
|
||||
;;
|
||||
;; DESCRIPTION:
|
||||
;;
|
||||
;; This function performs a 32-bit signed division (truncated)
|
||||
;;
|
||||
;; FUNCTIONS:
|
||||
;;
|
||||
;; void FID_i32byui32(int32_t *p_num_rem, int32_t *p_den_quo)
|
||||
;;
|
||||
;; ASSUMPTIONS:
|
||||
;;
|
||||
;; ALGORITHM:
|
||||
;;
|
||||
;; The algorithm used is a slow division method (Restoring division)
|
||||
;; see https://en.wikipedia.org/wiki/Division_algorithm#Restoring_division
|
||||
;;
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
|
||||
|
||||
;;*****************************************************************************
|
||||
;; Truncated Division
|
||||
;;
|
||||
;; Let N be the dividend, D the divisor, T a temporary variable and P
|
||||
;; the partial remainder of each iteration, i the bit index and loop iterator
|
||||
;; F.TF = sign(num)
|
||||
;; F.NI = sign(num)
|
||||
;; N = |N| , D = |D|
|
||||
;; R = 0 -- start with a remainder of 0
|
||||
;; loop i = 31:-1:0
|
||||
;; T = (R << 1) + N(i) - D -- shift up remainder, tack on MSb of numerator
|
||||
;; -- subtract divisor
|
||||
;; if(T >= 0) -- if the difference is positive
|
||||
;; R = T & 0xFFFFFFFF ---- remainder = T
|
||||
;; N = N << 1 + 1 ---- shift numerator up and add 1 (quotient)
|
||||
;; else -- else
|
||||
;; R = (R << 1) + N(31) ---- shift up remainder, tack on MSb of numerator
|
||||
;; N = N << 1 ---- shift up numerator
|
||||
;; end
|
||||
;; endloop -- after 32 such iterations N has the quotient
|
||||
;; -- and R the remainder
|
||||
;; if(F.TF == 1), Q = -Q -- The quotient is in the variable that
|
||||
;; -- previously held the numerator
|
||||
;; if(F.NI == 1), R = -R -- In truncating division remainder follows the
|
||||
;; -- sign of the dividend
|
||||
;; Register Usage:
|
||||
;; R1H : dividend (quotient)
|
||||
;; R2H : remainder
|
||||
;; R3H : divisor
|
||||
;; XAR4: pointer to dividend (numerator) and subsequently remainders
|
||||
;; XAR5: pointer to divisor (denominator) and subsequently quotient
|
||||
;;
|
||||
;; cycles = 4(call) + 14(body) + 4(return)
|
||||
;; = 22
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.if __TI_EABI__
|
||||
.asg FID_i32byui32, _FID_i32byui32
|
||||
.endif
|
||||
.global _FID_i32byui32
|
||||
.sect ".text"
|
||||
_FID_i32byui32:
|
||||
.asmfunc
|
||||
MOV32 R1H, *+XAR4[0] ; R1H = dividend
|
||||
MOV32 R3H, *+XAR5[0] ; R3H = divisor
|
||||
ABSI32DIV32U R2H, R1H
|
||||
.asg 1, N
|
||||
.loop
|
||||
SUBC4UI32 R2H, R1H, R3H
|
||||
.break N == 8
|
||||
.eval N + 1, N
|
||||
.endloop
|
||||
NEGI32DIV32 R1H, R2H
|
||||
MOV32 *+XAR5[0], R1H ; Save quotient
|
||||
MOV32 *+XAR4[0], R2H ; Save remainder
|
||||
LRETR
|
||||
.unasg N
|
||||
.endasmfunc
|
||||
|
||||
;; End of File
|
||||
@@ -0,0 +1,283 @@
|
||||
;;#############################################################################
|
||||
;;! \file source/fpu64/fid_i64byi32.asm
|
||||
;;!
|
||||
;;! \brief Signed (64-bit) / Signed (32-bit) Division
|
||||
;;! \author Vishal Coelho
|
||||
;;! \date 04/11/2016
|
||||
;;
|
||||
;; DESCRIPTION:
|
||||
;;
|
||||
;; This function performs a 64-bit/32-bit signed division (truncated, modulo
|
||||
;; or euclidean)
|
||||
;;
|
||||
;; FUNCTIONS:
|
||||
;;
|
||||
;; void FID_i64byi32_t(int64_t *p_num_rem, int64_t *p_den_quo)
|
||||
;; void FID_i64byi32_m(int64_t *p_num_rem, int64_t *p_den_quo)
|
||||
;; void FID_i64byi32_e(int64_t *p_num_rem, int64_t *p_den_quo)
|
||||
;;
|
||||
;; ASSUMPTIONS:
|
||||
;;
|
||||
;; ALGORITHM:
|
||||
;;
|
||||
;; The algorithm used is a slow division method (Restoring division)
|
||||
;; see https://en.wikipedia.org/wiki/Division_algorithm#Restoring_division
|
||||
;;
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
|
||||
|
||||
;;*****************************************************************************
|
||||
;; Truncated Division
|
||||
;;
|
||||
;; Let N be the dividend, D the divisor, T a temporary variable and P
|
||||
;; the partial remainder of each iteration, i the bit index and loop iterator
|
||||
;; F.TF = sign(num) ^ sign(den)
|
||||
;; F.NI = sign(num)
|
||||
;; N = |N| , D = |D|
|
||||
;; R = 0 -- start with a remainder of 0
|
||||
;; loop i = 63:-1:0
|
||||
;; T = (R << 1) + N(i) - D -- shift up remainder, tack on MSb of numerator
|
||||
;; -- subtract divisor
|
||||
;; if(T >= 0) -- if the difference is positive
|
||||
;; R = T & 0xFFF...FFUL ---- remainder = T
|
||||
;; N = N << 1 + 1 ---- shift numerator up and add 1 (quotient)
|
||||
;; else -- else
|
||||
;; R = (R << 1) + N(63) ---- shift up remainder, tack on MSb of numerator
|
||||
;; N = N << 1 ---- shift up numerator
|
||||
;; end
|
||||
;; endloop -- after 64 such iterations N has the quotient
|
||||
;; -- and R the remainder
|
||||
;; if(F.TF == 1), Q = -Q -- The quotient is in the variable that
|
||||
;; -- previously held the numerator
|
||||
;; if(F.NI == 1), R = -R -- In truncating division remainder follows the
|
||||
;; -- sign of the dividend
|
||||
;; Register Usage:
|
||||
;; [R1H:R0H]: dividend R1: quotient
|
||||
;; R2H : remainder
|
||||
;; R3H : divisor
|
||||
;; XAR4 : pointer to dividend (numerator) and subsequently remainders
|
||||
;; XAR5 : pointer to divisor (denominator) and subsequently quotient
|
||||
;;
|
||||
;; cycles = 4(call) + 26(body) + 4(return)
|
||||
;; = 34
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.if __TI_EABI__
|
||||
.asg FID_i64byi32_t, _FID_i64byi32_t
|
||||
.endif
|
||||
.global _FID_i64byi32_t
|
||||
.sect ".text"
|
||||
_FID_i64byi32_t:
|
||||
.asmfunc
|
||||
MOV32 R0H, *+XAR4[0] ; [R1H:R0H] = dividend
|
||||
MOV32 R1H, *+XAR4[2]
|
||||
MOV32 R3H, *+XAR5[0] ; R3H = divisor
|
||||
ABSI64DIV32 R2H, R1H:R0H, R3H
|
||||
.asg 1, N
|
||||
.loop
|
||||
SUBC4UI32 R2H, R1H, R3H
|
||||
.break N == 8
|
||||
.eval N + 1, N
|
||||
.endloop
|
||||
SWAPF R1, R0
|
||||
.asg 1, N
|
||||
.loop
|
||||
SUBC4UI32 R2H, R1H, R3H
|
||||
.break N == 8
|
||||
.eval N + 1, N
|
||||
.endloop
|
||||
SWAPF R1, R0
|
||||
NEGI64DIV32 R1H:R0H, R2H
|
||||
MOV32 *+XAR5[0], R0H
|
||||
MOV32 *+XAR5[2], R1H ; Save quotient
|
||||
MOV32 *+XAR4[0], R2H ; Save remainder
|
||||
LRETR
|
||||
.unasg N
|
||||
.endasmfunc
|
||||
|
||||
;;*****************************************************************************
|
||||
;; Modulo (Floored) Division
|
||||
;;
|
||||
;; F.TF = sign(num) ^ sign(den)
|
||||
;; F.NI = sign(num)
|
||||
;; N = |N| , D = |D|
|
||||
;; R = 0 -- start with a remainder of 0
|
||||
;; loop i = 63:-1:0
|
||||
;; T = (R << 1) + N(i) - D -- shift up remainder, tack on MSb of numerator
|
||||
;; -- subtract divisor
|
||||
;; if(T >= 0) -- if the difference is positive
|
||||
;; R = T & 0xFFF...FFUL ---- remainder = T
|
||||
;; N = N << 1 + 1 ---- shift numerator up and add 1 (quotient)
|
||||
;; else -- else
|
||||
;; R = (R << 1) + N(i) ---- shift up remainder, tack on MSb of numerator
|
||||
;; N = N << 1 ---- shift up numerator
|
||||
;; end
|
||||
;; endloop -- after 64 such iterations N has the quotient
|
||||
;; -- and R the remainder
|
||||
;; if(rem != 0)F.ZI = 0
|
||||
;; if(F.TF == 1 && F.ZI==0),
|
||||
;; Q += 1 -- The quotient is in the variable that
|
||||
;; R = D - R -- previously held the numerator
|
||||
;; if(F.TF == 1) Q = -Q
|
||||
;; if(F.NI ^ F.TF) R = -R -- In module division remainder follows the
|
||||
;; -- sign of the divisor
|
||||
;; Register Usage:
|
||||
;; R1H : dividend (quotient)
|
||||
;; R2H : remainder
|
||||
;; R3H : divisor
|
||||
;; XAR4: pointer to dividend (numerator) and subsequently remainders
|
||||
;; XAR5: pointer to divisor (denominator) and subsequently quotient
|
||||
;;
|
||||
;; cycles = 4(call) + 26(body) + 4(return)
|
||||
;; = 34
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.if __TI_EABI__
|
||||
.asg FID_i64byi32_m, _FID_i64byi32_m
|
||||
.endif
|
||||
.global _FID_i64byi32_m
|
||||
.sect ".text"
|
||||
_FID_i64byi32_m:
|
||||
.asmfunc
|
||||
MOV32 R0H, *+XAR4[0] ; [R1H:R0H] = dividend
|
||||
MOV32 R1H, *+XAR4[2]
|
||||
MOV32 R3H, *+XAR5[0] ; R3H = divisor
|
||||
ABSI64DIV32 R2H, R1H:R0H, R3H
|
||||
.asg 1, N
|
||||
.loop
|
||||
SUBC4UI32 R2H, R1H, R3H
|
||||
.break N == 8
|
||||
.eval N + 1, N
|
||||
.endloop
|
||||
SWAPF R1, R0
|
||||
.asg 1, N
|
||||
.loop
|
||||
SUBC4UI32 R2H, R1H, R3H
|
||||
.break N == 8
|
||||
.eval N + 1, N
|
||||
.endloop
|
||||
SWAPF R1, R0
|
||||
MNEGI64DIV32 R1H:R0H, R2H, R3H
|
||||
MOV32 *+XAR5[0], R0H
|
||||
MOV32 *+XAR5[2], R1H ; Save quotient
|
||||
MOV32 *+XAR4[0], R2H ; Save remainder
|
||||
LRETR
|
||||
.unasg N
|
||||
.endasmfunc
|
||||
|
||||
;;*****************************************************************************
|
||||
;; Euclidean Division
|
||||
;;
|
||||
;; F.TF = sign(num) ^ sign(den)
|
||||
;; F.NI = sign(num)
|
||||
;; N = |N| , D = |D|
|
||||
;; R = 0 -- start with a remainder of 0
|
||||
;; loop i = 63:-1:0
|
||||
;; T = (R << 1) + N(i) - D -- shift up remainder, tack on MSb of numerator
|
||||
;; -- subtract divisor
|
||||
;; if(T >= 0) -- if the difference is positive
|
||||
;; R = T & 0xFFF...FFUL ---- remainder = T
|
||||
;; N = N << 1 + 1 ---- shift numerator up and add 1 (quotient)
|
||||
;; else -- else
|
||||
;; R = (R << 1) + N(i) ---- shift up remainder, tack on MSb of numerator
|
||||
;; N = N << 1 ---- shift up numerator
|
||||
;; end
|
||||
;; endloop -- after 64 such iterations N has the quotient
|
||||
;; -- and R the remainder
|
||||
;; if(rem != 0)F.ZI = 0
|
||||
;; if(F.NI == 1 && F.ZI==0),
|
||||
;; Q += 1 -- The quotient is in the variable that
|
||||
;; R = D - R -- previously held the numerator
|
||||
;; if(F.TF == 1) Q = -Q -- In euclidean division remainder is always
|
||||
;; -- positive
|
||||
;; Register Usage:
|
||||
;; R1H : dividend (quotient)
|
||||
;; R2H : remainder
|
||||
;; R3H : divisor
|
||||
;; XAR4: pointer to dividend (numerator) and subsequently remainders
|
||||
;; XAR5: pointer to divisor (denominator) and subsequently quotient
|
||||
;;
|
||||
;; cycles = 4(call) + 26(body) + 4(return)
|
||||
;; = 34
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.if __TI_EABI__
|
||||
.asg FID_i64byi32_e, _FID_i64byi32_e
|
||||
.endif
|
||||
.global _FID_i64byi32_e
|
||||
.sect ".text"
|
||||
_FID_i64byi32_e:
|
||||
.asmfunc
|
||||
MOV32 R0H, *+XAR4[0] ; [R1H:R0H] = dividend
|
||||
MOV32 R1H, *+XAR4[2]
|
||||
MOV32 R3H, *+XAR5[0] ; R3H = divisor
|
||||
ABSI64DIV32 R2H, R1H:R0H, R3H
|
||||
.asg 1, N
|
||||
.loop
|
||||
SUBC4UI32 R2H, R1H, R3H
|
||||
.break N == 8
|
||||
.eval N + 1, N
|
||||
.endloop
|
||||
SWAPF R1, R0
|
||||
.asg 1, N
|
||||
.loop
|
||||
SUBC4UI32 R2H, R1H, R3H
|
||||
.break N == 8
|
||||
.eval N + 1, N
|
||||
.endloop
|
||||
SWAPF R1, R0
|
||||
ENEGI64DIV32 R1H:R0H, R2H, R3H
|
||||
MOV32 *+XAR5[0], R0H
|
||||
MOV32 *+XAR5[2], R1H ; Save quotient
|
||||
MOV32 *+XAR4[0], R2H ; Save remainder
|
||||
LRETR
|
||||
.unasg N
|
||||
.endasmfunc
|
||||
;; End of File
|
||||
@@ -0,0 +1,266 @@
|
||||
;;#############################################################################
|
||||
;;! \file source/fpu64/fid_i64byi64.asm
|
||||
;;!
|
||||
;;! \brief Signed Long Integer (64-bit) Division
|
||||
;;! \author Vishal Coelho
|
||||
;;! \date 04/12/2016
|
||||
;;
|
||||
;; DESCRIPTION:
|
||||
;;
|
||||
;; This function performs a 64-bit signed division (truncated, modulo or
|
||||
;; euclidean)
|
||||
;;
|
||||
;; FUNCTIONS:
|
||||
;;
|
||||
;; void FID_i64byi64_t(int64_t *p_num_rem, int64_t *p_den_quo)
|
||||
;; void FID_i64byi64_m(int64_t *p_num_rem, int64_t *p_den_quo)
|
||||
;; void FID_i64byi64_e(int64_t *p_num_rem, int64_t *p_den_quo)
|
||||
;;
|
||||
;; ASSUMPTIONS:
|
||||
;;
|
||||
;; ALGORITHM:
|
||||
;;
|
||||
;; The algorithm used is a slow division method (Restoring division)
|
||||
;; see https://en.wikipedia.org/wiki/Division_algorithm#Restoring_division
|
||||
;;
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
|
||||
|
||||
;;*****************************************************************************
|
||||
;; Truncated Division
|
||||
;;
|
||||
;; Let N be the dividend, D the divisor, T a temporary variable and P
|
||||
;; the partial remainder of each iteration, i the bit index and loop iterator
|
||||
;; F.TF = sign(num) ^ sign(den)
|
||||
;; F.NI = sign(num)
|
||||
;; N = |N| , D = |D|
|
||||
;; R = 0 -- start with a remainder of 0
|
||||
;; loop i = 63:-1:0
|
||||
;; T = (R << 1) + N(i) - D -- shift up remainder, tack on MSb of numerator
|
||||
;; -- subtract divisor
|
||||
;; if(T >= 0) -- if the difference is positive
|
||||
;; R = T & 0xFFFFFFFF ---- remainder = T
|
||||
;; N = N << 1 + 1 ---- shift numerator up and add 1 (quotient)
|
||||
;; else -- else
|
||||
;; R = (R << 1) + N(63) ---- shift up remainder, tack on MSb of numerator
|
||||
;; N = N << 1 ---- shift up numerator
|
||||
;; end
|
||||
;; endloop -- after 64 such iterations N has the quotient
|
||||
;; -- and R the remainder
|
||||
;; if(F.TF == 1), Q = -Q -- The quotient is in the variable that
|
||||
;; -- previously held the numerator
|
||||
;; if(F.NI == 1), R = -R -- In truncating division remainder follows the
|
||||
;; -- sign of the dividend
|
||||
;; Register Usage:
|
||||
;; R1H:R0H : dividend (quotient)
|
||||
;; R2H:R4H : remainder
|
||||
;; R3H:R5H : divisor
|
||||
;; XAR4 : pointer to dividend (numerator) and subsequently remainders
|
||||
;; XAR5 : pointer to divisor (denominator) and subsequently quotient
|
||||
;;
|
||||
;; cycles = 4(call) + 42(body) + 4(return)
|
||||
;; = 50
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.if __TI_EABI__
|
||||
.asg FID_i64byi64_t, _FID_i64byi64_t
|
||||
.endif
|
||||
.global _FID_i64byi64_t
|
||||
.sect ".text"
|
||||
_FID_i64byi64_t:
|
||||
.asmfunc
|
||||
MOV32 R0H, *+XAR4[0] ; [R1H:R0H] = dividend
|
||||
MOV32 R1H, *+XAR4[2]
|
||||
MOV32 R5H, *+XAR5[0] ; [R3H:R5H] = divisor
|
||||
MOV32 R3H, *+XAR5[2]
|
||||
ABSI64DIV64 R2H:R4H, R1H:R0H, R3H:R5H
|
||||
.asg 1, N
|
||||
.loop
|
||||
SUBC2UI64 R2H:R4H, R1H:R0H, R3H:R5H
|
||||
.break N == 32
|
||||
.eval N + 1, N
|
||||
.endloop
|
||||
NEGI64DIV64 R1H:R0H, R2H:R4H
|
||||
MOV32 *+XAR5[0], R0H ; Save quotient
|
||||
MOV32 *+XAR5[2], R1H
|
||||
MOV32 *+XAR4[0], R4H ; Save remainder
|
||||
MOV32 *+XAR4[2], R2H
|
||||
LRETR
|
||||
.unasg N
|
||||
.endasmfunc
|
||||
|
||||
;;*****************************************************************************
|
||||
;; Modulo (Floored) Division
|
||||
;;
|
||||
;; F.TF = sign(num) ^ sign(den)
|
||||
;; F.NI = sign(num)
|
||||
;; N = |N| , D = |D|
|
||||
;; R = 0 -- start with a remainder of 0
|
||||
;; loop i = 63:-1:0
|
||||
;; T = (R << 1) + N(i) - D -- shift up remainder, tack on MSb of numerator
|
||||
;; -- subtract divisor
|
||||
;; if(T >= 0) -- if the difference is positive
|
||||
;; R = T & 0xFFFFFFFF ---- remainder = T
|
||||
;; N = N << 1 + 1 ---- shift numerator up and add 1 (quotient)
|
||||
;; else -- else
|
||||
;; R = (R << 1) + N(i) ---- shift up remainder, tack on MSb of numerator
|
||||
;; N = N << 1 ---- shift up numerator
|
||||
;; end
|
||||
;; endloop -- after 64 such iterations N has the quotient
|
||||
;; -- and R the remainder
|
||||
;; if(rem != 0)F.ZI = 0
|
||||
;; if(F.TF == 1 && F.ZI==0),
|
||||
;; Q += 1 -- The quotient is in the variable that
|
||||
;; R = D - R -- previously held the numerator
|
||||
;; if(F.TF == 1) Q = -Q
|
||||
;; if(F.NI ^ F.TF) R = -R -- In module division remainder follows the
|
||||
;; -- sign of the divisor
|
||||
;; Register Usage:
|
||||
;; R1H:R0H : dividend (quotient)
|
||||
;; R2H:R4H : remainder
|
||||
;; R3H:R5H : divisor
|
||||
;; XAR4 : pointer to dividend (numerator) and subsequently remainders
|
||||
;; XAR5 : pointer to divisor (denominator) and subsequently quotient
|
||||
;;
|
||||
;; cycles = 4(call) + 42(body) + 4(return)
|
||||
;; = 50
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.if __TI_EABI__
|
||||
.asg FID_i64byi64_m, _FID_i64byi64_m
|
||||
.endif
|
||||
.global _FID_i64byi64_m
|
||||
.sect ".text"
|
||||
_FID_i64byi64_m:
|
||||
.asmfunc
|
||||
MOV32 R0H, *+XAR4[0] ; [R1H:R0H] = dividend
|
||||
MOV32 R1H, *+XAR4[2]
|
||||
MOV32 R5H, *+XAR5[0] ; [R3H:R5H] = divisor
|
||||
MOV32 R3H, *+XAR5[2]
|
||||
ABSI64DIV64 R2H:R4H, R1H:R0H, R3H:R5H
|
||||
.asg 1, N
|
||||
.loop
|
||||
SUBC2UI64 R2H:R4H, R1H:R0H, R3H:R5H
|
||||
.break N == 32
|
||||
.eval N + 1, N
|
||||
.endloop
|
||||
MNEGI64DIV64 R1H:R0H, R2H:R4H, R3H:R5H
|
||||
MOV32 *+XAR5[0], R0H ; Save quotient
|
||||
MOV32 *+XAR5[2], R1H
|
||||
MOV32 *+XAR4[0], R4H ; Save remainder
|
||||
MOV32 *+XAR4[2], R2H
|
||||
LRETR
|
||||
.unasg N
|
||||
.endasmfunc
|
||||
|
||||
|
||||
;;*****************************************************************************
|
||||
;; Euclidean Division
|
||||
;;
|
||||
;; F.TF = sign(num) ^ sign(den)
|
||||
;; F.NI = sign(num)
|
||||
;; N = |N| , D = |D|
|
||||
;; R = 0 -- start with a remainder of 0
|
||||
;; loop i = 63:-1:0
|
||||
;; T = (R << 1) + N(i) - D -- shift up remainder, tack on MSb of numerator
|
||||
;; -- subtract divisor
|
||||
;; if(T >= 0) -- if the difference is positive
|
||||
;; R = T & 0xFFFFFFFF ---- remainder = T
|
||||
;; N = N << 1 + 1 ---- shift numerator up and add 1 (quotient)
|
||||
;; else -- else
|
||||
;; R = (R << 1) + N(i) ---- shift up remainder, tack on MSb of numerator
|
||||
;; N = N << 1 ---- shift up numerator
|
||||
;; end
|
||||
;; endloop -- after 64 such iterations N has the quotient
|
||||
;; -- and R the remainder
|
||||
;; if(rem != 0)F.ZI = 0
|
||||
;; if(F.NI == 1 && F.ZI==0),
|
||||
;; Q += 1 -- The quotient is in the variable that
|
||||
;; R = D - R -- previously held the numerator
|
||||
;; if(F.TF == 1) Q = -Q -- In euclidean division remainder is always
|
||||
;; -- positive
|
||||
;; Register Usage:
|
||||
;; R1H:R0H : dividend (quotient)
|
||||
;; R2H:R4H : remainder
|
||||
;; R3H:R5H : divisor
|
||||
;; XAR4 : pointer to dividend (numerator) and subsequently remainders
|
||||
;; XAR5 : pointer to divisor (denominator) and subsequently quotient
|
||||
;;
|
||||
;; cycles = 4(call) + 42(body) + 4(return)
|
||||
;; = 50
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.if __TI_EABI__
|
||||
.asg FID_i64byi64_e, _FID_i64byi64_e
|
||||
.endif
|
||||
.global _FID_i64byi64_e
|
||||
.sect ".text"
|
||||
_FID_i64byi64_e:
|
||||
.asmfunc
|
||||
MOV32 R0H, *+XAR4[0] ; [R1H:R0H] = dividend
|
||||
MOV32 R1H, *+XAR4[2]
|
||||
MOV32 R5H, *+XAR5[0] ; [R3H:R5H] = divisor
|
||||
MOV32 R3H, *+XAR5[2]
|
||||
ABSI64DIV64 R2H:R4H, R1H:R0H, R3H:R5H
|
||||
.asg 1, N
|
||||
.loop
|
||||
SUBC2UI64 R2H:R4H, R1H:R0H, R3H:R5H
|
||||
.break N == 32
|
||||
.eval N + 1, N
|
||||
.endloop
|
||||
ENEGI64DIV64 R1H:R0H, R2H:R4H, R3H:R5H
|
||||
MOV32 *+XAR5[0], R0H ; Save quotient
|
||||
MOV32 *+XAR5[2], R1H
|
||||
MOV32 *+XAR4[0], R4H ; Save remainder
|
||||
MOV32 *+XAR4[2], R2H
|
||||
LRETR
|
||||
.unasg N
|
||||
.endasmfunc
|
||||
;; End of File
|
||||
@@ -0,0 +1,146 @@
|
||||
;;#############################################################################
|
||||
;;! \file source/fpu64/fid_i64byui32.asm
|
||||
;;!
|
||||
;;! \brief Signed (64-bit)/ Unsigned (32-bit) Division
|
||||
;;! \author Vishal Coelho
|
||||
;;! \date 04/11/2016
|
||||
;;
|
||||
;; DESCRIPTION:
|
||||
;;
|
||||
;; This function performs a 64-bit signed/ 32-bit unsigned division
|
||||
;; (truncated)
|
||||
;;
|
||||
;; FUNCTIONS:
|
||||
;;
|
||||
;; void FID_i64byui32(int64_t *p_num_rem, int64_t *p_den_quo)
|
||||
;;
|
||||
;; ASSUMPTIONS:
|
||||
;;
|
||||
;; ALGORITHM:
|
||||
;;
|
||||
;; The algorithm used is a slow division method (Restoring division)
|
||||
;; see https://en.wikipedia.org/wiki/Division_algorithm#Restoring_division
|
||||
;;
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
|
||||
|
||||
;;*****************************************************************************
|
||||
;; Truncated Division
|
||||
;;
|
||||
;; Let N be the dividend, D the divisor, T a temporary variable and P
|
||||
;; the partial remainder of each iteration, i the bit index and loop iterator
|
||||
;; F.TF = sign(num)
|
||||
;; F.NI = sign(num)
|
||||
;; N = |N| , D = |D|
|
||||
;; R = 0 -- start with a remainder of 0
|
||||
;; loop i = 63:-1:0
|
||||
;; T = (R << 1) + N(i) - D -- shift up remainder, tack on MSb of numerator
|
||||
;; -- subtract divisor
|
||||
;; if(T >= 0) -- if the difference is positive
|
||||
;; R = T & 0xFFF...FFUL ---- remainder = T
|
||||
;; N = N << 1 + 1 ---- shift numerator up and add 1 (quotient)
|
||||
;; else -- else
|
||||
;; R = (R << 1) + N(63) ---- shift up remainder, tack on MSb of numerator
|
||||
;; N = N << 1 ---- shift up numerator
|
||||
;; end
|
||||
;; endloop -- after 64 such iterations N has the quotient
|
||||
;; -- and R the remainder
|
||||
;; if(F.TF == 1), Q = -Q -- The quotient is in the variable that
|
||||
;; -- previously held the numerator
|
||||
;; if(F.NI == 1), R = -R -- In truncating division remainder follows the
|
||||
;; -- sign of the dividend
|
||||
;; Register Usage:
|
||||
;; R1H : dividend (quotient)
|
||||
;; R2H : remainder
|
||||
;; R3H : divisor
|
||||
;; XAR4: pointer to dividend (numerator) and subsequently remainders
|
||||
;; XAR5: pointer to divisor (denominator) and subsequently quotient
|
||||
;;
|
||||
;; cycles = 4(call) + 28(body) + 4(return)
|
||||
;; = 36
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.if __TI_EABI__
|
||||
.asg FID_i64byui32, _FID_i64byui32
|
||||
.endif
|
||||
.global _FID_i64byui32
|
||||
.sect ".text"
|
||||
_FID_i64byui32:
|
||||
.asmfunc
|
||||
MOV32 R0H, *+XAR4[0] ; [R1H:R0H] = dividend
|
||||
MOV32 R1H, *+XAR4[2]
|
||||
MOV32 R3H, *+XAR5[0] ; R3H = divisor
|
||||
ABSI64DIV32U R2H, R1H:R0H
|
||||
.asg 1, N
|
||||
.loop
|
||||
SUBC4UI32 R2H, R1H, R3H
|
||||
.break N == 8
|
||||
.eval N + 1, N
|
||||
.endloop
|
||||
SWAPF R1, R0
|
||||
.asg 1, N
|
||||
.loop
|
||||
SUBC4UI32 R2H, R1H, R3H
|
||||
.break N == 8
|
||||
.eval N + 1, N
|
||||
.endloop
|
||||
SWAPF R1, R0
|
||||
ZERO R4
|
||||
SWAPF R4, R2
|
||||
NEGI64DIV64 R1H:R0H, R2H:R4H
|
||||
MOV32 *+XAR5[0], R0H
|
||||
MOV32 *+XAR5[2], R1H ; Save quotient
|
||||
MOV32 *+XAR4[0], R4H
|
||||
MOV32 *+XAR4[2], R2H ; Save remainder
|
||||
LRETR
|
||||
.unasg N
|
||||
.endasmfunc
|
||||
|
||||
;; End of File
|
||||
@@ -0,0 +1,135 @@
|
||||
;;#############################################################################
|
||||
;;! \file source/fpu64/fid_i64byui64.asm
|
||||
;;!
|
||||
;;! \brief Signed (64-bit)/ Unsigned (64-bit) Division
|
||||
;;! \author Vishal Coelho
|
||||
;;! \date 04/13/2016
|
||||
;;
|
||||
;; DESCRIPTION:
|
||||
;;
|
||||
;; This function performs a 64-bit signed by unsigned division (truncated)
|
||||
;;
|
||||
;; FUNCTIONS:
|
||||
;;
|
||||
;; void FID_i64byui64(int64_t *p_num_rem, int64_t *p_den_quo)
|
||||
;;
|
||||
;; ASSUMPTIONS:
|
||||
;;
|
||||
;; ALGORITHM:
|
||||
;;
|
||||
;; The algorithm used is a slow division method (Restoring division)
|
||||
;; see https://en.wikipedia.org/wiki/Division_algorithm#Restoring_division
|
||||
;;
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
|
||||
;;*****************************************************************************
|
||||
;; Truncated Division
|
||||
;;
|
||||
;; Let N be the dividend, D the divisor, T a temporary variable and P
|
||||
;; the partial remainder of each iteration, i the bit index and loop iterator
|
||||
;; F.TF = sign(num)
|
||||
;; F.NI = sign(num)
|
||||
;; N = |N| , D = |D|
|
||||
;; R = 0 -- start with a remainder of 0
|
||||
;; loop i = 63:-1:0
|
||||
;; T = (R << 1) + N(i) - D -- shift up remainder, tack on MSb of numerator
|
||||
;; -- subtract divisor
|
||||
;; if(T >= 0) -- if the difference is positive
|
||||
;; R = T & 0xFFFFFFFF ---- remainder = T
|
||||
;; N = N << 1 + 1 ---- shift numerator up and add 1 (quotient)
|
||||
;; else -- else
|
||||
;; R = (R << 1) + N(63) ---- shift up remainder, tack on MSb of numerator
|
||||
;; N = N << 1 ---- shift up numerator
|
||||
;; end
|
||||
;; endloop -- after 64 such iterations N has the quotient
|
||||
;; -- and R the remainder
|
||||
;; if(F.TF == 1), Q = -Q -- The quotient is in the variable that
|
||||
;; -- previously held the numerator
|
||||
;; if(F.NI == 1), R = -R -- In truncating division remainder follows the
|
||||
;; -- sign of the dividend
|
||||
;; Register Usage:
|
||||
;; R1H:R0H : dividend (quotient)
|
||||
;; R2H:R4H : remainder
|
||||
;; R3H:R5H : divisor
|
||||
;; XAR4 : pointer to dividend (numerator) and subsequently remainders
|
||||
;; XAR5 : pointer to divisor (denominator) and subsequently quotient
|
||||
;;
|
||||
;; cycles = 4(call) + 42(body) + 4(return)
|
||||
;; = 50
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.if __TI_EABI__
|
||||
.asg FID_i64byui64, _FID_i64byui64
|
||||
.endif
|
||||
.global _FID_i64byui64
|
||||
.sect ".text"
|
||||
_FID_i64byui64:
|
||||
.asmfunc
|
||||
MOV32 R0H, *+XAR4[0] ; [R1H:R0H] = dividend
|
||||
MOV32 R1H, *+XAR4[2]
|
||||
MOV32 R5H, *+XAR5[0] ; [R3H:R5H] = divisor
|
||||
MOV32 R3H, *+XAR5[2]
|
||||
ABSI64DIV64U R2H:R4H, R1H:R0H
|
||||
.asg 1, N
|
||||
.loop
|
||||
SUBC2UI64 R2H:R4H, R1H:R0H, R3H:R5H
|
||||
.break N == 32
|
||||
.eval N + 1, N
|
||||
.endloop
|
||||
NEGI64DIV64 R1H:R0H, R2H:R4H
|
||||
MOV32 *+XAR5[0], R0H ; Save quotient
|
||||
MOV32 *+XAR5[2], R1H
|
||||
MOV32 *+XAR4[0], R4H ; Save remainder
|
||||
MOV32 *+XAR4[2], R2H
|
||||
LRETR
|
||||
.unasg N
|
||||
.endasmfunc
|
||||
|
||||
;; End of File
|
||||
@@ -0,0 +1,129 @@
|
||||
;;#############################################################################
|
||||
;;! \file source/fpu64/fid_ui16byui16.asm
|
||||
;;!
|
||||
;;! \brief Unsigned Integer (16-bit) Division
|
||||
;;! \author Vishal Coelho
|
||||
;;! \date 04/14/2016
|
||||
;;
|
||||
;; DESCRIPTION:
|
||||
;;
|
||||
;; This function performs a 16-bit unsigned division (truncated)
|
||||
;;
|
||||
;; FUNCTIONS:
|
||||
;;
|
||||
;; void FID_ui16byui16(uint16_t *p_num_rem, uint16_t *p_den_quo)
|
||||
;;
|
||||
;; ASSUMPTIONS:
|
||||
;;
|
||||
;; ALGORITHM:
|
||||
;;
|
||||
;; The algorithm used is a slow division method (Restoring division)
|
||||
;; see https://en.wikipedia.org/wiki/Division_algorithm#Restoring_division
|
||||
;;
|
||||
;; Let N be the dividend, D the divisor, T a temporary variable and P
|
||||
;; the partial remainder of each iteration, i the bit index and loop iterator
|
||||
;; R = 0 -- start with a remainder of 0
|
||||
;; loop i = 15:-1:0
|
||||
;; T = (R << 1) + N(i) - D -- shift up remainder, tack on MSb of numerator
|
||||
;; -- subtract divisor
|
||||
;; if(T >= 0) -- if the difference is positive
|
||||
;; R = T & 0xFFFFFFFF ---- remainder = T
|
||||
;; N = N << 1 + 1 ---- shift numerator up and add 1 (quotient)
|
||||
;; else -- else
|
||||
;; R = (R << 1) + N(15) ---- shift up remainder, tack on MSb of numerator
|
||||
;; N = N << 1 ---- shift up numerator
|
||||
;; end
|
||||
;; endloop -- after 32 such iterations N has the quotient
|
||||
;; -- and R the remainder
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
|
||||
|
||||
;;*****************************************************************************
|
||||
;; Register Usage:
|
||||
;; XAR0 : initial load of the divisor
|
||||
;; R1H : dividend (quotient)
|
||||
;; R2H : remainder
|
||||
;; R3H : divisor
|
||||
;; XAR4: pointer to dividend (numerator) and subsequently remainders
|
||||
;; XAR5: pointer to divisor (denominator) and subsequently quotient
|
||||
;;
|
||||
;; cycles = 4(call) + 15(body) + 4(return)
|
||||
;; = 23
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.if __TI_EABI__
|
||||
.asg FID_ui16byui16, _FID_ui16byui16
|
||||
.endif
|
||||
.global _FID_ui16byui16
|
||||
.sect ".text"
|
||||
_FID_ui16byui16:
|
||||
.asmfunc
|
||||
CLRC SXM ; turn off sign-extenstion
|
||||
MOV ACC, *+XAR5[0] ; ACC = [0:divisor]
|
||||
MOV32 R3H, ACC ; *| R3H = divisor
|
||||
MOV ACC, *+XAR4[0] << #16 ; 1| ACC = [dividend:0]
|
||||
MOV32 R1H, ACC ; 2|*|R1H = dividend
|
||||
ZERO R2 ; 3|1|alignment cycles
|
||||
NOP ; 4|2|alignment cycles
|
||||
NOP ; |3|alignment cycles
|
||||
NOP ; |4|alignment cycles
|
||||
.asg 1, N
|
||||
.loop
|
||||
SUBC4UI32 R2H, R1H, R3H
|
||||
.break N == 4
|
||||
.eval N + 1, N
|
||||
.endloop
|
||||
MOV16 *+XAR5[0], R1H ; Save quotient
|
||||
MOV16 *+XAR4[0], R2H ; Save remainder
|
||||
LRETR
|
||||
.unasg N
|
||||
.endasmfunc
|
||||
|
||||
;; End of File
|
||||
@@ -0,0 +1,125 @@
|
||||
;;#############################################################################
|
||||
;;! \file source/fpu64/fid_ui32byui16.asm
|
||||
;;!
|
||||
;;! \brief Unsigned Integer (32-bit) / Unsigned short (16-bit) Division
|
||||
;;! \author Vishal Coelho
|
||||
;;! \date 04/15/2016
|
||||
;;
|
||||
;; DESCRIPTION:
|
||||
;;
|
||||
;; This function performs a 32-bit unsigned division (truncated)
|
||||
;;
|
||||
;; FUNCTIONS:
|
||||
;;
|
||||
;; void FID_ui32byui16(uint32_t *p_num_rem, uint32_t *p_den_quo)
|
||||
;;
|
||||
;; ASSUMPTIONS:
|
||||
;;
|
||||
;; ALGORITHM:
|
||||
;;
|
||||
;; The algorithm used is a slow division method (Restoring division)
|
||||
;; see https://en.wikipedia.org/wiki/Division_algorithm#Restoring_division
|
||||
;;
|
||||
;; Let N be the dividend, D the divisor, T a temporary variable and P
|
||||
;; the partial remainder of each iteration, i the bit index and loop iterator
|
||||
;; R = 0 -- start with a remainder of 0
|
||||
;; loop i = 31:-1:0
|
||||
;; T = (R << 1) + N(i) - D -- shift up remainder, tack on MSb of numerator
|
||||
;; -- subtract divisor
|
||||
;; if(T >= 0) -- if the difference is positive
|
||||
;; R = T & 0xFFFFFFFF ---- remainder = T
|
||||
;; N = N << 1 + 1 ---- shift numerator up and add 1 (quotient)
|
||||
;; else -- else
|
||||
;; R = (R << 1) + N(31) ---- shift up remainder, tack on MSb of numerator
|
||||
;; N = N << 1 ---- shift up numerator
|
||||
;; end
|
||||
;; endloop -- after 32 such iterations N has the quotient
|
||||
;; -- and R the remainder
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
|
||||
;;*****************************************************************************
|
||||
;; Register Usage:
|
||||
;; R1H : dividend (quotient)
|
||||
;; R2H : remainder
|
||||
;; R3H : divisor
|
||||
;; XAR4: pointer to dividend (numerator) and subsequently remainders
|
||||
;; XAR5: pointer to divisor (denominator) and subsequently quotient
|
||||
;;
|
||||
;; cycles = 4(call) + 17(body) + 4(return)
|
||||
;; = 25
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.if __TI_EABI__
|
||||
.asg FID_ui32byui16, _FID_ui32byui16
|
||||
.endif
|
||||
.global _FID_ui32byui16
|
||||
.sect ".text"
|
||||
_FID_ui32byui16:
|
||||
.asmfunc
|
||||
CLRC SXM ; Turn off sign extension
|
||||
MOV ACC, *+XAR5[0] ; ACC = [0:divisor]
|
||||
MOV32 R3H, ACC ; *| R3H = [0:divisor]
|
||||
MOV32 R1H, *+XAR4[0] ; 1| R1H = dividend
|
||||
ZERO R2 ; 2| alignment cycle
|
||||
MOV16 *+XAR4[2], R2H ; 3| zero out high word of the remainder
|
||||
NOP ; 4| alignment cycle
|
||||
.asg 1, N
|
||||
.loop
|
||||
SUBC4UI32 R2H, R1H, R3H
|
||||
.break N == 8
|
||||
.eval N + 1, N
|
||||
.endloop
|
||||
MOV32 *+XAR5[0], R1H ; Save quotient
|
||||
MOV16 *+XAR4[0], R2H ; Save remainder
|
||||
LRETR
|
||||
.unasg N
|
||||
.endasmfunc
|
||||
|
||||
;; End of File
|
||||
@@ -0,0 +1,122 @@
|
||||
;;#############################################################################
|
||||
;;! \file source/fpu64/fid_ui32byui32.asm
|
||||
;;!
|
||||
;;! \brief Unsigned Integer (32-bit) Division
|
||||
;;! \author Vishal Coelho
|
||||
;;! \date 03/25/2016
|
||||
;;
|
||||
;; DESCRIPTION:
|
||||
;;
|
||||
;; This function performs a 32-bit unsigned division (truncated)
|
||||
;;
|
||||
;; FUNCTIONS:
|
||||
;;
|
||||
;; void FID_ui32byui32(uint32_t *p_num_rem, uint32_t *p_den_quo)
|
||||
;;
|
||||
;; ASSUMPTIONS:
|
||||
;;
|
||||
;; ALGORITHM:
|
||||
;;
|
||||
;; The algorithm used is a slow division method (Restoring division)
|
||||
;; see https://en.wikipedia.org/wiki/Division_algorithm#Restoring_division
|
||||
;;
|
||||
;; Let N be the dividend, D the divisor, T a temporary variable and P
|
||||
;; the partial remainder of each iteration, i the bit index and loop iterator
|
||||
;; R = 0 -- start with a remainder of 0
|
||||
;; loop i = 31:-1:0
|
||||
;; T = (R << 1) + N(i) - D -- shift up remainder, tack on MSb of numerator
|
||||
;; -- subtract divisor
|
||||
;; if(T >= 0) -- if the difference is positive
|
||||
;; R = T & 0xFFFFFFFF ---- remainder = T
|
||||
;; N = N << 1 + 1 ---- shift numerator up and add 1 (quotient)
|
||||
;; else -- else
|
||||
;; R = (R << 1) + N(31) ---- shift up remainder, tack on MSb of numerator
|
||||
;; N = N << 1 ---- shift up numerator
|
||||
;; end
|
||||
;; endloop -- after 32 such iterations N has the quotient
|
||||
;; -- and R the remainder
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
|
||||
|
||||
;;*****************************************************************************
|
||||
;; Register Usage:
|
||||
;; R1H : dividend (quotient)
|
||||
;; R2H : remainder
|
||||
;; R3H : divisor
|
||||
;; XAR4: pointer to dividend (numerator) and subsequently remainders
|
||||
;; XAR5: pointer to divisor (denominator) and subsequently quotient
|
||||
;;
|
||||
;; cycles = 4(call) + 13(body) + 4(return)
|
||||
;; = 21
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.if __TI_EABI__
|
||||
.asg FID_ui32byui32, _FID_ui32byui32
|
||||
.endif
|
||||
.global _FID_ui32byui32
|
||||
.sect ".text"
|
||||
_FID_ui32byui32:
|
||||
.asmfunc
|
||||
MOV32 R1H, *+XAR4[0] ; R1H = dividend
|
||||
MOV32 R3H, *+XAR5[0] ; R3H = divisor
|
||||
ZERO R2
|
||||
.asg 1, N
|
||||
.loop
|
||||
SUBC4UI32 R2H, R1H, R3H
|
||||
.break N == 8
|
||||
.eval N + 1, N
|
||||
.endloop
|
||||
MOV32 *+XAR5[0], R1H ; Save quotient
|
||||
MOV32 *+XAR4[0], R2H ; Save remainder
|
||||
LRETR
|
||||
.unasg N
|
||||
.endasmfunc
|
||||
|
||||
;; End of File
|
||||
@@ -0,0 +1,139 @@
|
||||
;;#############################################################################
|
||||
;;! \file source/fpu64/fid_ui64byui32.asm
|
||||
;;!
|
||||
;;! \brief Unsigned Long (64-bit) / Unsigned integer (32-bit)
|
||||
;;! \author Vishal Coelho
|
||||
;;! \date 04/07/2016
|
||||
;;
|
||||
;; DESCRIPTION:
|
||||
;;
|
||||
;; This function performs a 64-bit/32-bit unsigned division (truncated)
|
||||
;;
|
||||
;; FUNCTIONS:
|
||||
;;
|
||||
;; void FID_ui64byui32(uint64_t *p_num_rem, uint64_t *p_den_quo)
|
||||
;;
|
||||
;; ASSUMPTIONS:
|
||||
;;
|
||||
;; ALGORITHM:
|
||||
;;
|
||||
;; The algorithm used is a slow division method (Restoring division)
|
||||
;; see https://en.wikipedia.org/wiki/Division_algorithm#Restoring_division
|
||||
;;
|
||||
;; Let N be the dividend, D the divisor, T a temporary variable and P
|
||||
;; the partial remainder of each iteration, i the bit index and loop iterator
|
||||
;;
|
||||
;; First we process the high double word of the numerator
|
||||
;; outer_loop: -- twice, upper and lower dwords of the numerator
|
||||
;; R = 0 -- start with a remainder of 0
|
||||
;; loop i = 31:-1:0
|
||||
;; T = (R << 1) + N(i) - D -- shift up remainder, tack on MSb of numerator
|
||||
;; -- subtract divisor
|
||||
;; if(T >= 0) -- if the difference is positive
|
||||
;; R = T & 0xFFF...FFUL ---- remainder = T
|
||||
;; N = N << 1 + 1 ---- shift numerator up and add 1 (quotient)
|
||||
;; else -- else
|
||||
;; R = (R << 1) + N(63) ---- shift up remainder, tack on MSb of numerator
|
||||
;; N = N << 1 ---- shift up numerator
|
||||
;; end
|
||||
;; endloop -- after 31 such iterations N has the quotient
|
||||
;; -- and R the remainder
|
||||
;; swap -- swap the high and low dwords of the
|
||||
;; -- numerator/quotient
|
||||
;; end_outer_loop
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
|
||||
|
||||
;;*****************************************************************************
|
||||
;; Register Usage:
|
||||
;; R1H:R0H : dividend (quotient)
|
||||
;; R2H : remainder
|
||||
;; R3H : divisor
|
||||
;; XAR4 : pointer to dividend (numerator) and subsequently remainders
|
||||
;; XAR5 : pointer to divisor (denominator) and subsequently quotient
|
||||
;;
|
||||
;; cycles = 4(call) + 26(body) + 4(return)
|
||||
;; = 34
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.if __TI_EABI__
|
||||
.asg FID_ui64byui32, _FID_ui64byui32
|
||||
.endif
|
||||
.global _FID_ui64byui32
|
||||
.sect ".text"
|
||||
_FID_ui64byui32:
|
||||
.asmfunc
|
||||
MOV32 R0H, *+XAR4[0] ; [R1H:R0H] = dividend
|
||||
MOV32 R1H, *+XAR4[2]
|
||||
MOV32 R3H, *+XAR5[0] ; R3H = divisor
|
||||
ZERO R2
|
||||
MOV32 *+XAR4[2], R2H ; Zero high dword of remainder
|
||||
.asg 1, N
|
||||
.loop
|
||||
SUBC4UI32 R2H, R1H, R3H
|
||||
.break N == 8
|
||||
.eval N + 1, N
|
||||
.endloop
|
||||
SWAPF R1, R0
|
||||
.asg 1, N
|
||||
.loop
|
||||
SUBC4UI32 R2H, R1H, R3H
|
||||
.break N == 8
|
||||
.eval N + 1, N
|
||||
.endloop
|
||||
SWAPF R1, R0
|
||||
MOV32 *+XAR5[0], R0H
|
||||
MOV32 *+XAR5[2], R1H ; Save quotient
|
||||
MOV32 *+XAR4[0], R2H ; Save remainder
|
||||
LRETR
|
||||
.unasg N
|
||||
.endasmfunc
|
||||
|
||||
;; End of File
|
||||
@@ -0,0 +1,130 @@
|
||||
;;#############################################################################
|
||||
;;! \file source/fpu64/fid_ui64byui64.asm
|
||||
;;!
|
||||
;;! \brief Unsigned Long (64-bit) / Unsigned Long (64-bit)
|
||||
;;! \author Vishal Coelho
|
||||
;;! \date 04/1/2016
|
||||
;;
|
||||
;; DESCRIPTION:
|
||||
;;
|
||||
;; This function performs a 64-bit/64-bit unsigned division (truncated)
|
||||
;;
|
||||
;; FUNCTIONS:
|
||||
;;
|
||||
;; void FID_ui64byui64(uint64_t *p_num_rem, uint64_t *p_den_quo)
|
||||
;;
|
||||
;; ASSUMPTIONS:
|
||||
;;
|
||||
;; ALGORITHM:
|
||||
;;
|
||||
;; The algorithm used is a slow division method (Restoring division)
|
||||
;; see https://en.wikipedia.org/wiki/Division_algorithm#Restoring_division
|
||||
;;
|
||||
;; Let N be the dividend, D the divisor, T a temporary variable and P
|
||||
;; the partial remainder of each iteration, i the bit index and loop iterator
|
||||
;;
|
||||
;; R = 0 -- start with a remainder of 0
|
||||
;; loop i = 63:-1:0
|
||||
;; T = (R << 1) + N(i) - D -- shift up remainder, tack on MSb of numerator
|
||||
;; -- subtract divisor
|
||||
;; if(T >= 0) -- if the difference is positive
|
||||
;; R = T & 0xFFF...FFUL ---- remainder = T
|
||||
;; N = N << 1 + 1 ---- shift numerator up and add 1 (quotient)
|
||||
;; else -- else
|
||||
;; R = (R << 1) + N(63) ---- shift up remainder, tack on MSb of numerator
|
||||
;; N = N << 1 ---- shift up numerator
|
||||
;; end
|
||||
;; endloop -- after 64 such iterations N has the quotient
|
||||
;; -- and R the remainder
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
|
||||
|
||||
;;*****************************************************************************
|
||||
;; Register Usage:
|
||||
;; R1H:R0H : dividend (quotient)
|
||||
;; R2H:R4H : remainder
|
||||
;; R3H:R5H : divisor
|
||||
;; XAR4 : pointer to dividend (numerator) and subsequently remainders
|
||||
;; XAR5 : pointer to divisor (denominator) and subsequently quotient
|
||||
;;
|
||||
;; cycles = 4(call) + 42(body) + 4(return)
|
||||
;; = 50
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.if __TI_EABI__
|
||||
.asg FID_ui64byui64, _FID_ui64byui64
|
||||
.endif
|
||||
.global _FID_ui64byui64
|
||||
.sect ".text"
|
||||
_FID_ui64byui64:
|
||||
.asmfunc
|
||||
ZERO R2
|
||||
ZERO R4
|
||||
MOV32 R0H, *+XAR4[0] ; [R1H:R0H] = dividend
|
||||
MOV32 R1H, *+XAR4[2]
|
||||
MOV32 R5H, *+XAR5[0]
|
||||
MOV32 R3H, *+XAR5[2] ; [R3H:R5H] = divisor
|
||||
|
||||
.asg 1, N
|
||||
.loop
|
||||
SUBC2UI64 R2H:R4H, R1H:R0H, R3H:R5H
|
||||
.break N == 32
|
||||
.eval N + 1, N
|
||||
.endloop
|
||||
|
||||
MOV32 *+XAR5[0], R0H
|
||||
MOV32 *+XAR5[2], R1H ; Save quotient
|
||||
MOV32 *+XAR4[0], R4H
|
||||
MOV32 *+XAR4[2], R2H ; Save remainder
|
||||
LRETR
|
||||
.unasg N
|
||||
.endasmfunc
|
||||
|
||||
;; End of File
|
||||
@@ -0,0 +1,146 @@
|
||||
;;#############################################################################
|
||||
;;! \file source/fpu64/isqrt_f64.asm
|
||||
;;!
|
||||
;;! \brief Inverse Square Root function for the C28x + FPU64
|
||||
;;! \author Vishal Coelho
|
||||
;;! \date 12/24/2015
|
||||
;;
|
||||
;; DESCRIPTION:
|
||||
;;
|
||||
;; This function computes a 64-bit floating point (1.0)/sqrt(X). This
|
||||
;; function is not part of the normal RTS library.
|
||||
;;
|
||||
;; FUNCTIONS:
|
||||
;;
|
||||
;; float64 isqrt (float64 X)
|
||||
;;
|
||||
;; ASSUMPTIONS:
|
||||
;;
|
||||
;; ALGORITHM:
|
||||
;;
|
||||
;; Ye = Estimate(1/sqrt(X));
|
||||
;; Ye' = Ye*(1.5 - Ye*Ye*X*0.5)
|
||||
;; Ye'' = Ye'*(1.5 - Ye'*Ye'*X*0.5)
|
||||
;; Ye''' = Ye''*(1.5 - Ye''*Ye''*X*0.5)
|
||||
;; Y = Ye'''*(1.5 - Ye'''*Ye'''*X*0.5)
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
|
||||
;; the includes
|
||||
.cdecls C, LIST, "fastrts.h"
|
||||
|
||||
;;*****************************************************************************
|
||||
;; Register Usage:
|
||||
;; R0 : X,Y, the argument and the result
|
||||
;; R1 : Ye, first estimate of 1/sqrt(X)(all successive estimates Ye',...)
|
||||
;; R2 : X*0.5
|
||||
;; R3 : 1.5 - Ye*Ye*X*0.5 (all successive estimates Ye', Ye'' ..)
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.if __TI_EABI__
|
||||
.asg isqrt, _isqrtl
|
||||
.endif
|
||||
.global _isqrtl
|
||||
.sect ".text"
|
||||
_isqrtl: .asmfunc
|
||||
.if CONVERT_F32_TO_F64 == 1
|
||||
F32TOF64 R0, R0H ; convert argument to double precision
|
||||
.endif
|
||||
EISQRTF64 R1, R0 ; *|R1 = Ye = Estimate(1/sqrt(X))
|
||||
NOP ; 1|
|
||||
MPYF64 R2, R0, #0.5 ; *| R2 = X*0.5
|
||||
RPTB #_isqrtl_loop, #2 ; run loop 3 times
|
||||
MPYF64 R3, R1, R1 ; 1|*| R3 = Ye*Ye
|
||||
NOP ; 2|1|
|
||||
NOP ; 2|
|
||||
MPYF64 R3, R3, R2 ; *| R3 = Ye*Ye*X*0.5
|
||||
NOP ; 1|
|
||||
NOP ; 2|
|
||||
SUBF64 R3, #1.5, R3 ; *| R3 = 1.5 - Ye*Ye*X*0.5
|
||||
NOP ; 1|
|
||||
NOP ; 2|
|
||||
MPYF64 R1, R1, R3 ; *| R1 = Ye = Ye*(1.5 - Ye*Ye*X*0.5)
|
||||
NOP ; 1|
|
||||
NOP ; 2|
|
||||
_isqrtl_loop:
|
||||
MPYF64 R3, R1, R2 ; *| R3 = Ye'''*X*0.5
|
||||
NOP ; 1|
|
||||
NOP ; 2|
|
||||
MPYF64 R3, R1, R3 ; *| R3 = Ye'''*Ye'''*X*0.5
|
||||
NOP ; 1|
|
||||
NOP ; 2|
|
||||
SUBF64 R3, #1.5, R3 ; *| R3 = 1.5 - Ye'''*Ye'''*X*0.5
|
||||
NOP ; 1|
|
||||
NOP ; 2|
|
||||
MPYF64 R0, R1, R3 ; * | R0 = Ye'''*(1.5 - Ye'''*Ye'''*X*0.5)
|
||||
LRETR ; 1,2|
|
||||
.endasmfunc
|
||||
|
||||
;;*****************************************************************************
|
||||
;; This function will run the function above taking the address of the input
|
||||
;; and output as arguments
|
||||
;;
|
||||
;; Register Usage:
|
||||
;; XAR4 : points to the destination argument
|
||||
;; XAR5 : points to the source argument
|
||||
;;*****************************************************************************
|
||||
.if __TI_EABI__
|
||||
.asg run_isqrt, _run_isqrt
|
||||
.endif
|
||||
.global _run_isqrt
|
||||
.sect ".text"
|
||||
_run_isqrt: .asmfunc
|
||||
MOV32 R0L, *+XAR5[0]
|
||||
MOV32 R0H, *+XAR5[2]
|
||||
LCR #_isqrtl
|
||||
MOV32 *+XAR4[0], R0L
|
||||
MOV32 *+XAR4[2], R0H
|
||||
LRETR
|
||||
.endasmfunc
|
||||
;; End of File
|
||||
@@ -0,0 +1,292 @@
|
||||
;;#############################################################################
|
||||
;;! \file source/fpu64/sin_f64.asm
|
||||
;;!
|
||||
;;! \brief Fast sin function for the C28x + FPU64
|
||||
;;! \author Vishal Coelho
|
||||
;;! \date 12/21/2015
|
||||
;;
|
||||
;;+---------------------------------------------------------------------------+
|
||||
;;| DATE | AUTHOR | CHANGE |
|
||||
;;+---------------------------------------------------------------------------+
|
||||
;;| 170213 | V.C. | Using 5 term taylor series expansion for better error |
|
||||
;;| | | tolerance |
|
||||
;;+---------------------------------------------------------------------------+
|
||||
;;
|
||||
;; DESCRIPTION:
|
||||
;;
|
||||
;; This function computes a 64-bit floating point sin given a
|
||||
;; radian input. This function uses the FPU math tables to
|
||||
;; compute the sin.
|
||||
;;
|
||||
;; FUNCTIONS:
|
||||
;;
|
||||
;; float64u_t sin (float64u_t X)
|
||||
;;
|
||||
;; ASSUMPTIONS:
|
||||
;;
|
||||
;; * FPU64sinTable and FPU64cosTable are linked into the project.
|
||||
;; * angle is in radians
|
||||
;;
|
||||
;; ALGORITHM:
|
||||
;;
|
||||
;; The sin value is calculated as follows:
|
||||
;;
|
||||
;; 1) The offset into a 512 entry sin/cos table is calculated:
|
||||
;;
|
||||
;; k = 0x1FF & (int(Radian*512/(2*pi)))
|
||||
;;
|
||||
;;
|
||||
;; 2) The fractional component between table samples is
|
||||
;; calculated:
|
||||
;;
|
||||
;; x = fract(Radian*512/2*pi) * (2*pi)/512
|
||||
;;
|
||||
;; 3) The output sine value is calculated as follows:
|
||||
;;
|
||||
;; sin(Radian) = S(k) + x*( 1.0*C(k) +
|
||||
;; x*(-0.5*S(k) +
|
||||
;; x*(-0.166666666666667*C(k) +
|
||||
;; x*( 0.041666666666667*S(k) +
|
||||
;; x*( 0.008333333333333*C(k))))));
|
||||
;;
|
||||
;; where S(k) = Sin table value at offset "k"
|
||||
;; C(k) = Cos table value at offset "k"
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
|
||||
;; the includes
|
||||
.cdecls C, LIST, "fastrts.h"
|
||||
|
||||
;; external references
|
||||
.if __TI_EABI__
|
||||
.asg FPU64sinTable, _FPU64sinTable
|
||||
.asg FPU64cosTable, _FPU64cosTable
|
||||
.asg FPU64sincos_TABLE_SIZE_O_TWOPI, _FPU64sincos_TABLE_SIZE_O_TWOPI
|
||||
.asg FPU64sincos_TWOPI_O_TABLE_SIZE, _FPU64sincos_TWOPI_O_TABLE_SIZE
|
||||
.asg FPU64sincos_Coef1, _FPU64sincos_Coef1
|
||||
.asg FPU64sincos_Coef2, _FPU64sincos_Coef2
|
||||
.asg FPU64sincos_Coef3, _FPU64sincos_Coef3
|
||||
.asg FPU64sincos_Coef4, _FPU64sincos_Coef4
|
||||
.asg sin, _sinl
|
||||
.endif
|
||||
|
||||
.ref _FPU64sinTable
|
||||
.ref _FPU64cosTable
|
||||
.ref _FPU64sincos_TABLE_SIZE_O_TWOPI
|
||||
.ref _FPU64sincos_TWOPI_O_TABLE_SIZE
|
||||
.ref _FPU64sincos_Coef1
|
||||
.ref _FPU64sincos_Coef2
|
||||
.ref _FPU64sincos_Coef3
|
||||
.ref _FPU64sincos_Coef4
|
||||
;;*****************************************************************************
|
||||
;; Register Usage:
|
||||
;; AR0 : index into the sin/cos tables
|
||||
;; XAR4 : points to the head of the cosine table
|
||||
;; XAR5 : points to the head of the cosine table + 2
|
||||
;; XAR6 : points to the head of the sine table
|
||||
;; XAR7 : points to the head of the sine table + 2
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.global _sinl
|
||||
.sect ".text"
|
||||
_sinl: .asmfunc ; R0 = Radian (on entry)
|
||||
.asg XAR4, P_COS_L
|
||||
.asg XAR5, P_COS_H
|
||||
.asg XAR6, P_SIN_L
|
||||
.asg XAR7, P_SIN_H
|
||||
|
||||
.if CONVERT_F32_TO_F64 == 1
|
||||
F32TOF64 R0, R0H ; convert argument to double precision
|
||||
.endif
|
||||
MOVW DP, #_FPU64sincos_TABLE_SIZE_O_TWOPI
|
||||
; R1 = 512/(2*pi) = 512/6.283185307179586
|
||||
; = 81.487330863050417
|
||||
; = 0x40545f306dc9c883
|
||||
MOV32 R1L, @_FPU64sincos_TABLE_SIZE_O_TWOPI
|
||||
MOV32 R1H, @_FPU64sincos_TABLE_SIZE_O_TWOPI + 2
|
||||
|
||||
MPYF64 R0, R0, R1 ; *| R0 = angle * 512/(2*pi)
|
||||
|| MOV32 R3L, @_FPU64sincos_Coef4
|
||||
; | R3 = 8.3333333333333e-3
|
||||
; | = 0x3f81111111111111
|
||||
MOV32 R2L, @_FPU64sincos_TWOPI_O_TABLE_SIZE
|
||||
; 1| R2 = (2*pi)/512
|
||||
; | = 0.012271846303085
|
||||
; 2| = 0x3f8921fb54442d18
|
||||
MOV32 R2H, @_FPU64sincos_TWOPI_O_TABLE_SIZE + 2
|
||||
F64TOI64 R1, R0 ; *| R1 = int(angle * 512/(2*pi))
|
||||
MOVL P_COS_L, #_FPU64cosTable
|
||||
; 1|
|
||||
MOVL P_COS_H, #_FPU64cosTable+2
|
||||
MOVL P_SIN_L, #_FPU64sinTable
|
||||
MOVL P_SIN_H, #_FPU64sinTable+2
|
||||
MOV32 ACC, R1L ; ACC = int(angle *512/(2*pi))
|
||||
AND @AL, #0x1FF
|
||||
LSL AL, #2
|
||||
MOVZ AR0,@AL ; AR0 = Index into "sin/cos" table = k
|
||||
FRACF64 R0, R0 ; *| R0 = fract(angle*512/(2*pi))
|
||||
; 1|
|
||||
MOV32 R3H, @_FPU64sincos_Coef4 + 2
|
||||
|
||||
; R0 = x = frac(angle*512/(2*pi)) * (2*pi)/512
|
||||
MPYF64 R0, R0, R2 ; *|
|
||||
|| MOV32 R1L, *+P_COS_L[AR0] ; | R1 = C(k)
|
||||
MOV32 R1H, *+P_COS_H[AR0] ; 1|
|
||||
MPYF64 R1, R1, R3 ; 2|*| R1 = 8.3333333333333e-3*C(k)
|
||||
|| MOV32 R2L, @_FPU64sincos_Coef3
|
||||
; | | R2 = 0.041666666666667
|
||||
; |1| = 0x3fa5555555555555
|
||||
MOV32 R2H, @_FPU64sincos_Coef3 + 2
|
||||
MOV32 R3L, *+P_SIN_L[AR0] ; |2| R3 = S(k)
|
||||
MPYF64 R1, R0, R1 ; *| | R1 = x*(8.3333333333333e-3*C(k))
|
||||
|| MOV32 R3H, *+P_SIN_H[AR0] ; | |
|
||||
MPYF64 R2, R2, R3 ; 1|*| R2 = 0.041666666666667*S(k)
|
||||
|| MOV32 R3L, @_FPU64sincos_Coef2
|
||||
; | | R3 = 0.166666666666667
|
||||
; 2|1| = 0x3fc5555555555555
|
||||
MOV32 R3H, @_FPU64sincos_Coef2 + 2
|
||||
NOP ; |2|
|
||||
; R1 = 0.041666666666667*S(k) + x*(8.3333333333333e-3*C(k))
|
||||
ADDF64 R1, R2, R1 ; *| |
|
||||
|| MOV32 R2L, *+P_COS_L[AR0] ; | | R2 = C(k)
|
||||
MOV32 R2H, *+P_COS_H[AR0] ; 1| |
|
||||
MPYF64 R2, R3, R2 ; 2|*| R2 = 0.166666666666667*C(k)
|
||||
|| MOV32 R3L, *+P_SIN_L[AR0] ; | | R3 = S(k)
|
||||
; R1 = x*(0.041666666666667*S(k) + x*(8.3333333333333e-3*C(k)))
|
||||
MPYF64 R1, R0, R1 ; *|1|
|
||||
|| MOV32 R3H, *+P_SIN_H[AR0] ; | |
|
||||
NOP ; 1|2|
|
||||
NOP ; 2| |
|
||||
; R1 = -0.166666666666667*C(k) + x*(0.041666666666667*S(k)
|
||||
; + x*(8.3333333333333e-3*C(k)))
|
||||
SUBF64 R1, R1, R2 ; *| |
|
||||
|| MOV32 R2L, @_FPU64sincos_Coef1
|
||||
; | | R2 = 0.5
|
||||
; 1| | = 0x3fe0000000000000
|
||||
MOV32 R2H, @_FPU64sincos_Coef1 + 2
|
||||
MPYF64 R2, R2, R3 ; 2|*| R2 = 0.5*S(k)
|
||||
|| MOV32 R3L, *+P_COS_L[AR0] ; | | R3 = C(k)
|
||||
; R1 = x*(-0.166666666666667*C(k) + x*(0.041666666666667*S(k)
|
||||
; + x*(8.3333333333333e-3*C(k))))
|
||||
MPYF64 R1, R0, R1 ; *|1|
|
||||
|| MOV32 R3H, *+P_COS_H[AR0] ; | |
|
||||
NOP ; 1|2|
|
||||
NOP ; 2| |
|
||||
; R1 = -0.5*S(k) + x*(-0.166666666666667*C(k)
|
||||
; + x*(0.041666666666667*S(k)
|
||||
; + x*(8.3333333333333e-3*C(k))))
|
||||
SUBF64 R1, R1, R2 ; *| |
|
||||
|| MOV32 R2L, *+P_SIN_L[AR0] ; | | R2 = S(k)
|
||||
MOV32 R2H, *+P_SIN_H[AR0] ; 1| |
|
||||
NOP ; 2| |
|
||||
; R1 = x*(-0.5*S(k) + x*(-0.166666666666667*C(k)
|
||||
; + x*(0.041666666666667*S(k)
|
||||
; + x*(8.3333333333333e-3*C(k)))))
|
||||
MPYF64 R1, R0, R1 ; *| |
|
||||
NOP ; 1| |
|
||||
NOP ; 2| |
|
||||
; R1 = C(k) + x*(-0.5*S(k)
|
||||
; + x*(-0.166666666666667*C(k)
|
||||
; + x*(0.041666666666667*S(k)
|
||||
; + x*(8.3333333333333e-3*C(k)))))
|
||||
ADDF64 R1, R3, R1 ; *| |
|
||||
NOP ; 1| |
|
||||
NOP ; 2| |
|
||||
; R0 = x*(C(k) + x*(-0.5*S(k)
|
||||
; + x*(-0.166666666666667*C(k)
|
||||
; + x*(0.041666666666667*S(k)
|
||||
; + x*(8.3333333333333e-3*C(k))))))
|
||||
MPYF64 R0, R0, R1 ; *| |
|
||||
NOP ; 1| |
|
||||
NOP ; 2| |
|
||||
; R0 = S(k) + x*(C(k)
|
||||
; + x*(-0.5*S(k)
|
||||
; + x*(-0.166666666666667*C(k)
|
||||
; + x*(0.041666666666667*S(k)
|
||||
; + x*(8.3333333333333e-3*C(k))))))
|
||||
ADDF64 R0, R2, R0 ; *| |
|
||||
NOP ; 1| |
|
||||
NOP ; 2| |
|
||||
LRETR
|
||||
.unasg P_COS_L
|
||||
.unasg P_COS_H
|
||||
.unasg P_SIN_L
|
||||
.unasg P_SIN_H
|
||||
.endasmfunc
|
||||
|
||||
;;*****************************************************************************
|
||||
;; This function will run the function above taking the address of the input
|
||||
;; and output as arguments
|
||||
;;
|
||||
;; Register Usage:
|
||||
;; XAR4 : points to the destination argument
|
||||
;; XAR5 : points to the source argument
|
||||
;;
|
||||
;; Stack Usage:
|
||||
;;
|
||||
;; |_______|<- Stack Pointer (SP)
|
||||
;; |_______|<- XAR4 (SP-2)
|
||||
;;
|
||||
;;*****************************************************************************
|
||||
.if __TI_EABI__
|
||||
.asg run_sin, _run_sin
|
||||
.endif
|
||||
.global _run_sin
|
||||
.sect ".text"
|
||||
_run_sin: .asmfunc
|
||||
PUSH XAR4
|
||||
MOV32 R0L, *+XAR5[0]
|
||||
MOV32 R0H, *+XAR5[2]
|
||||
LCR #_sinl
|
||||
POP XAR4
|
||||
MOV32 *+XAR4[0], R0L
|
||||
MOV32 *+XAR4[2], R0H
|
||||
LRETR
|
||||
.endasmfunc
|
||||
;; End of File
|
||||
@@ -0,0 +1,350 @@
|
||||
;;#############################################################################
|
||||
;;! \file source/fpu64/sincos_f64.asm
|
||||
;;!
|
||||
;;! \brief Fast sincos function for the C28x + FPU64
|
||||
;;! \author Vishal Coelho
|
||||
;;! \date 02/29/2016
|
||||
;;
|
||||
;;+---------------------------------------------------------------------------+
|
||||
;;| DATE | AUTHOR | CHANGE |
|
||||
;;+---------------------------------------------------------------------------+
|
||||
;;| 170213 | V.C. | Using 5 term taylor series expansion for better error |
|
||||
;;| | | tolerance |
|
||||
;;+---------------------------------------------------------------------------+
|
||||
;;
|
||||
;; DESCRIPTION:
|
||||
;;
|
||||
;; This function computes a 64-bit floating point sin and cos given a
|
||||
;; radian input. This function uses the FPU math tables to
|
||||
;; compute the values.
|
||||
;;
|
||||
;; FUNCTIONS:
|
||||
;;
|
||||
;; void sincos(float64u_t radian, float64u_t* PtrSin, float64u_t* PtrCos)
|
||||
;;
|
||||
;; ASSUMPTIONS:
|
||||
;;
|
||||
;; * FPU64sinTable and FPU64cosTable are linked into the project.
|
||||
;; * angle is in radians
|
||||
;;
|
||||
;; ALGORITHM:
|
||||
;;
|
||||
;; The sin and cos values are calculated as follows:
|
||||
;;
|
||||
;; 1) The offset into a 512 entry sin/cos table is calculated:
|
||||
;;
|
||||
;; k = 0x1FF & (int(angle*512/(2*pi)))
|
||||
;;
|
||||
;;
|
||||
;; 2) The fractional component between table samples is
|
||||
;; calculated:
|
||||
;;
|
||||
;; x = fract(angle*512/2*pi) * (2*pi)/512
|
||||
;;
|
||||
;; 3) The output sine value is calculated as follows:
|
||||
;;
|
||||
;; sin(Radian) = S(k) + x*( 1.0*C(k) +
|
||||
;; x*(-0.5*S(k) +
|
||||
;; x*(-0.166666666666667*C(k) +
|
||||
;; x*( 0.041666666666667*S(k) +
|
||||
;; x*( 0.008333333333333*C(k))))));
|
||||
;; cos(Radian) = C(k) + x*(-1.0*S(k) +
|
||||
;; x*(-0.5*C(k) +
|
||||
;; x*( 0.166666666666667*S(k) +
|
||||
;; x*( 0.041666666666667*C(k) +
|
||||
;; x*(-0.008333333333333*S(k))))));
|
||||
;;
|
||||
;; where S(k) = Sin table value at offset "k"
|
||||
;; C(k) = Cos table value at offset "k"
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
|
||||
;; the includes
|
||||
.cdecls C, LIST, "fastrts.h"
|
||||
|
||||
;; external references
|
||||
.if __TI_EABI__
|
||||
.asg FPU64sinTable, _FPU64sinTable
|
||||
.asg FPU64cosTable, _FPU64cosTable
|
||||
.asg FPU64sincos_TABLE_SIZE_O_TWOPI, _FPU64sincos_TABLE_SIZE_O_TWOPI
|
||||
.asg FPU64sincos_TWOPI_O_TABLE_SIZE, _FPU64sincos_TWOPI_O_TABLE_SIZE
|
||||
.asg FPU64sincos_Coef1, _FPU64sincos_Coef1
|
||||
.asg FPU64sincos_Coef2, _FPU64sincos_Coef2
|
||||
.asg FPU64sincos_Coef3, _FPU64sincos_Coef3
|
||||
.asg FPU64sincos_Coef4, _FPU64sincos_Coef4
|
||||
.asg sincos, _sincosl
|
||||
.endif
|
||||
.ref _FPU64sinTable
|
||||
.ref _FPU64cosTable
|
||||
.ref _FPU64sincos_TABLE_SIZE_O_TWOPI
|
||||
.ref _FPU64sincos_TWOPI_O_TABLE_SIZE
|
||||
.ref _FPU64sincos_Coef1
|
||||
.ref _FPU64sincos_Coef2
|
||||
.ref _FPU64sincos_Coef3
|
||||
.ref _FPU64sincos_Coef4
|
||||
;;*****************************************************************************
|
||||
;; void sincos(long double angle, long double *sinptr, long double *cosptr)
|
||||
;; Register Usage:
|
||||
;; AR0 : index into the sin/cos tables
|
||||
;; XAR1 : points to the head of the cosine table
|
||||
;; XAR2 : points to the head of the cosine table + 2
|
||||
;; XAR4 : points to the sine of the angle
|
||||
;; XAR5 : points to the cosine of the angle
|
||||
;; XAR6 : points to the head of the sine table
|
||||
;; XAR7 : points to the head of the sine table + 2
|
||||
;;
|
||||
;; Stack Usage:
|
||||
;;
|
||||
;; |_______|<- Stack Pointer (SP)
|
||||
;; |_______|<- R4H (SP-2)
|
||||
;; |_______|<- XAR2 (SP-4)
|
||||
;; |_______|<- XAR1 (SP-6)
|
||||
;; |_______|<- rpc calling function (SP-8)
|
||||
;;
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.global _sincosl
|
||||
.sect ".text"
|
||||
_sincosl: .asmfunc ; R0 = angle (on entry)
|
||||
.asg XAR1, P_COS_L
|
||||
.asg XAR2, P_COS_H
|
||||
.asg XAR6, P_SIN_L
|
||||
.asg XAR7, P_SIN_H
|
||||
;;-----------------------------------------------------------------------------
|
||||
;; Context Save
|
||||
;;-----------------------------------------------------------------------------
|
||||
PUSH XAR1
|
||||
PUSH XAR2
|
||||
;;-----------------------------------------------------------------------------
|
||||
;; sincos
|
||||
;;-----------------------------------------------------------------------------
|
||||
.if CONVERT_F32_TO_F64 == 1
|
||||
F32TOF64 R0, R0H ; convert argument to double precision
|
||||
.endif
|
||||
MOVW DP, #_FPU64sincos_TABLE_SIZE_O_TWOPI
|
||||
; R1 = 512/(2*pi) = 512/6.283185307179586
|
||||
; = 81.487330863050417
|
||||
; = 0x40545f306dc9c883
|
||||
MOV32 R1L, @_FPU64sincos_TABLE_SIZE_O_TWOPI
|
||||
MOV32 R1H, @_FPU64sincos_TABLE_SIZE_O_TWOPI + 2
|
||||
|
||||
MPYF64 R0, R0, R1 ; *| R0 = angle * 512/(2*pi)
|
||||
|| MOV32 *SP++, R4H ; | Save R4H to the stack
|
||||
MOV32 R2L, @_FPU64sincos_TWOPI_O_TABLE_SIZE
|
||||
; 1| R2 = (2*pi)/512
|
||||
; | = 0.012271846303085
|
||||
; 2| = 0x3f8921fb54442d18
|
||||
MOV32 R2H, @_FPU64sincos_TWOPI_O_TABLE_SIZE + 2
|
||||
F64TOI64 R1, R0 ; *| R1 = int(angle * 512/(2*pi))
|
||||
MOV32 *SP++, R5H ; 1| Save R5H to the stack
|
||||
MOVL P_COS_L, #_FPU64cosTable
|
||||
MOVL P_COS_H, #_FPU64cosTable+2
|
||||
MOVL P_SIN_L, #_FPU64sinTable
|
||||
MOVL P_SIN_H, #_FPU64sinTable+2
|
||||
MOV32 ACC, R1L ; ACC = int(angle *512/(2*pi))
|
||||
AND @AL, #0x1FF
|
||||
LSL AL, #2
|
||||
MOVZ AR0,@AL ; AR0 = Index into "sin/cos" table = k
|
||||
FRACF64 R0, R0 ; *| R0 = fract(angle*512/(2*pi))
|
||||
; 1| R1 = 8.3333333333333e-3
|
||||
; = 0x3f81111111111111
|
||||
MOV32 R1L, @_FPU64sincos_Coef4
|
||||
MOV32 R1H, @_FPU64sincos_Coef4 + 2
|
||||
|
||||
; R0 = x = frac(angle*512/(2*pi)) * (2*pi)/512
|
||||
MPYF64 R0, R0, R2 ; *|
|
||||
|| MOV32 R3L, *+P_COS_L[AR0] ; | R3 = C(k)
|
||||
MOV32 R3H, *+P_COS_H[AR0] ; 1|
|
||||
MPYF64 R2, R1, R3 ; 2|*| R2 = 8.3333333333333e-3*C(k)
|
||||
|| MOV32 R4L, *+P_SIN_L[AR0] ; | | R4 = S(k)
|
||||
MOV32 R4H, *+P_SIN_H[AR0] ; |1|
|
||||
MPYF64 R1, R1, R4 ; *|2| R1 = 8.3333333333333e-3*S(k)
|
||||
|| MOV32 R5L, @_FPU64sincos_Coef3
|
||||
; | | R5 = 4.1666666666666e-2
|
||||
; | | = 0x3fa5555555555555
|
||||
MPYF64 R2, R0, R2 ; 1|*| R2 = x*8.3333333333333e-3*C(k)
|
||||
|| MOV32 R5H, @_FPU64sincos_Coef3 + 2
|
||||
MPYF64 R4, R5, R4 ; 2|1|*| R4 = 0.041666666666667*S(k)
|
||||
MPYF64 R3, R5, R3 ; *|2|1| R3 = 4.1666666666666e-2*C(k)
|
||||
|| MOV32 R5L, @_FPU64sincos_Coef2
|
||||
; | | R5 = 0.166666666666667
|
||||
; | | = 0x3fc5555555555555
|
||||
MPYF64 R1, R0, R1 ; 1|*|2| R1 = x*8.3333333333333e-3*S(k)
|
||||
|| MOV32 R5H, @_FPU64sincos_Coef2 + 2
|
||||
; R2 = 0.041666666666667*S(k) + x*8.3333333333333e-3*C(k)
|
||||
ADDF64 R2, R4, R2 ; 2|1|*|
|
||||
|| MOV32 R4L, *+P_COS_L[AR0] ; | | | R4 = C(k)
|
||||
MOV32 R4H, *+P_COS_H[AR0] ; |2|1|
|
||||
; R1 = 4.1666666666666e-2*C(k)- x*8.3333333333333e-3*S(k)
|
||||
SUBF64 R1, R3, R1 ; *| |2|
|
||||
MPYF64 R3, R5, R4 ; 1|*| | R3 = 0.166666666666667*C(k)
|
||||
|| MOV32 R4L, *+P_SIN_L[AR0] ; | | | R4 = S(k)
|
||||
; R2 = x*(0.041666666666667*S(k) + x*8.3333333333333e-3*C(k))
|
||||
MPYF64 R2, R0, R2 ; 2|1|*|
|
||||
|| MOV32 R4H, *+P_SIN_H[AR0] ; | | |
|
||||
MPYF64 R4, R4, R5 ; *|2|1| R4 = 0.166666666666667*S(k)
|
||||
|| MOV32 R5L, @_FPU64sincos_Coef1
|
||||
; | | | R5 = 0.5
|
||||
; | | | = 0x3fe0000000000000
|
||||
; R1 = x*(4.1666666666666e-2*C(k)- x*8.3333333333333e-3*S(k))
|
||||
MPYF64 R1, R0, R1 ; 1|*|2|
|
||||
|| MOV32 R5H, @_FPU64sincos_Coef1 + 2
|
||||
; R2 = -0.166666666666667*C(k) + x*(0.041666666666667*S(k)
|
||||
; + x*8.3333333333333e-3*C(k))
|
||||
SUBF64 R2, R2, R3 ; 2|1|*|
|
||||
|| MOV32 R3L, *+P_SIN_L[AR0] ; | | | R3 = S(k)
|
||||
MOV32 R3H, *+P_SIN_H[AR0] ; |2|1|
|
||||
; R1 = 0.166666666666667*S(k) + x*(4.1666666666666e-2*C(k)
|
||||
; - x*8.3333333333333e-3*S(k))
|
||||
ADDF64 R1, R4, R1 ; *| |2|
|
||||
|| MPYF64 R3, R5, R3 ; | | | R3 = 0.5*S(k)
|
||||
; R2 = x*(-0.166666666666667*C(k) + x*(0.041666666666667*S(k)
|
||||
; + x*8.3333333333333e-3*C(k)))
|
||||
MPYF64 R2, R0, R2 ; 1|*| |
|
||||
|| MOV32 R4L, *+P_COS_L[AR0] ; | | | R4 = C(k)
|
||||
MOV32 R4H, *+P_COS_H[AR0] ; 2|1| |
|
||||
; R1 = x*(0.166666666666667*S(k) + x*(4.1666666666666e-2*C(k)
|
||||
; - x*8.3333333333333e-3*S(k)))
|
||||
MPYF64 R1, R0, R1 ; *|2| |
|
||||
; R2 = -0.5*S(k) + x*(-0.166666666666667*C(k)
|
||||
; + x*(0.041666666666667*S(k)
|
||||
; + x*8.3333333333333e-3*C(k)))
|
||||
SUBF64 R2, R2, R3 ; 1|*| |
|
||||
|| MPYF64 R4, R4, R5 ; | | | R4 = 0.5*C(k)
|
||||
MOV32 R3L, *+P_COS_L[AR0] ; 2|1| | R3 = C(k)
|
||||
MOV32 R3H, *+P_COS_H[AR0] ; |2| |
|
||||
; R1 = -0.5*C(k) + x*(0.166666666666667*S(k)
|
||||
; + x*(4.1666666666666e-2*C(k)
|
||||
; - x*8.3333333333333e-3*S(k)))
|
||||
; R2 = x*(-0.5*S(k) + x*(-0.166666666666667*C(k)
|
||||
; + x*(0.041666666666667*S(k)
|
||||
; + x*8.3333333333333e-3*C(k))))
|
||||
SUBF64 R1, R1, R4 ; *| | |
|
||||
|| MPYF64 R2, R0, R2 ; | | |
|
||||
MOV32 R4L, *+P_SIN_L[AR0] ; 1| | | R4 = S(k)
|
||||
MOV32 R4H, *+P_SIN_H[AR0] ; 2| | |
|
||||
; R1 = x*(-0.5*C(k) + x*(0.166666666666667*S(k)
|
||||
; + x*(4.1666666666666e-2*C(k)
|
||||
; - x*8.3333333333333e-3*S(k))))
|
||||
; R2 = C(k) + x*(-0.5*S(k) + x*(-0.166666666666667*C(k)
|
||||
; + x*(0.041666666666667*S(k)
|
||||
; + x*8.3333333333333e-3*C(k))))
|
||||
MPYF64 R1, R0, R1 ; *| | |
|
||||
|| ADDF64 R2, R3, R2 ; | | |
|
||||
MOV32 R5H, *--SP ; 1| | | restore R5H
|
||||
NOP ; 2| | |
|
||||
; R1 = -S(k) + x*(-0.5*C(k) + x*(0.166666666666667*S(k)
|
||||
; + x*(4.1666666666666e-2*C(k)
|
||||
; - x*8.3333333333333e-3*S(k))))
|
||||
; R2 = x*(C(k) + x*(-0.5*S(k) + x*(-0.166666666666667*C(k)
|
||||
; + x*(0.041666666666667*S(k)
|
||||
; + x*8.3333333333333e-3*C(k)))))
|
||||
SUBF64 R1, R1, R4 ; *| | |
|
||||
|| MPYF64 R2, R0, R2 ; | | |
|
||||
NOP ; 1| | |
|
||||
NOP ; 2| | |
|
||||
; R2 = S(k) + x*(1.0*C(k)
|
||||
; + x*(-0.5*S(k)
|
||||
; + x*(-0.166666666666667*C(k)
|
||||
; + x*(0.041666666666667*S(k)
|
||||
; + x*8.3333333333333e-3*C(k)))))
|
||||
; R1 = x*(-S(k) + x*(-0.5*C(k) + x*(0.166666666666667*S(k)
|
||||
; + x*(4.1666666666666e-2*C(k)
|
||||
; - x*8.3333333333333e-3*S(k)))))
|
||||
ADDF64 R2, R4, R2 ; *| | |
|
||||
|| MPYF64 R1, R0, R1 ; | | |
|
||||
MOV32 *--SP, R4H ; 1| | | restore R4H
|
||||
POP XAR2 ; 2| | | restore XAR2
|
||||
; R1 = C(k) + x*(-1.0*S(k)
|
||||
; + x*(-0.5*C(k)
|
||||
; + x*(0.166666666666667*S(k)
|
||||
; + x*(4.1666666666666e-2*C(k)
|
||||
; - x*8.3333333333333e-3*S(k)))))
|
||||
ADDF64 R1, R3, R1 ; *| | |
|
||||
|| MOV32 *+XAR4[0], R2L ; | | | Save sin(angle) to memory
|
||||
MOV32 *+XAR4[2], R2H ; 1| | |
|
||||
POP XAR1 ; 2| | | restore XAR1
|
||||
MOV32 *+XAR5[0], R1L ; | | | Save cos(angle) to memory
|
||||
MOV32 *+XAR5[2], R1H ; | | |
|
||||
LRETR
|
||||
.unasg P_COS_L
|
||||
.unasg P_COS_H
|
||||
.unasg P_SIN_L
|
||||
.unasg P_SIN_H
|
||||
.endasmfunc
|
||||
|
||||
;;*****************************************************************************
|
||||
;; This function will run the function above taking the address of the input
|
||||
;; and output as arguments
|
||||
;;
|
||||
;; Register Usage:
|
||||
;; XAR4 : points to the input angle (in radians)
|
||||
;; XAR5 : points to the sine of the angle
|
||||
;;
|
||||
;; Stack Usage:
|
||||
;;
|
||||
;; |_______|<- Stack Pointer (SP)
|
||||
;; |_______|<- rpc calling function (SP-2)
|
||||
;; |_______|<- pointer to the cos(angle) (SP-4)
|
||||
;;
|
||||
;;*****************************************************************************
|
||||
.if __TI_EABI__
|
||||
.asg run_sincos, _run_sincos
|
||||
.endif
|
||||
.global _run_sincos
|
||||
.sect ".text"
|
||||
_run_sincos: .asmfunc
|
||||
MOV32 R0L, *+XAR4[0]
|
||||
MOV32 R0H, *+XAR4[2]
|
||||
MOVL XAR4, XAR5
|
||||
MOVL XAR5, *-SP[4]
|
||||
LCR #_sincosl
|
||||
LRETR
|
||||
.endasmfunc
|
||||
;; End of File
|
||||
@@ -0,0 +1,758 @@
|
||||
;;#############################################################################
|
||||
;;! \file sincostable_f64.asm
|
||||
;;! \brief Sine/Cosine Lookup Table (512)
|
||||
;;! \author Vishal Coelho
|
||||
;;! \date 06-Jan-2016
|
||||
;;!
|
||||
;; Revision History:
|
||||
;;+----------+---------------+------------------------------------------------+
|
||||
;;| DATE | AUTHOR | CHANGE |
|
||||
;;+----------+---------------+------------------------------------------------+
|
||||
;;| 02/13/17 | V.C. | Added N/2pi, 2pi/N and 4 taylor series |
|
||||
;;| | | coefficients to the section FPUmathTables |
|
||||
;;+----------+---------------+------------------------------------------------+
|
||||
;;| 01/16/18 | Ritvik Sadana | Changed symbol names to avoid conflicts with |
|
||||
;;| | | FPU32 symbols. |
|
||||
;;+----------+---------------+------------------------------------------------+
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
.if __TI_EABI__
|
||||
.asg FPU64sinTable, _FPU64sinTable
|
||||
.asg FPU64cosTable, _FPU64cosTable
|
||||
.asg FPU64sinTableEnd, _FPU64sinTableEnd
|
||||
.asg FPU64cosTableEnd, _FPU64cosTableEnd
|
||||
.asg FPU64sincos_TABLE_SIZE_O_TWOPI, _FPU64sincos_TABLE_SIZE_O_TWOPI
|
||||
.asg FPU64sincos_TWOPI_O_TABLE_SIZE, _FPU64sincos_TWOPI_O_TABLE_SIZE
|
||||
.asg FPU64sincos_Coef1, _FPU64sincos_Coef1
|
||||
.asg FPU64sincos_Coef2, _FPU64sincos_Coef2
|
||||
.asg FPU64sincos_Coef3, _FPU64sincos_Coef3
|
||||
.asg FPU64sincos_Coef4, _FPU64sincos_Coef4
|
||||
.endif
|
||||
.def _FPU64sinTable
|
||||
.def _FPU64cosTable
|
||||
.def _FPU64sinTableEnd
|
||||
.def _FPU64cosTableEnd
|
||||
.def _FPU64sincos_TABLE_SIZE_O_TWOPI
|
||||
.def _FPU64sincos_TWOPI_O_TABLE_SIZE
|
||||
.def _FPU64sincos_Coef1
|
||||
.def _FPU64sincos_Coef2
|
||||
.def _FPU64sincos_Coef3
|
||||
.def _FPU64sincos_Coef4
|
||||
|
||||
.sect "FPU64mathTables"
|
||||
|
||||
; The following 24 words must lie on the same page for the
|
||||
; DP addressing to be efficient
|
||||
.page
|
||||
; 512/(2*pi) = 512/6.283185307179586
|
||||
; = 81.487330863050417
|
||||
; = 0x40545f306dc9c883
|
||||
_FPU64sincos_TABLE_SIZE_O_TWOPI .long 0x6DC9C883, 0x40545F30
|
||||
|
||||
; (2*pi)/512 = 0.012271846303085
|
||||
; = 0x3f8921fb54442d18
|
||||
_FPU64sincos_TWOPI_O_TABLE_SIZE .long 0x54442D18, 0x3F8921FB
|
||||
|
||||
; 0.5 = 0x3fe0000000000000
|
||||
_FPU64sincos_Coef1 .long 0x00000000, 0x3FE00000
|
||||
; 0.166666666666667 = 0x3fc5555555555555
|
||||
_FPU64sincos_Coef2 .long 0x55555555, 0x3FC55555
|
||||
; 4.1666666666666e-2 = 0x3fa5555555555555
|
||||
_FPU64sincos_Coef3 .long 0x55555555, 0x3FA55555
|
||||
; 8.3333333333333e-3 = 0x3f81111111111111
|
||||
_FPU64sincos_Coef4 .long 0x11111111, 0x3F811111
|
||||
|
||||
_FPU64sinTable:
|
||||
.xldouble 0.0000000000000 ; sin(2 * pi * 0/ 512)
|
||||
.xldouble 0.0122715382857 ; sin(2 * pi * 1/ 512)
|
||||
.xldouble 0.0245412285229 ; sin(2 * pi * 2/ 512)
|
||||
.xldouble 0.0368072229414 ; sin(2 * pi * 3/ 512)
|
||||
.xldouble 0.0490676743274 ; sin(2 * pi * 4/ 512)
|
||||
.xldouble 0.0613207363022 ; sin(2 * pi * 5/ 512)
|
||||
.xldouble 0.0735645635997 ; sin(2 * pi * 6/ 512)
|
||||
.xldouble 0.0857973123444 ; sin(2 * pi * 7/ 512)
|
||||
.xldouble 0.0980171403296 ; sin(2 * pi * 8/ 512)
|
||||
.xldouble 0.1102222072939 ; sin(2 * pi * 9/ 512)
|
||||
.xldouble 0.1224106751992 ; sin(2 * pi * 10/ 512)
|
||||
.xldouble 0.1345807085071 ; sin(2 * pi * 11/ 512)
|
||||
.xldouble 0.1467304744554 ; sin(2 * pi * 12/ 512)
|
||||
.xldouble 0.1588581433339 ; sin(2 * pi * 13/ 512)
|
||||
.xldouble 0.1709618887603 ; sin(2 * pi * 14/ 512)
|
||||
.xldouble 0.1830398879551 ; sin(2 * pi * 15/ 512)
|
||||
.xldouble 0.1950903220161 ; sin(2 * pi * 16/ 512)
|
||||
.xldouble 0.2071113761922 ; sin(2 * pi * 17/ 512)
|
||||
.xldouble 0.2191012401569 ; sin(2 * pi * 18/ 512)
|
||||
.xldouble 0.2310581082807 ; sin(2 * pi * 19/ 512)
|
||||
.xldouble 0.2429801799033 ; sin(2 * pi * 20/ 512)
|
||||
.xldouble 0.2548656596045 ; sin(2 * pi * 21/ 512)
|
||||
.xldouble 0.2667127574749 ; sin(2 * pi * 22/ 512)
|
||||
.xldouble 0.2785196893851 ; sin(2 * pi * 23/ 512)
|
||||
.xldouble 0.2902846772545 ; sin(2 * pi * 24/ 512)
|
||||
.xldouble 0.3020059493192 ; sin(2 * pi * 25/ 512)
|
||||
.xldouble 0.3136817403989 ; sin(2 * pi * 26/ 512)
|
||||
.xldouble 0.3253102921623 ; sin(2 * pi * 27/ 512)
|
||||
.xldouble 0.3368898533922 ; sin(2 * pi * 28/ 512)
|
||||
.xldouble 0.3484186802494 ; sin(2 * pi * 29/ 512)
|
||||
.xldouble 0.3598950365350 ; sin(2 * pi * 30/ 512)
|
||||
.xldouble 0.3713171939518 ; sin(2 * pi * 31/ 512)
|
||||
.xldouble 0.3826834323651 ; sin(2 * pi * 32/ 512)
|
||||
.xldouble 0.3939920400610 ; sin(2 * pi * 33/ 512)
|
||||
.xldouble 0.4052413140050 ; sin(2 * pi * 34/ 512)
|
||||
.xldouble 0.4164295600976 ; sin(2 * pi * 35/ 512)
|
||||
.xldouble 0.4275550934303 ; sin(2 * pi * 36/ 512)
|
||||
.xldouble 0.4386162385385 ; sin(2 * pi * 37/ 512)
|
||||
.xldouble 0.4496113296546 ; sin(2 * pi * 38/ 512)
|
||||
.xldouble 0.4605387109582 ; sin(2 * pi * 39/ 512)
|
||||
.xldouble 0.4713967368260 ; sin(2 * pi * 40/ 512)
|
||||
.xldouble 0.4821837720791 ; sin(2 * pi * 41/ 512)
|
||||
.xldouble 0.4928981922298 ; sin(2 * pi * 42/ 512)
|
||||
.xldouble 0.5035383837257 ; sin(2 * pi * 43/ 512)
|
||||
.xldouble 0.5141027441932 ; sin(2 * pi * 44/ 512)
|
||||
.xldouble 0.5245896826785 ; sin(2 * pi * 45/ 512)
|
||||
.xldouble 0.5349976198871 ; sin(2 * pi * 46/ 512)
|
||||
.xldouble 0.5453249884220 ; sin(2 * pi * 47/ 512)
|
||||
.xldouble 0.5555702330196 ; sin(2 * pi * 48/ 512)
|
||||
.xldouble 0.5657318107836 ; sin(2 * pi * 49/ 512)
|
||||
.xldouble 0.5758081914178 ; sin(2 * pi * 50/ 512)
|
||||
.xldouble 0.5857978574564 ; sin(2 * pi * 51/ 512)
|
||||
.xldouble 0.5956993044924 ; sin(2 * pi * 52/ 512)
|
||||
.xldouble 0.6055110414043 ; sin(2 * pi * 53/ 512)
|
||||
.xldouble 0.6152315905806 ; sin(2 * pi * 54/ 512)
|
||||
.xldouble 0.6248594881424 ; sin(2 * pi * 55/ 512)
|
||||
.xldouble 0.6343932841636 ; sin(2 * pi * 56/ 512)
|
||||
.xldouble 0.6438315428898 ; sin(2 * pi * 57/ 512)
|
||||
.xldouble 0.6531728429538 ; sin(2 * pi * 58/ 512)
|
||||
.xldouble 0.6624157775902 ; sin(2 * pi * 59/ 512)
|
||||
.xldouble 0.6715589548470 ; sin(2 * pi * 60/ 512)
|
||||
.xldouble 0.6806009977955 ; sin(2 * pi * 61/ 512)
|
||||
.xldouble 0.6895405447371 ; sin(2 * pi * 62/ 512)
|
||||
.xldouble 0.6983762494090 ; sin(2 * pi * 63/ 512)
|
||||
.xldouble 0.7071067811865 ; sin(2 * pi * 64/ 512)
|
||||
.xldouble 0.7157308252838 ; sin(2 * pi * 65/ 512)
|
||||
.xldouble 0.7242470829515 ; sin(2 * pi * 66/ 512)
|
||||
.xldouble 0.7326542716724 ; sin(2 * pi * 67/ 512)
|
||||
.xldouble 0.7409511253550 ; sin(2 * pi * 68/ 512)
|
||||
.xldouble 0.7491363945235 ; sin(2 * pi * 69/ 512)
|
||||
.xldouble 0.7572088465065 ; sin(2 * pi * 70/ 512)
|
||||
.xldouble 0.7651672656225 ; sin(2 * pi * 71/ 512)
|
||||
.xldouble 0.7730104533627 ; sin(2 * pi * 72/ 512)
|
||||
.xldouble 0.7807372285721 ; sin(2 * pi * 73/ 512)
|
||||
.xldouble 0.7883464276266 ; sin(2 * pi * 74/ 512)
|
||||
.xldouble 0.7958369046089 ; sin(2 * pi * 75/ 512)
|
||||
.xldouble 0.8032075314806 ; sin(2 * pi * 76/ 512)
|
||||
.xldouble 0.8104571982526 ; sin(2 * pi * 77/ 512)
|
||||
.xldouble 0.8175848131516 ; sin(2 * pi * 78/ 512)
|
||||
.xldouble 0.8245893027850 ; sin(2 * pi * 79/ 512)
|
||||
.xldouble 0.8314696123025 ; sin(2 * pi * 80/ 512)
|
||||
.xldouble 0.8382247055548 ; sin(2 * pi * 81/ 512)
|
||||
.xldouble 0.8448535652497 ; sin(2 * pi * 82/ 512)
|
||||
.xldouble 0.8513551931053 ; sin(2 * pi * 83/ 512)
|
||||
.xldouble 0.8577286100003 ; sin(2 * pi * 84/ 512)
|
||||
.xldouble 0.8639728561216 ; sin(2 * pi * 85/ 512)
|
||||
.xldouble 0.8700869911087 ; sin(2 * pi * 86/ 512)
|
||||
.xldouble 0.8760700941954 ; sin(2 * pi * 87/ 512)
|
||||
.xldouble 0.8819212643484 ; sin(2 * pi * 88/ 512)
|
||||
.xldouble 0.8876396204029 ; sin(2 * pi * 89/ 512)
|
||||
.xldouble 0.8932243011955 ; sin(2 * pi * 90/ 512)
|
||||
.xldouble 0.8986744656940 ; sin(2 * pi * 91/ 512)
|
||||
.xldouble 0.9039892931234 ; sin(2 * pi * 92/ 512)
|
||||
.xldouble 0.9091679830905 ; sin(2 * pi * 93/ 512)
|
||||
.xldouble 0.9142097557035 ; sin(2 * pi * 94/ 512)
|
||||
.xldouble 0.9191138516901 ; sin(2 * pi * 95/ 512)
|
||||
.xldouble 0.9238795325113 ; sin(2 * pi * 96/ 512)
|
||||
.xldouble 0.9285060804732 ; sin(2 * pi * 97/ 512)
|
||||
.xldouble 0.9329927988347 ; sin(2 * pi * 98/ 512)
|
||||
.xldouble 0.9373390119126 ; sin(2 * pi * 99/ 512)
|
||||
.xldouble 0.9415440651830 ; sin(2 * pi * 100/ 512)
|
||||
.xldouble 0.9456073253805 ; sin(2 * pi * 101/ 512)
|
||||
.xldouble 0.9495281805930 ; sin(2 * pi * 102/ 512)
|
||||
.xldouble 0.9533060403542 ; sin(2 * pi * 103/ 512)
|
||||
.xldouble 0.9569403357322 ; sin(2 * pi * 104/ 512)
|
||||
.xldouble 0.9604305194156 ; sin(2 * pi * 105/ 512)
|
||||
.xldouble 0.9637760657954 ; sin(2 * pi * 106/ 512)
|
||||
.xldouble 0.9669764710449 ; sin(2 * pi * 107/ 512)
|
||||
.xldouble 0.9700312531945 ; sin(2 * pi * 108/ 512)
|
||||
.xldouble 0.9729399522056 ; sin(2 * pi * 109/ 512)
|
||||
.xldouble 0.9757021300385 ; sin(2 * pi * 110/ 512)
|
||||
.xldouble 0.9783173707196 ; sin(2 * pi * 111/ 512)
|
||||
.xldouble 0.9807852804032 ; sin(2 * pi * 112/ 512)
|
||||
.xldouble 0.9831054874312 ; sin(2 * pi * 113/ 512)
|
||||
.xldouble 0.9852776423889 ; sin(2 * pi * 114/ 512)
|
||||
.xldouble 0.9873014181579 ; sin(2 * pi * 115/ 512)
|
||||
.xldouble 0.9891765099648 ; sin(2 * pi * 116/ 512)
|
||||
.xldouble 0.9909026354278 ; sin(2 * pi * 117/ 512)
|
||||
.xldouble 0.9924795345987 ; sin(2 * pi * 118/ 512)
|
||||
.xldouble 0.9939069700024 ; sin(2 * pi * 119/ 512)
|
||||
.xldouble 0.9951847266722 ; sin(2 * pi * 120/ 512)
|
||||
.xldouble 0.9963126121828 ; sin(2 * pi * 121/ 512)
|
||||
.xldouble 0.9972904566787 ; sin(2 * pi * 122/ 512)
|
||||
.xldouble 0.9981181129001 ; sin(2 * pi * 123/ 512)
|
||||
.xldouble 0.9987954562052 ; sin(2 * pi * 124/ 512)
|
||||
.xldouble 0.9993223845883 ; sin(2 * pi * 125/ 512)
|
||||
.xldouble 0.9996988186962 ; sin(2 * pi * 126/ 512)
|
||||
.xldouble 0.9999247018391 ; sin(2 * pi * 127/ 512)
|
||||
_FPU64cosTable:
|
||||
.xldouble 1.0000000000000 ; sin(2 * pi * 128/ 512)
|
||||
.xldouble 0.9999247018391 ; sin(2 * pi * 129/ 512)
|
||||
.xldouble 0.9996988186962 ; sin(2 * pi * 130/ 512)
|
||||
.xldouble 0.9993223845883 ; sin(2 * pi * 131/ 512)
|
||||
.xldouble 0.9987954562052 ; sin(2 * pi * 132/ 512)
|
||||
.xldouble 0.9981181129001 ; sin(2 * pi * 133/ 512)
|
||||
.xldouble 0.9972904566787 ; sin(2 * pi * 134/ 512)
|
||||
.xldouble 0.9963126121828 ; sin(2 * pi * 135/ 512)
|
||||
.xldouble 0.9951847266722 ; sin(2 * pi * 136/ 512)
|
||||
.xldouble 0.9939069700024 ; sin(2 * pi * 137/ 512)
|
||||
.xldouble 0.9924795345987 ; sin(2 * pi * 138/ 512)
|
||||
.xldouble 0.9909026354278 ; sin(2 * pi * 139/ 512)
|
||||
.xldouble 0.9891765099648 ; sin(2 * pi * 140/ 512)
|
||||
.xldouble 0.9873014181579 ; sin(2 * pi * 141/ 512)
|
||||
.xldouble 0.9852776423889 ; sin(2 * pi * 142/ 512)
|
||||
.xldouble 0.9831054874312 ; sin(2 * pi * 143/ 512)
|
||||
.xldouble 0.9807852804032 ; sin(2 * pi * 144/ 512)
|
||||
.xldouble 0.9783173707196 ; sin(2 * pi * 145/ 512)
|
||||
.xldouble 0.9757021300385 ; sin(2 * pi * 146/ 512)
|
||||
.xldouble 0.9729399522056 ; sin(2 * pi * 147/ 512)
|
||||
.xldouble 0.9700312531945 ; sin(2 * pi * 148/ 512)
|
||||
.xldouble 0.9669764710449 ; sin(2 * pi * 149/ 512)
|
||||
.xldouble 0.9637760657954 ; sin(2 * pi * 150/ 512)
|
||||
.xldouble 0.9604305194156 ; sin(2 * pi * 151/ 512)
|
||||
.xldouble 0.9569403357322 ; sin(2 * pi * 152/ 512)
|
||||
.xldouble 0.9533060403542 ; sin(2 * pi * 153/ 512)
|
||||
.xldouble 0.9495281805930 ; sin(2 * pi * 154/ 512)
|
||||
.xldouble 0.9456073253805 ; sin(2 * pi * 155/ 512)
|
||||
.xldouble 0.9415440651830 ; sin(2 * pi * 156/ 512)
|
||||
.xldouble 0.9373390119126 ; sin(2 * pi * 157/ 512)
|
||||
.xldouble 0.9329927988347 ; sin(2 * pi * 158/ 512)
|
||||
.xldouble 0.9285060804732 ; sin(2 * pi * 159/ 512)
|
||||
.xldouble 0.9238795325113 ; sin(2 * pi * 160/ 512)
|
||||
.xldouble 0.9191138516901 ; sin(2 * pi * 161/ 512)
|
||||
.xldouble 0.9142097557035 ; sin(2 * pi * 162/ 512)
|
||||
.xldouble 0.9091679830905 ; sin(2 * pi * 163/ 512)
|
||||
.xldouble 0.9039892931234 ; sin(2 * pi * 164/ 512)
|
||||
.xldouble 0.8986744656940 ; sin(2 * pi * 165/ 512)
|
||||
.xldouble 0.8932243011955 ; sin(2 * pi * 166/ 512)
|
||||
.xldouble 0.8876396204029 ; sin(2 * pi * 167/ 512)
|
||||
.xldouble 0.8819212643484 ; sin(2 * pi * 168/ 512)
|
||||
.xldouble 0.8760700941954 ; sin(2 * pi * 169/ 512)
|
||||
.xldouble 0.8700869911087 ; sin(2 * pi * 170/ 512)
|
||||
.xldouble 0.8639728561216 ; sin(2 * pi * 171/ 512)
|
||||
.xldouble 0.8577286100003 ; sin(2 * pi * 172/ 512)
|
||||
.xldouble 0.8513551931053 ; sin(2 * pi * 173/ 512)
|
||||
.xldouble 0.8448535652497 ; sin(2 * pi * 174/ 512)
|
||||
.xldouble 0.8382247055548 ; sin(2 * pi * 175/ 512)
|
||||
.xldouble 0.8314696123025 ; sin(2 * pi * 176/ 512)
|
||||
.xldouble 0.8245893027850 ; sin(2 * pi * 177/ 512)
|
||||
.xldouble 0.8175848131516 ; sin(2 * pi * 178/ 512)
|
||||
.xldouble 0.8104571982526 ; sin(2 * pi * 179/ 512)
|
||||
.xldouble 0.8032075314806 ; sin(2 * pi * 180/ 512)
|
||||
.xldouble 0.7958369046089 ; sin(2 * pi * 181/ 512)
|
||||
.xldouble 0.7883464276266 ; sin(2 * pi * 182/ 512)
|
||||
.xldouble 0.7807372285721 ; sin(2 * pi * 183/ 512)
|
||||
.xldouble 0.7730104533627 ; sin(2 * pi * 184/ 512)
|
||||
.xldouble 0.7651672656225 ; sin(2 * pi * 185/ 512)
|
||||
.xldouble 0.7572088465065 ; sin(2 * pi * 186/ 512)
|
||||
.xldouble 0.7491363945235 ; sin(2 * pi * 187/ 512)
|
||||
.xldouble 0.7409511253550 ; sin(2 * pi * 188/ 512)
|
||||
.xldouble 0.7326542716724 ; sin(2 * pi * 189/ 512)
|
||||
.xldouble 0.7242470829515 ; sin(2 * pi * 190/ 512)
|
||||
.xldouble 0.7157308252838 ; sin(2 * pi * 191/ 512)
|
||||
.xldouble 0.7071067811865 ; sin(2 * pi * 192/ 512)
|
||||
.xldouble 0.6983762494090 ; sin(2 * pi * 193/ 512)
|
||||
.xldouble 0.6895405447371 ; sin(2 * pi * 194/ 512)
|
||||
.xldouble 0.6806009977955 ; sin(2 * pi * 195/ 512)
|
||||
.xldouble 0.6715589548470 ; sin(2 * pi * 196/ 512)
|
||||
.xldouble 0.6624157775902 ; sin(2 * pi * 197/ 512)
|
||||
.xldouble 0.6531728429538 ; sin(2 * pi * 198/ 512)
|
||||
.xldouble 0.6438315428898 ; sin(2 * pi * 199/ 512)
|
||||
.xldouble 0.6343932841636 ; sin(2 * pi * 200/ 512)
|
||||
.xldouble 0.6248594881424 ; sin(2 * pi * 201/ 512)
|
||||
.xldouble 0.6152315905806 ; sin(2 * pi * 202/ 512)
|
||||
.xldouble 0.6055110414043 ; sin(2 * pi * 203/ 512)
|
||||
.xldouble 0.5956993044924 ; sin(2 * pi * 204/ 512)
|
||||
.xldouble 0.5857978574564 ; sin(2 * pi * 205/ 512)
|
||||
.xldouble 0.5758081914178 ; sin(2 * pi * 206/ 512)
|
||||
.xldouble 0.5657318107836 ; sin(2 * pi * 207/ 512)
|
||||
.xldouble 0.5555702330196 ; sin(2 * pi * 208/ 512)
|
||||
.xldouble 0.5453249884220 ; sin(2 * pi * 209/ 512)
|
||||
.xldouble 0.5349976198871 ; sin(2 * pi * 210/ 512)
|
||||
.xldouble 0.5245896826785 ; sin(2 * pi * 211/ 512)
|
||||
.xldouble 0.5141027441932 ; sin(2 * pi * 212/ 512)
|
||||
.xldouble 0.5035383837257 ; sin(2 * pi * 213/ 512)
|
||||
.xldouble 0.4928981922298 ; sin(2 * pi * 214/ 512)
|
||||
.xldouble 0.4821837720791 ; sin(2 * pi * 215/ 512)
|
||||
.xldouble 0.4713967368260 ; sin(2 * pi * 216/ 512)
|
||||
.xldouble 0.4605387109582 ; sin(2 * pi * 217/ 512)
|
||||
.xldouble 0.4496113296546 ; sin(2 * pi * 218/ 512)
|
||||
.xldouble 0.4386162385385 ; sin(2 * pi * 219/ 512)
|
||||
.xldouble 0.4275550934303 ; sin(2 * pi * 220/ 512)
|
||||
.xldouble 0.4164295600976 ; sin(2 * pi * 221/ 512)
|
||||
.xldouble 0.4052413140050 ; sin(2 * pi * 222/ 512)
|
||||
.xldouble 0.3939920400610 ; sin(2 * pi * 223/ 512)
|
||||
.xldouble 0.3826834323651 ; sin(2 * pi * 224/ 512)
|
||||
.xldouble 0.3713171939518 ; sin(2 * pi * 225/ 512)
|
||||
.xldouble 0.3598950365350 ; sin(2 * pi * 226/ 512)
|
||||
.xldouble 0.3484186802494 ; sin(2 * pi * 227/ 512)
|
||||
.xldouble 0.3368898533922 ; sin(2 * pi * 228/ 512)
|
||||
.xldouble 0.3253102921623 ; sin(2 * pi * 229/ 512)
|
||||
.xldouble 0.3136817403989 ; sin(2 * pi * 230/ 512)
|
||||
.xldouble 0.3020059493192 ; sin(2 * pi * 231/ 512)
|
||||
.xldouble 0.2902846772545 ; sin(2 * pi * 232/ 512)
|
||||
.xldouble 0.2785196893851 ; sin(2 * pi * 233/ 512)
|
||||
.xldouble 0.2667127574749 ; sin(2 * pi * 234/ 512)
|
||||
.xldouble 0.2548656596045 ; sin(2 * pi * 235/ 512)
|
||||
.xldouble 0.2429801799033 ; sin(2 * pi * 236/ 512)
|
||||
.xldouble 0.2310581082807 ; sin(2 * pi * 237/ 512)
|
||||
.xldouble 0.2191012401569 ; sin(2 * pi * 238/ 512)
|
||||
.xldouble 0.2071113761922 ; sin(2 * pi * 239/ 512)
|
||||
.xldouble 0.1950903220161 ; sin(2 * pi * 240/ 512)
|
||||
.xldouble 0.1830398879551 ; sin(2 * pi * 241/ 512)
|
||||
.xldouble 0.1709618887603 ; sin(2 * pi * 242/ 512)
|
||||
.xldouble 0.1588581433339 ; sin(2 * pi * 243/ 512)
|
||||
.xldouble 0.1467304744554 ; sin(2 * pi * 244/ 512)
|
||||
.xldouble 0.1345807085071 ; sin(2 * pi * 245/ 512)
|
||||
.xldouble 0.1224106751992 ; sin(2 * pi * 246/ 512)
|
||||
.xldouble 0.1102222072939 ; sin(2 * pi * 247/ 512)
|
||||
.xldouble 0.0980171403296 ; sin(2 * pi * 248/ 512)
|
||||
.xldouble 0.0857973123444 ; sin(2 * pi * 249/ 512)
|
||||
.xldouble 0.0735645635997 ; sin(2 * pi * 250/ 512)
|
||||
.xldouble 0.0613207363022 ; sin(2 * pi * 251/ 512)
|
||||
.xldouble 0.0490676743274 ; sin(2 * pi * 252/ 512)
|
||||
.xldouble 0.0368072229414 ; sin(2 * pi * 253/ 512)
|
||||
.xldouble 0.0245412285229 ; sin(2 * pi * 254/ 512)
|
||||
.xldouble 0.0122715382857 ; sin(2 * pi * 255/ 512)
|
||||
.xldouble 0.0000000000000 ; sin(2 * pi * 256/ 512)
|
||||
.xldouble -0.0122715382857 ; sin(2 * pi * 257/ 512)
|
||||
.xldouble -0.0245412285229 ; sin(2 * pi * 258/ 512)
|
||||
.xldouble -0.0368072229414 ; sin(2 * pi * 259/ 512)
|
||||
.xldouble -0.0490676743274 ; sin(2 * pi * 260/ 512)
|
||||
.xldouble -0.0613207363022 ; sin(2 * pi * 261/ 512)
|
||||
.xldouble -0.0735645635997 ; sin(2 * pi * 262/ 512)
|
||||
.xldouble -0.0857973123444 ; sin(2 * pi * 263/ 512)
|
||||
.xldouble -0.0980171403296 ; sin(2 * pi * 264/ 512)
|
||||
.xldouble -0.1102222072939 ; sin(2 * pi * 265/ 512)
|
||||
.xldouble -0.1224106751992 ; sin(2 * pi * 266/ 512)
|
||||
.xldouble -0.1345807085071 ; sin(2 * pi * 267/ 512)
|
||||
.xldouble -0.1467304744554 ; sin(2 * pi * 268/ 512)
|
||||
.xldouble -0.1588581433339 ; sin(2 * pi * 269/ 512)
|
||||
.xldouble -0.1709618887603 ; sin(2 * pi * 270/ 512)
|
||||
.xldouble -0.1830398879551 ; sin(2 * pi * 271/ 512)
|
||||
.xldouble -0.1950903220161 ; sin(2 * pi * 272/ 512)
|
||||
.xldouble -0.2071113761922 ; sin(2 * pi * 273/ 512)
|
||||
.xldouble -0.2191012401569 ; sin(2 * pi * 274/ 512)
|
||||
.xldouble -0.2310581082807 ; sin(2 * pi * 275/ 512)
|
||||
.xldouble -0.2429801799033 ; sin(2 * pi * 276/ 512)
|
||||
.xldouble -0.2548656596045 ; sin(2 * pi * 277/ 512)
|
||||
.xldouble -0.2667127574749 ; sin(2 * pi * 278/ 512)
|
||||
.xldouble -0.2785196893851 ; sin(2 * pi * 279/ 512)
|
||||
.xldouble -0.2902846772545 ; sin(2 * pi * 280/ 512)
|
||||
.xldouble -0.3020059493192 ; sin(2 * pi * 281/ 512)
|
||||
.xldouble -0.3136817403989 ; sin(2 * pi * 282/ 512)
|
||||
.xldouble -0.3253102921623 ; sin(2 * pi * 283/ 512)
|
||||
.xldouble -0.3368898533922 ; sin(2 * pi * 284/ 512)
|
||||
.xldouble -0.3484186802494 ; sin(2 * pi * 285/ 512)
|
||||
.xldouble -0.3598950365350 ; sin(2 * pi * 286/ 512)
|
||||
.xldouble -0.3713171939518 ; sin(2 * pi * 287/ 512)
|
||||
.xldouble -0.3826834323651 ; sin(2 * pi * 288/ 512)
|
||||
.xldouble -0.3939920400610 ; sin(2 * pi * 289/ 512)
|
||||
.xldouble -0.4052413140050 ; sin(2 * pi * 290/ 512)
|
||||
.xldouble -0.4164295600976 ; sin(2 * pi * 291/ 512)
|
||||
.xldouble -0.4275550934303 ; sin(2 * pi * 292/ 512)
|
||||
.xldouble -0.4386162385385 ; sin(2 * pi * 293/ 512)
|
||||
.xldouble -0.4496113296546 ; sin(2 * pi * 294/ 512)
|
||||
.xldouble -0.4605387109582 ; sin(2 * pi * 295/ 512)
|
||||
.xldouble -0.4713967368260 ; sin(2 * pi * 296/ 512)
|
||||
.xldouble -0.4821837720791 ; sin(2 * pi * 297/ 512)
|
||||
.xldouble -0.4928981922298 ; sin(2 * pi * 298/ 512)
|
||||
.xldouble -0.5035383837257 ; sin(2 * pi * 299/ 512)
|
||||
.xldouble -0.5141027441932 ; sin(2 * pi * 300/ 512)
|
||||
.xldouble -0.5245896826785 ; sin(2 * pi * 301/ 512)
|
||||
.xldouble -0.5349976198871 ; sin(2 * pi * 302/ 512)
|
||||
.xldouble -0.5453249884220 ; sin(2 * pi * 303/ 512)
|
||||
.xldouble -0.5555702330196 ; sin(2 * pi * 304/ 512)
|
||||
.xldouble -0.5657318107836 ; sin(2 * pi * 305/ 512)
|
||||
.xldouble -0.5758081914178 ; sin(2 * pi * 306/ 512)
|
||||
.xldouble -0.5857978574564 ; sin(2 * pi * 307/ 512)
|
||||
.xldouble -0.5956993044924 ; sin(2 * pi * 308/ 512)
|
||||
.xldouble -0.6055110414043 ; sin(2 * pi * 309/ 512)
|
||||
.xldouble -0.6152315905806 ; sin(2 * pi * 310/ 512)
|
||||
.xldouble -0.6248594881424 ; sin(2 * pi * 311/ 512)
|
||||
.xldouble -0.6343932841636 ; sin(2 * pi * 312/ 512)
|
||||
.xldouble -0.6438315428898 ; sin(2 * pi * 313/ 512)
|
||||
.xldouble -0.6531728429538 ; sin(2 * pi * 314/ 512)
|
||||
.xldouble -0.6624157775902 ; sin(2 * pi * 315/ 512)
|
||||
.xldouble -0.6715589548470 ; sin(2 * pi * 316/ 512)
|
||||
.xldouble -0.6806009977955 ; sin(2 * pi * 317/ 512)
|
||||
.xldouble -0.6895405447371 ; sin(2 * pi * 318/ 512)
|
||||
.xldouble -0.6983762494090 ; sin(2 * pi * 319/ 512)
|
||||
.xldouble -0.7071067811865 ; sin(2 * pi * 320/ 512)
|
||||
.xldouble -0.7157308252838 ; sin(2 * pi * 321/ 512)
|
||||
.xldouble -0.7242470829515 ; sin(2 * pi * 322/ 512)
|
||||
.xldouble -0.7326542716724 ; sin(2 * pi * 323/ 512)
|
||||
.xldouble -0.7409511253550 ; sin(2 * pi * 324/ 512)
|
||||
.xldouble -0.7491363945235 ; sin(2 * pi * 325/ 512)
|
||||
.xldouble -0.7572088465065 ; sin(2 * pi * 326/ 512)
|
||||
.xldouble -0.7651672656225 ; sin(2 * pi * 327/ 512)
|
||||
.xldouble -0.7730104533627 ; sin(2 * pi * 328/ 512)
|
||||
.xldouble -0.7807372285721 ; sin(2 * pi * 329/ 512)
|
||||
.xldouble -0.7883464276266 ; sin(2 * pi * 330/ 512)
|
||||
.xldouble -0.7958369046089 ; sin(2 * pi * 331/ 512)
|
||||
.xldouble -0.8032075314806 ; sin(2 * pi * 332/ 512)
|
||||
.xldouble -0.8104571982526 ; sin(2 * pi * 333/ 512)
|
||||
.xldouble -0.8175848131516 ; sin(2 * pi * 334/ 512)
|
||||
.xldouble -0.8245893027850 ; sin(2 * pi * 335/ 512)
|
||||
.xldouble -0.8314696123025 ; sin(2 * pi * 336/ 512)
|
||||
.xldouble -0.8382247055548 ; sin(2 * pi * 337/ 512)
|
||||
.xldouble -0.8448535652497 ; sin(2 * pi * 338/ 512)
|
||||
.xldouble -0.8513551931053 ; sin(2 * pi * 339/ 512)
|
||||
.xldouble -0.8577286100003 ; sin(2 * pi * 340/ 512)
|
||||
.xldouble -0.8639728561216 ; sin(2 * pi * 341/ 512)
|
||||
.xldouble -0.8700869911087 ; sin(2 * pi * 342/ 512)
|
||||
.xldouble -0.8760700941954 ; sin(2 * pi * 343/ 512)
|
||||
.xldouble -0.8819212643484 ; sin(2 * pi * 344/ 512)
|
||||
.xldouble -0.8876396204029 ; sin(2 * pi * 345/ 512)
|
||||
.xldouble -0.8932243011955 ; sin(2 * pi * 346/ 512)
|
||||
.xldouble -0.8986744656940 ; sin(2 * pi * 347/ 512)
|
||||
.xldouble -0.9039892931234 ; sin(2 * pi * 348/ 512)
|
||||
.xldouble -0.9091679830905 ; sin(2 * pi * 349/ 512)
|
||||
.xldouble -0.9142097557035 ; sin(2 * pi * 350/ 512)
|
||||
.xldouble -0.9191138516901 ; sin(2 * pi * 351/ 512)
|
||||
.xldouble -0.9238795325113 ; sin(2 * pi * 352/ 512)
|
||||
.xldouble -0.9285060804732 ; sin(2 * pi * 353/ 512)
|
||||
.xldouble -0.9329927988347 ; sin(2 * pi * 354/ 512)
|
||||
.xldouble -0.9373390119126 ; sin(2 * pi * 355/ 512)
|
||||
.xldouble -0.9415440651830 ; sin(2 * pi * 356/ 512)
|
||||
.xldouble -0.9456073253805 ; sin(2 * pi * 357/ 512)
|
||||
.xldouble -0.9495281805930 ; sin(2 * pi * 358/ 512)
|
||||
.xldouble -0.9533060403542 ; sin(2 * pi * 359/ 512)
|
||||
.xldouble -0.9569403357322 ; sin(2 * pi * 360/ 512)
|
||||
.xldouble -0.9604305194156 ; sin(2 * pi * 361/ 512)
|
||||
.xldouble -0.9637760657954 ; sin(2 * pi * 362/ 512)
|
||||
.xldouble -0.9669764710449 ; sin(2 * pi * 363/ 512)
|
||||
.xldouble -0.9700312531945 ; sin(2 * pi * 364/ 512)
|
||||
.xldouble -0.9729399522056 ; sin(2 * pi * 365/ 512)
|
||||
.xldouble -0.9757021300385 ; sin(2 * pi * 366/ 512)
|
||||
.xldouble -0.9783173707196 ; sin(2 * pi * 367/ 512)
|
||||
.xldouble -0.9807852804032 ; sin(2 * pi * 368/ 512)
|
||||
.xldouble -0.9831054874312 ; sin(2 * pi * 369/ 512)
|
||||
.xldouble -0.9852776423889 ; sin(2 * pi * 370/ 512)
|
||||
.xldouble -0.9873014181579 ; sin(2 * pi * 371/ 512)
|
||||
.xldouble -0.9891765099648 ; sin(2 * pi * 372/ 512)
|
||||
.xldouble -0.9909026354278 ; sin(2 * pi * 373/ 512)
|
||||
.xldouble -0.9924795345987 ; sin(2 * pi * 374/ 512)
|
||||
.xldouble -0.9939069700024 ; sin(2 * pi * 375/ 512)
|
||||
.xldouble -0.9951847266722 ; sin(2 * pi * 376/ 512)
|
||||
.xldouble -0.9963126121828 ; sin(2 * pi * 377/ 512)
|
||||
.xldouble -0.9972904566787 ; sin(2 * pi * 378/ 512)
|
||||
.xldouble -0.9981181129001 ; sin(2 * pi * 379/ 512)
|
||||
.xldouble -0.9987954562052 ; sin(2 * pi * 380/ 512)
|
||||
.xldouble -0.9993223845883 ; sin(2 * pi * 381/ 512)
|
||||
.xldouble -0.9996988186962 ; sin(2 * pi * 382/ 512)
|
||||
.xldouble -0.9999247018391 ; sin(2 * pi * 383/ 512)
|
||||
.xldouble -1.0000000000000 ; sin(2 * pi * 384/ 512)
|
||||
.xldouble -0.9999247018391 ; sin(2 * pi * 385/ 512)
|
||||
.xldouble -0.9996988186962 ; sin(2 * pi * 386/ 512)
|
||||
.xldouble -0.9993223845883 ; sin(2 * pi * 387/ 512)
|
||||
.xldouble -0.9987954562052 ; sin(2 * pi * 388/ 512)
|
||||
.xldouble -0.9981181129001 ; sin(2 * pi * 389/ 512)
|
||||
.xldouble -0.9972904566787 ; sin(2 * pi * 390/ 512)
|
||||
.xldouble -0.9963126121828 ; sin(2 * pi * 391/ 512)
|
||||
.xldouble -0.9951847266722 ; sin(2 * pi * 392/ 512)
|
||||
.xldouble -0.9939069700024 ; sin(2 * pi * 393/ 512)
|
||||
.xldouble -0.9924795345987 ; sin(2 * pi * 394/ 512)
|
||||
.xldouble -0.9909026354278 ; sin(2 * pi * 395/ 512)
|
||||
.xldouble -0.9891765099648 ; sin(2 * pi * 396/ 512)
|
||||
.xldouble -0.9873014181579 ; sin(2 * pi * 397/ 512)
|
||||
.xldouble -0.9852776423889 ; sin(2 * pi * 398/ 512)
|
||||
.xldouble -0.9831054874312 ; sin(2 * pi * 399/ 512)
|
||||
.xldouble -0.9807852804032 ; sin(2 * pi * 400/ 512)
|
||||
.xldouble -0.9783173707196 ; sin(2 * pi * 401/ 512)
|
||||
.xldouble -0.9757021300385 ; sin(2 * pi * 402/ 512)
|
||||
.xldouble -0.9729399522056 ; sin(2 * pi * 403/ 512)
|
||||
.xldouble -0.9700312531945 ; sin(2 * pi * 404/ 512)
|
||||
.xldouble -0.9669764710449 ; sin(2 * pi * 405/ 512)
|
||||
.xldouble -0.9637760657954 ; sin(2 * pi * 406/ 512)
|
||||
.xldouble -0.9604305194156 ; sin(2 * pi * 407/ 512)
|
||||
.xldouble -0.9569403357322 ; sin(2 * pi * 408/ 512)
|
||||
.xldouble -0.9533060403542 ; sin(2 * pi * 409/ 512)
|
||||
.xldouble -0.9495281805930 ; sin(2 * pi * 410/ 512)
|
||||
.xldouble -0.9456073253805 ; sin(2 * pi * 411/ 512)
|
||||
.xldouble -0.9415440651830 ; sin(2 * pi * 412/ 512)
|
||||
.xldouble -0.9373390119126 ; sin(2 * pi * 413/ 512)
|
||||
.xldouble -0.9329927988347 ; sin(2 * pi * 414/ 512)
|
||||
.xldouble -0.9285060804732 ; sin(2 * pi * 415/ 512)
|
||||
.xldouble -0.9238795325113 ; sin(2 * pi * 416/ 512)
|
||||
.xldouble -0.9191138516901 ; sin(2 * pi * 417/ 512)
|
||||
.xldouble -0.9142097557035 ; sin(2 * pi * 418/ 512)
|
||||
.xldouble -0.9091679830905 ; sin(2 * pi * 419/ 512)
|
||||
.xldouble -0.9039892931234 ; sin(2 * pi * 420/ 512)
|
||||
.xldouble -0.8986744656940 ; sin(2 * pi * 421/ 512)
|
||||
.xldouble -0.8932243011955 ; sin(2 * pi * 422/ 512)
|
||||
.xldouble -0.8876396204029 ; sin(2 * pi * 423/ 512)
|
||||
.xldouble -0.8819212643484 ; sin(2 * pi * 424/ 512)
|
||||
.xldouble -0.8760700941954 ; sin(2 * pi * 425/ 512)
|
||||
.xldouble -0.8700869911087 ; sin(2 * pi * 426/ 512)
|
||||
.xldouble -0.8639728561216 ; sin(2 * pi * 427/ 512)
|
||||
.xldouble -0.8577286100003 ; sin(2 * pi * 428/ 512)
|
||||
.xldouble -0.8513551931053 ; sin(2 * pi * 429/ 512)
|
||||
.xldouble -0.8448535652497 ; sin(2 * pi * 430/ 512)
|
||||
.xldouble -0.8382247055548 ; sin(2 * pi * 431/ 512)
|
||||
.xldouble -0.8314696123025 ; sin(2 * pi * 432/ 512)
|
||||
.xldouble -0.8245893027850 ; sin(2 * pi * 433/ 512)
|
||||
.xldouble -0.8175848131516 ; sin(2 * pi * 434/ 512)
|
||||
.xldouble -0.8104571982526 ; sin(2 * pi * 435/ 512)
|
||||
.xldouble -0.8032075314806 ; sin(2 * pi * 436/ 512)
|
||||
.xldouble -0.7958369046089 ; sin(2 * pi * 437/ 512)
|
||||
.xldouble -0.7883464276266 ; sin(2 * pi * 438/ 512)
|
||||
.xldouble -0.7807372285721 ; sin(2 * pi * 439/ 512)
|
||||
.xldouble -0.7730104533627 ; sin(2 * pi * 440/ 512)
|
||||
.xldouble -0.7651672656225 ; sin(2 * pi * 441/ 512)
|
||||
.xldouble -0.7572088465065 ; sin(2 * pi * 442/ 512)
|
||||
.xldouble -0.7491363945235 ; sin(2 * pi * 443/ 512)
|
||||
.xldouble -0.7409511253550 ; sin(2 * pi * 444/ 512)
|
||||
.xldouble -0.7326542716724 ; sin(2 * pi * 445/ 512)
|
||||
.xldouble -0.7242470829515 ; sin(2 * pi * 446/ 512)
|
||||
.xldouble -0.7157308252838 ; sin(2 * pi * 447/ 512)
|
||||
.xldouble -0.7071067811865 ; sin(2 * pi * 448/ 512)
|
||||
.xldouble -0.6983762494090 ; sin(2 * pi * 449/ 512)
|
||||
.xldouble -0.6895405447371 ; sin(2 * pi * 450/ 512)
|
||||
.xldouble -0.6806009977955 ; sin(2 * pi * 451/ 512)
|
||||
.xldouble -0.6715589548470 ; sin(2 * pi * 452/ 512)
|
||||
.xldouble -0.6624157775902 ; sin(2 * pi * 453/ 512)
|
||||
.xldouble -0.6531728429538 ; sin(2 * pi * 454/ 512)
|
||||
.xldouble -0.6438315428898 ; sin(2 * pi * 455/ 512)
|
||||
.xldouble -0.6343932841636 ; sin(2 * pi * 456/ 512)
|
||||
.xldouble -0.6248594881424 ; sin(2 * pi * 457/ 512)
|
||||
.xldouble -0.6152315905806 ; sin(2 * pi * 458/ 512)
|
||||
.xldouble -0.6055110414043 ; sin(2 * pi * 459/ 512)
|
||||
.xldouble -0.5956993044924 ; sin(2 * pi * 460/ 512)
|
||||
.xldouble -0.5857978574564 ; sin(2 * pi * 461/ 512)
|
||||
.xldouble -0.5758081914178 ; sin(2 * pi * 462/ 512)
|
||||
.xldouble -0.5657318107836 ; sin(2 * pi * 463/ 512)
|
||||
.xldouble -0.5555702330196 ; sin(2 * pi * 464/ 512)
|
||||
.xldouble -0.5453249884220 ; sin(2 * pi * 465/ 512)
|
||||
.xldouble -0.5349976198871 ; sin(2 * pi * 466/ 512)
|
||||
.xldouble -0.5245896826785 ; sin(2 * pi * 467/ 512)
|
||||
.xldouble -0.5141027441932 ; sin(2 * pi * 468/ 512)
|
||||
.xldouble -0.5035383837257 ; sin(2 * pi * 469/ 512)
|
||||
.xldouble -0.4928981922298 ; sin(2 * pi * 470/ 512)
|
||||
.xldouble -0.4821837720791 ; sin(2 * pi * 471/ 512)
|
||||
.xldouble -0.4713967368260 ; sin(2 * pi * 472/ 512)
|
||||
.xldouble -0.4605387109582 ; sin(2 * pi * 473/ 512)
|
||||
.xldouble -0.4496113296546 ; sin(2 * pi * 474/ 512)
|
||||
.xldouble -0.4386162385385 ; sin(2 * pi * 475/ 512)
|
||||
.xldouble -0.4275550934303 ; sin(2 * pi * 476/ 512)
|
||||
.xldouble -0.4164295600976 ; sin(2 * pi * 477/ 512)
|
||||
.xldouble -0.4052413140050 ; sin(2 * pi * 478/ 512)
|
||||
.xldouble -0.3939920400610 ; sin(2 * pi * 479/ 512)
|
||||
.xldouble -0.3826834323651 ; sin(2 * pi * 480/ 512)
|
||||
.xldouble -0.3713171939518 ; sin(2 * pi * 481/ 512)
|
||||
.xldouble -0.3598950365350 ; sin(2 * pi * 482/ 512)
|
||||
.xldouble -0.3484186802494 ; sin(2 * pi * 483/ 512)
|
||||
.xldouble -0.3368898533922 ; sin(2 * pi * 484/ 512)
|
||||
.xldouble -0.3253102921623 ; sin(2 * pi * 485/ 512)
|
||||
.xldouble -0.3136817403989 ; sin(2 * pi * 486/ 512)
|
||||
.xldouble -0.3020059493192 ; sin(2 * pi * 487/ 512)
|
||||
.xldouble -0.2902846772545 ; sin(2 * pi * 488/ 512)
|
||||
.xldouble -0.2785196893851 ; sin(2 * pi * 489/ 512)
|
||||
.xldouble -0.2667127574749 ; sin(2 * pi * 490/ 512)
|
||||
.xldouble -0.2548656596045 ; sin(2 * pi * 491/ 512)
|
||||
.xldouble -0.2429801799033 ; sin(2 * pi * 492/ 512)
|
||||
.xldouble -0.2310581082807 ; sin(2 * pi * 493/ 512)
|
||||
.xldouble -0.2191012401569 ; sin(2 * pi * 494/ 512)
|
||||
.xldouble -0.2071113761922 ; sin(2 * pi * 495/ 512)
|
||||
.xldouble -0.1950903220161 ; sin(2 * pi * 496/ 512)
|
||||
.xldouble -0.1830398879551 ; sin(2 * pi * 497/ 512)
|
||||
.xldouble -0.1709618887603 ; sin(2 * pi * 498/ 512)
|
||||
.xldouble -0.1588581433339 ; sin(2 * pi * 499/ 512)
|
||||
.xldouble -0.1467304744554 ; sin(2 * pi * 500/ 512)
|
||||
.xldouble -0.1345807085071 ; sin(2 * pi * 501/ 512)
|
||||
.xldouble -0.1224106751992 ; sin(2 * pi * 502/ 512)
|
||||
.xldouble -0.1102222072939 ; sin(2 * pi * 503/ 512)
|
||||
.xldouble -0.0980171403296 ; sin(2 * pi * 504/ 512)
|
||||
.xldouble -0.0857973123444 ; sin(2 * pi * 505/ 512)
|
||||
.xldouble -0.0735645635997 ; sin(2 * pi * 506/ 512)
|
||||
.xldouble -0.0613207363022 ; sin(2 * pi * 507/ 512)
|
||||
.xldouble -0.0490676743274 ; sin(2 * pi * 508/ 512)
|
||||
.xldouble -0.0368072229414 ; sin(2 * pi * 509/ 512)
|
||||
.xldouble -0.0245412285229 ; sin(2 * pi * 510/ 512)
|
||||
.xldouble -0.0122715382857 ; sin(2 * pi * 511/ 512)
|
||||
_FPU64sinTableEnd:
|
||||
.xldouble 0.0000000000000 ; sin(2 * pi * 512/ 512)
|
||||
.xldouble 0.0122715382857 ; sin(2 * pi * 513/ 512)
|
||||
.xldouble 0.0245412285229 ; sin(2 * pi * 514/ 512)
|
||||
.xldouble 0.0368072229414 ; sin(2 * pi * 515/ 512)
|
||||
.xldouble 0.0490676743274 ; sin(2 * pi * 516/ 512)
|
||||
.xldouble 0.0613207363022 ; sin(2 * pi * 517/ 512)
|
||||
.xldouble 0.0735645635997 ; sin(2 * pi * 518/ 512)
|
||||
.xldouble 0.0857973123444 ; sin(2 * pi * 519/ 512)
|
||||
.xldouble 0.0980171403296 ; sin(2 * pi * 520/ 512)
|
||||
.xldouble 0.1102222072939 ; sin(2 * pi * 521/ 512)
|
||||
.xldouble 0.1224106751992 ; sin(2 * pi * 522/ 512)
|
||||
.xldouble 0.1345807085071 ; sin(2 * pi * 523/ 512)
|
||||
.xldouble 0.1467304744554 ; sin(2 * pi * 524/ 512)
|
||||
.xldouble 0.1588581433339 ; sin(2 * pi * 525/ 512)
|
||||
.xldouble 0.1709618887603 ; sin(2 * pi * 526/ 512)
|
||||
.xldouble 0.1830398879551 ; sin(2 * pi * 527/ 512)
|
||||
.xldouble 0.1950903220161 ; sin(2 * pi * 528/ 512)
|
||||
.xldouble 0.2071113761922 ; sin(2 * pi * 529/ 512)
|
||||
.xldouble 0.2191012401569 ; sin(2 * pi * 530/ 512)
|
||||
.xldouble 0.2310581082807 ; sin(2 * pi * 531/ 512)
|
||||
.xldouble 0.2429801799033 ; sin(2 * pi * 532/ 512)
|
||||
.xldouble 0.2548656596045 ; sin(2 * pi * 533/ 512)
|
||||
.xldouble 0.2667127574749 ; sin(2 * pi * 534/ 512)
|
||||
.xldouble 0.2785196893851 ; sin(2 * pi * 535/ 512)
|
||||
.xldouble 0.2902846772545 ; sin(2 * pi * 536/ 512)
|
||||
.xldouble 0.3020059493192 ; sin(2 * pi * 537/ 512)
|
||||
.xldouble 0.3136817403989 ; sin(2 * pi * 538/ 512)
|
||||
.xldouble 0.3253102921623 ; sin(2 * pi * 539/ 512)
|
||||
.xldouble 0.3368898533922 ; sin(2 * pi * 540/ 512)
|
||||
.xldouble 0.3484186802494 ; sin(2 * pi * 541/ 512)
|
||||
.xldouble 0.3598950365350 ; sin(2 * pi * 542/ 512)
|
||||
.xldouble 0.3713171939518 ; sin(2 * pi * 543/ 512)
|
||||
.xldouble 0.3826834323651 ; sin(2 * pi * 544/ 512)
|
||||
.xldouble 0.3939920400610 ; sin(2 * pi * 545/ 512)
|
||||
.xldouble 0.4052413140050 ; sin(2 * pi * 546/ 512)
|
||||
.xldouble 0.4164295600976 ; sin(2 * pi * 547/ 512)
|
||||
.xldouble 0.4275550934303 ; sin(2 * pi * 548/ 512)
|
||||
.xldouble 0.4386162385385 ; sin(2 * pi * 549/ 512)
|
||||
.xldouble 0.4496113296546 ; sin(2 * pi * 550/ 512)
|
||||
.xldouble 0.4605387109582 ; sin(2 * pi * 551/ 512)
|
||||
.xldouble 0.4713967368260 ; sin(2 * pi * 552/ 512)
|
||||
.xldouble 0.4821837720791 ; sin(2 * pi * 553/ 512)
|
||||
.xldouble 0.4928981922298 ; sin(2 * pi * 554/ 512)
|
||||
.xldouble 0.5035383837257 ; sin(2 * pi * 555/ 512)
|
||||
.xldouble 0.5141027441932 ; sin(2 * pi * 556/ 512)
|
||||
.xldouble 0.5245896826785 ; sin(2 * pi * 557/ 512)
|
||||
.xldouble 0.5349976198871 ; sin(2 * pi * 558/ 512)
|
||||
.xldouble 0.5453249884220 ; sin(2 * pi * 559/ 512)
|
||||
.xldouble 0.5555702330196 ; sin(2 * pi * 560/ 512)
|
||||
.xldouble 0.5657318107836 ; sin(2 * pi * 561/ 512)
|
||||
.xldouble 0.5758081914178 ; sin(2 * pi * 562/ 512)
|
||||
.xldouble 0.5857978574564 ; sin(2 * pi * 563/ 512)
|
||||
.xldouble 0.5956993044924 ; sin(2 * pi * 564/ 512)
|
||||
.xldouble 0.6055110414043 ; sin(2 * pi * 565/ 512)
|
||||
.xldouble 0.6152315905806 ; sin(2 * pi * 566/ 512)
|
||||
.xldouble 0.6248594881424 ; sin(2 * pi * 567/ 512)
|
||||
.xldouble 0.6343932841636 ; sin(2 * pi * 568/ 512)
|
||||
.xldouble 0.6438315428898 ; sin(2 * pi * 569/ 512)
|
||||
.xldouble 0.6531728429538 ; sin(2 * pi * 570/ 512)
|
||||
.xldouble 0.6624157775902 ; sin(2 * pi * 571/ 512)
|
||||
.xldouble 0.6715589548470 ; sin(2 * pi * 572/ 512)
|
||||
.xldouble 0.6806009977955 ; sin(2 * pi * 573/ 512)
|
||||
.xldouble 0.6895405447371 ; sin(2 * pi * 574/ 512)
|
||||
.xldouble 0.6983762494090 ; sin(2 * pi * 575/ 512)
|
||||
.xldouble 0.7071067811865 ; sin(2 * pi * 576/ 512)
|
||||
.xldouble 0.7157308252838 ; sin(2 * pi * 577/ 512)
|
||||
.xldouble 0.7242470829515 ; sin(2 * pi * 578/ 512)
|
||||
.xldouble 0.7326542716724 ; sin(2 * pi * 579/ 512)
|
||||
.xldouble 0.7409511253550 ; sin(2 * pi * 580/ 512)
|
||||
.xldouble 0.7491363945235 ; sin(2 * pi * 581/ 512)
|
||||
.xldouble 0.7572088465065 ; sin(2 * pi * 582/ 512)
|
||||
.xldouble 0.7651672656225 ; sin(2 * pi * 583/ 512)
|
||||
.xldouble 0.7730104533627 ; sin(2 * pi * 584/ 512)
|
||||
.xldouble 0.7807372285721 ; sin(2 * pi * 585/ 512)
|
||||
.xldouble 0.7883464276266 ; sin(2 * pi * 586/ 512)
|
||||
.xldouble 0.7958369046089 ; sin(2 * pi * 587/ 512)
|
||||
.xldouble 0.8032075314806 ; sin(2 * pi * 588/ 512)
|
||||
.xldouble 0.8104571982526 ; sin(2 * pi * 589/ 512)
|
||||
.xldouble 0.8175848131516 ; sin(2 * pi * 590/ 512)
|
||||
.xldouble 0.8245893027850 ; sin(2 * pi * 591/ 512)
|
||||
.xldouble 0.8314696123025 ; sin(2 * pi * 592/ 512)
|
||||
.xldouble 0.8382247055548 ; sin(2 * pi * 593/ 512)
|
||||
.xldouble 0.8448535652497 ; sin(2 * pi * 594/ 512)
|
||||
.xldouble 0.8513551931053 ; sin(2 * pi * 595/ 512)
|
||||
.xldouble 0.8577286100003 ; sin(2 * pi * 596/ 512)
|
||||
.xldouble 0.8639728561216 ; sin(2 * pi * 597/ 512)
|
||||
.xldouble 0.8700869911087 ; sin(2 * pi * 598/ 512)
|
||||
.xldouble 0.8760700941954 ; sin(2 * pi * 599/ 512)
|
||||
.xldouble 0.8819212643484 ; sin(2 * pi * 600/ 512)
|
||||
.xldouble 0.8876396204029 ; sin(2 * pi * 601/ 512)
|
||||
.xldouble 0.8932243011955 ; sin(2 * pi * 602/ 512)
|
||||
.xldouble 0.8986744656940 ; sin(2 * pi * 603/ 512)
|
||||
.xldouble 0.9039892931234 ; sin(2 * pi * 604/ 512)
|
||||
.xldouble 0.9091679830905 ; sin(2 * pi * 605/ 512)
|
||||
.xldouble 0.9142097557035 ; sin(2 * pi * 606/ 512)
|
||||
.xldouble 0.9191138516901 ; sin(2 * pi * 607/ 512)
|
||||
.xldouble 0.9238795325113 ; sin(2 * pi * 608/ 512)
|
||||
.xldouble 0.9285060804732 ; sin(2 * pi * 609/ 512)
|
||||
.xldouble 0.9329927988347 ; sin(2 * pi * 610/ 512)
|
||||
.xldouble 0.9373390119126 ; sin(2 * pi * 611/ 512)
|
||||
.xldouble 0.9415440651830 ; sin(2 * pi * 612/ 512)
|
||||
.xldouble 0.9456073253805 ; sin(2 * pi * 613/ 512)
|
||||
.xldouble 0.9495281805930 ; sin(2 * pi * 614/ 512)
|
||||
.xldouble 0.9533060403542 ; sin(2 * pi * 615/ 512)
|
||||
.xldouble 0.9569403357322 ; sin(2 * pi * 616/ 512)
|
||||
.xldouble 0.9604305194156 ; sin(2 * pi * 617/ 512)
|
||||
.xldouble 0.9637760657954 ; sin(2 * pi * 618/ 512)
|
||||
.xldouble 0.9669764710449 ; sin(2 * pi * 619/ 512)
|
||||
.xldouble 0.9700312531945 ; sin(2 * pi * 620/ 512)
|
||||
.xldouble 0.9729399522056 ; sin(2 * pi * 621/ 512)
|
||||
.xldouble 0.9757021300385 ; sin(2 * pi * 622/ 512)
|
||||
.xldouble 0.9783173707196 ; sin(2 * pi * 623/ 512)
|
||||
.xldouble 0.9807852804032 ; sin(2 * pi * 624/ 512)
|
||||
.xldouble 0.9831054874312 ; sin(2 * pi * 625/ 512)
|
||||
.xldouble 0.9852776423889 ; sin(2 * pi * 626/ 512)
|
||||
.xldouble 0.9873014181579 ; sin(2 * pi * 627/ 512)
|
||||
.xldouble 0.9891765099648 ; sin(2 * pi * 628/ 512)
|
||||
.xldouble 0.9909026354278 ; sin(2 * pi * 629/ 512)
|
||||
.xldouble 0.9924795345987 ; sin(2 * pi * 630/ 512)
|
||||
.xldouble 0.9939069700024 ; sin(2 * pi * 631/ 512)
|
||||
.xldouble 0.9951847266722 ; sin(2 * pi * 632/ 512)
|
||||
.xldouble 0.9963126121828 ; sin(2 * pi * 633/ 512)
|
||||
.xldouble 0.9972904566787 ; sin(2 * pi * 634/ 512)
|
||||
.xldouble 0.9981181129001 ; sin(2 * pi * 635/ 512)
|
||||
.xldouble 0.9987954562052 ; sin(2 * pi * 636/ 512)
|
||||
.xldouble 0.9993223845883 ; sin(2 * pi * 637/ 512)
|
||||
.xldouble 0.9996988186962 ; sin(2 * pi * 638/ 512)
|
||||
.xldouble 0.9999247018391 ; sin(2 * pi * 639/ 512)
|
||||
.xldouble 1.0000000000000 ; sin(2 * pi * 640/ 512)
|
||||
_FPU64cosTableEnd:
|
||||
|
||||
;; End of File
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
;;#############################################################################
|
||||
;;! \file source/fpu64/sqrt_f64.asm
|
||||
;;!
|
||||
;;! \brief Square Root function for the C28x + FPU64
|
||||
;;! \author Vishal Coelho
|
||||
;;! \date 01/06/2016
|
||||
;;
|
||||
;; DESCRIPTION:
|
||||
;;
|
||||
;; This function computes a 64-bit floating point sqrt(X).
|
||||
;;
|
||||
;; FUNCTIONS:
|
||||
;;
|
||||
;; float64 sqrt (float64 X)
|
||||
;;
|
||||
;; ASSUMPTIONS:
|
||||
;;
|
||||
;; ALGORITHM:
|
||||
;;
|
||||
;: Ye = Estimate(1/sqrt(X));
|
||||
;; Ye' = Ye*(1.5 - Ye*Ye*X*0.5)
|
||||
;; Ye'' = Ye'*(1.5 - Ye'*Ye'*X*0.5)
|
||||
;; Ye''' = Ye''*(1.5 - Ye''*Ye''*X*0.5)
|
||||
;; Ye'''' = Ye'''*(1.5 - Ye'''*Ye'''*X*0.5)
|
||||
;; Y = sqrt(X) = X * Ye''''
|
||||
;;
|
||||
;;#############################################################################
|
||||
;;!
|
||||
;;! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
;;! All rights reserved not granted herein.
|
||||
;;! Limited License.
|
||||
;;!
|
||||
;;! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
;;! non-exclusive license under copyrights and patents it now or hereafter
|
||||
;;! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
;;! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
;;! foregoing patent license, such license is granted solely to the extent that
|
||||
;;! any such patent is necessary to Utilize the software alone. The patent
|
||||
;;! license shall not apply to any combinations which include this software,
|
||||
;;! other than combinations with devices manufactured by or for TI
|
||||
;;! ("TI Devices").
|
||||
;;! No hardware patent is licensed hereunder.
|
||||
;;!
|
||||
;;! Redistributions must preserve existing copyright notices and reproduce this
|
||||
;;! license (including the above copyright notice and the disclaimer and
|
||||
;;! (if applicable) source code license limitations below) in the documentation
|
||||
;;! and/or other materials provided with the distribution.
|
||||
;;!
|
||||
;;! Redistribution and use in binary form, without modification, are permitted
|
||||
;;! provided that the following conditions are met:
|
||||
;;!
|
||||
;;! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
;;! permitted with respect to any software provided in binary form.
|
||||
;;! * Any redistribution and use are licensed by TI for use only
|
||||
;;! with TI Devices.
|
||||
;;! * Nothing shall obligate TI to provide you with source code for the
|
||||
;;! software licensed and provided to you in object code.
|
||||
;;!
|
||||
;;! If software source code is provided to you, modification and redistribution
|
||||
;;! of the source code are permitted provided that the following conditions
|
||||
;;! are met:
|
||||
;;!
|
||||
;;! * any redistribution and use of the source code, including any resulting
|
||||
;;! derivative works, are licensed by TI for use only with TI Devices.
|
||||
;;! * any redistribution and use of any object code compiled from the source
|
||||
;;! code and any resulting derivative works, are licensed by TI for use
|
||||
;;! only with TI Devices.
|
||||
;;!
|
||||
;;! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
;;! suppliers may be used to endorse or promote products derived from this
|
||||
;;! software without specific prior written permission.
|
||||
;;#############################################################################
|
||||
|
||||
|
||||
;; the includes
|
||||
.cdecls C, LIST, "fastrts.h"
|
||||
|
||||
;;*****************************************************************************
|
||||
;; Register Usage:
|
||||
;; R0 : X,Y, the argument and the result
|
||||
;; R1 : Ye, first estimate of 1/sqrt(X)(all successive estimates Ye',...)
|
||||
;; R2 : X*0.5
|
||||
;; R3 : 1.5 - Ye*Ye*X*0.5 (all successive estimates Ye', Ye'' ..)
|
||||
;;*****************************************************************************
|
||||
.page
|
||||
.if __TI_EABI__
|
||||
.asg sqrt, _sqrtl
|
||||
.endif
|
||||
.global _sqrtl
|
||||
.sect ".text"
|
||||
_sqrtl: .asmfunc
|
||||
.if CONVERT_F32_TO_F64 == 1
|
||||
F32TOF64 R0, R0H ; convert argument to double precision
|
||||
.endif
|
||||
EISQRTF64 R1, R0 ; *|R1 = Ye = Estimate(1/sqrt(X))
|
||||
NOP ; 1|
|
||||
MPYF64 R2, R0, #0.5 ; *| R2 = X*0.5
|
||||
RPTB #_isqrt_loop, #2 ; run loop 3 times
|
||||
MPYF64 R3, R1, R1 ; 1|*| R3 = Ye*Ye
|
||||
NOP ; 2|1|
|
||||
NOP ; 2|
|
||||
MPYF64 R3, R3, R2 ; *| R3 = Ye*Ye*X*0.5
|
||||
NOP ; 1|
|
||||
NOP ; 2|
|
||||
SUBF64 R3, #1.5, R3 ; *| R3 = 1.5 - Ye*Ye*X*0.5
|
||||
NOP ; 1|
|
||||
NOP ; 2|
|
||||
MPYF64 R1, R1, R3 ; *| R1 = Ye = Ye*(1.5 - Ye*Ye*X*0.5)
|
||||
NOP ; 1|
|
||||
NOP ; 2|
|
||||
_isqrt_loop:
|
||||
MPYF64 R3, R1, R2 ; *| R3 = Ye'''*X*0.5
|
||||
NOP ; 1|
|
||||
NOP ; 2|
|
||||
MPYF64 R3, R1, R3 ; *| R3 = Ye'''*Ye'''*X*0.5
|
||||
NOP ; 1|
|
||||
NOP ; 2|
|
||||
SUBF64 R3, #1.5, R3 ; *| R3 = 1.5 - Ye'''*Ye'''*X*0.5
|
||||
CMPF64 R0, #0.0 ; 1| if X == 0, set ZF, NF
|
||||
NOP ; 2|
|
||||
MPYF64 R1, R1, R3 ; *| R1 = Ye'''*(1.5 - Ye'''*Ye'''*X*0.5)
|
||||
NOP ; 1|
|
||||
NOP ; 2|
|
||||
MOV64 R1, R0, EQ ; If X is zero, set Ye'''' to 0
|
||||
MPYF64 R0, R0, R1 ; * | R0 = Y = X * Ye''''
|
||||
LRETR ; 1,2|
|
||||
.endasmfunc
|
||||
|
||||
;;*****************************************************************************
|
||||
;; This function will run the function above taking the address of the input
|
||||
;; and output as arguments
|
||||
;;
|
||||
;; Register Usage:
|
||||
;; XAR4 : points to the destination argument
|
||||
;; XAR5 : points to the source argument
|
||||
;;*****************************************************************************
|
||||
.if __TI_EABI__
|
||||
.asg run_sqrt, _run_sqrt
|
||||
.endif
|
||||
.global _run_sqrt
|
||||
.sect ".text"
|
||||
_run_sqrt: .asmfunc
|
||||
MOV32 R0L, *+XAR5[0]
|
||||
MOV32 R0H, *+XAR5[2]
|
||||
LCR #_sqrtl
|
||||
MOV32 *+XAR4[0], R0L
|
||||
MOV32 *+XAR4[2], R0H
|
||||
LRETR
|
||||
.endasmfunc
|
||||
;; End of File
|
||||
Reference in new issue
Block a user