Presentation is loading. Please wait.

Presentation is loading. Please wait.

Getting serious about “going fast” on the TigerSHARC

Similar presentations


Presentation on theme: "Getting serious about “going fast” on the TigerSHARC"— Presentation transcript:

1 Getting serious about “going fast” on the TigerSHARC
What are the characteristics of DSP algorithms?

2 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada
Tackled today What are the basic characteristics of a DSP algorithm? A near perfect “starting” example DCRemoval( ) has many of the features of the FIR filters used in all the Labs Testing the performance of the CPP version First assembly version – using I-ALU operations – testing and timing Code will be examined in more detail in the next lecture 2/19/2019 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada

3 IEEE Micro Magazine Article
How RISCy is DSP? Smith, M.R.; Micro, IEEE  ,Volume: 12 , Issue: 6 , Dec Pages: Available on line via the library “Electronic web links” 2/19/2019 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada

4 Characteristics of an FIR algorithm
Involves one of the three basic types of DSP algorithms FIR (Type 1), IIR (Type 2) and FFT (Type 3) Representative of DSP equations found in filtering, convolution and modeling Multiplication / addition intensive Simple format within a (long) loop Many memory fetches of fixed and changing data Handle “infinite amount of input data” – need FIFO buffer when handling ON-LINE data All calculations “MUST” be completed in the time interval between samples 2/19/2019 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada

5 Comparing IIR and FIR filters
Infinite Impulse Response filters – few operations to produce output from input for each IIR stage Finite Impulse Response filters – many operations to produce output from input. Long FIFO buffer which may require as many operations As FIR calculation itself. Easy to optimize 2/19/2019 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada

6 DCRemoval( ) part of SDR My version
Memory intensive Addition intensive Loops for main code FIFO implemented as circular buffer 2/19/2019 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada

7 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada
Memory intensive Addition intensive Loops for main code FIFO implemented as circular buffer Not as complex as FIR, but many of the same requirements Easier to handle You use same ideas in optimizing FIR over Labs 2 and 3 Two issues – speed and accuracy. Develop suitable tests for CPP code and check that various assembly language versions satisfy the same tests 2/19/2019 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada

8 E-TDD format of DCRemoval( ) perhaps a little unsophisticated
Clear the internal buffer Put in one known value with known result (based on MY implementation If algorithm works for long enough then gives the correct answer 2/19/2019 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada

9 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada
First attempt – “ENCM415 approach” Use the integer ALU operations (I-ALU) Why? Looks less complex that other options Learn one thing at a time Can be done “using direct translation of C++ (working code) Tests 1) Can we call and return from the assembly code routine? – understanding the C++ calling conventions 2) Does the assembly code routine give the same result as the C++ version? 3) How does the assembly code routine’s performance compare to the C++ version? and hidden (IMPLICIT) test – are there any errors in jumping backwards and forwards between C++ and many assembly code routines – detailed understanding of the C++ calling conventions 2/19/2019 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada

10 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada
Call and return test Basically – if the code gets here it is probably that we did not crash the system I use a cut-and-paste approach to develop code variants. This test is (embarrassingly) useful. 2/19/2019 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada

11 Initially we expect the code to fail to work correctly
If the code works initially, then it is doing so by accident Use XF_CHECK_EQUAL( ) Expected to fail NOTE: This test is just a “cut-and-paste” version of C++ test with three changes of function name 2/19/2019 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada

12 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada
Timing test Initially – since all we do is “call and return” -- we expect (trivially) fast code Issues Some algorithms may optimize better when called many times – cache and coding issues Does it matter whether the function is called once, 10 or 100 times? Call the function to test within a loop – make sure that the loop overhead for calling the function does not compromise the timing of the test – may be important if we develop very optimized code, and every last cycle (between interrupts) counts 2/19/2019 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada

13 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada
Timing test Once 10 times 100 times Normalized the timing tests to “process the function once” Need to develop various other routines to make tests work -- DoNothing loop, run C++ and assembly code routines in a loop May not be correctly performing timing – but gives initial concepts 2/19/2019 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada

14 Other functions needed to run the test
Do Nothing Careful – may be optimized to “nothing” C++ function loop J-ALU function loop 2/19/2019 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada

15 Steps -- Manual technique
Add tests to project Build connect file so that tests will be activate Note file name and directory name 2/19/2019 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada

16 Steps -- E-TDD Gui technique
Add tests to project Build connect file so that tests will be activate 2/19/2019 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada

17 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada
Build and run the code Build and run manually BUILD PROJECT and DEBUG | RUN Or build and run using E-TDD GUI 2/19/2019 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada

18 Use build failure information to determine assembly code function name
Required name for void DCremovalASM_JALU(int *, int *) _DCremoval_JALU__FPiT1 2/19/2019 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada

19 Write ASM “call-and-return”, then run the test
Simple ASM stub GHOST BREAKPOINT – A break point that is set in the code “some how” – completely random, but seems to occur after making big changes in a project – number of ways of handling them 2/19/2019 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada

20 Proper test run and exit – lib_prog_term
Yellow indicates that there are NO failures but some expected failures All successes and failures shown in console window 2/19/2019 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada

21 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada
Quick look at the code Will examine in more detail in next class void DCremovalASM(int *, int *) Setting up the static arrays Defining and then setting pointers Moving incoming parameters in FIFO Summing the FIFO values Performing (FAST) division Returning the correct values Updating the FIFO in preparation for next time this function is called – discarding oldest value, and “rippling” the FIFO to make the “newest” FIFO slot empty 2/19/2019 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada

22 Developing the assembly code static arrays – “section data1”
2/19/2019 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada

23 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada
Define the (250) register names for code maintainability (and marking) ease Actual static array declaration DEFINE pointers into arrays DEFINE temps DEFINE Inpars SET pointers into arrays 2/19/2019 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada

24 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada
Key and common error Same as in C++ There is a difference between Defining / declaring the pointer register and Placing (setting) a value in the pointer register so it actually points some where Register names – what they are and where they are stored. In an exam, use of a register in this format is “required” but it is preferred, rather than required, that you include the define statements – watch for question wording 2/19/2019 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada

25 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada
Value into FIFO buffer RISC processor LOAD and STORE architecture MIPS-like (ENCM369) rather than CISC (ENCM415) Read from memory  register  store to memory 2/19/2019 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada

26 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada
Perform sum Hardware loops, some 64-bit and some 32-bit instructions Sum Division 2/19/2019 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada

27 Correcting INPARS and then updating the FIFO buffer
Adjust the INPARS remember int * Update FIFO memory using load / store approach SLOW 2/19/2019 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada

28 Adjust tests for expected success
2/19/2019 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada

29 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada
Tackled today What are the basic characteristics of a DSP algorithm? A near perfect “starting” example DCRemoval( ) has many of the features of the FIR filters used in all the Labs Testing the performance of the CPP version First assembly version – using I-ALU operations – testing and timing Code will be examined in more detail in the next lecture 2/19/2019 DC removal Lecture 1, M. Smith, ECE, University of Calgary, Canada


Download ppt "Getting serious about “going fast” on the TigerSHARC"

Similar presentations


Ads by Google