Download presentation
Presentation is loading. Please wait.
1
* M. R. Smith smithmr@ucalgary.ca
07/16/96 This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep track of these action items during your presentation In Slide Show, click on the right mouse button Select “Meeting Minder” Select the “Action Items” tab Type in action items as they come up Click OK to dismiss this box This will automatically create an Action Item slide at the end of your presentation with your points entered. Lab. 2 information M. R. Smith 2/4/2019 *
2
Copyright smithmr@ucalgary.ca
Overview of Lab. 2 Task 1: Check Lab. 1 code still works -- PRELAB for Lab. 2 Task 2: Check that Lab. 1 Tests are sufficient. – PRELAB for Lab. 2 Possible solution to “clicking error” heard during Lab. 1 Task 3: Timing of existing optimized and un-optimized C++ subroutines – PRELAB for Lab. 2 Possible refactoring of subroutines Task 4: Demonstration of C++ functionality of Lab. 1 (start of Lab. 2) Task 5: Generation of Tests for (un-optimized) assembly code Task 6: Create and validate assembly language version of “IndexAdjust( )” Task 7: Create and validate assembly language versions “FIR( )” Task 8: Demonstration of functionality Task 9: Timing of un-optimized assembly code 2/4/2019 ENCM515 – Lab. 3 and Lab. 4, 2007 Copyright
3
Task 1: Check Lab. 1 code still works
This is used to check the functionality of the laboratory station 2/4/2019 ENCM515 – Lab. 3 and Lab. 4, 2007 Copyright
4
Task 2.1: Check that Lab. 1 Tests are sufficient.
Make sure that your tests validate your code for both long and short arrays Before hand-in: In Lab1Tests directory: Split the tests into two files (A) one for FIR( ) and (B) one for AdjustIndex( ); Use the E-TDD GUI to adjust the connection between the tests and the test executable This will make your life much easier for Lab. 2 and Lab. 3 In the Lab1Tests directory: Remove all Lab. 1 .cpp files from the Lab1Tests.prj project that you are not testing, or are not needed for testing. If a file is used for testing, but not when running the Lab. 1 code, then this file should be in the Lab1Tests directory and not Lab. 1 directory. Your approach to testing and test organization is part of the “course conventions” and will form part of the evaluation. Getting the tests organized is going to be important as we add more and more functionality to the project. Adjust the test code so that only the “test failures” are being shown. 2/4/2019 ENCM515 – Lab. 3 and Lab. 4, 2007 Copyright
5
Task 2.2: Check that Lab. 1 Tests are sufficient.
Many people are reporting “clicking sounds” when array size is large e.g. N = 1024 Could be coding defect. Check that all the tests “really” work for both large and small array sizes Could be a design or code defect. The sound goes from left to right in about 4 seconds. Do the clicking sounds occur every 4 seconds? If so, then perhaps the way we handle the “bounce” at each end is wrong “aurially” (Code and test defect) Code defect: Did we write the wrong tests for what we needed to do? Design defect: Try changing the code so that the bounce (N = 32) goes 29, 30, 31, 31, 30, 29 rather than 29, 30, 31, 30, 29. If that cures the clicks, fix the tests to reflect the new code design. 2/4/2019 ENCM515 – Lab. 3 and Lab. 4, 2007 Copyright
6
Task 2.3: Check that Lab. 1 Tests are sufficient.
Many people are reporting “clicking sounds” when array size is large N = 1024 Design error? The “steps” we are using to adjust the index is too ”coarse” for large array sizes. Quick test to see if this idea is correct Change the “AdjustIndex( )” code so that the adjustment is of size 1 rather than delay-length / 32. However, this will make the left-to-right movement too slow for N > 32 In “CommonCB_CPPCode.h” there is the line if (audioInterruptCounter > ONESECOND / 8) TEMPORARILY change the code to if (audioInterruptCounter > ONESECOND / 128) If that solves the clicking, then you know what the problem is. You should now fix the code (if you are a perfectionist), blame the customer (if you are a pragmatist) or fix it later (if you are procrastinator). Make sure that your code and tests are compatible before leaving Task 2 stages 2/4/2019 ENCM515 – Lab. 3 and Lab. 4, 2007 Copyright
7
Task 3.1: Timing of C++ subroutines
Timing of AdjustIndex( ) In the timing test call the code M times where M = 1, 10, 100 and 1000 times Report “time / each execution” rather than ”time for all executions” . You would expect the code to be independent of M for 10, 100 and 1000 There may be instruction cache issues as you are rerunning the code Time both optimized and un-optimized versions of the C++ code I would expect little different if your code was written well. You should try “refactoring” your code to reduce the number of “if” used Make sure that you remove the time of the loop overhead of calling the code. That is particularly important for small functions 2/4/2019 ENCM515 – Lab. 3 and Lab. 4, 2007 Copyright
8
Task 3.2: Timing of C++ subroutines
Timing of FIR( ) In the timing test call the code M times where M = 1, 10, 100 and 1000 times Report “time / each execution” rather than ”time for all executions” . You would expect the code to be independent of M for 10, 100 and 1000 There may be instruction cache issues and data cache issues as you are rerunning the code Time both optimized and un-optimized versions of the C++ code Later on (Lab. 3) we will be doing SIMD operations where the left-filter operation is performed in the X-Compute block, while the right filter is done in the Y-Compute block Plan ahead for these SIMD operations so that your timing tests calculate the time for processing both the left and the right channels. The answer may not be the same as twice the time of processing just the left channel. 2/4/2019 ENCM515 – Lab. 3 and Lab. 4, 2007 Copyright
9
Task 4: Demonstrate C++ functionality
Get checked off by T. A. or myself on the following Make a marking sheet showing Lab. team names and indicate “all your own work”. Add the following lines to the marking sheet Sound moves from side to side Demonstrated low pass FIR filter operation Demonstrated high-pass FIR filter operation Note: DSP-A can directly read DSP-B flags when DSP-B is running. The hand-shaking is automatically handled by the bus interface. In principle you can use DSP-B buttons to allow you to choose between FIR operations. 2/4/2019 ENCM515 – Lab. 3 and Lab. 4, 2007 Copyright
10
Task 5: Tests for (un-optimized) assembly code
In Lab1Test directory: Make copies of the C++ test and timing files as TestFIR_ASM.cpp and TestIndex_ASM.cpp Modify the tests to call the un-optimized assembly versions of the IndexAdjust( ) and FIR( ) code. Add the files to the Lab1Tests project Use the E-TDD GUI to connect these tests to the run-time code In Lab1 directory: Generate the necessary assembly code stubs Add the files to both Lab1 project and Lab1Test projects Temporarily deactivate the C++ test and timing files. Use the E-TDD GUI to disconnect these tests from the run-time code 2/4/2019 ENCM515 – Lab. 3 and Lab. 4, 2007 Copyright
11
Task 6: Assembly language version of “IndexAdjust( )”
Use the C++ code as a design template for your assembly language code. I mentioned earlier that this code will be faster to turn into assembly code (and faster in execution) if you refactored your Lab. 1 code to minimize use of IF statements. Expectations Follow course coding conventions Use of predicted and non-predicted jumps to optimize speed Use of NF options (no flag change instructions) Use of the YR registers (if using compute block) and K registers if using the I-ALU block 2/4/2019 ENCM515 – Lab. 3 and Lab. 4, 2007 Copyright
12
Task 7: Assembly language versions “FIR( )”
Use the C++ code as a design template for your assembly language code. Expectations Follow course coding conventions Use of predicted and non-predicted jumps to optimize speed Use of NF options (no flag change instructions) Use of the XR registers Use of hardware loop Use of “post modify increment” memory operations on both data and coefficient access In Lab. 3, we will be using dm and pm data operations. Don’t do that now, but think ahead so that the impact of these changes is minimal 2/4/2019 ENCM515 – Lab. 3 and Lab. 4, 2007 Copyright
13
Task 8: Demonstrate ASM functionality
Get checked off by T. A. or myself on the following Make a marking sheet showing Lab. team names and indicate “all your own work”. Add the following lines to the marking sheet Sound moves from side to side Demonstrated low pass FIR filter operation Demonstrated high-pass FIR filter operation Note: DSP-A can directly read DSP-B flags when DSP-B is running. The hand-shaking is automatically handled by the bus interface. In principle you can use DSP-B buttons to allow you to choose between FIR operations. 2/4/2019 ENCM515 – Lab. 3 and Lab. 4, 2007 Copyright
14
Task 9: Timing of un-optimized assembly code
Take the FIR code – cut-and-paste into a table (paper, EXCEL etc) As in the take-home quiz, identify which resource is used by which instruction Calculate where you expect the stalls (memory and alu) to occur. Calculate expected execution time Note, to make my life easier, I assume that there are no cache issues Run the timing tests – did you get the timing you expected. Run the pipeline viewer on the FIR code. Explain any differences – don’t fix the earlier calculations! Note, I normally look at the pipeline results for when the FIR code is being executed around about the 3rd time (set breakpoint, go, go, go and then look). That way I “hope” to avoid cache issues If you get cache issues, then report that, but don’t try to fix. 2/4/2019 ENCM515 – Lab. 3 and Lab. 4, 2007 Copyright
15
Copyright smithmr@ucalgary.ca
Overview Lab. 2 Task 1: Check Lab. 1 code still works Task 2: Check that Lab. 1 Tests are sufficient. Possible solution to “clicking error” heard during Lab. 1 Task 3: Timing of existing optimized and un-optimized C++ subroutines Possible refactoring of subroutines Task 4: Demonstration of C++ functionality of Lab. 1 Task 5: Generation of Tests for (un-optimized) assembly code Task 6: Create and validate assembly language version of “IndexAdjust( )” Task 7: Create and validate assembly language versions “FIR( )” Task 8: Demonstration of functionality Task 9: Timing of un-optimized assembly code Task 10: Modifying code to support hardware circular buffer operation 2/4/2019 ENCM515 – Lab. 3 and Lab. 4, 2007 Copyright
16
Copyright smithmr@ucalgary.ca
Overview of Lab. 3 Task 1: Check Lab. 2 code still works -- PRELAB for Lab. 3 Task 2: Add hardware circular buffer for FIR -- PRELAB for Lab. 3 Task 3: Modify C++ FIR code and to allow dm and pm operations. Task 4: Demonstration of C++ functionality of Lab. 2 (start of Lab. 3) Task 5: Modify (and optimize) ASM FIR code to allow parallel dm and pm operations Task 6: Adjust the (internal) FIR code so that the loop executes N / 2 times. Optimize code to demonstrate parallel operations possible inside the new “longer” loop.Create and validate assembly language version of “IndexAdjust( )” Task 7: Adjust the (internal) FIR code by “unrolling the loop” and obtain maximal SISD operations Task 8: In a new directory Lab adjust your C++ code to allow the left and right channels to operate at the same time using maximal SIMD operations. Not part of Lab. 3 Demonstrating the issues surrounding dual and quad memory fetches (DAB usage) Demonstrating dual processor operation. This could be done by taking the Lab. 3 Task 7 code and running one version in DSP-A (left channel code) and another DSP-B (right channel code). Alternatively we make look at an Analog Devices example code using FFT on both processors to implement filters 2/4/2019 ENCM515 – Lab. 3 and Lab. 4, 2007 Copyright
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.