Update repo

This commit is contained in:
2026-08-30 23:04:35 -07:00
parent 749dab5721
commit ce65a0f59a
14950 changed files with 4408250 additions and 1 deletions
@@ -0,0 +1,89 @@
; DCL_DF11_C1.asm - Direct Form 1 implementation in first order
;
;;#############################################################################
;;!
;;! 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 $defined(__TI_EABI__)
.if __TI_EABI__
.asg DCL_runDF11_C1, _DCL_runDF11_C1
.endif
.endif
.global _DCL_runDF11_C1
.sect "dclfuncs"
; C prototype: float DCL_runDF11_C1(DCL_DF11 *p, float32_t ek)
; argument 1 = *p : 32-bit structure address [XAR4]
; argument 2 = ek : 32-bit floating-point input [R0H]
; return = uk : 32-bit floating-point [R0H]
.align 2
_DCL_runDF11_C1:
.asmfunc
MOV32 R1H, *XAR4++ ; R1H = b0
MPYF32 R2H, R0H, R1H ; R2H = v2
|| MOV32 R3H, *XAR4++ ; R3H = b1
MOV32 R1H, *+XAR4[2] ; R1H = d1
MPYF32 R3H, R1H, R3H ; R3H = v3
MOV32 *+XAR4[2], R0H ; save e(k)
ADDF32 R0H, R2H, R3H ; R0H = v2 + v3
|| MOV32 R2H, *+XAR4[4] ; R2H = d2
MOV32 R3H, *+XAR4[0] ; R3H = a1
MPYF32 R1H, R2H, R3H ; R1H = v6
NOP ; delay slot
SUBF32 R0H, R0H, R1H ; R0H = v5
NOP ; delay slot
MOV32 *+XAR4[4], R0H ; save u(k)
LRETR
.endasmfunc
.end
; end of file
@@ -0,0 +1,95 @@
; DCL_DF11_L1.asm - Full Direct Form 1 implementation in first order
;
;;#############################################################################
;;!
;;! 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 DCL_runDF11_L1, _DCL_runDF11_L1
.endif
.global _DCL_runDF11_L1
.def __cla_DCL_DF11_L1_sp
SIZEOF_LFRAME .set 2
LFRAME_MR3 .set 0
.align 2
__cla_DCL_DF11_L1_sp .usect ".scratchpad:Cla1Prog:_DCL_DF11_L1_LSECT", SIZEOF_LFRAME, 0, 1
.asg __cla_DCL_DF11_L1_sp, LFRAME
.sect "Cla1Prog:_DCL_DF11_L1_LSECT"
; C prototype: float DCL_runDF11_L1(DCL_DF11 *p, float32_t ek);
; argument 1 = *p : 32-bit structure address [MAR0]
; argument 2 = ek : 32-bit floating-point [MR0]
; return = uk : 32-bit floating-point [MR0]
_DCL_runDF11_L1:
; MDEBUGSTOP
MSETFLG RNDF32=1 ; round to nearest even
MMOV32 @LFRAME + LFRAME_MR3, MR3 ; save MR3
MNOP ; MAR0 read stall
MNOP ; MAR0 read stall
MMOV32 MR1, *MAR0[2]++ ; MR1 = b0
MMPYF32 MR2, MR0, MR1 ; MR2 = v2
|| MMOV32 MR3, *MAR0[4]++ ; MR3 = b1
MMOV32 MR1, *MAR0 ; MR1 = d1
MMPYF32 MR3, MR1, MR3 ; MR3 = v3
MMOV32 *MAR0[-2]++, MR0 ; save d1
MADDF32 MR0, MR2, MR3 ; MR0 = v2+v3
|| MMOV32 MR3, *MAR0[4]++ ; MR3 = a1
MMOV32 MR2, *MAR0 ; MR2 = d2
MMPYF32 MR1, MR2, MR3 ; MR1 = v6
MNOP ; delay slot
MSUBF32 MR0, MR0, MR1 ; MR0 = v5
MRCNDD UNC ; return call
MMOV32 *MAR0, MR0 ; save d2
MNOP ; delay slot
MMOV32 MR3, @LFRAME + LFRAME_MR3 ; restore MR3
.unasg LFRAME
; end of file
@@ -0,0 +1,140 @@
; DCL_DF13_C1.asm - Full Direct Form 1 implementation in third order
;
;;#############################################################################
;;!
;;! 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 $defined(__TI_EABI__)
.if __TI_EABI__
.asg DCL_runDF13_C1, _DCL_runDF13_C1
.endif
.endif
.global _DCL_runDF13_C1
.sect "dclfuncs"
; C prototype: float DCL_runDF13_C1(DCL_DF13 *p, float32_t ek)
; argument 1 = *p : 32-bit ARMA structure address [XAR4]
; argument 2 = ek : 32-bit floating-point input [R0H]
; return = uk : 32-bit floating-point [R0H]
; XAR4 = coefficient pointer
; XAR5 = data pointer
.align 2
_DCL_runDF13_C1:
.asmfunc
; context save
PUSH XAR5
MOV32 *SP++, R4H
MOV32 *SP++, R5H
; initialize pointers
MOVL ACC, @XAR4 ; ACC = &p(0) = &b0
ADDB ACC, #0x10 ; ACC = &p(8) = &d0
MOVL XAR5, ACC ; XAR5 = &d0
MOV32 *XAR5++, R0H ; save d0, XAR5 = &d1
; v0 = b0 * d0
MOV32 R1H, *XAR4++ ; R1H = b0
MPYF32 R2H, R0H, R1H ; R2H = v0
|| MOV32 R3H, *XAR5 ; R3H = d1
MOV32 *XAR5++, R0H ; save d0
; v1 = b1 * d1
MOV32 R1H, *XAR4++ ; R1H = b1
MPYF32 R4H, R1H, R3H ; R4H = v1
|| MOV32 R5H, *XAR5 ; R5H = d2
MOV32 *XAR5++, R3H ; save d1
; v2 = b2 * d2
ADDF32 R0H, R2H, R4H ; R0H = v01
|| MOV32 R1H, *XAR4++ ; R1H = b2
MPYF32 R2H, R1H, R5H ; R2H = v2
|| MOV32 R4H, *XAR5 ; R4H = d3
MOV32 *XAR5++, R5H ; save d2
; v3 = b3 * d3
ADDF32 R0H, R0H, R2H ; R0H = v012
|| MOV32 R1H, *XAR4++ ; R1H = b3
MPYF32 R3H, R1H, R4H ; R3H = v3
MOV32 R2H, *+XAR5[6] ; R2H = d7
; XAR4 = &a0, XAR5 = &d4. Indirect offset addressing from here.
; v7 = a3 * d7
ADDF32 R0H, R0H, R3H ; R0H = v0123
|| MOV32 R1H, *+XAR4[6] ; R1H = a3
MPYF32 R3H, R1H, R2H ; R3H = v7
MOV32 R4H, *+XAR5[4] ; R4H = d6
MOV32 *+XAR5[6], R4H ; save d6
; v6 = a2 * d6
SUBF32 R0H, R0H, R3H ; R0H = v01237
|| MOV32 R1H, *+XAR4[4] ; R1H = a2
MPYF32 R2H, R1H, R4H ; R2H = v6
MOV32 R5H, *+XAR5[2] ; R5H = d5
MOV32 *+XAR5[4], R5H ; save d5
; v5 = a1 * d5
SUBF32 R0H, R0H, R2H ; R0H = v012367
|| MOV32 R1H, *+XAR4[2] ; R1H = a1
MPYF32 R2H, R1H, R5H ; R2H = v5
MOV32 R5H, *--SP, UNC
SUBF32 R0H, R0H, R2H ; R0H = v0123567
MOV32 R4H, *--SP, UNC
MOV32 *+XAR5[2], R0H ; save d4
MOV32 *+XAR5[0], R0H ; save u(k)
POP XAR5
LRETR
.endasmfunc
.end
; end of file
@@ -0,0 +1,165 @@
; DCL_DF13_C2C3.asm - Pre-computed Direct Form 1 implementation in third order
;
;;#############################################################################
;;!
;;! 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 $defined(__TI_EABI__)
.if __TI_EABI__
.asg DCL_runDF13_C2, _DCL_runDF13_C2
.asg DCL_runDF13_C3, _DCL_runDF13_C3
.endif
.endif
FASTCR_DF13_C3 .set 0 ; set to 1 to enable shadowed context save/restore
.global _DCL_runDF13_C2
.global _DCL_runDF13_C3
.sect "dclfuncs"
; C prototype: float DCL_runDF13_C2(DCL_DF13 *p, float32_t ek, float32_t vk)
; argument 1 = *p : controller structure address [XAR4]
; argument 2 = ek : controller input [R0H]
; argument 3 = vk : partial product [R1H]
; return = uk : controller output [R0H]
_DCL_runDF13_C2:
.asmfunc
MOV32 R2H, *+XAR4[0] ; R2H = b0
MPYF32 R0H, R0H, R2H ; R0H = e(k) * b0
MOV AR0, #0x18 ; AR0 = 24
ADDF32 R0H, R0H, R1H ; R0H = u(k)
LRETR
.endasmfunc
; C prototype: float DCL_runDF13_C3(DF13 *p, float ek, float uk)
; argument 1 = *p : controller structure address [XAR4]
; argument 2 = ek : controller input [R0H]
; argument 3 = uk : controller output [R1H]
; return : v(k)
_DCL_runDF13_C3:
.asmfunc
; context save
PUSH XAR5
.if FASTCR_DF13_C3 = 0
MOV32 *SP++, R4H
MOV32 *SP++, R5H
MOV32 *SP++, R6H
MOV32 *SP++, R7H
.else
SAVE
.endif
; initialise pointers
MOVL ACC, @XAR4 ; ACC = &p(0) = &b0
ADDB ACC, #0x10 ; ACC = &p(8) = &d0
MOVL XAR5, ACC ; XAR5 = &d0
MOV32 *XAR5++, R0H ; save d0, XAR5 = d1
; v1 = e(k) * b1
MOV32 R2H, *XAR4++ ; R2H = b0
MOV32 R2H, *XAR4++ ; R2H = b1
MPYF32 R3H, R2H, R0H ; R3H = v1
|| MOV32 R4H, *XAR5 ; R4H = d1
MOV32 *XAR5++, R0H ; save e(k-1)
; v2 = e(k-1) * b2
MOV32 R5H, *XAR4++ ; R5H = b2
MPYF32 R2H, R5H, R4H ; R2H = v2
|| MOV32 R6H, *XAR5 ; R6H = d2
MOV32 *XAR5++, R4H ; save e(k-2)
; v3 = e(k-3) * b3
MOV32 R5H, *XAR4++ ; R5H = b3
MPYF32 R7H, R5H, R6H ; R7H = v2
|| MOV32 *XAR5++, R6H ; save e(k-3)
; save v123
ADDF32 R0H, R3H, R2H ; R0H = v1 + v2
MOV32 R5H, *XAR4++ ; R5H = a0
ADDF32 R0H, R0H, R7H ; R0H = v1 + v2 + v3
|| MOV32 R5H, *XAR4++ ; R5H = a1
; v4 = u(k) * a1
MPYF32 R2H, R1H, R5H ; R2H = v4
|| MOV32 *XAR5++, R1H ; XAR5 = &d5
MOV32 R3H, *XAR5 ; R3H = d5
SUBF32 R0H, R0H, R2H ; R0H = v1 + v2 + v3 - v4
MOV32 *XAR5++, R1H ; save u(k-1)
; v5 = u(k-1) * a2
MOV32 R4H, *XAR4++ ; R4H = a2
MPYF32 R5H, R4H, R3H ; R5H = v5
|| MOV32 R1H, *XAR5 ; R2H = d6
MOV32 *XAR5++, R3H ; save u(k-2)
; v6 = u(k-2) * a3
SUBF32 R0H, R0H, R5H ; R0H = v1 + v2 + v3 - v4 - v5
|| MOV32 R6H, *XAR4 ; R6H = a3
MPYF32 R7H, R6H, R1H ; R7H = v7
MOV32 *XAR5, R1H ; save u(k-3)
SUBF32 R0H, R0H, R7H ; save v(k+1)
; context restore
.if FASTCR_DF13_C3 = 0
MOV32 R7H, *--SP, UNC ; do not parallel with previous SUBF32
MOV32 R6H, *--SP, UNC
MOV32 R5H, *--SP, UNC
MOV32 R4H, *--SP, UNC
.else
RESTORE
.endif
POP XAR5
LRETR
.endasmfunc
.end
; end of file
@@ -0,0 +1,135 @@
; DCL_DF13_L1.asm - Full Direct Form 1 implementation in third order
;
;;#############################################################################
;;!
;;! 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 DCL_runDF13_L1, _DCL_runDF13_L1
.endif
.global _DCL_runDF13_L1
.def __cla_DCL_DF13_L1_sp
SIZEOF_LFRAME .set 6
LFRAME_MR1 .set 0
LFRAME_MR3 .set 2
LFRAME_MAR0 .set 4
LFRAME_MAR1 .set 5
.align 2
__cla_DCL_DF13_L1_sp .usect ".scratchpad:Cla1Prog:_DCL_DF13_L1_LSECT", SIZEOF_LFRAME, 0, 1
.asg __cla_DCL_DF13_L1_sp, LFRAME
.sect "Cla1Prog:_DCL_DF13_L1_LSECT"
; C prototype: float DCL_runDF13_L1(DCL_DF13 *p, float32_t ek);
; argument 1 = *p : 32-bit structure address [MAR0]
; argument 2 = ek : 32-bit floating-point [MR0]
; return = uk : 32-bit floating-point [MR0]
_DCL_runDF13_L1:
; MDEBUGSTOP
MSETFLG RNDF32=1 ; round to nearest even
MMOV32 @LFRAME + LFRAME_MR3, MR3 ; save MR3
MNOP ; MAR0 read stall
MMOV16 @LFRAME + LFRAME_MAR0, MAR0 ; store MAR0 to frame
MMOV16 @LFRAME + LFRAME_MAR1, MAR1 ; store MAR1 to frame
MNOP ; MAR0 read stall
MMOVZ16 MR2, @LFRAME + LFRAME_MAR0 ; MR2 = &b0
MMOV16 MAR1, MR2, #0x10 ; MAR1 = &d0
MMOV32 MR1, *MAR0[2]++ ; MR1 = b0
MNOP ; MAR1 load stall
MMPYF32 MR2, MR0, MR1 ; MR2 = v0
MMOV32 *MAR1[2]++, MR0 ; save d0
MMOV32 MR0, *MAR0[2]++ ; MR0 = b1
MMOV32 MR1, *MAR1[2]++ ; MR1 = d1
MMPYF32 MR3, MR0, MR1 ; MR3 = v1
MMOV32 MR0, *MAR0[2]++ ; MR0 = b2
MADDF32 MR2, MR2, MR3 ; MR2 = v0 + v1
|| MMOV32 MR1, *MAR1[2]++ ; MR1 = d2
MMPYF32 MR3, MR0, MR1 ; MR3 = v2
MMOV32 MR0, *MAR0[4]++ ; MR0 = b3
MADDF32 MR2, MR2, MR3 ; MR2 = v0 + v1 + v2
|| MMOV32 MR1, *MAR1[4]++ ; MR1 = d3
MMPYF32 MR3, MR0, MR1 ; MR3 = v3
MMOV32 MR0, *MAR0[2]++ ; MR0 = a1
MADDF32 MR2, MR2, MR3 ; MR2 = v0 + v1 + v2 + v3
|| MMOV32 MR1, *MAR1[2]++ ; MR1 = d5
MMPYF32 MR3, MR0, MR1 ; MR3 = v5
MMOV32 MR0, *MAR0[2]++ ; MR0 = a2
MSUBF32 MR2, MR2, MR3 ; MR2 = v0 + v1 + v2 + v3 - v5
|| MMOV32 MR1, *MAR1[2]++ ; MR1 = d6
MMPYF32 MR3, MR0, MR1 ; MR3 = v6
MMOV32 MR0, *MAR0[14]++ ; MR0 = a3, MAR0 = &d6
MSUBF32 MR2, MR2, MR3 ; MR2 = v0 + v1 + v2 + v3 - v5 - v6
|| MMOV32 MR1, *MAR1[-6]++ ; MR1 = d7, MAR1 = &d4
MMPYF32 MR3, MR0, MR1 ; MR3 = v7
MNOP
MSUBF32 MR0, MR2, MR3 ; MR0 = v0 + v1 + v2 + v3 - v5 - v6 - v7
MNOP
MMOV32 *MAR1[-6]++, MR0 ; save uk = d4
MMOVD32 MR1, *MAR0[-2]++ ; u(k-3) <- u(k-2)
MMOVD32 MR1, *MAR0[-2]++ ; u(k-2) <- u(k-1)
MMOVD32 MR1, *MAR0[-4]++ ; u(k-1) <- u(k)
MMOVD32 MR1, *MAR0[-2]++ ; e(k-3) <- e(k-2)
MMOVD32 MR1, *MAR0[-2]++ ; e(k-2) <- e(k-1)
MRCNDD UNC ; return call
MMOVD32 MR1, *MAR0 ; e(k-1) <- e(k)
MMOV16 MAR1, @LFRAME + LFRAME_MAR1 ; restore MAR1
MMOV32 MR3, @LFRAME + LFRAME_MR3 ; restore MR3
.unasg LFRAME
; end of file
@@ -0,0 +1,149 @@
; DCL_DF13_L2L3.asm - Pre-computed Direct Form 1 implementation in third order
;
;;#############################################################################
;;!
;;! 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 DCL_runDF13_L2, _DCL_runDF13_L2
.asg DCL_runDF13_L3, _DCL_runDF13_L3
.endif
.global _DCL_runDF13_L2
.global _DCL_runDF13_L3
.def __cla_DCL_DF13_L2L3_sp
SIZEOF_LFRAME .set 6
LFRAME_MR1 .set 0
LFRAME_MR3 .set 2
LFRAME_MAR0 .set 4
LFRAME_MAR1 .set 5
__cla_DCL_DF13_L2L3_sp .usect ".scratchpad:Cla1Prog:_DCL_DF13_L2L3_LSECT", SIZEOF_LFRAME, 0, 1
.asg __cla_DCL_DF13_L2L3_sp, LFRAME
.sect "Cla1Prog:_DCL_DF13_L2L3_LSECT"
.align 2
; C prototype: float DCL_runDF13_L2(DCL_DF13 *p, float32_t ek, float32_t vk);
; argument 1 = *p : controller structure address [MAR0]
; argument 2 = e(k) : controller input [MR0]
; argument 3 = v(k) : partial control [MR1]
; return = u(k) : controller output [MR0]
_DCL_runDF13_L2:
; MDEBUGSTOP
MSETFLG RNDF32=1 ; round to nearest even
MNOP ; MAR0 load delay slot 2
MNOP ; MAR0 load delay slot 3
MMOV32 MR2, *MAR0[0]++ ; MR2 = b0
MRCNDD UNC ; return call
MMPYF32 MR0, MR0, MR2 ; MR0 = e(k) * b0
MNOP
MADDF32 MR0, MR0, MR1 ; MR0 = u(k)
; C prototype: float DCL_runDF13_L3(DF13 *p, float ek, float uk)
; argument 1 = *p : structure address [MAR0]
; argument 2 = ek : controller input [MR0]
; argument 3 = uk : u(k) output [MR1]
; return: v(k+1) partial control [MR0]
_DCL_runDF13_L3:
; MDEBUGSTOP
MSETFLG RNDF32=1 ; round to nearest even
MMOV32 @LFRAME + LFRAME_MR1, MR1 ; save MR1
MMOV32 @LFRAME + LFRAME_MR3, MR3 ; save MR3
MMOV16 @LFRAME + LFRAME_MAR0, MAR0 ; store MAR0 to frame
MMOV16 @LFRAME + LFRAME_MAR1, MAR1 ; save MAR1
MNOP ; MAR0 read stall
MMOVZ16 MR2, @LFRAME + LFRAME_MAR0 ; MR2 = &b0
MMOV16 MAR1, MR2, #0x10 ; MAR1 = &d0
MMOV32 MR1, *MAR0[2]++ ; MR1 = b0
MNOP ; MAR1 load stall
MNOP
MMOV32 *MAR1[2]++, MR0 ; save d0
MMOV32 MR3, *MAR1 ; MR3 = d1
MMOV32 *MAR1[2]++, MR0 ; save d1
MMOV32 MR1, *MAR0[2]++ ; MR1 = b1
MMPYF32 MR0, MR0, MR1 ; MR0 = v1
MMOV32 MR1, *MAR0[2]++ ; MR1 = b2
MMOV32 MR2, *MAR1 ; MR2 = d2
MMOV32 *MAR1, MR3 ; save d2
MMPYF32 MR2, MR1, MR3 ; MR2 = v2
MMOV32 MR3, *MAR1[8]++ ; MR3 = b3
MADDF32 MR0, MR0, MR2 ; MR0 = v12
MMOV32 MR1, *MAR0[8]++ ; MR1 = b3
MMPYF32 MR2, MR1, MR3 ; MR2 = v3
MMOV32 MR3, *MAR1[-2]++ ; MR3 = d6
MADDF32 MR0, MR0, MR2 ; MR0 = v123
MMOV32 MR1, *MAR0[-2]++ ; MR1 = a3
MMOV32 MR2, *MAR1[2]++ ; MR2 = d5
MMOV32 *MAR1[-2]++, MR2 ; save d6
MMPYF32 MR3, MR1, MR3 ; MR3 = v6
MMOV32 MR1, *MAR0[-2]++ ; MR1 = a2
MSUBF32 MR0, MR0, MR3 ; MR0 = v1236
MNOP
MMPYF32 MR3, MR1, MR2 ; MR3 = v5
MMOV32 MR1, *MAR0 ; MR1 = a1
MSUBF32 MR0, MR0, MR3 ; MR0 = v12356
MMOV32 MR2, @LFRAME + LFRAME_MR1 ; MR2 = uk
MMPYF32 MR3, MR1, MR2 ; MR4 = v4
|| MMOV32 *MAR1, MR2 ; save d5
MRCNDD UNC ; return call
MSUBF32 MR0, MR0, MR3 ; MR0 = v(k+1)
MMOV16 MAR1, @LFRAME + LFRAME_MAR1 ; restore MAR1
MMOV32 MR3, @LFRAME + LFRAME_MR3 ; restore MR3
.unasg LFRAME
; end of file
@@ -0,0 +1,112 @@
; DCL_DF22_C1.asm - Full Direct Form 2 implementation in second order
;
;;#############################################################################
;;!
;;! 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 $defined(__TI_EABI__)
.if __TI_EABI__
.asg DCL_runDF22_C1, _DCL_runDF22_C1
.endif
.endif
FASTCR_DF22_C1 .set 0 ; set to 1 to enable shadowed context save/restore
.global _DCL_runDF22_C1
.sect "dclfuncs"
; C prototype: float DCL_runDF22_C1(DCL_DF22 *p, float32_t ek)
; argument 1 = *p : 32-bit ARMA structure address [XAR4]
; argument 2 = ek : 32-bit floating-point input [R0H]
; return = uk : 32-bit floating-point [R0H]
.align 2
_DCL_runDF22_C1:
.asmfunc
.if FASTCR_DF22_C1 = 0
MOV32 *SP++, R4H
MOV32 *SP++, R5H
MOV32 *SP++, R6H
MOV32 *SP++, R7H
.else
SAVE
.endif
MOV32 R2H, *XAR4++ ; R2H = b0
MPYF32 R3H, R2H, R0H ; R3H = v0 = b0 * ek
|| MOV32 R4H, *XAR4++ ; R4H = b1
MPYF32 R5H, R4H, R0H ; R5H = v1 = b1 * ek
|| MOV32 R6H, *XAR4++ ; R6H = b2
MPYF32 R4H, R6H, R0H ; R4H = v2 = b2 * ek
|| MOV32 R7H, *XAR4++ ; R7H = a1
MOV32 R0H, *XAR4++ ; R0H = a2
MOV32 R6H, *XAR4++ ; R6H = x1
ADDF32 R1H, R3H, R6H ; R1H = uk = v0 + x1
|| MOV32 R2H, *XAR4 ; R2H = x2
ADDF32 R5H, R5H, R2H ; R5H = v1 + x2
MPYF32 R6H, R7H, R1H ; R6H = v3 = a1 * uk
MPYF32 R7H, R0H, R1H ; R7H = v4 = a2 * uk
SUBF32 R5H, R5H, R6H ; R5H = x1d = v1 + x2 - v3
SUBF32 R6H, R4H, R7H ; R6H = x2d = v2 - v4
MOV32 R0H, R1H, UNC ; return uk
MOV32 *XAR4, R6H ; save x2
MOV32 *--XAR4, R5H ; save x1
.if FASTCR_DF22_C1 = 0
MOV32 R7H, *--SP, UNC
MOV32 R6H, *--SP, UNC
MOV32 R5H, *--SP, UNC
MOV32 R4H, *--SP, UNC
.else
RESTORE
.endif
LRETR
.endasmfunc
.end
; end of file
@@ -0,0 +1,130 @@
; DCL_DF22_C2C3.asm - Pre-computed Direct Form 2 implementation in second order
;
;;#############################################################################
;;!
;;! 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 $defined(__TI_EABI__)
.if __TI_EABI__
.asg DCL_runDF22_C2, _DCL_runDF22_C2
.asg DCL_runDF22_C3, _DCL_runDF22_C3
.endif
.endif
FASTCR_DF22_C3 .set 0 ; set to 1 to enable shadowed context save/restore
.global _DCL_runDF22_C2
.global _DCL_runDF22_C3
.sect "dclfuncs"
; C prototype: float DCL_runDF22_C2(DCL_DF22 *p, float32_t ek)
; argument 1 = *p : controller structure address [XAR4]
; argument 2 = ek : controller input [R0H]
; return = uk : controller output [R0H]
.align 2
_DCL_runDF22_C2:
.asmfunc
MOV32 R1H, *+XAR4[0] ; R1H = b0
MOV AR0, #0xA ; AR0 = 10
MPYF32 R0H, R0H, R1H ; R0H = ek * b0
MOV32 R1H, *+XAR4[AR0] ; R1H = x1
ADDF32 R0H, R0H, R1H ; R0H = uk
LRETR
.endasmfunc
; C prototype: void DCL_runDF22_C3(DF22 *p, float ek, float uk)
; argument 1 = *p : controller structure address [XAR4]
; argument 2 = ek : controller input [R0H]
; argument 3 = uk : u(k) output [R1H]
; return: void
.align 2
_DCL_runDF22_C3:
.asmfunc
.if FASTCR_DF22_C3 = 0
MOV32 *SP++, R4H
MOV32 *SP++, R5H
MOV32 *SP++, R6H
MOV32 *SP++, R7H
.else
SAVE
.endif
MOV32 R2H, *XAR4++ ; XAR4 = &b1
MOV32 R2H, *XAR4++ ; R2H = b1
MPYF32 R3H, R2H, R0H ; R3H = v1
|| MOV32 R4H, *XAR4++ ; R4H = b2
MPYF32 R5H, R4H, R0H ; R5H = v2
|| MOV32 R6H, *XAR4++ ; R6H = a1
MPYF32 R7H, R6H, R1H ; R7H = v3
|| MOV32 R0H, *XAR4++ ; R0H = a2, XAR4 = &x1
MPYF32 R0H, R0H, R1H ; R0H = v4
|| MOV32 R2H, *+XAR4[2] ; R2H = x2
ADDF32 R3H, R3H, R2H ; R3H = v1 + x2
SUBF32 R5H, R5H, R0H ; R5H = x2d
SUBF32 R2H, R3H, R7H ; R2H = x1d
;|| MOV32 R7H, *--SP ; [CODEGEN-1534] - removed for fast CR
NOP ; delay slot for R2H
MOV32 *+XAR4[2], R5H ; save x2
MOV32 *+XAR4[0], R2H ; save x1
.if FASTCR_DF22_C3 = 0
MOV32 R7H, *--SP, UNC
MOV32 R6H, *--SP, UNC
MOV32 R5H, *--SP, UNC
MOV32 R4H, *--SP, UNC
.else
RESTORE
.endif
LRETR
.endasmfunc
.end
; end of file
@@ -0,0 +1,101 @@
; DCL_DF22_L1.asm - Full Direct Form 2 implementation in second order
;
;;#############################################################################
;;!
;;! 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 DCL_runDF22_L1, _DCL_runDF22_L1
.endif
.global _DCL_runDF22_L1
.def __cla_DCL_DF22_L1_sp
SIZEOF_LFRAME .set 2
LFRAME_MR3 .set 0
.align 2
__cla_DCL_DF22_L1_sp .usect ".scratchpad:Cla1Prog:_DCL_DF22_L1_LSECT", SIZEOF_LFRAME, 0, 1
.asg __cla_DCL_DF22_L1_sp, LFRAME
.sect "Cla1Prog:_DCL_DF22_L1_LSECT"
; C prototype: float DCL_runDF22_L1(DCL_DF22 *p, float32_t ek)
; argument 1 = *p : structure address [MAR0]
; argument 2 = ek : controller input [MR0]
; return = uk : controller output [MR0]
_DCL_runDF22_L1:
; MDEBUGSTOP
MSETFLG RNDF32=1 ; round to nearest even
MMOV32 @LFRAME + LFRAME_MR3, MR3 ; save MR3
MNOP ; MAR0 load delay
MMOV32 MR1, *MAR0[10]++ ; MR1 = b0
MMPYF32 MR2, MR0, MR1 ; MR2 = v0
|| MMOV32 MR3, *MAR0[-8]++ ; MR3 = x1
MADDF32 MR1, MR2, MR3 ; MR1 = uk
|| MMOV32 MR3, *MAR0[10]++ ; MR3 = b1
MMPYF32 MR2, MR0, MR3 ; MR2 = v1
|| MMOV32 MR3, *MAR0[-6]++ ; MR3 = x2
MADDF32 MR3, MR2, MR3 ; MR3 = v1 + x2
|| MMOV32 MR2, *MAR0[4]++ ; MR2 = a1
MMPYF32 MR2, MR2, MR1 ; MR2 = v3
MNOP ; MR2 delay slot
MSUBF32 MR3, MR3, MR2 ; MR3 = x1d
MMOV32 *MAR0[-6]++, MR3 ; save x1
MMOV32 MR3, *MAR0[4]++ ; MR3 = b2
MMPYF32 MR2, MR0, MR3 ; MR2 = v2
|| MMOV32 MR3, *MAR0[4]++ ; MR3 = a2
MMOV32 MR0, MR1 ; return uk
MMPYF32 MR1, MR1, MR3 ; MR1 = v4
MRCNDD UNC ; return call
MSUBF32 MR3, MR2, MR1 ; MR3 = x2d
MMOV32 *MAR0, MR3 ; save x2
MMOV32 MR3, @LFRAME + LFRAME_MR3 ; restore MR3
.unasg LFRAME
; end of file
@@ -0,0 +1,121 @@
; DCL_DF22_L2L3.asm - Pre-computed Direct Form 2 implementation in second order
;
;;#############################################################################
;;!
;;! 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 DCL_runDF22_L2, _DCL_runDF22_L2
.asg DCL_runDF22_L3, _DCL_runDF22_L3
.endif
.global _DCL_runDF22_L2
.global _DCL_runDF22_L3
.def __cla_DCL_DF22_L2L3_sp
SIZEOF_LFRAME .set 2
LFRAME_MR3 .set 0
.align 2
__cla_DCL_DF22_L2L3_sp .usect ".scratchpad:Cla1Prog:_DCL_DF22_L2L3_LSECT", SIZEOF_LFRAME, 0, 1
.asg __cla_DCL_DF22_L2L3_sp, LFRAME
.sect "Cla1Prog:_DCL_DF22_L2L3_LSECT"
; C prototype:
; float DCL_runDF22_L2(DCL_DF22 *p, float32_t ek)
; argument 1 = *p : structure address [MAR0]
; argument 2 = ek : controller input [MR0]
; return = uk : controller output [MR0]
_DCL_runDF22_L2:
; MDEBUGSTOP
MSETFLG RNDF32=1 ; round to nearest even
MNOP ; MAR0 load delay
MNOP ; MAR0 load delay
MMOV32 MR1, *MAR0[10]++ ; MR1 = b0, MAR0 = &x1
MRCNDD UNC ; return call
MMPYF32 MR0, MR0, MR1 ; MR0 = v0
MMOV32 MR1, *MAR0 ; MR1 = x1
MADDF32 MR0, MR0, MR1 ; MR0 = uk
; C prototype: void DCL_runDF22_L3(DF22 *p, float ek, float uk)
; argument 1 = *p : structure address [MAR0]
; argument 2 = ek : controller input [MR0]
; argument 3 = uk : u(k) output [MR1]
; return: void
_DCL_runDF22_L3:
; MDEBUGSTOP
MSETFLG RNDF32=1 ; round to nearest even
MMOV32 @LFRAME + LFRAME_MR3, MR3 ; save MR3
MNOP ; MAR0 load delay
MMOV32 MR2, *MAR0[2]++ ; MR2 = b0
MMOV32 MR2, *MAR0[2]++ ; MR2 = b1
MMPYF32 MR2, MR0, MR2 ; MR2 = v1
|| MMOV32 MR3, *MAR0[2]++ ; MR3 = b2
MMPYF32 MR3, MR0, MR3 ; MR3 = v2
|| MMOV32 MR0, *MAR0[6]++ ; MR0 = a1
MMPYF32 MR0, MR0, MR1 ; MR0 = v3
MNOP
MSUBF32 MR2, MR2, MR0 ; MR2 = v1 - v3
MMOV32 MR0, *MAR0[-2]++ ; MR0 = x2
MADDF32 MR2, MR2, MR0 ; MR2 = x1d
MNOP
MMOV32 *MAR0[-2]++, MR2 ; save x1
MMOV32 MR2, *MAR0[4]++ ; MR2 = a2
MMPYF32 MR2, MR2, MR1 ; MR2 = v4
MNOP
MSUBF32 MR0, MR3, MR2 ; MR0 = x2d
MRCNDD UNC ; return call
MMOV32 *MAR0, MR0 ; save x2
MNOP ; return delay 2
MMOV32 MR3, @LFRAME + LFRAME_MR3 ; restore MR3
.unasg LFRAME
; end of file
@@ -0,0 +1,125 @@
; DCL_DF23_C1.asm - Full Direct Form 2 implementation in third order
;
;;#############################################################################
;;!
;;! 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 $defined(__TI_EABI__)
.if __TI_EABI__
.asg DCL_runDF23_C1, _DCL_runDF23_C1
.endif
.endif
FASTCR_DF23_C1 .set 0 ; set to 1 to enable shadowed context save/restore
.global _DCL_runDF23_C1
.sect "dclfuncs"
; C prototype: float DCL_runDF23_C1(DCL_DF23 *p, float32_t ek)
; argument 1 = *p : 32-bit ARMA structure address [XAR4]
; argument 2 = ek : 32-bit floating-point input [R0H]
; return = uk : 32-bit floating-point [R0H]
.align 2
_DCL_runDF23_C1:
.asmfunc
PUSH XAR5
.if FASTCR_DF23_C1 = 0
MOV32 *SP++, R4H
MOV32 *SP++, R5H
MOV32 *SP++, R6H
MOV32 *SP++, R7H
.else
SAVE
.endif
MOVL ACC, @XAR4 ; ACC = &b0
ADDB ACC, #0xE ; ACC = &x1
MOVL XAR5, ACC ; XAR5 = &x1
MOV32 R1H, *XAR5++ ; R1H = x1
MOV32 R2H, *XAR4++ ; R2H = b0
MPYF32 R3H, R2H, R0H ; R3H = v1
MOV32 R2H, *XAR4++ ; R2H = b1
ADDF32 R7H, R1H, R3H ; R7H = uk
|| MOV32 R3H, *XAR4++ ; R3H = b2
MPYF32 R1H, R2H, R0H ; R1H = v2
|| MOV32 R4H, *XAR4++ ; R4H = b3
MPYF32 R2H, R3H, R0H ; R2H = v4
|| MOV32 R5H, *XAR4++ ; R5H = a1
MPYF32 R3H, R4H, R0H ; R3H = v6
|| MOV32 R6H, *XAR4++ ; R6H = a2
MPYF32 R4H, R5H, R7H ; R4H = v3
|| MOV32 R0H, *XAR5++ ; R0H = x2
ADDF32 R1H, R0H, R1H ; R1H = v2 + x2
MOV32 R0H, *XAR4++ ; R0H = a3
SUBF32 R1H, R1H, R4H ; R1H = x1d
MPYF32 R5H, R6H, R7H ; R5H = v5
|| MOV32 R6H, *XAR5 ; R6H = x3
ADDF32 R2H, R2H, R6H ; R2H = v4 + x3
MOV32 *XAR4++, R1H ; save x1
SUBF32 R2H, R2H, R5H ; R2H = x2d
MPYF32 R5H, R0H, R7H ; R5H = v7
MOV32 *XAR4++, R2H ; save x2
SUBF32 R3H, R3H, R5H ; R3H = x3d
MOV32 R0H, R7H, UNC ; save uk
MOV32 *XAR4, R3H ; save x3
.if FASTCR_DF23_C1 = 0
MOV32 R7H, *--SP, UNC
MOV32 R6H, *--SP, UNC
MOV32 R5H, *--SP, UNC
MOV32 R4H, *--SP, UNC
.else
RESTORE
.endif
POP XAR5
LRETR
.endasmfunc
.end
; end of file
@@ -0,0 +1,140 @@
; DCL_DF23_C2C3.asm - Pre-coomputed Direct Form 2 implementation in third order
;
;;#############################################################################
;;!
;;! 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 $defined(__TI_EABI__)
.if __TI_EABI__
.asg DCL_runDF23_C2, _DCL_runDF23_C2
.asg DCL_runDF23_C3, _DCL_runDF23_C3
.endif
.endif
FASTCR_DF23_C3 .set 0 ; set to 1 to enable shadowed context save/restore
.global _DCL_runDF23_C2
.global _DCL_runDF23_C3
.sect "dclfuncs"
; C prototype: float DCL_runDF23_C2(DCL_DF23 *p, float32_t ek)
; argument 1 = *p : controller structure address [XAR4]
; argument 2 = ek : controller input [R0H]
; return = uk : controller output [R0H]
.align 2
_DCL_runDF23_C2:
.asmfunc
MOV32 R1H, *+XAR4[0] ; R1H = b0
MOV AR0, #0xE ; AR0 = 14
MPYF32 R0H, R0H, R1H ; R0H = ek * b0
MOV32 R1H, *+XAR4[AR0] ; R1H = x1
ADDF32 R0H, R0H, R1H ; R0H = uk
LRETR
.endasmfunc
; C prototype: void DCL_runDF23_C3(DF23 *p, float ek, float uk)
; argument 1 = *p : controller structure address [XAR4]
; argument 2 = ek : controller input [R0H]
; argument 3 = uk : u(k) output [R1H]
; return: void
.align 2
_DCL_runDF23_C3:
.asmfunc
.if FASTCR_DF23_C3 = 0
MOV32 *SP++, R4H
MOV32 *SP++, R5H
MOV32 *SP++, R6H
MOV32 *SP++, R7H
.else
SAVE
.endif
MOVL ACC, @XAR4 ; ACC = &b0
ADDB ACC, #0x10 ; ACC = &x2
MOVL XAR5, ACC ; XAR5 = &x2
MOV32 R2H, *XAR4++ ; R2H = b0
MOV32 R2H, *XAR4++ ; R2H = b1
MPYF32 R3H, R0H, R2H ; R3H = v2
|| MOV32 R4H, *XAR5++ ; R4H = x2
MOV32 R2H, *XAR4++ ; R2H = b2
ADDF32 R3H, R3H, R4H ; R3H = v2 + x2
|| MOV32 R4H, *XAR4++ ; R4H = b3
MPYF32 R5H, R0H, R2H ; R5H = v4
|| MOV32 R6H, *XAR4++ ; R6H = a1
MPYF32 R7H, R4H, R0H ; R7H = v6
|| MOV32 R4H, *XAR4++ ; R4H = a2
MPYF32 R6H, R6H, R1H ; R6H = v3
MOV32 R0H, *XAR4++ ; R0H = a3
SUBF32 R3H, R3H, R6H ; R3H = x1d
MPYF32 R4H, R4H, R1H ; R4H = v5
MOV32 R2H, *XAR5 ; R2H = x3
MOV32 *XAR4++, R3H ; save x1
ADDF32 R5H, R5H, R2H ; R5H = v4 + x3
MPYF32 R1H, R0H, R1H ; R1H = v7
SUBF32 R4H, R5H, R4H ; R4H = x2d
SUBF32 R7H, R7H, R1H ; R7H = x3d
MOV32 *XAR4++, R4H ; save x2
MOV32 *XAR4, R7H ; save x3
.if FASTCR_DF23_C3 = 0
MOV32 R7H, *--SP, UNC
MOV32 R6H, *--SP, UNC
MOV32 R5H, *--SP, UNC
MOV32 R4H, *--SP, UNC
.else
RESTORE
.endif
LRETR
.endasmfunc
.end
; end of file
@@ -0,0 +1,115 @@
; DCL_DF23_L1.asm - Full Direct Form 2 implementation in third order
;
;;#############################################################################
;;!
;;! 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 DCL_runDF23_L1, _DCL_runDF23_L1
.endif
.global _DCL_runDF23_L1
.def __cla_DCL_DF23_L1_sp
SIZEOF_LFRAME .set 2
LFRAME_MR3 .set 0
.align 2
__cla_DCL_DF23_L1_sp .usect ".scratchpad:Cla1Prog:_DCL_DF23_L1_LSECT", SIZEOF_LFRAME, 0, 1
.asg __cla_DCL_DF23_L1_sp, LFRAME
.sect "Cla1Prog:_DCL_DF23_L1_LSECT"
; C prototype: float DCL_runDF23_L1(DCL_DF23 *p, float32_t ek);
; argument 1 = *p : 32-bit structure address [MAR0]
; argument 2 = ek : 32-bit floating-point [MR0]
; return = uk : 32-bit floating-point [MR0]
_DCL_runDF23_L1:
; MDEBUGSTOP
MSETFLG RNDF32=1 ; round to nearest even
MMOV32 @LFRAME + LFRAME_MR3, MR3 ; save MR3
MNOP ; MAR0 load delay slot 3
MMOV32 MR1, *MAR0[2]++ ; MR1 = b0
MMPYF32 MR2, MR1, MR0 ; MR2 = v1
|| MMOV32 MR3, *MAR0[12]++ ; MR3 = b1
MMOV32 MR1, *MAR0[2]++ ; MR1 = x1
MADDF32 MR2, MR1, MR2 ; MR2 = uk
MMPYF32 MR3, MR0, MR3 ; MR3 = v2
MMOV32 MR1, *MAR0[-8]++ ; MR1 = x2
MADDF32 MR3, MR1, MR3 ; MR3 = x2 + v2
|| MMOV32 MR1, *MAR0[-4]++ ; MR1 = a1
MMPYF32 MR1, MR1, MR2 ; MR1 = v3
MNOP
MSUBF32 MR3, MR3, MR1 ; MR3 = x1d
MMOV32 MR1, *MAR0[10]++ ; MR1 = b2
MMOV32 *MAR0[4]++, MR3 ; save x1
MMPYF32 MR1, MR0, MR1 ; MR1 = v4
MMOV32 MR3, *MAR0[-8]++ ; MR3 = x3
MADDF32 MR3, MR1, MR3 ; MR3 = x3 + v4
|| MMOV32 MR1, *MAR0[-4]++ ; MR1 = a2
MMPYF32 MR1, MR1, MR2 ; MR1 = v5
MNOP
MSUBF32 MR3, MR3, MR1 ; MR3 = x2d
MMOV32 MR1, *MAR0[10]++ ; MR1 = b3
MMOV32 *MAR0[-4]++, MR3 ; save x2
MMPYF32 MR1, MR0, MR1 ; MR1 = v6
|| MMOV32 MR3, *MAR0[6]++ ; MR3 = a3
MMPYF32 MR3, MR2, MR3 ; MR3 = v7
MSUBF32 MR1, MR1, MR3 ; MR1 = x3d
MRCNDD UNC ; return call
MMOV32 MR0, MR2, UNC ; return uk
MMOV32 MR3, @LFRAME + LFRAME_MR3 ; restore MR3
MMOV32 *MAR0[0]++, MR1 ; save x3
.unasg LFRAME
; end of file
@@ -0,0 +1,131 @@
; DCL_DF23_L2L3.asm - Pre-computed Direct Form 2 implementation in third order
;
;;#############################################################################
;;!
;;! 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 DCL_runDF23_L2, _DCL_runDF23_L2
.asg DCL_runDF23_L3, _DCL_runDF23_L3
.endif
.global _DCL_runDF23_L2
.global _DCL_runDF23_L3
.def __cla_DCL_DF23_L2L3_sp
SIZEOF_LFRAME .set 2
LFRAME_MR3 .set 0
.align 2
__cla_DCL_DF23_L2L3_sp .usect ".scratchpad:Cla1Prog:_DCL_DF23_L2L3_LSECT", SIZEOF_LFRAME, 0, 1
.asg __cla_DCL_DF23_L2L3_sp, LFRAME
.sect "Cla1Prog:_DCL_DF23_L2L3_LSECT"
; C prototype: float DCL_runDF23_L2(DCL_DF23 *p, float32_t ek);
; argument 1 = *p : controller structure address [MAR0]
; argument 2 = ek : controller input [MR0]
; return = uk : controller output [MR0]
_DCL_runDF23_L2:
; MDEBUGSTOP
MSETFLG RNDF32=1 ; round to nearest even
MNOP ; MAR0 load delay slot 2
MNOP ; MAR0 load delay slot 3
MMOV32 MR2, *MAR0[14]++ ; MR2 = b0
MRCNDD UNC ; return call
MMPYF32 MR1, MR0, MR2 ; MR1 = ek * b0
MMOV32 MR2, *MAR0[0]++ ; MR2 = x1
MADDF32 MR0, MR1, MR2 ; MR0 = uk
; C prototype: void DCL_runDF23_L3(DF23 *p, float ek, float uk);
; argument 1 = *p : structure address [MAR0]
; argument 2 = ek : controller input [MR0]
; argument 3 = uk : u(k) controller output [MR1]
; return: void
_DCL_runDF23_L3:
; MDEBUGSTOP
MSETFLG RNDF32=1 ; round to nearest even
MMOV32 @LFRAME + LFRAME_MR3, MR3 ; save MR3
MNOP ; MAR0 load delay slot 3
MMOV32 MR2, *MAR0[2]++ ; MR2 = b0
MMOV32 MR2, *MAR0[14]++ ; MR2 = b1
MMPYF32 MR2, MR0, MR2 ; MR2 = v2
MMOV32 MR3, *MAR0[-8]++ ; MR3 = x2
MADDF32 MR2, MR2, MR3 ; MR2 = x2 + v2
MMOV32 MR3, *MAR0[-4]++ ; MR3 = a1
MMPYF32 MR3, MR1, MR3 ; MR3 = v3
MNOP
MSUBF32 MR2, MR2, MR3 ; MR2 = x1d
MMOV32 MR3, *MAR0[10]++ ; MR3 = b2
MMOV32 *MAR0[4]++, MR2 ; save x1
MMPYF32 MR3, MR0, MR3 ; MR3 = v4
MMOV32 MR2, *MAR0[-8]++ ; MR2 = x3
MADDF32 MR2, MR2, MR3 ; MR2 = x3 + v4
MMOV32 MR3, *MAR0[-4]++ ; MR3 = a2
MMPYF32 MR3, MR1, MR3 ; MR3 = v5
MNOP
MSUBF32 MR2, MR2, MR3 ; MR2 = x2d
MMOV32 MR3, *MAR0[10]++ ; MR3 = b3
MMOV32 *MAR0[-4]++, MR2 ; save x2
MMPYF32 MR3, MR0, MR3 ; MR3 = v6
MMOV32 MR2, *MAR0[6]++ ; MR2 = a3
MMPYF32 MR2, MR1, MR2 ; MR2 = v7
MNOP
MSUBF32 MR2, MR3, MR2 ; MR2 = x3d
MRCNDD UNC ; return call
MMOV32 *MAR0[0]++, MR2 ; save x3
MNOP
MMOV32 MR3, @LFRAME + LFRAME_MR3 ; restore MR3
.unasg LFRAME
; end of file
@@ -0,0 +1,199 @@
; DCL_NLPID_C3.asm - Series form nonlinear PID controller
;
;;#############################################################################
;;!
;;! 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 $defined(__TI_EABI__)
.if __TI_EABI__
.asg DCL_runNLPID_C3, _DCL_runNLPID_C3
.endif
.endif
.global _DCL_runNLPID_C3
.sect "dclfuncs"
; C prototype: float32_t DCL_runNLPID_C3(DCL_NLPID *p, float32_t rk, float32_t yk, float32_t lk)
; argument 1 = *p : [XAR4] NLPID structure address
; argument 2 = rk : [R0H] reference - normalized [-1.0f, +1.0f]
; argument 3 = yk : [R1H] feedback - normalized [-1.0f, +1.0f]
; argument 4 = lk : [R2H] saturation - either 0.0f (saturated) or 1.0f (in range)
; return = uk : [R0H] control
.align 2
_DCL_runNLPID_C3:
.asmfunc
.if (.TMS320C2800_TMU1 = 1)
; normalized servo error
SUBF32 R0H, R0H, R1H ; R0H = ek
ZERO R5H ; R5H = 0.0f, SUBF32 delay slot
MPYF32 R0H, #0.5, R0H ; R0H = ek/2 = v1
ADDF32 R4H, R5H, #1.0 ; R4H = 1.0f, MPYF32 delay slot
ABSF32 R3H, R0H ; R3H = |ek/2| = v3
SUBF32 R5H, #-1.0, R5H ; R5H = -1.0f
CMPF32 R0H, #0.0 ; set flags on v1
MOV32 R4H, R5H, LT ; R4H = v2
MOV32 *SP++, R2H ; push lk
; nonlinear p-path block
MOV32 R6H, *+XAR4[6] ; R6H = alpha_p
LOG2F32 R7H, R3H ; R7H = log2(v3)
MOV AR0, #12 ; AR0 = delta_p offset
MOV32 R5H, *+XAR4[AR0] ; R5H = delta_p
MOV AR1, #18 ; AR1 = gamma_p offset
MPYF32 R2H, R6H, R7H ; R2H = alpha_p * log2(v3)
MOV32 *SP++, R7H ; push log2(v3)
NEGF32 R2H, R2H ; R2H = -(alpha_p * log2(v3))
IEXP2F32 R2H, R2H ; R2H = 2^(x*log2(v3))
MOV32 R7H, *+XAR4[AR1] ; R6H = gamma_p
MPYF32 R7H, R0H, R7H ; R7H = v4 (linear)
MOV AR0, #8 ; AR0 = alpha_i offset
MPYF32 R6H, R2H, R4H ; R6H = v4 (sign restore)
CMPF32 R3H, R5H ; set flags on (v3 - delta_p)
MOV32 R6H, R7H, LEQ ; R6H = v4
; nonlinear i-path block
MOV AR1, #20 ; AR1 = gamma_i offset
MOV32 R5H, *+XAR4[AR1] ; R5H = gamma_i
MPYF32 R5H, R0H, R5H ; R5H = v5 (linear)
MOV32 R2H, *+XAR4[AR0] ; R2H = alpha_i
MOV32 R7H, *--SP ; R7H = log2(v3)
MPYF32 R2H, R2H, R7H ; R2H = alpha_i * log2(v3)
MOV AR1, #14 ; AR1 = delta_i offset
NEGF32 R2H, R2H ; R2H = -(alpha_i * log2(v3))
IEXP2F32 R7H, R2H ; R7H = 2^(x*log2(v3))
NOP ; IEXPF32 delay slot 1
MOV AR0, #10 ; AR0 = alpha_d offset
MOV32 R0H, *+XAR4[AR1] ; R0H = delta_i
MPYF32 R7H, R7H, R4H ; R7H = v5 (sign restore), delay slot after
CMPF32 R3H, R0H ; set flags on (v3 delta_i)
MOV32 R5H, R7H, GT ; R5H = v5
; nonlinear d-path block
ZERO R2H ; R2H = 0.0f
ADDF32 R3H, R2H, #1.0 ; R3H = 1.0f
ABSF32 R4H, R1H ; R4H = |yk| = vd3, ADDF32 delay slot
SUBF32 R2H, #0.0, R3H ; R2H = -1.0f
CMPF32 R1H, #0.0 ; set flags on yk
MOV32 R3H, R2H, LT ; R3H = sgn(yk) = vd2
MOV32 R2H, *+XAR4[AR0] ; R2H = alpha_d
LOG2F32 R0H, R1H ; R0H = log2(yk)
MOV AR1, #22 ; AR1 = gamma_d offset
MOV32 R7H, *+XAR4[AR1] ; R7H = gamma_d
MPYF32 R7H, R1H, R7H ; R7H = v6 (linear)
MPYF32 R0H, R2H, R0H ; R0H = alpha_d*log2(yk)
NOP ; MPYF32 delay slot
NEGF32 R0H, R0H ; R2H = -(alpha_d * log2(yk))
IEXP2F32 R1H, R0H ; R1H = 2^(x*log2(yk))
MOV AR1, #16 ; AR1 = delta_d offset
MOV32 R2H, *+XAR4[AR1] ; R2H = delta_d
NOP ; IEXP2F32 delay slot 3
MPYF32 R1H, R1H, R3H ; R1H = v6 (sign restore), delay slot after
CMPF32 R4H, R2H ; set flags on (vd3 - delta_d)
MOV32 R7H, R1H, GT ; R7H = v6
; linear i-path
MOV32 R2H, *+XAR4[0] ; R2H = kp
MPYF32 R0H, R5H, R2H ; R0H = v5*kp
|| MOV32 R1H, *+XAR4[2] ; R1H = ki
MOV AR0, #34 ; AR0 = i16 offset
MPYF32 R0H, R0H, R1H ; R0H = v7
|| MOV32 R4H, *+XAR4[AR0] ; R4H = i16
MOV AR0, #32 ; AR0 = i7 offset
MPYF32 R0H, R0H, R4H ; R0H = v7*i16
MOV32 R1H, *+XAR4[AR0] ; R1H = i7
ADDF32 R0H, R0H, R1H ; R0H = v8
MOV AR1, #24 ; AR1 = c1 offset, ADDF32 delay slot
MOV32 *+XAR4[AR0], R0H ; store i7
; linear d-path
MOV32 R1H, *+XAR4[4] ; R1H = kd
MPYF32 R1H, R7H, R1H ; R1H = v6*kd
|| MOV32 R3H, *+XAR4[AR1] ; R3H = c1
MOV AR0, #28 ; AR0 = d2 offset
MPYF32 R1H, R1H, R3H ; R1H = v15
|| MOV32 R3H, *+XAR4[AR0] ; R3H = d2
MOV AR1, #30 ; AR1 = d3 offset
SUBF32 R5H, R1H, R3H ; R5H = v15-d2
|| MOV32 *+XAR4[AR0], R1H ; store d2
MOV32 R4H, *+XAR4[AR1] ; R4H = d3
SUBF32 R1H, R5H, R4H ; R1H = v16
MOV AR0, #26 ; AR0 = c2 offset
MOV32 R4H, *+XAR4[AR0] ; R4H = c2
MPYF32 R3H, R1H, R4H ; R3H = c2*v16
SUBF32 R6H, R6H, R1H ; R6H = v4-v16
MOV32 *+XAR4[AR1], R3H ; store d3
MPYF32 R2H, R2H, R6H ; R2H = v4a, delay slot after
; saturation
MOV AR0, #38 ; AR0 = Umax offset
ADDF32 R0H, R0H, R2H ; R0H = v9
|| MOV32 R1H, *+XAR4[AR0] ; R1H = Umax
MOV AR1, #40 ; AR1 = Umin offset
ZERO R7H ; R7H = 0.0f
ADDF32 R6H, R7H, #1.0 ; R6H = 1.0
MOV32 R2H, *+XAR4[AR1] ; R2H = Umin
MINF32 R0H, R1H ; saturate positive
|| MOV32 R6H, R7H ; R0H = v17
MAXF32 R0H, R2H ; saturate negative
|| MOV32 R6H, R7H ; R6H = v12
MOV32 R3H, *--SP ; R3H = lk
MPYF32 R4H, R3H, R6H ; R4H = lk*v12
MOV AR0, #34 ; AR0 = i16 offset
MOV32 *+XAR4[AR0], R4H ; store i16
.else
.emsg "ERROR - TMU1 NOT PRESENT: _DCL_runNLPID_C3 NOT BUILT"
.endif
LRETR ; return
.endasmfunc
.end
; end of file
@@ -0,0 +1,101 @@
; DCL_PI2_C2.asm - Series PI controller with double integrator
;
;;#############################################################################
;;!
;;! 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 $defined(__TI_EABI__)
.if __TI_EABI__
.asg DCL_runPI2_C2, _DCL_runPI2_C2
.endif
.endif
.global _DCL_runPI2_C2
.sect "dclfuncs"
; C prototype: float DCL_runPI2_C2(PI2 *p, float rk, float yk)
; argument 1 = *p : 32-bit PI2 structure address [XAR4]
; argument 2 = rk : 32-bit floating-point reference [R0H]
; argument 3 = yk : 32-bit floating-point feedback [R1H]
; return = uk : 32-bit floating-point [R0H]
.align 2
_DCL_runPI2_C2:
.asmfunc
SUBF32 R2H, R0H, R1H ; R2H = v1
MOV32 R1H, *XAR4++ ; R1H = Kpa
MPYF32 R0H, R1H, R2H ; R0H = v2
|| MOV32 R1H, *XAR4++ ; R1H = KiT
MPYF32 R2H, R1H, R2H ; R2H = v3
MOV32 R1H, *+XAR4[6] ; R1H = i12
MPYF32 R2H, R1H, R2H ; R2H = v4
MOV32 R3H, *XAR4 ; R3H = i6
ADDF32 R2H, R2H, R3H ; R2H = v5
MOV32 R3H, *+XAR4[2] ; R3H = i9
MPYF32 R1H, R1H, R2H ; R1H = v7
MOV32 *XAR4++, R2H ; save i6
ADDF32 R2H, R1H, R3H ; R2H = v8
NOP
MOV32 *XAR4++, R2H ; save i9
ADDF32 R0H, R0H, R2H ; R0H = v10
ZERO R1H ; R1H = 0.0f
ADDF32 R2H, R1H, #1.0 ; R2H = 1.0f
MOV32 R3H, *+XAR4[2] ; R3H = Umaxa
MINF32 R0H, R3H ; R0H = sat+
|| MOV32 R2H, R1H ; R2H = v11
MOV32 R3H, *+XAR4[4] ; R3H = Umina
MAXF32 R0H, R3H ; R0H = uk
|| MOV32 R2H, R1H ; R2H = v11
MOV32 *XAR4, R2H ; save i12
LRETR ; return call
.endasmfunc
.end
; end of file
@@ -0,0 +1,137 @@
; DCL_PID_A1.asm - Parallel PID controller on C28x (fixed point)
;
;;#############################################################################
;;!
;;! 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 $defined(__TI_EABI__)
.if __TI_EABI__
.asg DCL_runPID_A1, _DCL_runPID_A1
.endif
.endif
.global _DCL_runPID_A1
.sect "dcl32funcs"
; C prototype: int32_t DCL_runPID_A1(DCL_DCL_PID32 *p, int32_t rk, int32_t yk)
; argument 1 = *p : DCL_PID32 structure address [XAR4]
; argument 2 = rk : set point reference [ACC]
; argument 3 = yk : feedback [stack-2]
; return = uk : control [ACC]
.align 2
_DCL_runPID_A1:
.asmfunc
MOVL XT, *-SP[4] ; XT = yk
SUBL ACC, XT ; ACC = v5
MOVL XT, ACC ; XT = v5
IMPYL P, XT, *XAR4 ; P = v6[L]
QMPYL ACC, XT, *XAR4++ ; ACC = v6[H]
LSL64 ACC:P, #8 ; ACC = [I8Q24]
PUSH ACC ; push v6 to stack
IMPYL P, XT, *XAR4 ; P = v7[L]
QMPYL ACC, XT, *XAR4++ ; ACC = v7[H]
LSL64 ACC:P, #8 ; ACC = [I8Q24]
MOVB XAR0, #12 ; XAR0 = 12
MOVL XT, ACC ; XT = v7
IMPYL P, XT, *+XAR4[AR0] ; P = v14[L]
QMPYL ACC, XT, *+XAR4[AR0] ; ACC = v14[H]
LSL64 ACC:P, #8 ; ACC = [I8Q24]
MOVB XAR0, #10 ; XAR0 = 10
ADDL ACC, *+XAR4[AR0] ; ACC = v8
SAT ACC ; saturate v8
MOVL *+XAR4[AR0], ACC ; store i10
PUSH ACC ; push v8 to stack
MOVL XT, *-SP[8] ; XT = yk
IMPYL P, XT, *XAR4 ; P = v1a[L] = v5*Kda
QMPYL ACC, XT, *XAR4++ ; ACC = v1a[H] = v5*Kda
LSL64 ACC:P, #8 ; format v1a as[I8Q24]
MOVL XT, ACC ; XT = v1
IMPYL P, XT, *XAR4 ; P = v2a[L]
QMPYL ACC, XT, *XAR4++ ; ACC = v2a[H]
LSL64 ACC:P, #8 ; ACC = [I8Q24]
MOVL P, ACC ; P = v2a
ADDL ACC, P ; ACC = v2 <<--- c1a coefficient scaling
MOVL P, ACC ; P = v2
SUBL ACC, *+XAR4[2] ; ACC = v2b = v2-d2
MOVL *+XAR4[2], P ; save d2
SUBL ACC, *+XAR4[4] ; ACC = v4
SAT ACC ; saturate v4
MOVL XT, ACC ; XT = v4
IMPYL P, XT, *XAR4 ; P = v3[L]
QMPYL ACC, XT, *XAR4 ; ACC = d3[H]
LSL64 ACC:P, #8 ; format d3 as [I8Q24]
MOVL *+XAR4[4], ACC ; save d3
MOVL P, XT ; P = v4
POP ACC ; ACC = v8
SPM 0 ; PM = 0
SUBL ACC, P ; ACC = v8-v4
POP P ; P = v6
ADDL ACC, P ; ACC = v9
SAT ACC ; saturate v9
ADDB XAR4, #10 ; XAR4 = &Umaxa
MOVL P, ACC ; P = v9
MINL ACC, *XAR4++ ; clamp v9 pos
MAXL ACC, *XAR4 ; clamp v9 neg; ACC = uk
PUSH ACC ; save uk to stack
CMPL ACC, P<<PM ; set flags on (uk-v9)
PUSH ST0 ; save flags
ZAPA ; ACC = P = 0
OR ACC, #0x1000<<12 ; ACC = [I8Q24](1.0)
POP ST0 ; restore flags
MOVL P, ACC, EQ ; P = v12
SUBB XAR4, #4 ; XAR4 = &i14
MOVL *XAR4, P ; save i14
POP ACC ; ACC = uk
LRETR ; return uk
.endasmfunc
.end
; end of file
@@ -0,0 +1,163 @@
; DCL_PID_C1.asm - Series PID controller
;
;;#############################################################################
;;!
;;! 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 $defined(__TI_EABI__)
.if __TI_EABI__
.asg DCL_runPID_C1, _DCL_runPID_C1
.endif
.endif
FASTCR_PID_C1 .set 0 ; set to 1 to enable shadowed context save/restore
.global _DCL_runPID_C1
.sect "dclfuncs"
; 11/14/2017: [RP] added XAR1 to context save
; C prototype: float DCL_runPID_C1(DCL_PID *p, float32_t rk, float32_t yk, float32_t lk)
; argument 1 = *p : 32-bit PID structure address [XAR4]
; argument 2 = rk : 32-bit floating-point reference [R0H]
; argument 3 = yk : 32-bit floating-point feedback [R1H]
; argument 4 = lk : 32-bit floating-point saturation input [R2H]
; return = uk : 32-bit floating-point [R0H]
.align 2
_DCL_runPID_C1:
.asmfunc
; context save
MOVL *SP++, XAR1
.if FASTCR_PID_C1 = 0
MOV32 *SP++, R4H
MOV32 *SP++, R5H
MOV32 *SP++, R6H
MOV32 *SP++, R7H
.else
SAVE
.endif
; derivative path
MOV32 R3H, *+XAR4[4] ; R3H = Kda
MOV AR0, #8 ; AR0 = 8
MPYF32 R5H, R1H, R3H ; R5H = Kda * yk
|| MOV32 R4H, *+XAR4[AR0] ; R4H = c1a
MOV AR0, #0xC ; AR0 = 12
MPYF32 R3H, R4H, R5H ; R3H = v1 = Kda * yk * c1a
|| MOV32 R6H, *+XAR4[AR0] ; R6H = d2
MOV AR1, #0xE ; AR1 = 14
SUBF32 R4H, R3H, R6H ; R4H = v1 - d2
|| MOV32 R5H, *+XAR4[AR1] ; R5H = d3
NOP
SUBF32 R4H, R4H, R5H ; R4H = v4 = v1 - d2 - d3
|| MOV32 *+XAR4[AR0], R3H ; save d2
MOV AR0, #0xA ; AR0 = 10
MOV32 R6H, *+XAR4[AR0] ; R6H = c2a
MPYF32 R5H, R6H, R4H ; R5H = d3 = c2a * v4
NOP
MOV32 *+XAR4[AR1], R5H ; save d3
; proportional path
MOV32 R5H, *+XAR4[6] ; R5H = Kra
MPYF32 R6H, R5H, R0H ; R6H = Kra * rk
NOP
SUBF32 R3H, R6H, R1H ; R3H = v5 = (Kra * rk) - yk
NOP
SUBF32 R5H, R3H, R4H ; R5H = v5 - v4
|| MOV32 R6H, *+XAR4[0] ; R6H = Kpa
MOV AR0, #0x12 ; AR0 = 18
MPYF32 R7H, R5H, R6H ; R7H = v6
|| MOV32 R4H, *+XAR4[2] ; R4H = Kia
; integral path
MPYF32 R5H, R4H, R6H ; R5H = Kpa * Kia
|| SUBF32 R3H, R0H, R1H ; R3H = rk - yk
MOV32 R6H, *+XAR4[AR0] ; R6H = i14
MPYF32 R4H, R3H, R5H ; R4H = v7
MOV AR0, #0x10 ; AR0 = 16
MPYF32 R4H, R4H, R6H ; R4H = v7 * i14
|| MOV32 R6H, *+XAR4[AR0] ; R6H = i10
NOP
ADDF32 R3H, R4H, R6H ; R3H = v8
; output saturation
ZERO R0H ; R0H = 0.0f
MOV32 *+XAR4[AR0], R3H ; save i10
ADDF32 R1H, R7H, R3H ; R1H = v9
ADDF32 R6H, R0H, #1.0 ; R6H = 1.0f
MOV AR1, #0x14 ; AR1 = 20
MOV32 R3H, *+XAR4[AR1] ; R3H = Umaxa
MINF32 R1H, R3H ; sat v9
|| MOV32 R6H, R0H ; R6H = 0.0f if sat
MOV AR1, #0x16 ; AR1 = 22
MOV32 R3H, *+XAR4[AR1] ; R3H = Umina
MAXF32 R1H, R3H ; sat v9
|| MOV32 R6H, R0H ; R6H = 0.0f if sat
; context restore & return
MPYF32 R3H, R2H, R6H ; R3H = i14
MOV32 R0H, R1H ; return uk
MOV AR0, #0x12 ; AR0 = 18
MOV32 *+XAR4[AR0], R3H ; save i14
.if FASTCR_PID_C1 = 0
MOV32 R7H, *--SP, UNC
MOV32 R6H, *--SP, UNC
MOV32 R5H, *--SP, UNC
MOV32 R4H, *--SP, UNC
.else
RESTORE
.endif
MOVL XAR1, *--SP
LRETR
.endasmfunc
.end
; end of file
@@ -0,0 +1,156 @@
; DCL_PID_C4.asm - Parallel PID controller
;
;;#############################################################################
;;!
;;! 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 $defined(__TI_EABI__)
.if __TI_EABI__
.asg DCL_runPID_C4, _DCL_runPID_C4
.endif
.endif
FASTCR_PID_C4 .set 0 ; set to 1 to enable shadowed context save/restore
.global _DCL_runPID_C4
.sect "dclfuncs"
; 11/14/2017: [RP] added XAR1 to context save
; C prototype: float DCL_runPID_C4(DCL_PID *p, float32_t rk, float32_t yk, float32_t lk)
; argument 1 = *p : 32-bit PID structure address [XAR4]
; argument 2 = rk : 32-bit floating-point reference [R0H]
; argument 3 = yk : 32-bit floating-point feedback [R1H]
; argument 4 = lk : 32-bit floating-point saturation input [R2H]
; return = uk : 32-bit floating-point [R0H]
.align 2
_DCL_runPID_C4:
.asmfunc
; context save
MOVL *SP++, XAR1
.if FASTCR_PID_C4 = 0
MOV32 *SP++, R4H
MOV32 *SP++, R5H
MOV32 *SP++, R6H
.else
SAVE
.endif
; servo error
SUBF32 R1H, R0H, R1H ; R1H = ek = rk - yk
; derivative path
MOV32 R3H, *+XAR4[4] ; R3H = Kda
MOV AR0, #8 ; AR0 = 8
MPYF32 R5H, R1H, R3H ; R5H = Kda * ek
|| MOV32 R4H, *+XAR4[AR0] ; R4H = c1a
MOV AR0, #0xC ; AR0 = 12
MPYF32 R3H, R4H, R5H ; R3H = v1 = Kda * ek * c1a
|| MOV32 R6H, *+XAR4[AR0] ; R6H = d2
MOV AR1, #0xE ; AR1 = 14
SUBF32 R4H, R3H, R6H ; R4H = v1 - d2
MOV32 R5H, *+XAR4[AR1] ; R5H = d3
SUBF32 R4H, R4H, R5H ; R4H = v4 = v1 - d2 - d3
|| MOV32 *+XAR4[AR0], R3H ; save d2
MOV AR0, #0xA ; AR0 = 10
MOV32 R6H, *+XAR4[AR0] ; R6H = c2a
MPYF32 R5H, R6H, R4H ; R5H = d3 = c2a * v4
MOV AR0, #0x12 ; AR0 = 18
MOV32 *+XAR4[AR1], R5H ; save d3
; integral path
MOV32 R3H, *+XAR4[2] ; R3H = Kia
MPYF32 R5H, R1H, R3H ; R5H = v7
MOV32 R6H, *+XAR4[AR0] ; R6H = i14
MPYF32 R5H, R6H, R5H ; R5H = v7 * i14
MOV AR0, #0x10 ; AR0 = 16
MOV32 R0H, *+XAR4[AR0] ; R0H = i10
ADDF32 R5H, R0H, R5H ; R5H = v8
; proportional path
MOV32 R3H, *+XAR4[0] ; R3H = Kpa
MPYF32 R6H, R1H, R3H ; R6H = v6
; PID sum
ADDF32 R4H, R5H, R4H ; R4H = v4 + v8
MOV32 *+XAR4[AR0], R5H ; save i10
ADDF32 R1H, R4H, R6H ; R1H = v9
; output saturation
ZERO R0H ; R0H = 0.0f
ADDF32 R6H, R0H, #1.0 ; R6H = 1.0f
MOV AR1, #0x14 ; AR1 = 20
MOV32 R3H, *+XAR4[AR1] ; R3H = Umaxa
MINF32 R1H, R3H ; sat v9
|| MOV32 R6H, R0H ; R6H = 0.0f if sat
MOV AR1, #0x16 ; AR1 = 22
MOV32 R3H, *+XAR4[AR1] ; R3H = Umina
MAXF32 R1H, R3H ; sat v9
|| MOV32 R6H, R0H ; R6H = 0.0f if sat = v12
MPYF32 R3H, R2H, R6H ; R3H = i14
MOV32 R0H, R1H ; R0H = uk
MOV AR0, #0x12 ; AR0 = 18
MOV32 *+XAR4[AR0], R3H ; save i14
; context restore
.if FASTCR_PID_C4 = 0
MOV32 R6H, *--SP, UNC
MOV32 R5H, *--SP, UNC
MOV32 R4H, *--SP, UNC
.else
RESTORE
.endif
MOVL XAR1, *--SP
LRETR
.endasmfunc
.end
; end of file
@@ -0,0 +1,146 @@
; DCL_PID_L1.asm - Series PID controller
;
;;#############################################################################
;;!
;;! 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 $defined(__TI_EABI__)
.if __TI_EABI__
.asg DCL_runPID_L1, _DCL_runPID_L1
.endif
.endif
.global _DCL_runPID_L1
.def __cla_DCL_runPID_L1_sp
SIZEOF_LFRAME .set 10
LFRAME_MR3 .set 0
LFRAME_V5 .set 2
LFRAME_V6 .set 4
LFRAME_V7 .set 6
LFRAME_LK .set 8
__cla_DCL_runPID_L1_sp .usect ".scratchpad:Cla1Prog:_DCL_runPID_L1", SIZEOF_LFRAME, 0, 1
.asg __cla_DCL_runPID_L1_sp, LFRAME
.sect "Cla1Prog:_DCL_runPID_L1"
.align 2
; C prototype:
; float DCL_runPID_L1(DCL_PID *p, float32_t rk, float32_t yk, float32_t lk)
; argument 1 = *p : PID structure address [MAR0]
; argument 2 = rk : control loop reference [MR0]
; argument 3 = yk : control loop feedback [MR1]
; argument 4 = lk : controller saturation input [MR2]
; return = uk : control effort [MR0]
_DCL_runPID_L1:
; MDEBUGSTOP
MSETFLG RNDF32=1 ; round to nearest even
MMOV32 @LFRAME + LFRAME_MR3, MR3 ; save MR3
MMOV32 @LFRAME + LFRAME_LK, MR2 ; save lk
;*** proportional path & integral prelude ***
MSUBF32 MR3, MR0, MR1 ; MR3 = ek
|| MMOV32 MR2, *MAR0[2]++ ; MR2 = Kpa
MMPYF32 MR2, MR2, MR3 ; MR2 = Kpa * ek
|| MMOV32 MR3, *MAR0[4]++ ; MR3 = Kia
MMPYF32 MR2, MR2, MR3 ; MR2 = v7
|| MMOV32 MR3, *MAR0[-2]++ ; MR3 = Kra
MMPYF32 MR3, MR0, MR3 ; MR3 = Kra * rk
|| MMOV32 @LFRAME + LFRAME_V7, MR2 ; save v7
MSUBF32 MR3, MR3, MR1 ; MR3 = v5
|| MMOV32 MR2, *MAR0[4]++ ; MR2 = Kda
;*** derivative path ***
MMPYF32 MR0, MR1, MR2 ; MR0 = Kda * yk
|| MMOV32 @LFRAME + LFRAME_V5, MR3 ; save v5
MMOV32 MR3, *MAR0[6]++ ; MR3 = c1a
MMPYF32 MR0, MR0, MR3 ; MR0 = v1
|| MMOV32 MR1, *MAR0[-2]++ ; MR1 = d3
MSUBF32 MR2, MR0, MR1 ; MR2 = v1 - d3
|| MMOV32 MR3, *MAR0 ; MR3 = d2
MMOV32 *MAR0[-2]++, MR0 ; save d2 = v1
MSUBF32 MR2, MR2, MR3 ; MR2 = v4
|| MMOV32 MR1, *MAR0[4]++ ; MR1 = c2a
MMPYF32 MR0, MR1, MR2 ; MR0 = c2a * v4
|| MMOV32 MR3, @LFRAME + LFRAME_V5 ; MR3 = v5
MSUBF32 MR2, MR3, MR2 ; MR2 = v5 - v4
|| MMOV32 *MAR0[-14]++, MR0 ; save d3
;*** integral path ***
MMOV32 MR3, *MAR0[18]++ ; MR3 = Kpa
MMPYF32 MR0, MR2, MR3 ; MR0 = v6
|| MMOV32 MR1, *MAR0[-2]++ ; MR1 = i14
MMOV32 @LFRAME + LFRAME_V6, MR0 ; save v6
MMOV32 MR2, @LFRAME + LFRAME_V7 ; MR2 = v7
MMPYF32 MR0, MR1, MR2 ; MR0 = i14 * v7
|| MMOV32 MR3, *MAR0 ; MR3 = i10
MADDF32 MR1, MR0, MR3 ; MR1 = v8
|| MMOV32 MR2, @LFRAME + LFRAME_V6 ; MR2 = v6
MADDF32 MR0, MR1, MR2 ; MR0 = v9
|| MMOV32 *MAR0[4]++, MR1 ; save i10
;*** saturation ***
MMOVF32 MR2, #0.0f ; MR2 = 0.0f
MMOVF32 MR3, #1.0f ; MR3 = 1.0f
MMOV32 MR1, *MAR0[2]++ ; MR1 = Umaxa
MMINF32 MR0, MR1 ; MR0 = sat+
MMOV32 MR3, MR2, GT ; MR3 = v12
MMOV32 MR1, *MAR0[-4]++ ; MR1 = Umina
MMAXF32 MR0, MR1 ; MR0 = sat-
MMOV32 MR3, MR2, LT ; MR3 = v12
MRCNDD UNC ; return call
MMOV32 MR1, @LFRAME + LFRAME_LK ; MR1 = lk
MMPYF32 MR2, MR1, MR3 ; MR2 = v12 * lk
|| MMOV32 MR3, @LFRAME + LFRAME_MR3 ; restore MR3
MMOV32 *MAR0, MR2 ; save i14
.unasg LFRAME
; end of file
@@ -0,0 +1,140 @@
; DCL_PID_L2.asm - Parallel PID controller
;
;;#############################################################################
;;!
;;! 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 $defined(__TI_EABI__)
.if __TI_EABI__
.asg DCL_runPID_L2, _DCL_runPID_L2
.endif
.endif
.global _DCL_runPID_L2
.def __cla_DCL_runPID_L2_sp
SIZEOF_LFRAME .set 10
LFRAME_MR3 .set 0
LFRAME_V5 .set 2
LFRAME_V6 .set 4
LFRAME_V7 .set 6
LFRAME_LK .set 8
__cla_DCL_runPID_L2_sp .usect ".scratchpad:Cla1Prog:_DCL_runPID_L2", SIZEOF_LFRAME, 0, 1
.asg __cla_DCL_runPID_L2_sp, LFRAME
.sect "Cla1Prog:_DCL_runPID_L2"
.align 2
; C prototype:
; float DCL_runPID_L2(DCL_PID *p, float32_t rk, float32_t yk, float32_t lk)
; argument 1 = *p : PID structure address [MAR0]
; argument 2 = rk : control loop reference [MR0]
; argument 3 = yk : control loop feedback [MR1]
; argument 4 = lk : controller saturation input [MR2]
; return = uk : control effort [MR0]
_DCL_runPID_L2:
; MDEBUGSTOP
MSETFLG RNDF32=1 ; round to nearest even
MMOV32 @LFRAME + LFRAME_MR3, MR3 ; save MR3
MMOV32 @LFRAME + LFRAME_LK, MR2 ; save lk
;*** servo error ***
MSUBF32 MR0, MR0, MR1 ; MR0 = v5
|| MMOV32 MR1, *MAR0[4]++ ; MR1 = Kpa
;*** derivative path ***
MMOV32 MR1, *MAR0[4]++ ; MR1 = Kda
MMPYF32 MR3, MR0, MR1 ; MR3 = Kda * v5
|| MMOV32 MR1, *MAR0[4]++ ; MR1 = c1a
MMPYF32 MR3, MR1, MR3 ; MR3 = v1
|| MMOV32 MR1, *MAR0 ; MR1 = d2
MSUBF32 MR1, MR3, MR1 ; MR1 = v1 - d2
|| MMOV32 *MAR0[2]++, MR3 ; save d2
MMOV32 MR3, *MAR0[-4]++ ; MR3 = d3
MSUBF32 MR1, MR1, MR3 ; MR1 = v4
|| MMOV32 MR3, *MAR0[-10]++ ; MR3 = c2a
MMPYF32 MR3, MR1, MR3 ; MR3 = d3
|| MMOV32 MR2, *MAR0[14]++ ; MR2 = Kpa
;*** proportional path ***
MMPYF32 MR2, MR0, MR2 ; MR2 = v6
|| MMOV32 *MAR0[-12]++, MR3 ; save d3
MADDF32 MR1, MR1, MR2 ; MR1 = v4 + v6
|| MMOV32 MR3, *MAR0[16]++ ; MR3 = Kia
;*** integral path ***
MMPYF32 MR0, MR0, MR3 ; MR0 = v7
|| MMOV32 MR3, *MAR0[-2]++ ; MR3 = i14
MMPYF32 MR0, MR0, MR3 ; MR0 = v7 * i14
|| MMOV32 MR3, *MAR0 ; MR3 = i10
MADDF32 MR0, MR0, MR3 ; MR0 = v8
MMOV32 *MAR0[4]++, MR0 ; save i10
;*** PID sum ***
MADDF32 MR0, MR0, MR1 ; MR0 = v9
|| MMOV32 MR1, *MAR0[2]++ ; MR1 = Umaxa
;*** saturation ***
MMOVF32 MR2, #0.0f ; MR2 = 0.0f
MMOVF32 MR3, #1.0f ; MR3 = 1.0f
MMINF32 MR0, MR1 ; MR0 = sat+
MMOV32 MR3, MR2, GT ; MR3 = v12
MMOV32 MR1, *MAR0[-4]++ ; MR1 = Umina
MMAXF32 MR0, MR1 ; MR0 = sat-
MMOV32 MR3, MR2, LT ; MR3 = v12
MRCNDD UNC ; return call
MMOV32 MR1, @LFRAME + LFRAME_LK ; MR1 = lk
MMPYF32 MR2, MR1, MR3 ; MR2 = lk * v12
|| MMOV32 MR3, @LFRAME + LFRAME_MR3 ; restore MR3
MMOV32 *MAR0, MR2 ; save i14
.unasg LFRAME
; end of file
@@ -0,0 +1,110 @@
; DCL_PI_A1.asm - Series PI controller on C28x (fixed point) [r1.02]
;
;;#############################################################################
;;!
;;! 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 $defined(__TI_EABI__)
.if __TI_EABI__
.asg DCL_runPI_A1, _DCL_runPI_A1
.endif
.endif
.global _DCL_runPI_A1
.sect "dcl32funcs"
; C prototype: int32_t DCL_runPI_A1(DCL_PI32 *p, int32_t rk, int32_t yk)
; argument 1 = *p : DCL_PI32 structure address [XAR4]
; argument 2 = rk : set point reference [ACC]
; argument 3 = yk : feedback [stack-2]
; return = uk : control [ACC]
.align 2
_DCL_runPI_A1:
.asmfunc
MOVL XT, *-SP[4] ; XT = yk
SUBL ACC, XT ; ACC = v1
MOVL XT, ACC ; XT = v1
IMPYL P, XT, *XAR4 ; P = v2(L)
QMPYL ACC, XT, *XAR4++ ; ACC = v2(H)
LSL64 ACC:P, #8 ; ACC = v2 [I8Q24]
MOVL XT, ACC ; XT = v2
IMPYL P, XT, *XAR4 ; P = v3(L)
QMPYL ACC, XT, *XAR4++ ; ACC = v3(H)
LSL64 ACC:P, #8 ; ACC = v3 [I8Q24]
MOVL XAR0, XT ; store v2
MOVL XT, ACC ; XT = v3
IMPYL P, XT, *XAR4 ; P = v8(L)
QMPYL ACC, XT, *XAR4++ ; ACC = v8(H)
LSL64 ACC:P, #8 ; ACC = v8 [I8Q24]
ADDL ACC, *XAR4 ; ACC = v4
SAT ACC ; saturate ACC
MOVL *XAR4++, ACC ; store i10
ADDL ACC, XAR0 ; ACC = v5
SAT ACC ; saturate v5
MOVL P, ACC ; P = v5
MINL ACC, *XAR4++ ; clamp v5 pos
MAXL ACC, *XAR4 ; ACC = uk
PUSH ACC ; push uk to stack
SPM 0 ; zero PM
CMPL ACC, P<<PM ; set flags on (uk-v5)
PUSH ST0 ; save flags
ZAPA ; ACC = P = 0
OR ACC, #0x1000<<12 ; ACC = IQ24(1.0)
POP ST0 ; restore flags
MOVL P, ACC, EQ ; P = i6
SUBB XAR4, #6 ; XAR4 = &i6
MOVL *XAR4, P ; store i6
MOVL ACC, *--SP ; ACC = uk
LRETR ; return uk
.endasmfunc
.end
; end of file
@@ -0,0 +1,132 @@
; DCL_PI_C1.asm - Series PI controller
;
;;#############################################################################
;;!
;;! 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 $defined(__TI_EABI__)
.if __TI_EABI__
.asg DCL_runPI_C1, _DCL_runPI_C1
.endif
.endif
FASTCR_PI_C1 .set 0 ; set to 1 to enable shadowed context save/restore
.global _DCL_runPI_C1
.sect "dclfuncs"
; 11/14/2017: [RP] added XAR1 to context save
; C prototype: float DCL_runPI_C1(DCL_PI *p, float32_t rk, float32_t yk)
; argument 1 = *p : 32-bit PI structure address [XAR4]
; argument 2 = rk : 32-bit floating-point reference [R0H]
; argument 3 = yk : 32-bit floating-point feedback [R1H]
; return = uk : 32-bit floating-point [R0H]
.align 2
_DCL_runPI_C1:
.asmfunc
; context save
MOVL *SP++, XAR1
.if FASTCR_PI_C1 = 0
MOV32 *SP++, R4H
MOV32 *SP++, R5H
MOV32 *SP++, R6H
.else
SAVE
.endif
; servo error
SUBF32 R4H, R0H, R1H ; R4H = v1
; proportional path
MOV32 R5H, *+XAR4[0] ; R5H = Kpa
MPYF32 R6H, R4H, R5H ; R6H = v2
; integral path
MOV32 R5H, *+XAR4[2] ; R5H = Kia
MPYF32 R4H, R5H, R6H ; R4H = v3
MOV AR1, #0xA ; AR1 = 10
MOV32 R5H, *+XAR4[AR1] ; R5H = i6
MPYF32 R3H, R4H, R5H ; R3H = v8
MOV32 R4H, *+XAR4[4] ; R4H = i10
ADDF32 R5H, R4H, R3H ; R5H = v4
ZERO R1H ; R1H = 0.0f
MOV32 *+XAR4[4], R5H ; save i10
; control
ADDF32 R0H, R5H, R6H ; R0H = v5
ADDF32 R5H, R1H, #1.0 ; R5H = 1.0f
MOV32 R3H, *+XAR4[6] ; R3H = Umaxa
MINF32 R0H, R3H ; if (v5 > Umaxa) R0H = Umax else R0H = v5
|| MOV32 R5H, R1H ; R5H = 0.0f
MOV AR0, #8 ; AR0 = 8
MOV32 R3H, *+XAR4[AR0] ; R3H = Umina
MAXF32 R0H, R3H ; if (v5 < Umina) R0H = Umin else R0H = v5
|| MOV32 R5H, R1H ; R5H = 0.0f
; anti-windup
NOP ; delay slot
MOV32 *+XAR4[AR1], R5H ; save i6
; context restore
.if FASTCR_PI_C1 = 0
MOV32 R6H, *--SP, UNC ; delay slot
MOV32 R5H, *--SP, UNC
MOV32 R4H, *--SP, UNC
.else
RESTORE
.endif
MOVL XAR1, *--SP
LRETR
.endasmfunc
.end
; end of file
@@ -0,0 +1,100 @@
; DCL_PI_C4.asm - Parallel form PI controller
;
;;#############################################################################
;;!
;;! 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 $defined(__TI_EABI__)
.if __TI_EABI__
.asg DCL_runPI_C4, _DCL_runPI_C4
.endif
.endif
.global _DCL_runPI_C4
.sect "dclfuncs"
; C prototype: float DCL_runPI_C4(DCL_PI *p, float32_t rk, float32_t yk)
; argument 1 = *p : 32-bit PI structure address [XAR4]
; argument 2 = rk : 32-bit floating-point reference [R0H]
; argument 3 = yk : 32-bit floating-point feedback [R1H]
; return = uk : 32-bit floating-point [R0H]
.align 2
_DCL_runPI_C4:
.asmfunc
SUBF32 R2H, R0H, R1H ; R2H = v1
|| MOV32 R1H, *XAR4 ; R1H = Kpa
MOV AR0, #0xA ; AR0 = 10
MPYF32 R0H, R1H, R2H ; R0H = v2
|| MOV32 R1H, *+XAR4[2] ; R1H = Kia
MOV32 R3H, *+XAR4[AR0] ; R3H = i6
MPYF32 R2H, R1H, R2H ; R2H = v3
MOV32 R1H, *+XAR4[4] ; R1H = i10
MPYF32 R2H, R2H, R3H ; R2H = v8
NOP ; delay slot
ADDF32 R3H, R1H, R2H ; R3H = v4
MOV AR0, #8 ; AR0 = 8
ADDF32 R0H, R0H, R3H ; R3H = v5
|| MOV32 *+XAR4[4], R3H ; save i10
ZERO R1H ; R1H = 0.0f
ADDF32 R2H, R1H, #1.0 ; R2H = 1.0f
MOV32 R3H, *+XAR4[6] ; R3H = Umaxa
MINF32 R0H, R3H ; R0H = sat+
|| MOV32 R2H, R1H ; R2H = v6
MOV32 R3H, *+XAR4[AR0] ; R3H = Umina
MAXF32 R0H, R3H ; R0H = uk
|| MOV32 R2H, R1H ; R2H = v6
MOV AR0, #0xA ; AR0 = 10
MOV32 *+XAR4[AR0], R2H ; save i6
LRETR ; return call
.endasmfunc
.end
; end of file
@@ -0,0 +1,103 @@
; DCL_PI_C7.asm - Series form PI controller with Tustin integrator
;
;;#############################################################################
;;!
;;! 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 $defined(__TI_EABI__)
.if __TI_EABI__
.asg DCL_runPI_C7, _DCL_runPI_C7
.endif
.endif
.global _DCL_runPI_C7
.sect "dclfuncs"
; C prototype: float32_t DCL_runPI_C7(DCL_PI *p, float32_t rk, float32_t yk)
; argument 1 = *p : 32-bit PI structure address [XAR4]
; argument 2 = rk : 32-bit floating-point reference [R0H]
; argument 3 = yk : 32-bit floating-point feedback [R1H]
; return = uk : 32-bit floating-point [R0H]
.align 2
_DCL_runPI_C7:
.asmfunc
SUBF32 R2H, R0H, R1H ; R2H = v1
|| MOV32 R1H, *XAR4 ; R1H = Kp
MOV AR0, #0xA ; AR0 = 10
MPYF32 R0H, R1H, R2H ; R0H = v2
|| MOV32 R1H, *+XAR4[2] ; R1H = Ki
MOV32 R3H, *+XAR4[AR0] ; R3H = i6
MPYF32 R1H, R1H, R0H ; R1H = v3
|| MOV32 R2H, *+XAR4[4] ; R2H = i10
MOV AR0, #0xC ; AR0 = 12
MPYF32 R3H, R1H, R3H ; R3H = v8
|| MOV32 R1H, *+XAR4[AR0] ; R1H = i11
ADDF32 R2H, R1H, R2H ; R2H = i10+i11
MOV32 *+XAR4[AR0], R3H ; store i11
ADDF32 R1H, R2H, R3H ; R1H = v4
MOV AR0, #8 ; AR0 = 8
ADDF32 R0H, R0H, R1H ; R0H = v5
|| MOV32 *+XAR4[4], R1H ; store i10
ZERO R1H ; R1H = 0.0f
ADDF32 R2H, R1H, #1.0 ; R2H = 1.0f
MOV32 R3H, *+XAR4[6] ; R3H = Umax
MINF32 R0H, R3H ; R0H = sat+
|| MOV32 R2H, R1H ; R2H = v6
MOV32 R3H, *+XAR4[AR0] ; R3H = Umin
MAXF32 R0H, R3H ; R0H = uk
|| MOV32 R2H, R1H ; R2H = v6
MOV AR0, #0xA ; AR0 = 10
MOV32 *+XAR4[AR0], R2H ; store i6
LRETR ; return
.endasmfunc
.end
; end of file
@@ -0,0 +1,114 @@
; DCL_PI_L1.asm - Series PI controller
;
;;#############################################################################
;;!
;;! 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 $defined(__TI_EABI__)
.if __TI_EABI__
.asg DCL_runPI_L1, _DCL_runPI_L1
.endif
.endif
.global _DCL_runPI_L1
.def __cla_DCL_runPI_L1_sp
SIZEOF_LFRAME .set 5
LFRAME_MR3 .set 0
__cla_DCL_runPI_L1_sp .usect ".scratchpad:Cla1Prog:_DCL_runPI_L1", SIZEOF_LFRAME, 0, 1
.asg __cla_DCL_runPI_L1_sp, LFRAME
.sect "Cla1Prog:_DCL_runPI_L1"
.align 2
; C prototype:
; float DCL_runPI_L1(DCL_PI_CLA *p, float32_t rk, float32_t yk)
; argument 1 = *p : 32-bit PI structure address [MAR0]
; argument 2 = rk : 32-bit floating-point reference [MR0]
; argument 3 = yk : 32-bit floating-point feedback [MR1]
; return = uk : 32-bit floating-point [MR0]
_DCL_runPI_L1:
; MDEBUGSTOP
MSETFLG RNDF32=1 ; round to nearest even
MMOV32 @LFRAME + LFRAME_MR3, MR3 ; save MR3
;*** servo error ***
MSUBF32 MR2, MR0, MR1 ; MR2 = v1
;*** proportional path ***
MMOV32 MR1, *MAR0[2]++ ; MR1 = Kpa
MMPYF32 MR2, MR1, MR2 ; MR2 = v2
;*** integral path ***
|| MMOV32 MR1, *MAR0[8]++ ; MR1 = Kia
MMPYF32 MR0, MR2, MR1 ; MR0 = v3
|| MMOV32 MR1, *MAR0[-6]++ ; MR1 = i6
MMPYF32 MR0, MR0, MR1 ; MR0 = v8
|| MMOV32 MR1, *MAR0 ; MR1 = i10
MADDF32 MR0, MR0, MR1 ; MR0 = v4
MMOV32 *MAR0[2]++, MR0 ; save i10
MADDF32 MR0, MR0, MR2 ; MR0 = v5
;*** output saturation ***
MMOVF32 MR2, #0.0f ; MR2 = 0.0f
MMOVF32 MR3, #1.0f ; MR3 = 1.0f
MMOV32 MR1, *MAR0[2]++ ; MR1 = Umaxa
MMINF32 MR0, MR1 ; MR0 = sat+
MMOV32 MR3, MR2, GT ; MR3 = v6
MMOV32 MR1, *MAR0[2]++ ; MR1 = Umina
MMAXF32 MR0, MR1 ; MR0 = sat-
MRCNDD UNC ; return call
MMOV32 MR3, MR2, LT ; MR3 = v6
MMOV32 *MAR0, MR3 ; save i6
MMOV32 MR3, @LFRAME + LFRAME_MR3 ; restore MR3
.unasg LFRAME
; end of file
@@ -0,0 +1,106 @@
; DCL_PI_L2.asm - Parallel PI controller
;
;;#############################################################################
;;!
;;! 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 $defined(__TI_EABI__)
.if __TI_EABI__
.asg DCL_runPI_L2, _DCL_runPI_L2
.endif
.endif
.global _DCL_runPI_L2
.def __cla_DCL_runPI_L2_sp
SIZEOF_LFRAME .set 5
LFRAME_MR3 .set 0
__cla_DCL_runPI_L2_sp .usect ".scratchpad:Cla1Prog:_DCL_runPI_L2", SIZEOF_LFRAME, 0, 1
.asg __cla_DCL_runPI_L2_sp, LFRAME
.sect "Cla1Prog:_DCL_runPI_L2"
.align 2
; C prototype:
; float DCL_runPI_L2(DCL_PI_CLA *p, float32_t rk, float32_t yk)
; argument 1 = *p : 32-bit PI structure address [MAR0]
; argument 2 = rk : 32-bit floating-point reference [MR0]
; argument 3 = yk : 32-bit floating-point feedback [MR1]
; return = uk : 32-bit floating-point [MR0]
_DCL_runPI_L2:
; MDEBUGSTOP
MSETFLG RNDF32=1 ; round to nearest even
MMOV32 @LFRAME + LFRAME_MR3, MR3 ; save MR3
MSUBF32 MR0, MR0, MR1 ; MR0 = v1
MMOV32 MR1, *MAR0[2]++ ; MR1 = Kpa
MMPYF32 MR2, MR0, MR1 ; MR2 = v2
|| MMOV32 MR1, *MAR0[8]++ ; MR1 = Kia
MMPYF32 MR3, MR0, MR1 ; MR3 = v3
|| MMOV32 MR0, *MAR0[-6]++ ; MR0 = i6
MMPYF32 MR1, MR0, MR3 ; MR1 = v8
|| MMOV32 MR0, *MAR0 ; MR0 = i10
MADDF32 MR3, MR0, MR1 ; MR3 = v4
MMOV32 *MAR0[2]++, MR3 ; save i10
MADDF32 MR0, MR2, MR3 ; MR0 = v5
|| MMOV32 MR1, *MAR0[2]++ ; MR1 = Umaxa
MMOVF32 MR2, #0.0f ; MR1 = 0.0f
MMOVF32 MR3, #1.0f ; MR2 = 1.0f
MMINF32 MR0, MR1 ; MR0 = sat+
MMOV32 MR3, MR2, GT ; MR3 = v6
MMOV32 MR1, *MAR0[2]++ ; MR1 = Umina
MMAXF32 MR0, MR1 ; MR0 = sat-
MRCNDD UNC ; return call
MMOV32 MR3, MR2, LT ; MR3 = v6
MMOV32 *MAR0, MR3 ; save i6
MMOV32 MR3, @LFRAME + LFRAME_MR3 ; restore MR3
.unasg LFRAME
; end of file
@@ -0,0 +1,93 @@
; DCL_calcGamma.asm - compultes the linear region gain on TMU type 1
;
;;#############################################################################
;;!
;;! 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 $defined(__TI_EABI__)
.if __TI_EABI__
.asg DCL_calcGamma, _DCL_calcGamma
.endif
.endif
.global _DCL_calcGamma
.sect "dclfuncs"
; C prototype: float32_t DCL_calcGamma(float32_t a, float32_t d)
; argument 1 = a : [R0H] alpha - normalized [0.0f, +2.0f]
; argument 2 = d : [R1H] delta - normalized (0.0f, +1.0f]
; return = v : [R0H] calcGamma(d,a)
.align 2
_DCL_calcGamma:
.asmfunc
.if $defined(.TMS320C2800_TMU1)
; .if (.TMS320C2800_TMU1 = 1)
LOG2F32 R2H, R1H ; R2H = log2(d)
NOP
NOP
NOP
MPYF32 R3H, R0H, R2H ; R3H = a*log2(d)
NOP
NEGF32 R2H, R3H ; R2H = -a*log2(d)
IEXP2F32 R3H, R2H ; R3H = d^a
NOP
NOP
NOP
NOP
DIVF32 R0H, R3H, R1H ; R0H = d^(a-1)
NOP ; first delay slot for DIVF32, others in LRETR pipeline
.endif
LRETR ; return
.endasmfunc
.end
; end of file
@@ -0,0 +1,92 @@
; DCL_clamp_C1.asm - clamps output from immediate ARMA controller
;
;;#############################################################################
;;!
;;! 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 $defined(__TI_EABI__)
.if __TI_EABI__
.asg DCL_runClamp_C1, _DCL_runClamp_C1
.endif
.endif
.global _DCL_runClamp_C1
.sect "dclfuncs"
; This function saturates an input data value to defined upper & lower limits.
; If the input data lies definitely within limits the function returns 0,
; otherwise it returns 1.
; i.e. return 0 if (lowerLim < data < upperLim), otherwise return 1.
; C prototype: uint16_t DCL_runClamp_C1(float *data, float Umax, float Umin)
; argument 1 = *data: address of input data [XAR4]
; argument 2 = Umax : upper limit [R0H]
; argument 3 = Umin : lower limit [R1H]
; return = integer : 1 = clamped, 0 = not clamped [AL]
.align 2
_DCL_runClamp_C1:
.asmfunc
ZAPA ; AL = 0
MOV32 R2H, *+XAR4[0] ; R2H = data
CMPF32 R2H, R0H ; compare: data, Umax
MOVST0 ZF, NF ; copy flags: Z = ZF, N = NF
MOVB AL, #1, GEQ ; data >= Umax ---> AL = 1
MOV32 R0H, R2H, LT ; data < Umax ---> R0H = data
CMPF32 R2H, R1H ; comapare: data, Umin
MOVST0 ZF, NF ; copy flags: Z = ZF, N = NF
MOVB AL, #1, LEQ ; data <= Umin ---> AL = 1
MOV32 R0H, R1H, LT ; data < Umin ---> R0H = Umin
MOV32 *+XAR4[0], R0H ; &data = R0H
LRETR
.endasmfunc
.end
; end of file
@@ -0,0 +1,99 @@
; DCL_clamp_L1.asm - clamps output from immediate ARMA controller on CLA
;
;;#############################################################################
;;!
;;! 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 $defined(__TI_EABI__)
.if __TI_EABI__
.asg DCL_runClamp_L1, _DCL_runClamp_L1
.endif
.endif
.global _DCL_runClamp_L1
.def __cla_DCL_clamp_L1_sp
SIZEOF_LFRAME .set 4
LFRAME_MR3 .set 0
LFRAME_ONE .set 2
.align 2
__cla_DCL_clamp_L1_sp .usect ".scratchpad:Cla1Prog:_DCL_clamp_L1_LSECT", SIZEOF_LFRAME, 0, 1
.asg __cla_DCL_clamp_L1_sp, LFRAME
.sect "Cla1Prog:_DCL_clamp_L1_LSECT"
; This function saturates an input data value to defined upper & lower limits.
; If the input data lies definitely within limits the function returns 0.0f,
; otherwise it returns 1.0f. The return value can be used by the pre-computed
; controller to test for saturation.
; i.e. return 0.0f if (Umin < data < Umax), otherwise return 1.0f
; Returns 1.0f if data lies at the boundary: (data == Umax) or (data == Umin).
; Returns 1.0f if limits are invalid: (Umax < Umin).
; C prototype: float DCL_runClamp_L1(float *data, float Umax, float Umin)
; argument 1 = *data: address of input data [MAR0]
; argument 2 = Umax : upper limit [MR0]
; argument 3 = Umin : lower limit [MR1]
; return = float : 1.0f = clamped, 0.0f = not clamped [MR0]
_DCL_runClamp_L1:
MMOV32 @LFRAME + LFRAME_MR3, MR3 ; save MR3
MMOVF32 MR3, #1.0f ; MR3 = 1.0f
MMOV32 @LFRAME + LFRAME_ONE, MR3 ; save constant
MMOVF32 MR3, #0.0f ; MR3 = 0.0f
MMOV32 MR2, *MAR0 ; MR2 = data
MMINF32 MR0, MR2 ; if (MR0 > MR2) {MR0 = MR2, ZF = 0, NF = 0} elseif (MR0 == MR2) {ZF = 1, NF = 0} else {ZF = 0, NF = 1}
MMOV32 MR3, @LFRAME + LFRAME_ONE, LEQ ; if (data >= Umax) {MR3 = 1.0f}
MMAXF32 MR0, MR1 ; if (MR0 < MR1) {MR0 = MR1, ZF = 0, NF = 1} elseif (MR0 == MR1) {ZF = 1, NF = 0} else {ZF = 0, NF = 0}
MMOV32 MR3, @LFRAME + LFRAME_ONE, LEQ ; if (data <= Umin) {MR3 = 1.0f}
MRCNDD UNC ; return call
MMOV32 *MAR0, MR0 ; update data
MMOV32 MR0, MR3 ; return MR3
MMOV32 MR3, @LFRAME + LFRAME_MR3 ; restore MR3
.unasg LFRAME
; end of file
@@ -0,0 +1,60 @@
/* DCL_error.c */
//#############################################################################
//!
//! 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.
//#############################################################################
#include "DCL.h"
void DCL_runErrorHandler(DCL_CSS *p)
{
if (ERR_NONE != p->err)
{
DCL_BREAK_POINT;
while(1);
}
}
/* end of file */
@@ -0,0 +1,104 @@
; DCL_frwlog.asm - fast read & write operations to floating-point data log [DCL_fdlog.h]
;
;;#############################################################################
;;!
;;! 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 $defined(__TI_EABI__)
.if __TI_EABI__
.asg DCL_freadLog, _DCL_freadLog
.asg DCL_fwriteLog, _DCL_fwriteLog
.endif
.endif
.global _DCL_freadLog
.global _DCL_fwriteLog
.sect "dclfuncs"
; C prototype: float DCL_freadLog(FDLOG *p);
; argument 1 = *p: address of FDLOG structure [XAR4]
; return = FDLOG data [R0H]
.align 2
_DCL_freadLog:
.asmfunc
MOVL XAR0, *+XAR4[4] ; XAR0 = p.dptr
MOVL ACC, *+XAR4[0] ; ACC = p.fptr
MOV32 R0H, *XAR0++ ; R0H = data, XAR0 = p.dptr + 1
MOVL *+XAR4[4], XAR0 ; save dptr
MOVL P, XAR0 ; P = dptr
SUBUL P, *+XAR4[2] ; P = dptr - lptr
MOVL *+XAR4[4], ACC, GT ; wrap if p.lptr < (p.dptr + 1)
LRETR
.endasmfunc
; C prototype: float32_t DCL_fwriteLog(FDLOG *p, float32_t data);
; argument 1 = *p: address of FDLOG structure [XAR4]
; argument 2 = data: input FDLOG data [R0H]
; return = over-written FDLOG data [R0H]
.align 2
_DCL_fwriteLog:
.asmfunc
MOVL XAR0, *+XAR4[4] ; XAR0 = p.dptr
MOVL ACC, *XAR0 ; ACC = old data
MOV32 *XAR0++, R0H ; write new data, XAR0 = p.dptr + 1
MOV32 R0H, ACC ; save old data to R0H [4 delay slots]
MOVL ACC, *+XAR4[0] ; ACC = p.fptr
MOVL *+XAR4[4], XAR0 ; save dptr
MOVL P, XAR0 ; P = dptr
SUBUL P, *+XAR4[2] ; P = dptr - lptr
MOVL *+XAR4[4], ACC, GT ; wrap if p.lptr < (p.dptr + 1)
LRETR
.endasmfunc
.end
; end of file
@@ -0,0 +1,464 @@
; DCL_futils.asm - fast update function utilities for 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.
;;#############################################################################
; set symbols below to '1' to enable assembly
FU_PID .set 1
FU_PI .set 1
FU_PI2 .set 1
FU_DF11 .set 1
FU_DF13 .set 1
FU_DF22 .set 1
FU_DF23 .set 1
FU_GSM .set 1
FU_NLPID .set 1
.if $defined(__TI_EABI__)
.if __TI_EABI__
.asg DCL_fupdatePID, _DCL_fupdatePID
.asg DCL_fupdatePI, _DCL_fupdatePI
.asg DCL_fupdatePI2, _DCL_fupdatePI2
.asg DCL_fupdateDF11, _DCL_fupdateDF11
.asg DCL_fupdateDF13, _DCL_fupdateDF13
.asg DCL_fupdateDF22, _DCL_fupdateDF22
.asg DCL_fupdateDF23, _DCL_fupdateDF23
.asg DCL_fupdateGSM, _DCL_fupdateGSM
.asg DCL_fupdateNLPID, _DCL_fupdateNLPID
.endif
.endif
.sect "dclfuncs"
;--- PID ---------------------------------------------------------------------
.if FU_PID = 1
.global _DCL_fupdatePID
.align 2
; C prototype: void DCL_fupdatePID(DCL_PID *p)
; argument 1 = *p : 32-bit DCL_PID structure address [XAR4]
; return = void [R0H]
_DCL_fupdatePID:
.asmfunc
PUSH ST0 ; save flags
PUSH XAR0 ; save XAR0
PUSH XAR7 ; save XAR7
PUSH ST1 ; preserve INTM
MOVL XAR7, @XAR4 ; XAR7 = &p
ADDB XAR7, #26 ; XAR7 = &CSS
MOVL XAR0, *XAR7 ; XAR0 = &tpt
MOVL ACC, *+XAR0[4] ; ACC = CSS.sts
AND ACC, #1 ; mask bit 0
BF PID_EXIT, EQ ; skip if zero
TCLR *+XAR0[4], #0 ; clear STS_UPDATE_PENDING flag
MOVL XAR0, XAR7 ; XAR0 = &CSS
SUBB XAR0, #2 ; XAR0 = &SPS
MOVL XAR7, *XAR0 ; XAR7 = &Kp
SETC INTM ; block interrupts
RPT #11 ; repeat 12 times
|| PREAD *XAR4++, *XAR7 ; SPS copy
ADDB XAR4, #8 ; XAR4 = &Umax
ADDB XAR7, #12 ; XAR7 = &SPS.Umax
MOVL ACC, *XAR7++ ; SPS.Umax -> ACC
MOVL *XAR4++, ACC ; update Umax
MOVL ACC, *XAR7 ; SPS.Umin -> ACC
MOVL *XAR4, ACC ; update Umin
PID_EXIT:
POP ST1 ; restore INTM
POP XAR7 ; restore XAR7
POP XAR0 ; restore XAR0
POP ST0 ; restore flags
LRETR
.endasmfunc
.endif ; FU_PID
;--- PI ----------------------------------------------------------------------
.if FU_PI = 1
.global _DCL_fupdatePI
.align 2
; C prototype: void DCL_fupdatePI(DCL_PI *p)
; argument 1 = *p : 32-bit DCL_PI structure address [XAR4]
; return = void [R0H]
_DCL_fupdatePI:
.asmfunc
PUSH ST0 ; save flags
PUSH XAR0 ; save XAR0
PUSH XAR7 ; save XAR7
PUSH ST1 ; preserve INTM
MOVL XAR7, @XAR4 ; XAR7 = &p
ADDB XAR7, #20 ; XAR7 = &CSS
MOVL XAR0, *XAR7 ; XAR0 = &tpt
MOVL ACC, *+XAR0[4] ; ACC = CSS.sts
AND ACC, #1 ; mask bit 0
BF PI_EXIT, EQ ; skip if zero
TCLR *+XAR0[4], #0 ; clear STS_UPDATE_PENDING flag
MOVL XAR0, XAR7 ; XAR0 = &CSS
SUBB XAR0, #2 ; XAR0 = &SPS
MOVL XAR7, *XAR0 ; XAR7 = &Kp
SETC INTM ; block interrupts
MOVL ACC, *XAR7++ ; SPS.Kp -> ACC
MOVL *XAR4++, ACC ; update KpUmax
MOVL ACC, *XAR7++ ; SPS.Ki -> ACC
MOVL *XAR4++, ACC ; update Ki
ADDB XAR4, #2 ; XAR4 = &Umax
MOVL ACC, *XAR7++ ; SPS.Umax -> ACC
MOVL *XAR4++, ACC ; update Umax
MOVL ACC, *XAR7++ ; SPS.Umin -> ACC
MOVL *XAR4++, ACC ; update Umin
ADDB XAR4, #2 ; XAR4 = &Imax
MOVL ACC, *XAR7++ ; SPS.Imax -> ACC
MOVL *XAR4++, ACC ; update Imax
MOVL ACC, *XAR7 ; SPS.Imin -> ACC
MOVL *XAR4, ACC ; update Imin
PI_EXIT:
POP ST1 ; restore INTM
POP XAR7 ; restore XAR7
POP XAR0 ; restore XAR0
POP ST0 ; restore flags
LRETR
.endasmfunc
.endif ; FU_PI
;--- PI2 ----------------------------------------------------------------------
.if FU_PI2 = 1
.global _DCL_fupdatePI2
.align 2
; C prototype: void DCL_fupdatePI2(DCL_PI2 *p)
; argument 1 = *p : 32-bit DCL_PI structure address [XAR4]
; return = void [R0H]
_DCL_fupdatePI2:
.asmfunc
PUSH ST0 ; save flags
PUSH XAR0 ; save XAR0
PUSH XAR7 ; save XAR7
PUSH ST1 ; preserve INTM
MOVL XAR7, @XAR4 ; XAR7 = &p
ADDB XAR7, #18 ; XAR7 = &CSS
MOVL XAR0, *XAR7 ; XAR0 = &tpt
MOVL ACC, *+XAR0[4] ; ACC = CSS.sts
AND ACC, #1 ; mask bit 0
BF PI2_EXIT, EQ ; skip if zero
TCLR *+XAR0[4], #0 ; clear STS_UPDATE_PENDING flag
MOVL XAR0, XAR7 ; XAR0 = &CSS
SUBB XAR0, #2 ; XAR0 = &SPS
MOVL XAR7, *XAR0 ; XAR7 = &Kp
SETC INTM ; block interrupts
MOVL ACC, *XAR7++ ; SPS.Kp -> ACC
MOVL *XAR4++, ACC ; update KpUmax
MOVL ACC, *XAR7++ ; SPS.Ki -> ACC
MOVL *XAR4++, ACC ; update Ki
ADDB XAR4, #8 ; XAR4 = &Umax
MOVL ACC, *XAR7++ ; SPS.Umax -> ACC
MOVL *XAR4++, ACC ; update Umax
MOVL ACC, *XAR7 ; SPS.Umin -> ACC
MOVL *XAR4, ACC ; update Umin
PI2_EXIT:
POP ST1 ; restore INTM
POP XAR7 ; restore XAR7
POP XAR0 ; restore XAR0
POP ST0 ; restore flags
LRETR
.endasmfunc
.endif ; FU_PI2
;--- DF11 ----------------------------------------------------------------------
.if FU_DF11 = 1
.global _DCL_fupdateDF11
.align 2
; C prototype: void DCL_fupdateDF11(DCL_DF11 *p)
; argument 1 = *p : 32-bit DCL_DF11 structure address [XAR4]
; return = void [R0H]
_DCL_fupdateDF11:
.asmfunc
PUSH ST0 ; save flags
PUSH XAR0 ; save XAR0
PUSH XAR7 ; save XAR7
PUSH ST1 ; preserve INTM
MOVL XAR7, @XAR4 ; XAR7 = &p
ADDB XAR7, #12 ; XAR7 = &CSS
MOVL XAR0, *XAR7 ; XAR0 = &tpt
MOVL ACC, *+XAR0[4] ; ACC = CSS.sts
AND ACC, #1 ; mask bit 0
BF DF11_EXIT, EQ ; skip if zero
TCLR *+XAR0[4], #0 ; clear STS_UPDATE_PENDING flag
MOVL XAR0, XAR7 ; XAR0 = &CSS
SUBB XAR0, #2 ; XAR0 = &SPS
MOVL XAR7, *XAR0 ; XAR7 = &b0
SETC INTM ; block interrupts
RPT #5 ; repeat 6 times
|| PREAD *XAR4++, *XAR7 ; SPS copy
DF11_EXIT:
POP ST1 ; restore INTM
POP XAR7 ; restore XAR7
POP XAR0 ; restore XAR0
POP ST0 ; restore flags
LRETR
.endasmfunc
.endif ; FU_DF11
;--- DF13 ----------------------------------------------------------------------
.if FU_DF13 = 1
.global _DCL_fupdateDF13
.align 2
; C prototype: void DCL_fupdateDF13(DCL_DF13 *p)
; argument 1 = *p : 32-bit DCL_DF13 structure address [XAR4]
; return = void [R0H]
_DCL_fupdateDF13:
.asmfunc
PUSH ST0 ; save flags
PUSH XAR0 ; save XAR0
PUSH XAR7 ; save XAR7
PUSH ST1 ; preserve INTM
MOVL XAR7, @XAR4 ; XAR7 = &p
ADDB XAR7, #34 ; XAR7 = &CSS
MOVL XAR0, *XAR7 ; XAR0 = &tpt
MOVL ACC, *+XAR0[4] ; ACC = CSS.sts
AND ACC, #1 ; mask bit 0
BF DF13_EXIT, EQ ; skip if zero
TCLR *+XAR0[4], #0 ; clear STS_UPDATE_PENDING flag
MOVL XAR0, XAR7 ; XAR0 = &CSS
SUBB XAR0, #2 ; XAR0 = &SPS
MOVL XAR7, *XAR0 ; XAR7 = &b0
SETC INTM ; block interrupts
RPT #15 ; repeat 16 times
|| PREAD *XAR4++, *XAR7 ; SPS copy
DF13_EXIT:
POP ST1 ; restore INTM
POP XAR7 ; restore XAR7
POP XAR0 ; restore XAR0
POP ST0 ; restore flags
LRETR
.endasmfunc
.endif ; FU_DF13
;--- DF22 ----------------------------------------------------------------------
.if FU_DF22 = 1
.global _DCL_fupdateDF22
.align 2
; C prototype: void DCL_fupdateDF22(DCL_DF22 *p)
; argument 1 = *p : 32-bit DCL_DF22 structure address [XAR4]
; return = void [R0H]
_DCL_fupdateDF22:
.asmfunc
PUSH ST0 ; save flags
PUSH XAR0 ; save XAR0
PUSH XAR7 ; save XAR7
PUSH ST1 ; preserve INTM
MOVL XAR7, @XAR4 ; XAR7 = &p
ADDB XAR7, #16 ; XAR7 = &CSS
MOVL XAR0, *XAR7 ; XAR0 = &tpt
MOVL ACC, *+XAR0[4] ; ACC = CSS.sts
AND ACC, #1 ; mask bit 0
BF DF22_EXIT, EQ ; skip if zero
TCLR *+XAR0[4], #0 ; clear STS_UPDATE_PENDING flag
MOVL XAR0, XAR7 ; XAR0 = &CSS
SUBB XAR0, #2 ; XAR0 = &SPS
MOVL XAR7, *XAR0 ; XAR7 = &b0
SETC INTM ; block interrupts
RPT #9 ; repeat 10 times
|| PREAD *XAR4++, *XAR7 ; SPS copy
DF22_EXIT:
POP ST1 ; restore INTM
POP XAR7 ; restore XAR7
POP XAR0 ; restore XAR0
POP ST0 ; restore flags
LRETR
.endasmfunc
.endif ; FU_DF22
;--- DF23 ----------------------------------------------------------------------
.if FU_DF23 = 1
.global _DCL_fupdateDF23
.align 2
; C prototype: void DCL_fupdateDF23(DCL_DF23 *p)
; argument 1 = *p : 32-bit DCL_DF23 structure address [XAR4]
; return = void [R0H]
_DCL_fupdateDF23:
.asmfunc
PUSH ST0 ; save flags
PUSH XAR0 ; save XAR0
PUSH XAR7 ; save XAR7
PUSH ST1 ; preserve INTM
MOVL XAR7, @XAR4 ; XAR7 = &p
ADDB XAR7, #22 ; XAR7 = &CSS
MOVL XAR0, *XAR7 ; XAR0 = &tpt
MOVL ACC, *+XAR0[4] ; ACC = CSS.sts
AND ACC, #1 ; mask bit 0
BF DF23_EXIT, EQ ; skip if zero
TCLR *+XAR0[4], #0 ; clear STS_UPDATE_PENDING flag
MOVL XAR0, XAR7 ; XAR0 = &CSS
SUBB XAR0, #2 ; XAR0 = &SPS
MOVL XAR7, *XAR0 ; XAR7 = &b0
SETC INTM ; block interrupts
RPT #13 ; repeat 14 times
|| PREAD *XAR4++, *XAR7 ; SPS copy
DF23_EXIT:
POP ST1 ; restore INTM
POP XAR7 ; restore XAR7
POP XAR0 ; restore XAR0
POP ST0 ; restore flags
LRETR
.endasmfunc
.endif ; FU_DF23
;--- GSM ----------------------------------------------------------------------
.if FU_GSM = 1
.global _DCL_fupdateGSM
.align 2
; C prototype: void DCL_fupdateGSM(DCL_GSM *p)
; argument 1 = *p : 32-bit DCL_GSM structure address [XAR4]
; return = void [R0H]
_DCL_fupdateGSM:
.asmfunc
PUSH ST0 ; save flags
PUSH XAR0 ; save XAR0
PUSH XAR7 ; save XAR7
PUSH ST1 ; preserve INTM
MOVL XAR7, @XAR4 ; XAR7 = &p
ADDB XAR7, #38 ; XAR7 = &CSS
MOVL XAR0, *XAR7 ; XAR0 = &tpt
MOVL ACC, *+XAR0[4] ; ACC = CSS.sts
AND ACC, #1 ; mask bit 0
BF GSM_EXIT, EQ ; skip if zero
TCLR *+XAR0[4], #0 ; clear STS_UPDATE_PENDING flag
MOVL XAR0, XAR7 ; XAR0 = &CSS
SUBB XAR0, #2 ; XAR0 = &SPS
MOVL XAR7, *XAR0 ; XAR7 = &m[0]
SETC INTM ; block interrupts
RPT #33 ; repeat 34 times
|| PREAD *XAR4++, *XAR7 ; SPS copy
GSM_EXIT:
POP ST1 ; restore INTM
POP XAR7 ; restore XAR7
POP XAR0 ; restore XAR0
POP ST0 ; restore flags
LRETR
.endasmfunc
.endif ; FU_GSM
;--- NLPID -------------------------------------------------------------------
.if FU_NLPID = 1
.global _DCL_fupdateNLPID
.align 2
; C prototype: void DCL_fupdateNLPID(DCL_NLPID *p)
; argument 1 = *p : 32-bit DCL_NLPID structure address [XAR4]
; return = void [R0H]
_DCL_fupdateNLPID:
.asmfunc
PUSH ST0 ; save flags
PUSH XAR0 ; save XAR0
PUSH XAR7 ; save XAR7
PUSH ST1 ; preserve INTM
MOVL XAR7, @XAR4 ; XAR7 = &p
ADDB XAR7, #44 ; XAR7 = &CSS
MOVL XAR0, *XAR7 ; XAR0 = &tpt
MOVL ACC, *+XAR0[4] ; ACC = CSS.sts
AND ACC, #1 ; mask bit 0
BF NLPID_EXIT, EQ ; skip if zero
TCLR *+XAR0[4], #0 ; clear STS_UPDATE_PENDING flag
MOVL XAR0, XAR7 ; XAR0 = &CSS
SUBB XAR0, #2 ; XAR0 = &SPS
MOVL XAR7, *XAR0 ; XAR7 = &Kp
SETC INTM ; block interrupts
RPT #27 ; repeat 28 times
|| PREAD *XAR4++, *XAR7 ; SPS copy
ADDB XAR4, #10 ; XAR4 = &Umax
ADDB XAR7, #28 ; XAR7 = &SPS.Umax
MOVL ACC, *XAR7++ ; SPS.Umax -> ACC
MOVL *XAR4++, ACC ; update Umax
MOVL ACC, *XAR7 ; SPS.Umin -> ACC
MOVL *XAR4, ACC ; update Umin
NLPID_EXIT:
POP ST1 ; restore INTM
POP XAR7 ; restore XAR7
POP XAR0 ; restore XAR0
POP ST0 ; restore flags
LRETR
.endasmfunc
.endif ; FU_NLPID
;-----------------------------------------------------------------------------
.end
; end of file
@@ -0,0 +1,151 @@
; DCL_futils32.asm - fixed point function utilities for C28x
;
;;#############################################################################
;;!
;;! 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 $defined(__TI_EABI__)
.if __TI_EABI__
.asg DCL_fupdatePID32, _DCL_fupdatePID32
.asg DCL_fupdatePI32, _DCL_fupdatePI32
.endif
.endif
.sect "dcl32funcs"
;--- PID32 ---------------------------------------------------------------------
.global _DCL_fupdatePID32
.align 2
; C prototype: void DCL_fupdatePID32(DCL_PID32 *p)
; argument 1 = *p : 32-bit DCL_PID32 structure address [XAR4]
; return = void
_DCL_fupdatePID32:
.asmfunc
PUSH ST0 ; save flags
PUSH XAR0 ; save XAR0
PUSH XAR7 ; save XAR7
PUSH ST1 ; preserve INTM
MOVL XAR7, @XAR4 ; XAR7 = &p
ADDB XAR7, #24 ; XAR7 = &CSS
MOVL XAR0, *XAR7 ; XAR0 = &tpt
MOVL ACC, *+XAR0[4] ; ACC = CSS.sts
AND ACC, #1 ; mask bit 0
BF PID32_EXIT, EQ ; skip if zero
TCLR *+XAR0[4], #0 ; clear STS_UPDATE_PENDING flag
MOVL XAR0, XAR7 ; XAR0 = &CSS
SUBB XAR0, #2 ; XAR0 = &SPS
MOVL XAR7, *XAR0 ; XAR7 = &Kp
SETC INTM ; block interrupts
RPT #9 ; repeat 10 times
|| PREAD *XAR4++, *XAR7 ; SPS copy
ADDB XAR4, #8 ; XAR4 = &Umax
ADDB XAR7, #12 ; XAR7 = &SPS.Umax
MOVL ACC, *XAR7++ ; SPS.Umax -> ACC
MOVL *XAR4++, ACC ; update Umax
MOVL ACC, *XAR7 ; SPS.Umin -> ACC
MOVL *XAR4, ACC ; update Umin
PID32_EXIT:
POP ST1 ; restore INTM
POP XAR7 ; restore XAR7
POP XAR0 ; restore XAR0
POP ST0 ; restore flags
LRETR
.endasmfunc
;--- PI32 ----------------------------------------------------------------------
.global _DCL_fupdatePI32
.align 2
; C prototype: void DCL_fupdatePI32(DCL_PI32 *p)
; argument 1 = *p : 32-bit DCL_PI32 structure address [XAR4]
; return = void
_DCL_fupdatePI32:
.asmfunc
PUSH ST0 ; save flags
PUSH XAR0 ; save XAR0
PUSH XAR7 ; save XAR7
PUSH ST1 ; preserve INTM
MOVL XAR7, @XAR4 ; XAR7 = &p
ADDB XAR7, #14 ; XAR7 = &CSS
MOVL XAR0, *XAR7 ; XAR0 = &tpt
MOVL ACC, *+XAR0[4] ; ACC = CSS.sts
AND ACC, #1 ; mask bit 0
BF PI32_EXIT, EQ ; skip if zero
TCLR *+XAR0[4], #0 ; clear STS_UPDATE_PENDING flag
MOVL XAR0, XAR7 ; XAR0 = &CSS
SUBB XAR0, #2 ; XAR0 = &SPS
MOVL XAR7, *XAR0 ; XAR7 = &Kp
SETC INTM ; block interrupts
MOVL ACC, *XAR7++ ; SPS.Kp -> ACC
MOVL *XAR4++, ACC ; update KpUmax
MOVL ACC, *XAR7++ ; SPS.Ki -> ACC
MOVL *XAR4++, ACC ; update Ki
ADDB XAR4, #4 ; XAR4 = &Umax
MOVL ACC, *XAR7++ ; SPS.Umax -> ACC
MOVL *XAR4++, ACC ; update Umax
MOVL ACC, *XAR7 ; SPS.Umin -> ACC
MOVL *XAR4, ACC ; update Umin
PI32_EXIT:
POP ST1 ; restore INTM
POP XAR7 ; restore XAR7
POP XAR0 ; restore XAR0
POP ST0 ; restore flags
LRETR
.endasmfunc
;-----------------------------------------------------------------------------
.end
; end of file
@@ -0,0 +1,154 @@
; DCL_index.asm - computes performance indices from TCM data
;
;;#############################################################################
;;!
;;! 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 $defined(__TI_EABI__)
.if __TI_EABI__
.asg DCL_runITAE_C1, _DCL_runITAE_C1
.asg DCL_runIAE_C1, _DCL_runIAE_C1
.asg DCL_runIES_C1, _DCL_runIES_C1
.endif
.endif
.global _DCL_runITAE_C1
.global _DCL_runIAE_C1
.global _DCL_runIES_C1
.sect "dclfuncs"
; 11/14/2017: [RP] changed AR7 to AR0
; C prototype: float DCL_runITAE_C1(FDLOG *elog, float prd)
; argument 1 = *elog: address of input data [XAR4]
; argument 2 = prd : sample period in seconds [R0H]
; return = ITAE index [R0H]
.align 2
_DCL_runITAE_C1:
.asmfunc
MOVL ACC, *+XAR4[2] ; ACC = elog.lptr
SUBL ACC, *+XAR4[0] ; ACC = buffer length
LSR AL, #1 ; AL = N/2
MOV AR0, AL
ZERO R2H
ZERO R3H
MOVL XAR5, *XAR4
;--- repeat loop
RPTB _ITAE_END, AR0
MOV32 R1H, *XAR5++ ; R1H = data
ABSF32 R1H, R1H ; R1H = abs(data)
MPYF32 R1H, R1H, R3H ; R1H = abs(data) * time
ADDF32 R3H, R3H, R0H ; R3H = time
ADDF32 R2H, R2H, R1H ; R2H = cumulative index
_ITAE_END:
NOP
MOV32 R0H, R2H
LRETR
.endasmfunc
.page
; C prototype: float DCL_runIAE_C1(FDLOG *elog)
; argument 1 = *elog: address of input data [XAR4]
; return = IAE index [R0H]
.align 2
_DCL_runIAE_C1:
.asmfunc
MOVL ACC, *+XAR4[2] ; ACC = elog.lptr
SUBL ACC, *+XAR4[0] ; ACC = buffer length
LSR AL, #1 ; AL = N/2
MOV AR0, AL
ZERO R0H
MOVL XAR5, *XAR4
;--- repeat loop
RPTB _IAE_END, AR0
MOV32 R1H, *XAR5++ ; R1H = data
ABSF32 R1H, R1H ; R1H = abs(data)
ADDF32 R0H, R0H, R1H ; R0H = cumulative index
NOP
NOP
NOP
_IAE_END:
LRETR
.endasmfunc
.page
; C prototype: float DCL_runIES_C1(FDLOG *elog)
; argument 1 = *elog: address of input data [XAR4]
; return = IES index [R0H]
.align 2
_DCL_runIES_C1:
.asmfunc
MOVL ACC, *+XAR4[2] ; ACC = elog.lptr
SUBL ACC, *+XAR4[0] ; ACC = buffer length (N) in 16-bit words
LSR AL, #1 ; AL = N in 32-bit words
MOV AR0, AL ; AR7 = loop count
ZERO R0H
MOVL XAR5, *XAR4
;--- repeat loop
RPTB _IES_END, AR0
MOV32 R1H, *XAR5++ ; R1H = data
MPYF32 R2H, R1H, R1H ; R2H = data^2
NOP
ADDF32 R0H, R0H, R2H ; R0H = cumulative index
NOP
NOP
_IES_END:
LRETR
.endasmfunc
.end
; end of file