<< 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

what does nano mean?
Anassong Reply
nano basically means 10^(-9). nanometer is a unit to measure length.
Bharti
do you think it's worthwhile in the long term to study the effects and possibilities of nanotechnology on viral treatment?
Damian Reply
absolutely yes
Daniel
how to know photocatalytic properties of tio2 nanoparticles...what to do now
Akash Reply
it is a goid question and i want to know the answer as well
Maciej
characteristics of micro business
Abigail
for teaching engĺish at school how nano technology help us
Anassong
Do somebody tell me a best nano engineering book for beginners?
s. Reply
what is fullerene does it is used to make bukky balls
Devang Reply
are you nano engineer ?
s.
fullerene is a bucky ball aka Carbon 60 molecule. It was name by the architect Fuller. He design the geodesic dome. it resembles a soccer ball.
Tarell
what is the actual application of fullerenes nowadays?
Damian
That is a great question Damian. best way to answer that question is to Google it. there are hundreds of applications for buck minister fullerenes, from medical to aerospace. you can also find plenty of research papers that will give you great detail on the potential applications of fullerenes.
Tarell
what is the Synthesis, properties,and applications of carbon nano chemistry
Abhijith Reply
Mostly, they use nano carbon for electronics and for materials to be strengthened.
Virgil
is Bucky paper clear?
CYNTHIA
so some one know about replacing silicon atom with phosphorous in semiconductors device?
s. Reply
Yeah, it is a pain to say the least. You basically have to heat the substarte up to around 1000 degrees celcius then pass phosphene gas over top of it, which is explosive and toxic by the way, under very low pressure.
Harper
Do you know which machine is used to that process?
s.
how to fabricate graphene ink ?
SUYASH Reply
for screen printed electrodes ?
SUYASH
What is lattice structure?
s. Reply
of graphene you mean?
Ebrahim
or in general
Ebrahim
in general
s.
Graphene has a hexagonal structure
tahir
On having this app for quite a bit time, Haven't realised there's a chat room in it.
Cied
what is biological synthesis of nanoparticles
Sanket Reply
what's the easiest and fastest way to the synthesize AgNP?
Damian Reply
China
Cied
types of nano material
abeetha Reply
I start with an easy one. carbon nanotubes woven into a long filament like a string
Porter
many many of nanotubes
Porter
what is the k.e before it land
Yasmin
what is the function of carbon nanotubes?
Cesar
I'm interested in nanotube
Uday
what is nanomaterials​ and their applications of sensors.
Ramkumar Reply
what is nano technology
Sravani Reply
what is system testing?
AMJAD
preparation of nanomaterial
Victor Reply
how to synthesize TiO2 nanoparticles by chemical methods
Zubear
what's the program
Jordan
?
Jordan
what chemical
Jordan
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
Good
Berger describes sociologists as concerned with
Mueller Reply
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). OpenStax CNX. Sep 27, 2006 Download for free at http://cnx.org/content/col10236/1.14
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)' conversation and receive update notifications?

Ask