C28x Custom Block Demo: QSQRT
This demo illustates how a processor specific fixed-point square root block can be created and verified.
Processor-Independent Magnitude Calculation Test Bench
Open and Run Testbench: mag_tb_fixpt.mdl
Open Algorithm mag_fixpt.mdl
Generate code for algorithm model (Ctrl-B)
Processor-Specific Magnitude Calculation Test Bench
Open and Run Testbench mag_tb_fixpt_c28x.mdl
Open Algorithm mag_fixpt_c28x.mdl
Generate code for algorithm model (Ctrl-B)
Contents
C28x Custom Library
Open c28x_custom_lib.mdl to identify the QSQRT configurable susbystem (cfgsub), simulation specification (sim) and code generation specification (rtw).
Simple Model Ready for Production Code Generation
Open c28x_qsqrt_pcg.mdl which is a simple model containing only the QSQRT block and with the input and output signal storage classes set to Exported Global.
Verification: General Technique
This approach can be applied to most processor IDE's.
Test Bench Model: Export Input Test Signals
Open c28x_qsqrt_tb.mdl to verify simulation performance and export and input test vectors formatted for the target Integrated Develpoment Environment (IDE)
CCS Project Test Bench
Run c28x_qsqrt_ccs_hand_tb_open.m to open a manually created Code Composer Studio project which calls the automatically generated code. This represents a generic approach of how a target IDE can be used as part of the verification process.
Test Bench Model: Import Output Test Signals and Compare
Open c28x_qsqrt_tb.mdl again and import output test signals from target IDE then run simulation to compare results.
- Simulation and generated code results vary slightly since different approximation techniques are used.
- Exact results could be achieved by creating a simulation model based taking into account processor-specific implementation details. (See c28x_iir16_demo for a similar example using Embedded MATLAB.)
Verification: Using Link for Code Composer Studio
Link for Code Composer Studio and the Embedded Target for TI C2000 DSP products can be used to automate much of the verification.
Simple Model with CCS Project Automation
Open c28x_qsqrt_et.mdl which is a simple model containing the QSQRT block but uses the Embedded Target for TI C2000 DSP to automate creation of a CCS project.
CCS Cosimulation Test Bench Model to Verify Results
Open c28x_qsqrt_tb_ccs_cosim.mdl which compares the simulation results against a cosimulation of the previously automatically created CCS project.
View c28x_qsqrt_ccs_cosim.m to see the Link for Code Composer Studio scfript which enables the cosimulation.