<< Chapter < Page Chapter >> Page >

Library routines

If the algorithm uses common mathematical operations, such as the cosine and FFT operations, it is usuallywise to use existing library routines instead of "reinventing the wheel." As many library routines are readily available from DSPmanufacturers and over the internet, the first factor to consider in using a library is its license: do you have permission to use it inyour application? Libraries can often be used freely for educational and research purposes, but any other use requires inspectionof the library license.

The second factor to consider is the design goal of the library: was it designed for speed or low memory usage? Typically speed can bebought with more memory and vice-versa, so when selecting a library it is important to decidewhich budget (speed or memory) is more important with respect to the routine.

Compiler optimization

Recall that the basic operation of a C compiler is to translate C source code into assembly instructions and then into an executable.

"Compiler optimization is used to improve the efficiency (in terms ofrunning time or resource usage) of the executables output by a compiler. These techniques allow programmers to write source code in a straightforward manner, expressing their intentions clearly,while allowing the computer to make choices about implementation details that lead to efficient execution. Contrary to what the termmight imply, this rarely results in executables that are perfectly "optimal" by any measure, only executables that are much improvedcompared to direct translation of the programmer's original source."

An optimizing compiler traditionally groups optimizations into phases . Each phase contains a series of optimizations (or transformations) that are performed in a fixed order.These phases are usually turned on with command-line flags such as -O1 , -O2 , etc. Each flag indicates an optimization "level" where the level includes all of the lower levels. At higheroptimization levels bugs in the code are sometimes introduced, so it is important to check the behavior of a compiler-optimized programagainst the reference implementation. Keep the highest optimization level that produces accurate code.

At this point the compiled code should be checked against the budgetary constraints. Is it fast enough? Does it fit in available memory?Total memory usage is placed in a file produced by the compiler (sometimes a command-line flag is needed for this). Speed can bemeasured in a couple of ways. The most common method is the use of a profiler . A profiler tracks the performance of the program, providing data on how many times each function is called, as well ashow much time each function takes in terms of cycles and percentages of total program cycles. A simulator also allows clock cycles to bemeasured, typically by allowing the user to place breakpoints around sections of code to be measured. If the speed and memory properties ofthe compiled code fit the budget, optimization is finished. If not, some of the routines must be hand-written in assembly.

Write key assembly routines manually

Finally, if the budget cannot be met with the other optimization techniques some routines must be written in assembly. Manually-writtenassembly code is usually the most efficient, but it is labor-intensive and it is not portable to other architectures.Therefore it is done as a last resort and only on routines that absolutely require it for budget constraints to be met. This is doneby rewriting the routine that consumes the largest portion of the budget, followed by the next largest budget-consuming routine and soon until the budget is met. It should be noted that this step is almost always required in embedded applications ascurrent state-of-the-art C compilers and optimizers do not produce sufficiently fast and/or small code.

If meeting the budget is unexpectedly difficult, remember that no compiler optimization or assembler can effectively overcome a poor algorithm design or implementation. If you are confident that your implentation is fast and accurate, then the budget may be too tight for the application. Either some parts ofthe application must be removed (extra "features", for example) or an architecture with more resources must be used.

Questions & Answers

how do you translate this in Algebraic Expressions
linda Reply
why surface tension is zero at critical temperature
Need to simplify the expresin. 3/7 (x+y)-1/7 (x-1)=
Crystal Reply
. After 3 months on a diet, Lisa had lost 12% of her original weight. She lost 21 pounds. What was Lisa's original weight?
Chris Reply
what is biological synthesis of nanoparticles
Sanket Reply
what's the easiest and fastest way to the synthesize AgNP?
Damian Reply
types of nano material
abeetha Reply
I start with an easy one. carbon nanotubes woven into a long filament like a string
many many of nanotubes
what is the k.e before it land
what is the function of carbon nanotubes?
I'm interested in nanotube
what is nanomaterials​ and their applications of sensors.
Ramkumar Reply
what is nano technology
Sravani Reply
what is system testing?
preparation of nanomaterial
Victor Reply
Yes, Nanotechnology has a very fast field of applications and their is always something new to do with it...
Himanshu Reply
good afternoon madam
what is system testing
what is the application of nanotechnology?
In this morden time nanotechnology used in many field . 1-Electronics-manufacturad IC ,RAM,MRAM,solar panel etc 2-Helth and Medical-Nanomedicine,Drug Dilivery for cancer treatment etc 3- Atomobile -MEMS, Coating on car etc. and may other field for details you can check at Google
anybody can imagine what will be happen after 100 years from now in nano tech world
after 100 year this will be not nanotechnology maybe this technology name will be change . maybe aftet 100 year . we work on electron lable practically about its properties and behaviour by the different instruments
name doesn't matter , whatever it will be change... I'm taking about effect on circumstances of the microscopic world
how hard could it be to apply nanotechnology against viral infections such HIV or Ebola?
silver nanoparticles could handle the job?
not now but maybe in future only AgNP maybe any other nanomaterials
I'm interested in Nanotube
this technology will not going on for the long time , so I'm thinking about femtotechnology 10^-15
can nanotechnology change the direction of the face of the world
Prasenjit Reply
At high concentrations (>0.01 M), the relation between absorptivity coefficient and absorbance is no longer linear. This is due to the electrostatic interactions between the quantum dots in close proximity. If the concentration of the solution is high, another effect that is seen is the scattering of light from the large number of quantum dots. This assumption only works at low concentrations of the analyte. Presence of stray light.
Ali Reply
the Beer law works very well for dilute solutions but fails for very high concentrations. why?
bamidele Reply
how did you get the value of 2000N.What calculations are needed to arrive at it
Smarajit Reply
Privacy Information Security Software Version 1.1a
Got questions? Join the online conversation and get instant answers!
QuizOver.com Reply

Get the best Algebra and trigonometry course in your pocket!

Source:  OpenStax, Digital signal processing laboratory (ece 420 55x). OpenStax CNX. Jan 18, 2010 Download for free at http://cnx.org/content/col10397/1.10
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Digital signal processing laboratory (ece 420 55x)' conversation and receive update notifications?