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,45 @@
<projectSpec>
<project
name="cla_ex1_asin"
device="TMS320F28377D"
cgtVersion="22.6.0.LTS"
products="sysconfig;C2000WARE"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
enableSysConfigTool="true"
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2837xD --package F2837xD_176PTP --part F2837xD_176PTP"
postBuildStep="
if ${CLB_DEBUG} == 1 mkdir &quot;${BuildDirectory}/simulation&quot;
;if ${CLB_DEBUG} == 1 ${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include/type3 -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp
;if ${CLB_DEBUG} == 1 ${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/type3/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/type3/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/type3/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/type3/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/type3/CLB_counter_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/type3/CLB_counter_top_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/type3/CLB_FSM_top_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/type3/CLB_LUT4_top_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/type3/CLB_OutputLUT_top_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group
;if ${CLB_DEBUG} == 1 &quot;./simulation/simulation_output.exe&quot;
;if ${CLB_DEBUG} == 1 ${NODE_TOOL} &quot;${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/dot_file_libraries/clbDotUtility.js&quot; &quot;${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/&quot; &quot;${BuildDirectory}/syscfg&quot; &quot;${BuildDirectory}/syscfg/clb.dot&quot;
;if ${GENERATE_DIAGRAM} == 1 mkdir &quot;${BuildDirectory}/diagrams&quot;
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} &quot;${C2000WARE_ROOT}/driverlib/.meta/generate_diagrams.js&quot; &quot;${C2000WARE_ROOT}&quot; &quot;${BuildDirectory}/diagrams&quot; &quot;${BuildDirectory}/syscfg&quot;
"
>
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=DEBUG -ml -mt -v28 --float_support=fpu32 --cla_support=cla1 --vcu_support=vcu2 --tmu_support=tmu0 --gen_func_subsections=on --define=CPU1 --diag_warning=225 --diag_suppress=10063 --diag_suppress=10068 --diag_suppress=770 --display_error_number" linkerBuildOptions="--define=CLA_C --entry_point code_start --stack_size=0x3F8 --heap_size=0x200 -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=DEBUG --define=_FLASH -ml -mt -v28 --float_support=fpu32 --cla_support=cla1 --vcu_support=vcu2 --tmu_support=tmu0 --define=CPU1 --diag_warning=225 --diag_suppress=10063 --diag_suppress=10068 --diag_suppress=770 --display_error_number --gen_func_subsections=on " linkerBuildOptions="--define=CLA_C --entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=_FLASH -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
<pathVariable name="CLB_SYSCFG_ROOT" path="../../../../../../utilities/clb_tool/clb_syscfg/" scope="project" />
<pathVariable name="SYSTEMC_INSTALL" path="../../../../../../utilities/clb_tool/clb_syscfg/systemc-2.3.3" scope="project" />
<pathVariable name="CLB_SIM_COMPILER" path="C:/TDM-GCC-64/bin" scope="project" />
<buildVariable name="CLB_DEBUG" value="0" scope="project" />
<buildVariable name="GENERATE_DIAGRAM" value="0" scope="project" />
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_CLA_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM"/>
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_CLA_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH"/>
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
<file action="copy" path="../asin.cla" targetDirectory="" />
<file action="copy" path="../cla_ex1_asin.c" targetDirectory="" />
<file action="copy" path="../cla_ex1_asin_shared.h" targetDirectory="" />
<file action="copy" path="../cla_ex1_asin.syscfg" targetDirectory="" />
</project>
</projectSpec>
@@ -0,0 +1,45 @@
<projectSpec>
<project
name="cla_ex2_atan"
device="TMS320F28377D"
cgtVersion="22.6.0.LTS"
products="sysconfig;C2000WARE"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
enableSysConfigTool="true"
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2837xD --package F2837xD_176PTP --part F2837xD_176PTP""
postBuildStep="
if ${CLB_DEBUG} == 1 mkdir &quot;${BuildDirectory}/simulation&quot;
;if ${CLB_DEBUG} == 1 ${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include/type3 -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp
;if ${CLB_DEBUG} == 1 ${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/type3/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/type3/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/type3/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/type3/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/type3/CLB_counter_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/type3/CLB_counter_top_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/type3/CLB_FSM_top_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/type3/CLB_LUT4_top_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/type3/CLB_OutputLUT_top_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group
;if ${CLB_DEBUG} == 1 &quot;./simulation/simulation_output.exe&quot;
;if ${CLB_DEBUG} == 1 ${NODE_TOOL} &quot;${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/dot_file_libraries/clbDotUtility.js&quot; &quot;${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/&quot; &quot;${BuildDirectory}/syscfg&quot; &quot;${BuildDirectory}/syscfg/clb.dot&quot;
;if ${GENERATE_DIAGRAM} == 1 mkdir &quot;${BuildDirectory}/diagrams&quot;
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} &quot;${C2000WARE_ROOT}/driverlib/.meta/generate_diagrams.js&quot; &quot;${C2000WARE_ROOT}&quot; &quot;${BuildDirectory}/diagrams&quot; &quot;${BuildDirectory}/syscfg&quot;
"
>
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_ROOT} --gen_func_subsections=on --define=DEBUG -ml -mt -v28 --float_support=fpu32 --cla_support=cla1 --vcu_support=vcu2 --tmu_support=tmu0 --define=CPU1 --diag_warning=225 --diag_suppress=10063 --diag_suppress=10068 --diag_suppress=770 --display_error_number" linkerBuildOptions=""--define=CLA_C --entry_point code_start --stack_size=0x3F8 --heap_size=0x200 -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_ROOT} --gen_func_subsections=on --define=DEBUG --define=_FLASH -ml -mt -v28 --float_support=fpu32 --cla_support=cla1 --vcu_support=vcu2 --tmu_support=tmu0 --define=CPU1 --diag_warning=225 --diag_suppress=10063 --diag_suppress=10068 --diag_suppress=770 --display_error_number" linkerBuildOptions="--define=CLA_C --entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=_FLASH -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
<pathVariable name="CLB_SYSCFG_ROOT" path="../../../../../../utilities/clb_tool/clb_syscfg/" scope="project" />
<pathVariable name="SYSTEMC_INSTALL" path="../../../../../../utilities/clb_tool/clb_syscfg/systemc-2.3.3" scope="project" />
<pathVariable name="CLB_SIM_COMPILER" path="C:/TDM-GCC-64/bin" scope="project" />
<buildVariable name="CLB_DEBUG" value="0" scope="project" />
<buildVariable name="GENERATE_DIAGRAM" value="0" scope="project" />
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_CLA_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM"/>
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_CLA_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH"/>
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
<file action="copy" path="../atan.cla" targetDirectory="" />
<file action="copy" path="../cla_ex2_atan.c" targetDirectory="" />
<file action="copy" path="../cla_ex2_atan_shared.h" targetDirectory="" />
<file action="copy" path="../cla_ex2_atan.syscfg" targetDirectory="" />
</project>
</projectSpec>
@@ -0,0 +1,162 @@
//#############################################################################
// \file asin.cla
//
// \brief Arc Sine Example
//
//#############################################################################
// $Copyright:
// Copyright (C) 2013-2024 Texas Instruments Incorporated - http://www.ti.com/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the
// distribution.
//
// Neither the name of Texas Instruments Incorporated nor the names of
// its contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// $
//#############################################################################
//
// Included Files
//
#include "cla_ex1_asin_shared.h"
//
// Defines
//
//
// Globals
//
// Note that the globals defined in the .cla source are global to the cla source
// file. i.e. they may be shared across tasks. All of the data shared between
// the CLA and the C28x CPU must be defined in the C (or C++) code, and not the
// CLA code.
//
//
// Function Definitions
//
//Task 1 : Calculate asin(X)
// Description:
// Step(1): Calculate absolute of the input X
//
// Step(2): Use the upper 6-bits of input "X" value as an
// index into the table to obtain the coefficients
// for a second order equation:
//
// _FPUasinTable:
// CoeffA0[0]
// CoeffA1[0]
// CoeffA2[0]
// .
// .
// CoeffA0[63]
// CoeffA1[63]
// CoeffA2[63]
//
// Step(3): Calculate the angle using the following equation:
//
// arctan(Ratio) = A0 + A1*Ratio + A2*Ratio*Ratio
// arctan(Ratio) = A0 + Ratio(A1 + A2*Ratio)
//
// Step(4): The final angle is determined as follows:
//
// if( X < 0 )
// Angle = -Angle
__interrupt void Cla1Task1 ( void )
{
//
//Local Variables
//
int xTblIdx; //integer valued Table index
float A0,A1,A2; //Table coefficients
float *entry;
float result;
//
//Preprocessing
//
__mdebugstop();
xTblIdx = fVal * TABLE_SIZE_M_1; //convert table index to u16-bits
xTblIdx = xTblIdx * 3; //Table is ordered as 3 32-bit coefficients, the
//index points to these triplets, hence the *3*sizeof(float)
entry = &CLAasinTable[xTblIdx];
A0 = *entry++;
A1 = *entry++;
A2 = *entry;
result = A0 + fVal*(A1 + A2*fVal);
//
//Post processing
//
if(fVal < 0)
{
result = - result;
}
fResult = result;
}
interrupt void Cla1Task2 ( void )
{
}
interrupt void Cla1Task3 ( void )
{
}
interrupt void Cla1Task4 ( void )
{
}
interrupt void Cla1Task5 ( void )
{
}
interrupt void Cla1Task6 ( void )
{
}
interrupt void Cla1Task7 ( void )
{
}
interrupt void Cla1Task8 ( void )
{
}
//
// End of file
//
@@ -0,0 +1,187 @@
//#############################################################################
// \file atan.cla
//
// \brief Arc Tangent Example
//
//#############################################################################
// $Copyright:
// Copyright (C) 2013-2024 Texas Instruments Incorporated - http://www.ti.com/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the
// distribution.
//
// Neither the name of Texas Instruments Incorporated nor the names of
// its contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// $
//#############################################################################
//
// Included Files
//
#include "cla_ex2_atan_shared.h"
//
// Defines
//
//
// Globals
//
// Note that the globals defined in the .cla source are global to the cla source
// file. i.e. they may be shared across tasks. All of the data shared between
// the CLA and the C28x CPU must be defined in the C (or C++) code, and not the
// CLA code.
//
//
// Function Definitions
//
//Task 1 : Calculate atan(Y)
// Description:
// Step(1): if( 1.0 >= abs(Y) )
// Numerator = abs(Y)
// Denominator = 1.0
// else
// Numerator = 1.0
// Denominator = abs(Y)
//
// Step(2): Ratio = Numerator/Denominator
//
// Note: Ratio range = 0.0 to 1.0
//
// Step(3): Use the upper 6-bits of the "Ratio" value as an
// index into the table to obtain the coefficients
// for a second order equation:
//
// _FPUatan2Table:
// CoeffA0[0]
// CoeffA1[0]
// CoeffA2[0]
// .
// .
// CoeffA0[63]
// CoeffA1[63]
// CoeffA2[63]
//
// Step(4): Calculate the angle using the following equation:
//
// arctan(Ratio) = A0 + A1*Ratio + A2*Ratio*Ratio
// arctan(Ratio) = A0 + Ratio(A1 + A2*Ratio)
//
// Step(5): The final angle is determined as follows:
//
// if( Y >= 0 and 1.0 >= abs(Y) )
// Angle = arctan(abs(Y)/1.0)
// if( Y >= 0 and 1.0 < abs(Y) )
// Angle = PI/2 - arctan(1.0/abs(Y))
// if( Y < 0 )
// Angle = -Angle
__interrupt void Cla1Task1 ( void )
{
//
//Local Variables
//
unsigned int uxTblIdx; //unsigned integer valued Table index
float ratio;
float num,den;
float A0,A1,A2; //Table coefficients
float *base;
float result;
//
//Preprocessing
//
__mdebugstop();
num = __mminf32(fabsf(fVal),1.0f);
den = __mmaxf32(fabsf(fVal),1.0f);
ratio = (num/den); //Expected the newton raphson algo for better
//accuracy on the divide
uxTblIdx = ratio * TABLE_SIZE_M_1 * 3; //convert table index to u16-bits
uxTblIdx = uxTblIdx * 3; //Table is ordered as 3 32-bit coefficients, the
//index points to these triplets, hence the *3*sizeof(float)
base = &CLAatan2Table[uxTblIdx];
A0 = *base++;
A1 = *base++;
A2 = *base;
result = A0 + ratio*(A1 + A2*ratio);
//
//Post processing
//
if(fabsf(fVal) > 1.0f)
{
result = PIBYTWO - result;
}
if(fVal < 0.0f)
{
result = -result;
}
fResult = result;
}
interrupt void Cla1Task2 ( void )
{
}
interrupt void Cla1Task3 ( void )
{
}
interrupt void Cla1Task4 ( void )
{
}
interrupt void Cla1Task5 ( void )
{
}
interrupt void Cla1Task6 ( void )
{
}
interrupt void Cla1Task7 ( void )
{
}
interrupt void Cla1Task8 ( void )
{
}
//
// End of file
//
@@ -0,0 +1,416 @@
//###########################################################################
//
// FILE: cla_ex1_asin.c
//
// TITLE: CLA Arcsine Example
//
//! \addtogroup driver_example_list
//! <h1>CLA \f$arcsine(x)\f$ using a lookup table (cla_asin_cpu01)</h1>
//!
//! In this example, Task 1 of the CLA will calculate the arcsine of
//! an input argument in the range (-1.0 to 1.0) using a lookup table.
//!
//! \b Memory \b Allocation \n
//! - CLA1 Math Tables (RAMLS0)
//! - CLAasinTable - Lookup table
//! - CLA1 to CPU Message RAM
//! - fResult - Result of the lookup algorithm
//! - CPU to CLA1 Message RAM
//! - fVal - Sample input to the lookup algorithm
//!
//! \b Watch \b Variables \n
//! - fVal - Argument to task 1
//! - fResult - Result of \f$arcsin(fVal)\f$
//!
//
//###########################################################################
// $Copyright:
// Copyright (C) 2013-2024 Texas Instruments Incorporated - http://www.ti.com/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the
// distribution.
//
// Neither the name of Texas Instruments Incorporated nor the names of
// its contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// $
//###########################################################################
//
// Included Files
//
#include "driverlib.h"
#include "device.h"
#include "cla_ex1_asin_shared.h"
#include "board.h"
//
// Defines
//
#define WAITSTEP asm(" RPT #255 || NOP")
//
// Globals
//
//
//Task 1 (C) Variables
// NOTE: Do not initialize the Message RAM variables globally, they will be
// reset during the message ram initialization phase in the CLA memory
// configuration routine
//
#ifdef __cplusplus
#pragma DATA_SECTION("CpuToCla1MsgRAM");
float fVal;
#pragma DATA_SECTION("Cla1ToCpuMsgRAM");
float fResult;
#else
#pragma DATA_SECTION(fVal,"CpuToCla1MsgRAM");
float fVal;
#pragma DATA_SECTION(fResult,"Cla1ToCpuMsgRAM");
float fResult;
#endif //__cplusplus
float y[BUFFER_SIZE];
//
//Task 2 (C) Variables
//
//
//Task 3 (C) Variables
//
//
//Task 4 (C) Variables
//
//
//Task 5 (C) Variables
//
//
//Task 6 (C) Variables
//
//
//Task 7 (C) Variables
//
//
//Task 8 (C) Variables
//
//
//Common (C) Variables
//The Exponential table
//
#ifdef __cplusplus
#pragma DATA_SECTION("CLADataLS0")
#else
#pragma DATA_SECTION(CLAasinTable,"CLADataLS0")
#endif //__cplusplus
float CLAasinTable[]={
0.0, 1.0, 0.0,
0.000000636202, 0.999877862610, 0.007815361896,
0.000005099694, 0.999510644409, 0.015647916155,
0.000017268312, 0.998895919094, 0.023514960332,
0.000041121765, 0.998029615282, 0.031434003631,
0.000080794520, 0.996905974725, 0.039422875916,
0.000140631089, 0.995517492804, 0.047499840611,
0.000225244584, 0.993854840311, 0.055683712914,
0.000339579512, 0.991906765146, 0.063993984848,
0.000488979852, 0.989659972212, 0.072450958820,
0.000679263611, 0.987098979366, 0.081075891529,
0.000916805182, 0.984205946802, 0.089891150305,
0.001208627040, 0.980960476685, 0.098920384204,
0.001562502549, 0.977339379243, 0.108188712551,
0.001987071928, 0.973316400729, 0.117722933997,
0.002491973784, 0.968861907789, 0.127551759665,
0.003087995053, 0.963942521723, 0.137706074532,
0.003787242692, 0.958520694794, 0.148219231941,
0.004603341138, 0.952554219267, 0.159127386977,
0.005551660294, 0.945995657913, 0.170469875522,
0.006649579796, 0.938791682505, 0.182289647088,
0.007916796475, 0.930882303984, 0.194633761132,
0.009375683410, 0.922199974574, 0.207553958472,
0.011051710808, 0.912668537890, 0.221107321885,
0.012973941175, 0.902201997769, 0.235357042896,
0.015175614174, 0.890703070035, 0.250373315541,
0.017694840102, 0.878061473098, 0.266234382514,
0.020575425537, 0.864151902887, 0.283027765009,
0.023867860513, 0.848831624374, 0.300851714968,
0.027630504055, 0.831937595031, 0.319816937941,
0.031931014547, 0.813283013821, 0.340048646894,
0.036848083955, 0.792653161200, 0.361689022958,
0.042473551274, 0.769800358920, 0.384900179460,
0.048914992206, 0.744437830278, 0.409867752228,
0.056298910750, 0.716232177740, 0.436805274317,
0.064774696786, 0.684794109766, 0.465959540059,
0.074519565699, 0.649666934178, 0.497617226179,
0.085744766889, 0.610312179660, 0.532113122767,
0.098703445606, 0.566091493186, 0.569840443472,
0.113700678529, 0.516243664372, 0.611263845480,
0.131106395009, 0.459855210927, 0.656936015611,
0.151372169232, 0.395822366759, 0.707518998893,
0.175053263659, 0.322801460177, 0.763811905770,
0.202837883870, 0.239143420888, 0.826787304376,
0.235586468765, 0.142806299514, 0.897639596948,
0.274385149825, 0.031236880585, 0.977850174820,
0.320619535938, -0.098791845166, 1.069276441800,
0.376078169620, -0.251407364538, 1.174275392129,
0.443100143614, -0.431959397725, 1.295878193174,
0.524789871827, -0.647485610469, 1.438041695773,
0.625336471263, -0.907400624736, 1.606018804842,
0.750500589935, -1.224540947101, 1.806917563896,
0.908377657341, -1.616794995066, 2.050569262035,
1.110633894185, -2.109729648039, 2.350920816737,
1.374584721437, -2.740985157716, 2.728353889708,
1.726848242753, -3.567962877198, 3.213722960014,
2.210117561056, -4.682006534082, 3.855770086891,
2.896554011854, -6.236312386687, 4.735651038017,
3.916505715382, -8.505488022524, 5.997790945975,
5.526855868703, -12.026617159136, 7.922628470498,
8.298197116322, -17.983705080358, 11.123941286820,
13.741706072449, -29.488929624542, 17.203344479111,
27.202707817485, -57.466598393615, 31.741016484669,
83.158101335898, -171.803399517566, 90.149831709374
};
float asin_expected[BUFFER_SIZE]={
1.570796, 1.393789, 1.320141, 1.263401, 1.215375,
1.172892, 1.134327, 1.098718, 1.065436, 1.034046,
1.004232, 0.9757544, 0.9484279, 0.9221048, 0.8966658,
0.8720123, 0.8480621, 0.8247454, 0.8020028, 0.7797828,
0.7580408, 0.7367374, 0.7158381, 0.6953120, 0.6751316,
0.6552721, 0.6357113, 0.6164289, 0.5974064, 0.5786270,
0.5600753, 0.5417370, 0.5235988, 0.5056486, 0.4878751,
0.4702678, 0.4528166, 0.4355124, 0.4183464, 0.4013104,
0.3843968, 0.3675981, 0.3509074, 0.3343180, 0.3178237,
0.3014185, 0.2850964, 0.2688521, 0.2526802, 0.2365756,
0.2205333, 0.2045484, 0.1886164, 0.1727327, 0.1568929,
0.1410927, 0.1253278, 0.1095943, 0.09388787, 0.07820469,
0.06254076, 0.04689218, 0.03125509, 0.01562564
};
uint16_t pass = 0;
uint16_t fail = 0;
//
// Function Prototypes
//
void CLA_runTest(void);
__interrupt void cla1Isr1();
__interrupt void cla1Isr2();
__interrupt void cla1Isr3();
__interrupt void cla1Isr4();
__interrupt void cla1Isr5();
__interrupt void cla1Isr6();
__interrupt void cla1Isr7();
__interrupt void cla1Isr8();
//
// Main
//
void main(void)
{
//
// Intialize device clock and peripherals
//
Device_init();
//
// Disable pin locks and enable internal pullups.
//
//Device_initGPIO(); //skipped for this example
//
// Initialize PIE and clear PIE registers. Disables CPU interrupts
//
Interrupt_initModule();
//
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
//
Interrupt_initVectorTable();
//
// Initialize resources
//
Board_init();
//
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
//
EINT;
ERTM;
//
// Run the test
//
CLA_runTest();
for(;;)
{
}
}
//
// CLA_runTest - Execute CLA task tests for specified vectors
//
void CLA_runTest(void)
{
int16_t i;
float error;
for(i = 0; i < BUFFER_SIZE; i++)
{
fVal= (float)(BUFFER_SIZE - i)/(float)BUFFER_SIZE;
CLA_forceTasks(CLA1_BASE,CLA_TASKFLAG_1);
WAITSTEP;
y[i] = fResult;
error = fabsf(asin_expected[i]-y[i]);
if(error < 0.1f)
{
pass++;
}
else
{
fail++;
}
}
#if 0
CLA_forceTasks(CLA1_BASE,CLA_TASKFLAG_2);
WAITSTEP;
CLA_forceTasks(CLA1_BASE,CLA_TASKFLAG_3);
WAITSTEP;
CLA_forceTasks(CLA1_BASE,CLA_TASKFLAG_4);
WAITSTEP;
CLA_forceTasks(CLA1_BASE,CLA_TASKFLAG_5);
WAITSTEP;
CLA_forceTasks(CLA1_BASE,CLA_TASKFLAG_6);
WAITSTEP;
CLA_forceTasks(CLA1_BASE,CLA_TASKFLAG_7);
WAITSTEP;
CLA_forceTasks(CLA1_BASE,CLA_TASKFLAG_8);
WAITSTEP;
#endif
}
//
// cla1Isr1 - CLA1 ISR 1
//
__interrupt void cla1Isr1 ()
{
//
// Acknowledge the end-of-task interrupt for task 1
//
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP11);
//
// Uncomment to halt debugger and stop here
//
// asm(" ESTOP0");
}
//
// cla1Isr2 - CLA1 ISR 2
//
__interrupt void cla1Isr2 ()
{
asm(" ESTOP0");
}
//
// cla1Isr3 - CLA1 ISR 3
//
__interrupt void cla1Isr3 ()
{
asm(" ESTOP0");
}
//
// cla1Isr4 - CLA1 ISR 4
//
__interrupt void cla1Isr4 ()
{
asm(" ESTOP0");
}
//
// cla1Isr5 - CLA1 ISR 5
//
__interrupt void cla1Isr5 ()
{
asm(" ESTOP0");
}
//
// cla1Isr6 - CLA1 ISR 6
//
__interrupt void cla1Isr6 ()
{
asm(" ESTOP0");
}
//
// cla1Isr7 - CLA1 ISR 7
//
__interrupt void cla1Isr7 ()
{
asm(" ESTOP0");
}
//
// cla1Isr8 - CLA1 ISR 8
//
__interrupt void cla1Isr8 ()
{
//
// Acknowledge the end-of-task interrupt for task 8
//
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP11);
//
// Uncomment to halt debugger and stop here
//
// asm(" ESTOP0");
}
//
// End of file
//
@@ -0,0 +1,20 @@
/**
* Import the modules used in this configuration.
*/
const cla = scripting.addModule("/driverlib/cla.js", {}, false);
const cla1 = cla.addInstance();
const memcfg = scripting.addModule("/driverlib/memcfg.js");
/**
* Write custom configuration values to the imported modules.
*/
cla1.$name = "myCLA0";
memcfg.config_MEMCFG_SECT_LS4 = "CLA_prog";
memcfg.config_MEMCFG_SECT_LS5 = "CLA_prog";
memcfg.config_MEMCFG_SECT_LS0 = "CLA_data";
memcfg.config_MEMCFG_SECT_LS1 = "CLA_data";
memcfg.init_MEMCFG_SECT_MSGCPUTOCLA1 = true;
memcfg.init_MEMCFG_SECT_MSGCLA1TOCPU = true;
@@ -0,0 +1,131 @@
#ifndef _CLA_ASIN_SHARED_H_
#define _CLA_ASIN_SHARED_H_
//#############################################################################
//
// FILE: cla_ex1_asin_shared.h
//
// TITLE: CLA arcsine example header file.
//
//#############################################################################
// $Copyright:
// Copyright (C) 2013-2024 Texas Instruments Incorporated - http://www.ti.com/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the
// distribution.
//
// Neither the name of Texas Instruments Incorporated nor the names of
// its contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// $
//#############################################################################
//
// Included Files
//
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
//
// Defines
//
#define BUFFER_SIZE 64
#define TABLE_SIZE 64
#define TABLE_SIZE_M_1 TABLE_SIZE-1
#define PIBYTWO 1.570796327
#define PI 3.141592653589
#define INV2PI 0.159154943
//
// Globals
//
//
//Task 1 (C) Variables
//
extern float y[]; //Result vector
extern float fVal; //Holds the input argument to the task
extern float fResult; //The arsine of the input argument
//
//Task 2 (C) Variables
//
//
//Task 3 (C) Variables
//
//
//Task 4 (C) Variables
//
//
//Task 5 (C) Variables
//
//
//Task 6 (C) Variables
//
//
//Task 7 (C) Variables
//
//
//Task 8 (C) Variables
//
//
//Common (C) Variables
//
extern float CLAasinTable[]; //The arcsine lookup table
//
// Function Prototypes
//
// The following are symbols defined in the CLA assembly code
// Including them in the shared header file makes them
// .global and the main CPU can make use of them.
//
__interrupt void Cla1Task1();
__interrupt void Cla1Task2();
__interrupt void Cla1Task3();
__interrupt void Cla1Task4();
__interrupt void Cla1Task5();
__interrupt void Cla1Task6();
__interrupt void Cla1Task7();
__interrupt void Cla1Task8();
#ifdef __cplusplus
}
#endif // extern "C"
#endif //end of _CLA_ASIN_SHARED_H_ definition
//
// End of file
//
@@ -0,0 +1,433 @@
//###########################################################################
//
// FILE: cla_ex2_atan.c
//
// TITLE: CLA ArcTan Example for F2837xD.
//
//! \addtogroup driver_example_list
//! <h1>CLA \f$arctangent(x)\f$ using a lookup table (cla_atan_cpu01)</h1>
//!
//! In this example, Task 1 of the CLA will calculate the arctangent of
//! an input argument using a lookup table.
//!
//! \b Memory \b Allocation \n
//! - CLA1 Math Tables (RAMLS0)
//! - CLAatan2Table - Lookup table
//! - CLA1 to CPU Message RAM
//! - fResult - Result of the lookup algorithm
//! - CPU to CLA1 Message RAM
//! - fNum - Numerator of sample input
//! - fDen - Denominator of sample input
//!
//! \b Watch \b Variables \n
//! - fVal - Argument to task 1
//! - fResult - Result of \f$arctan(fVal)\f$
//!
//
//###########################################################################
//
//
// $Copyright:
// Copyright (C) 2013-2024 Texas Instruments Incorporated - http://www.ti.com/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the
// distribution.
//
// Neither the name of Texas Instruments Incorporated nor the names of
// its contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// $
//###########################################################################
//
// Included Files
//
#include "driverlib.h"
#include "device.h"
#include "cla_ex2_atan_shared.h"
#include "board.h"
//
// Defines
//
#define WAITSTEP asm(" RPT #255 || NOP")
//
// Globals
//
//
//Task 1 (C) Variables
// NOTE: Do not initialize the Message RAM variables globally, they will be
// reset during the message ram initialization phase in the CLA memory
// configuration routine
//
#ifdef __cplusplus
#pragma DATA_SECTION("CpuToCla1MsgRAM");
float fVal;
#pragma DATA_SECTION("CpuToCla1MsgRAM")
float PIBYTWO;
#pragma DATA_SECTION("Cla1ToCpuMsgRAM");
float fResult;
#else
#pragma DATA_SECTION(fVal,"CpuToCla1MsgRAM");
float fVal;
#pragma DATA_SECTION(PIBYTWO,"CpuToCla1MsgRAM")
float PIBYTWO = 1.570796327;
#pragma DATA_SECTION(fResult,"Cla1ToCpuMsgRAM");
float fResult;
#endif //__cplusplus
float y[BUFFER_SIZE];
//
//Task 2 (C) Variables
//
//
//Task 3 (C) Variables
//
//
//Task 4 (C) Variables
//
//
//Task 5 (C) Variables
//
//
//Task 6 (C) Variables
//
//
//Task 7 (C) Variables
//
//
//Task 8 (C) Variables
//
//
//Common (C) Variables
//The Exponential table
//
#ifdef __cplusplus
#pragma DATA_SECTION("CLADataLS0")
#else
#pragma DATA_SECTION(CLAatan2Table,"CLADataLS0")
#endif //__cplusplus
float CLAatan2Table[]={
0.000000000000, 1.000040679675, -0.007811069750,
-0.000003807022, 1.000528067772, -0.023410345493,
-0.000018968310, 1.001498568106, -0.038941197075,
-0.000052831927, 1.002943680965, -0.054358563160,
-0.000112417996, 1.004850785788, -0.069618206649,
-0.000204295885, 1.007203293243, -0.084677028723,
-0.000334469493, 1.009980843501, -0.099493367628,
-0.000508272606, 1.013159547023, -0.114027278430,
-0.000730276035, 1.016712263449, -0.128240790343,
-0.001004207980, 1.020608913557, -0.142098138715,
-0.001332888717, 1.024816818801, -0.155565969259,
-0.001718180431, 1.029301062569, -0.168613512667,
-0.002160952612, 1.034024867135, -0.181212728329,
-0.002661063159, 1.038949980222, -0.193338416410,
-0.003217354977, 1.044037065160, -0.204968298146,
-0.003827667546, 1.049246088868, -0.216083064706,
-0.004488862702, 1.054536702192, -0.226666395507,
-0.005196863579, 1.059868607573, -0.236704947279,
-0.005946705500, 1.065201909527, -0.246188315613,
-0.006732597422, 1.070497443994, -0.255108971022,
-0.007547992413, 1.075717083222, -0.263462171840,
-0.008385665599, 1.080824013499, -0.271245856476,
-0.009237797924, 1.085782983693, -0.278460517693,
-0.010096064139, 1.090560523211, -0.285109061650,
-0.010951723407, 1.095125128557, -0.291196654447,
-0.011795711029, 1.099447418304, -0.296730558920,
-0.012618729873, 1.103500256784, -0.301719964310,
-0.013411340199, 1.107258847274, -0.306175811325,
-0.014164046711, 1.110700795887, -0.310110614947,
-0.014867381831, 1.113806147717, -0.313538287176,
-0.015511984298, 1.116557397059, -0.316473961655,
-0.016088672395, 1.118939473766, -0.318933821948,
-0.016588511229, 1.120939707956, -0.320934934991,
-0.017002873645, 1.122547775367, -0.322495091022,
-0.017323494499, 1.123755625749, -0.323632651068,
-0.017542518140, 1.124557396633, -0.324366402860,
-0.017652539065, 1.124949314810, -0.324715425833,
-0.017646635823, 1.124929587773, -0.324698965683,
-0.017518398344, 1.124498287266, -0.324336318787,
-0.017261948920, 1.123657226955, -0.323646726613,
-0.016871957164, 1.122409836098, -0.322649280139,
-0.016343649294, 1.120761030918, -0.321362834119,
-0.015672812166, 1.118717085258, -0.319805931024,
-0.014855792451, 1.116285501852, -0.317996734279,
-0.013889491441, 1.113474885484, -0.315952970460,
-0.012771355912, 1.110294819035, -0.313691879968,
-0.011499365513, 1.106755743329, -0.311230175714,
-0.010072017131, 1.102868841531, -0.308584009287,
-0.008488306656, 1.098645928648, -0.305768944066,
-0.006747708579, 1.094099346648, -0.302799934724,
-0.004850153815, 1.089241865523, -0.299691312610,
-0.002796006119, 1.084086590517, -0.296456776409,
-0.000586037441, 1.078646875666, -0.293109387609,
0.001778597452, 1.072936243727, -0.289661570229,
0.004296386804, 1.066968312440, -0.286125114351,
0.006965487894, 1.060756727064, -0.282511182960,
0.009783753017, 1.054315099009, -0.278830321668,
0.012748755207, 1.047656950440, -0.275092470943,
0.015857813546, 1.040795664582, -0.271306980411,
0.019108017893, 1.033744441476, -0.267482624928,
0.022496252887, 1.026516258989, -0.263627622089,
0.026019221162, 1.019123838651, -0.259749650860,
0.029673465636, 1.011579616186, -0.255855871106,
0.033455390838, 1.003895716322, -0.251952943763,
0.037361283212, 0.996083931611, -0.248047051426
};
float atan_expected[BUFFER_SIZE]={
1.5395565, 1.5385494, 1.5374753, 1.5363272,
1.5350972, 1.5337762, 1.5323538, 1.5308176,
1.5291537, 1.5273454, 1.5253731, 1.5232133,
1.5208379, 1.5182133, 1.5152978, 1.5120405,
1.5083776, 1.5042281, 1.4994888, 1.4940244,
1.4876550, 1.4801364, 1.4711276, 1.4601392,
1.4464413, 1.4288993, 1.4056476, 1.3734008,
1.3258177, 1.2490457, 1.1071488, 0.7853982,
0.0000000, -0.7853982, -1.1071488, -1.2490457,
-1.3258177, -1.3734008, -1.4056476, -1.4288993,
-1.4464413, -1.4601392, -1.4711276, -1.4801364,
-1.4876550, -1.4940244, -1.4994888, -1.5042281,
-1.5083776, -1.5120405, -1.5152978, -1.5182133,
-1.5208379, -1.5232133, -1.5253731, -1.5273454,
-1.5291537, -1.5308176, -1.5323538, -1.5337762,
-1.5350972, -1.5363272, -1.5374753, -1.5385494
};
uint16_t pass = 0;
uint16_t fail = 0;
//
// Function Prototypes
//
void CLA_runTest(void);
__interrupt void cla1Isr1();
__interrupt void cla1Isr2();
__interrupt void cla1Isr3();
__interrupt void cla1Isr4();
__interrupt void cla1Isr5();
__interrupt void cla1Isr6();
__interrupt void cla1Isr7();
__interrupt void cla1Isr8();
//
// Main
//
void main(void)
{
//
// Initialize device clock and peripherals
//
Device_init();
//
// Disable pin locks and enable internal pullups.
//
//Device_initGPIO(); //skipped for this example
//
// Initialize PIE and clear PIE registers. Disables CPU interrupts
//
Interrupt_initModule();
//
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
//
Interrupt_initVectorTable();
//
// Initialize resources
//
Board_init();
//
// Enable Global Interrupts (INTM) and realtime interrupt (DGBM)
//
EINT;
ERTM;
//
// Run the test
//
CLA_runTest();
for(;;)
{
}
}
//
// CLA_runTest - Execute CLA task tests for specified vectors
//
void CLA_runTest(void)
{
int16_t i;
float error;
//
// Initialize the CPUToCLA1MsgRam variables here
//
PIBYTWO = 1.570796327;
for(i = 0; i < BUFFER_SIZE; i++)
{
fVal = (float)((BUFFER_SIZE/2) - i);
CLA_forceTasks(CLA1_BASE,CLA_TASKFLAG_1);
WAITSTEP;
y[i] = fResult;
error = fabsf(atan_expected[i]-y[i]);
if(error < 0.001f)
{
pass++;
}
else
{
fail++;
}
}
#if 0
CLA_forceTasks(CLA1_BASE,CLA_TASKFLAG_2);
WAITSTEP;
CLA_forceTasks(CLA1_BASE,CLA_TASKFLAG_3);
WAITSTEP;
CLA_forceTasks(CLA1_BASE,CLA_TASKFLAG_4);
WAITSTEP;
CLA_forceTasks(CLA1_BASE,CLA_TASKFLAG_5);
WAITSTEP;
CLA_forceTasks(CLA1_BASE,CLA_TASKFLAG_6);
WAITSTEP;
CLA_forceTasks(CLA1_BASE,CLA_TASKFLAG_7);
WAITSTEP;
CLA_forceTasks(CLA1_BASE,CLA_TASKFLAG_8);
WAITSTEP;
#endif
}
//
// cla1Isr1 - CLA1 ISR 1
//
__interrupt void cla1Isr1 ()
{
//
// Acknowledge the end-of-task interrupt for task 1
//
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP11);
//
// Uncomment to halt debugger and stop here
//
// asm(" ESTOP0");
}
//
// cla1Isr2 - CLA1 ISR 2
//
__interrupt void cla1Isr2 ()
{
asm(" ESTOP0");
}
//
// cla1Isr3 - CLA1 ISR 3
//
__interrupt void cla1Isr3 ()
{
asm(" ESTOP0");
}
//
// cla1Isr4 - CLA1 ISR 4
//
__interrupt void cla1Isr4 ()
{
asm(" ESTOP0");
}
//
// cla1Isr5 - CLA1 ISR 5
//
__interrupt void cla1Isr5 ()
{
asm(" ESTOP0");
}
//
// cla1Isr6 - CLA1 ISR 6
//
__interrupt void cla1Isr6 ()
{
asm(" ESTOP0");
}
//
// cla1Isr7 - CLA1 ISR 7
//
__interrupt void cla1Isr7 ()
{
asm(" ESTOP0");
}
//
// cla1Isr8 - CLA1 ISR 8
//
__interrupt void cla1Isr8 ()
{
//
// Acknowledge the end-of-task interrupt for task 8
//
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP11);
//
// Uncomment to halt debugger and stop here
//
// asm(" ESTOP0");
}
//
// End of file
//
@@ -0,0 +1,20 @@
/**
* Import the modules used in this configuration.
*/
const cla = scripting.addModule("/driverlib/cla.js", {}, false);
const cla1 = cla.addInstance();
const memcfg = scripting.addModule("/driverlib/memcfg.js");
/**
* Write custom configuration values to the imported modules.
*/
cla1.$name = "myCLA0";
memcfg.config_MEMCFG_SECT_LS4 = "CLA_prog";
memcfg.config_MEMCFG_SECT_LS5 = "CLA_prog";
memcfg.config_MEMCFG_SECT_LS0 = "CLA_data";
memcfg.config_MEMCFG_SECT_LS1 = "CLA_data";
memcfg.init_MEMCFG_SECT_MSGCPUTOCLA1 = true;
memcfg.init_MEMCFG_SECT_MSGCLA1TOCPU = true;
@@ -0,0 +1,129 @@
#ifndef _CLA_ATAN_SHARED_H_
#define _CLA_ATAN_SHARED_H_
//#############################################################################
//
// FILE: cla_ex2_atan_shared.h
//
// TITLE: CLA arctangent example header file.
//
//#############################################################################
// $Copyright:
// Copyright (C) 2013-2024 Texas Instruments Incorporated - http://www.ti.com/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the
// distribution.
//
// Neither the name of Texas Instruments Incorporated nor the names of
// its contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// $
//#############################################################################
//
// Included Files
//
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
//
// Defines
//
#define BUFFER_SIZE 64
#define TABLE_SIZE 64
#define TABLE_SIZE_M_1 TABLE_SIZE-1
#define INV2PI 0.159154943
//
// Globals
//
//
//Task 1 (C) Variables
//
extern float y[]; //Result vector
extern float fVal; //Holds the input argument to the task
extern float fResult; //The arsine of the input argument
//
//Task 2 (C) Variables
//
//
//Task 3 (C) Variables
//
//
//Task 4 (C) Variables
//
//
//Task 5 (C) Variables
//
//
//Task 6 (C) Variables
//
//
//Task 7 (C) Variables
//
//
//Task 8 (C) Variables
//
//
//Common (C) Variables
//
extern float PIBYTWO;
extern float CLAatan2Table[];
//
// Function Prototypes
//
// The following are symbols defined in the CLA assembly code
// Including them in the shared header file makes them
// .global and the main CPU can make use of them.
//
__interrupt void Cla1Task1();
__interrupt void Cla1Task2();
__interrupt void Cla1Task3();
__interrupt void Cla1Task4();
__interrupt void Cla1Task5();
__interrupt void Cla1Task6();
__interrupt void Cla1Task7();
__interrupt void Cla1Task8();
#ifdef __cplusplus
}
#endif // extern "C"
#endif //end of _CLA_ATAN_SHARED_H_ definition
//
// End of file
//