SlideShare una empresa de Scribd logo
1 de 20
EMBEDDED C
KRUNAL SIDDHAPATHAK
HIGH LEVEL OPTIMIZATIONS IN CODE
1. Floating – point to Fixed – point conversion
2. Simple loop transformations
3. Loop tiling/blocking
4. Loop Splitting
5. Array Folding
CODE OPTIMIZATION
1) Floating –point to Fixed –
point Conversion:
• Reduction in cycle count by
75% and energy
consumption by 76% for an
MPEG – 2 video compression
algorithm.
• Trade – off between cost of
implementation and quality
of algorithm.
• Done using Fixed – C data
types.
• E.g. a=fixed(5,4,s,wt,*b)
fixed a,*b,c[8]
2) Array Folding:
• Options for reducing storage
requirements of large arrays
must be explored since
memory space is limited in
embedded systems.
• Inter – array folding method
employs sharing of memory
space among arrays which
are not needed at
overlapping time intervals.
• Limited sets of components
needed within an array can
also be taken as at a time
only a subset of array
elements is needed.
CODE OPTIMIZATION
3) Loop tiling/blocking:
• It is utmost essential to reuse
“small” memories including
caches and scratch – pad
memories.
• Blocked or tiled algorithms
improves locality of references.
• Innermost loop becomes
restricted as it accesses less
array elements.
• If a proper blocking factor is
selected, the elements are still
in the cache when next iteration
of the innermost loop starts.
• Improves performance for
matrix multiplications by
reducing no. of memory
references using reuse factor.
4) Loop Splitting:
• Efficiency of algorithm improves
if loops are splitted and one
loop body handles the regular
cases and a second one handles
the exceptions.
• Total number of cycles can be
saved by splitting of nested
loops for various applications
and target processors.
• Cycle count can be reduced by
75%.
CODE OPTIMIZATION
Simple Loop
Transformations
Loop
Permutation
Loop Fusion,
Loop Fission
Loop Unrolling
• Two loops can
either be merged
into a single loop –
Loop Fusion.
• Single loop is
splitted into two
loops – Loop Fission
• Helps in reuse of
array elements in
cache as next
iteration of the
loop body will
access an adjacent
location in
memory.
• Number of copies of the
loop is called unrolling
factor (>2).
• Reduces loop overhead
(less branches per
instruction) & improves
speed but increases code
size.
• Restricted to loops with
constant no. of
iterations.
EMBEDDED C FOR HIGH
PERFORMANCE DSP PROGRAMMING
• Performance is the key to digital signal
processing because it translates into
application – based end – user systems.
• Changes in technological and economic
requirements make it more and more
expensive to continue programming the DSP
processor in assembly languages.
• DSP architectures are not easy to program
optimally due to their non – orthogonality.
• Stronger error correction and encryption
algorithms must be added to match up to the
increased complexity in DSP.
• Communication protocols have become more
sophisticated and require much more code to
implement.
• Multiple protocol stacks have been
implemented to be compatible with multiple
service providers.
• In addition, backward compatibility with older
protocols is also needed to stay synchronized
with provider networks that are in a slow
process of upgrading.
ENTERING WITH EMBEDDED C
• Embedded C is designed to bridge the
performance mismatch between the signal
processing algorithms, standard C and the
architecture.
• It is an extension of C language with the
primitives that are needed by signal processing
applications and that are commonly provided by
DSP processors.
• Maintainability and portability of code are the
key winners in this process.
REQUIREMENTS FOR I/O HARDWARE
ADDRESSING INTERFACE
1. The device drive source code must be
portable.
2. The interface must not prevent
implementations to produce machine code
that is as efficient as other methods.
3. The design should permit encapsulation of
the system dependent access method.
MEMORY MANAGEMENT IN AN
AEROSPACE EMBEDDED CODE
• Dynamic Allocation eases development by
providing system memory to application
processes as needed at runtime and retrieving
the memory when it is no longer needed.
• C’s runtime library function malloc() can exhibit
wildly unpredictable performance and become a
bottleneck in multithread programs on multi core
systems.
• Hence, dynamic memory allocation is forbidden
in a safety – critical embedded avionics code.
WHY NOT DYNAMIC MEMORY
ALLOCATION IN AVIONICS?
• Dynamic memory is a poor – choice for a
mission – critical code as it is based on list
allocator algorithms that organize memory
pools into contiguous locations in a single
linked list.
• These list allocators allocates a memory using
malloc() and de – allocates the memory
location for reuse using free(). But it places a
burden on the programmer to balance each
call to malloc() with a corresponding call to
free().
THEN WHAT IS THE SOLUTION?
• Customized memory allocation functions that
more closely match specific allocation
scenarios are used such as:
1. Stack – based allocator
2. Thread – local allocator
3. In – Memory Database Systems (IMDS)
• The performance, stability and predictability
of the safety – critical code increases using
above custom allocators.
STACK – BASED ALLOCATOR
• In this algorithm, each allocation returns the
address of the current position of the stack
pointer and advances the pointer by the amount
of the request.
• When memory is no longer needed, the stack
pointer is rewound.
• Processing Overhead is reduced because there is
no chain of pointers to manage nor are there any
allocation sizes or contiguous locations to track.
• A memory leak can’t be accidentally introduced
through improper de – allocation because the
application does not have to track specific
allocations.
CUSTOM STACK – BASED ALLOCATOR
THREAD – LOCAL ALLOCATOR
• A custom thread – local allocator avoids conflicts
by assigning a specific memory pool to each
thread.
• The thread’s allocation is performed from this
block without interference with other thread’s
requests, thus enhancing performance and
predictability.
• It uses a Pending Request List or PRL for each
thread to coordinate the release of memory
blocks that are freed by a thread other than the
one that performed the original allocation.
• Memory that is allocated and de - allocated by
the same thread requires no coordination, and
therefore no lock conflicts occur.
IN – MEMORY DATABASE SYSTEMS
(IMDS)
• Benefits of Custom memory allocators can also
be harnessed by integrating third – party
software like IMDS.
• IMDS manages application objects in RAM.
• Memory allocation & de – allocation of
application objects is also done using malloc()
and free().
• With an IMDS, concurrency among multithreads
is maintained automatically via transactions.
APPLICATIONS IN MILITARY
• A sensor object could represent either optical
sensors for tracking missile targets or biosensors
for defense in chemical warfare or motion
sensors to aid in navigating an aircraft.
• This sensor object occupies memory from the
memory pool and free() returns memory back to
the heap & space is relinquished for reuse when
the code completes.
• malloc() is responsible for memory fragmentation
and for deciding the allocator type.
EMBEDDED C IN
FPGA SWITCHING
TECHNOLOGY
• C algorithms can be
applied to programmable
& flexible FPGAs using
ultra – low latency.
• Parallelism involves
unrolling a software
process into multiple
parallel hardware
processes.
• Recently applied in Wall
Street
• Possesses potential use
for military purposes.
THANK YOU

Más contenido relacionado

La actualidad más candente

network ram parallel computing
network ram parallel computingnetwork ram parallel computing
network ram parallel computingNiranjana Ambadi
 
Parallel computing in india
Parallel computing in indiaParallel computing in india
Parallel computing in indiaPreeti Chauhan
 
Enabling Machine Learning on the Edge using SRAM Conserving Efficient Neural ...
Enabling Machine Learning on the Edge using SRAM Conserving Efficient Neural ...Enabling Machine Learning on the Edge using SRAM Conserving Efficient Neural ...
Enabling Machine Learning on the Edge using SRAM Conserving Efficient Neural ...Bharath Sudharsan
 
Lecture 3 parallel programming platforms
Lecture 3   parallel programming platformsLecture 3   parallel programming platforms
Lecture 3 parallel programming platformsVajira Thambawita
 
Parallel Processors (SIMD)
Parallel Processors (SIMD) Parallel Processors (SIMD)
Parallel Processors (SIMD) Ali Raza
 
Advanced computer architecture lesson 5 and 6
Advanced computer architecture lesson 5 and 6Advanced computer architecture lesson 5 and 6
Advanced computer architecture lesson 5 and 6Ismail Mukiibi
 
Parallel Algorithms Advantages and Disadvantages
Parallel Algorithms Advantages and DisadvantagesParallel Algorithms Advantages and Disadvantages
Parallel Algorithms Advantages and DisadvantagesMurtadha Alsabbagh
 
Parallel computing
Parallel computingParallel computing
Parallel computingvirend111
 
Limitations of memory system performance
Limitations of memory system performanceLimitations of memory system performance
Limitations of memory system performanceSyed Zaid Irshad
 
Lecture 1
Lecture 1Lecture 1
Lecture 1Mr SMAK
 
Introduction to parallel_computing
Introduction to parallel_computingIntroduction to parallel_computing
Introduction to parallel_computingMehul Patel
 
ECML PKDD 2021 ML meets IoT Tutorial Part II: Creating ML based Self learning...
ECML PKDD 2021 ML meets IoT Tutorial Part II: Creating ML based Self learning...ECML PKDD 2021 ML meets IoT Tutorial Part II: Creating ML based Self learning...
ECML PKDD 2021 ML meets IoT Tutorial Part II: Creating ML based Self learning...Bharath Sudharsan
 
Multithreading: Exploiting Thread-Level Parallelism to Improve Uniprocessor ...
Multithreading: Exploiting Thread-Level  Parallelism to Improve Uniprocessor ...Multithreading: Exploiting Thread-Level  Parallelism to Improve Uniprocessor ...
Multithreading: Exploiting Thread-Level Parallelism to Improve Uniprocessor ...Ahmed kasim
 
Multicore and shared multi processor
Multicore and shared multi processorMulticore and shared multi processor
Multicore and shared multi processorSou Jana
 
Unit IV Memory and I/O Organization
Unit IV Memory and I/O OrganizationUnit IV Memory and I/O Organization
Unit IV Memory and I/O OrganizationBalaji Vignesh
 
Parallel Programing Model
Parallel Programing ModelParallel Programing Model
Parallel Programing ModelAdlin Jeena
 

La actualidad más candente (20)

Parallel Processing Concepts
Parallel Processing Concepts Parallel Processing Concepts
Parallel Processing Concepts
 
network ram parallel computing
network ram parallel computingnetwork ram parallel computing
network ram parallel computing
 
Parallel computing in india
Parallel computing in indiaParallel computing in india
Parallel computing in india
 
Enabling Machine Learning on the Edge using SRAM Conserving Efficient Neural ...
Enabling Machine Learning on the Edge using SRAM Conserving Efficient Neural ...Enabling Machine Learning on the Edge using SRAM Conserving Efficient Neural ...
Enabling Machine Learning on the Edge using SRAM Conserving Efficient Neural ...
 
Lecture 3 parallel programming platforms
Lecture 3   parallel programming platformsLecture 3   parallel programming platforms
Lecture 3 parallel programming platforms
 
Parallel Processors (SIMD)
Parallel Processors (SIMD) Parallel Processors (SIMD)
Parallel Processors (SIMD)
 
Advanced computer architecture lesson 5 and 6
Advanced computer architecture lesson 5 and 6Advanced computer architecture lesson 5 and 6
Advanced computer architecture lesson 5 and 6
 
Parallel Algorithms Advantages and Disadvantages
Parallel Algorithms Advantages and DisadvantagesParallel Algorithms Advantages and Disadvantages
Parallel Algorithms Advantages and Disadvantages
 
Parallel computing
Parallel computingParallel computing
Parallel computing
 
Limitations of memory system performance
Limitations of memory system performanceLimitations of memory system performance
Limitations of memory system performance
 
Hpc 4 5
Hpc 4 5Hpc 4 5
Hpc 4 5
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
 
Introduction to parallel_computing
Introduction to parallel_computingIntroduction to parallel_computing
Introduction to parallel_computing
 
ECML PKDD 2021 ML meets IoT Tutorial Part II: Creating ML based Self learning...
ECML PKDD 2021 ML meets IoT Tutorial Part II: Creating ML based Self learning...ECML PKDD 2021 ML meets IoT Tutorial Part II: Creating ML based Self learning...
ECML PKDD 2021 ML meets IoT Tutorial Part II: Creating ML based Self learning...
 
Lecture02 types
Lecture02 typesLecture02 types
Lecture02 types
 
Multithreading: Exploiting Thread-Level Parallelism to Improve Uniprocessor ...
Multithreading: Exploiting Thread-Level  Parallelism to Improve Uniprocessor ...Multithreading: Exploiting Thread-Level  Parallelism to Improve Uniprocessor ...
Multithreading: Exploiting Thread-Level Parallelism to Improve Uniprocessor ...
 
Multicore and shared multi processor
Multicore and shared multi processorMulticore and shared multi processor
Multicore and shared multi processor
 
Unit IV Memory and I/O Organization
Unit IV Memory and I/O OrganizationUnit IV Memory and I/O Organization
Unit IV Memory and I/O Organization
 
Parallel Programing Model
Parallel Programing ModelParallel Programing Model
Parallel Programing Model
 
Parallel processing
Parallel processingParallel processing
Parallel processing
 

Destacado

Destacado (20)

Embedded C workshop
Embedded C workshopEmbedded C workshop
Embedded C workshop
 
C Programming For Embedded Systems
C Programming For Embedded SystemsC Programming For Embedded Systems
C Programming For Embedded Systems
 
Embedded c programming22 for fdp
Embedded c programming22 for fdpEmbedded c programming22 for fdp
Embedded c programming22 for fdp
 
Embedded C - Lecture 1
Embedded C - Lecture 1Embedded C - Lecture 1
Embedded C - Lecture 1
 
Embedded c
Embedded cEmbedded c
Embedded c
 
Embedded C
Embedded CEmbedded C
Embedded C
 
Musketeers mind rover
Musketeers mind roverMusketeers mind rover
Musketeers mind rover
 
Grid computing
Grid computingGrid computing
Grid computing
 
Atumatic toll tax system
Atumatic toll tax systemAtumatic toll tax system
Atumatic toll tax system
 
MICROWAVE RADIO COVERAGE FOR VEHICLE TO-VEHICLE AND IN-VEHICLE COMMUNICATION
MICROWAVE RADIO COVERAGE FOR VEHICLE TO-VEHICLE AND IN-VEHICLE COMMUNICATION MICROWAVE RADIO COVERAGE FOR VEHICLE TO-VEHICLE AND IN-VEHICLE COMMUNICATION
MICROWAVE RADIO COVERAGE FOR VEHICLE TO-VEHICLE AND IN-VEHICLE COMMUNICATION
 
Features of modern intel microprocessors
Features of modern intel microprocessorsFeatures of modern intel microprocessors
Features of modern intel microprocessors
 
Embedded system - embedded system programming
Embedded system - embedded system programmingEmbedded system - embedded system programming
Embedded system - embedded system programming
 
States & Capitals 111
States & Capitals 111States & Capitals 111
States & Capitals 111
 
C++ for Embedded Programming
C++ for Embedded ProgrammingC++ for Embedded Programming
C++ for Embedded Programming
 
Embedded c programming
Embedded c programmingEmbedded c programming
Embedded c programming
 
C prog ppt
C prog pptC prog ppt
C prog ppt
 
Sic a new era in power electronics
Sic a new era in power electronicsSic a new era in power electronics
Sic a new era in power electronics
 
Embedded _c_
Embedded  _c_Embedded  _c_
Embedded _c_
 
Embedded C - Lecture 3
Embedded C - Lecture 3Embedded C - Lecture 3
Embedded C - Lecture 3
 
Embedded c program and programming structure for beginners
Embedded c program and programming structure for beginnersEmbedded c program and programming structure for beginners
Embedded c program and programming structure for beginners
 

Similar a Embedded C

Memory and Performance Isolation for a Multi-tenant Function-based Data-plane
Memory and Performance Isolation for a Multi-tenant Function-based Data-planeMemory and Performance Isolation for a Multi-tenant Function-based Data-plane
Memory and Performance Isolation for a Multi-tenant Function-based Data-plane AJAY KHARAT
 
Advanced processor principles
Advanced processor principlesAdvanced processor principles
Advanced processor principlesDhaval Bagal
 
Accelerating Deep Learning Inference 
on Mobile Systems
Accelerating Deep Learning Inference 
on Mobile SystemsAccelerating Deep Learning Inference 
on Mobile Systems
Accelerating Deep Learning Inference 
on Mobile SystemsDarian Frajberg
 
Approximation techniques used for general purpose algorithms
Approximation techniques used for general purpose algorithmsApproximation techniques used for general purpose algorithms
Approximation techniques used for general purpose algorithmsSabidur Rahman
 
Basics of micro controllers for biginners
Basics of  micro controllers for biginnersBasics of  micro controllers for biginners
Basics of micro controllers for biginnersGerwin Makanyanga
 
VLSI design Dr B.jagadeesh UNIT-5.pptx
VLSI design Dr B.jagadeesh   UNIT-5.pptxVLSI design Dr B.jagadeesh   UNIT-5.pptx
VLSI design Dr B.jagadeesh UNIT-5.pptxjagadeesh276791
 
Computre_Engineering_Introduction_FPGA.ppt
Computre_Engineering_Introduction_FPGA.pptComputre_Engineering_Introduction_FPGA.ppt
Computre_Engineering_Introduction_FPGA.pptghadeer228987
 
OMI - The Missing Piece of a Modular, Flexible and Composable Computing World
OMI - The Missing Piece of a Modular, Flexible and Composable Computing WorldOMI - The Missing Piece of a Modular, Flexible and Composable Computing World
OMI - The Missing Piece of a Modular, Flexible and Composable Computing WorldAllan Cantle
 
Introduction to embedded System.pptx
Introduction to embedded System.pptxIntroduction to embedded System.pptx
Introduction to embedded System.pptxPratik Gohel
 
Chip Multithreading Systems Need a New Operating System Scheduler
Chip Multithreading Systems Need a New Operating System Scheduler Chip Multithreading Systems Need a New Operating System Scheduler
Chip Multithreading Systems Need a New Operating System Scheduler Sarwan ali
 
4.1 Introduction 145• In this section, we first take a gander at a.pdf
4.1 Introduction 145• In this section, we first take a gander at a.pdf4.1 Introduction 145• In this section, we first take a gander at a.pdf
4.1 Introduction 145• In this section, we first take a gander at a.pdfarpowersarps
 
Project Presentation Final
Project Presentation FinalProject Presentation Final
Project Presentation FinalDhritiman Halder
 
Evaluating UCIe based multi-die SoC to meet timing and power
Evaluating UCIe based multi-die SoC to meet timing and power Evaluating UCIe based multi-die SoC to meet timing and power
Evaluating UCIe based multi-die SoC to meet timing and power Deepak Shankar
 
embedded system-Memory_Organization_final.pdf
embedded system-Memory_Organization_final.pdfembedded system-Memory_Organization_final.pdf
embedded system-Memory_Organization_final.pdfSarveshPandey64
 
Trends and challenges in IP based SOC design
Trends and challenges in IP based SOC designTrends and challenges in IP based SOC design
Trends and challenges in IP based SOC designAishwaryaRavishankar8
 
Remote core locking-Andrea Lombardo
Remote core locking-Andrea LombardoRemote core locking-Andrea Lombardo
Remote core locking-Andrea LombardoAndrea Lombardo
 

Similar a Embedded C (20)

Memory and Performance Isolation for a Multi-tenant Function-based Data-plane
Memory and Performance Isolation for a Multi-tenant Function-based Data-planeMemory and Performance Isolation for a Multi-tenant Function-based Data-plane
Memory and Performance Isolation for a Multi-tenant Function-based Data-plane
 
Node architecture
Node architectureNode architecture
Node architecture
 
Advanced processor principles
Advanced processor principlesAdvanced processor principles
Advanced processor principles
 
Accelerating Deep Learning Inference 
on Mobile Systems
Accelerating Deep Learning Inference 
on Mobile SystemsAccelerating Deep Learning Inference 
on Mobile Systems
Accelerating Deep Learning Inference 
on Mobile Systems
 
Lect_1.pptx
Lect_1.pptxLect_1.pptx
Lect_1.pptx
 
Approximation techniques used for general purpose algorithms
Approximation techniques used for general purpose algorithmsApproximation techniques used for general purpose algorithms
Approximation techniques used for general purpose algorithms
 
Basics of micro controllers for biginners
Basics of  micro controllers for biginnersBasics of  micro controllers for biginners
Basics of micro controllers for biginners
 
VLSI design Dr B.jagadeesh UNIT-5.pptx
VLSI design Dr B.jagadeesh   UNIT-5.pptxVLSI design Dr B.jagadeesh   UNIT-5.pptx
VLSI design Dr B.jagadeesh UNIT-5.pptx
 
Computre_Engineering_Introduction_FPGA.ppt
Computre_Engineering_Introduction_FPGA.pptComputre_Engineering_Introduction_FPGA.ppt
Computre_Engineering_Introduction_FPGA.ppt
 
OMI - The Missing Piece of a Modular, Flexible and Composable Computing World
OMI - The Missing Piece of a Modular, Flexible and Composable Computing WorldOMI - The Missing Piece of a Modular, Flexible and Composable Computing World
OMI - The Missing Piece of a Modular, Flexible and Composable Computing World
 
Introduction to embedded System.pptx
Introduction to embedded System.pptxIntroduction to embedded System.pptx
Introduction to embedded System.pptx
 
Doc32002
Doc32002Doc32002
Doc32002
 
Chip Multithreading Systems Need a New Operating System Scheduler
Chip Multithreading Systems Need a New Operating System Scheduler Chip Multithreading Systems Need a New Operating System Scheduler
Chip Multithreading Systems Need a New Operating System Scheduler
 
4.1 Introduction 145• In this section, we first take a gander at a.pdf
4.1 Introduction 145• In this section, we first take a gander at a.pdf4.1 Introduction 145• In this section, we first take a gander at a.pdf
4.1 Introduction 145• In this section, we first take a gander at a.pdf
 
Project Presentation Final
Project Presentation FinalProject Presentation Final
Project Presentation Final
 
Evaluating UCIe based multi-die SoC to meet timing and power
Evaluating UCIe based multi-die SoC to meet timing and power Evaluating UCIe based multi-die SoC to meet timing and power
Evaluating UCIe based multi-die SoC to meet timing and power
 
embedded system-Memory_Organization_final.pdf
embedded system-Memory_Organization_final.pdfembedded system-Memory_Organization_final.pdf
embedded system-Memory_Organization_final.pdf
 
Vcs standard ccna 2 ch-1.1
Vcs standard ccna 2 ch-1.1Vcs standard ccna 2 ch-1.1
Vcs standard ccna 2 ch-1.1
 
Trends and challenges in IP based SOC design
Trends and challenges in IP based SOC designTrends and challenges in IP based SOC design
Trends and challenges in IP based SOC design
 
Remote core locking-Andrea Lombardo
Remote core locking-Andrea LombardoRemote core locking-Andrea Lombardo
Remote core locking-Andrea Lombardo
 

Último

Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 

Último (20)

Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 

Embedded C

  • 2. HIGH LEVEL OPTIMIZATIONS IN CODE 1. Floating – point to Fixed – point conversion 2. Simple loop transformations 3. Loop tiling/blocking 4. Loop Splitting 5. Array Folding
  • 3. CODE OPTIMIZATION 1) Floating –point to Fixed – point Conversion: • Reduction in cycle count by 75% and energy consumption by 76% for an MPEG – 2 video compression algorithm. • Trade – off between cost of implementation and quality of algorithm. • Done using Fixed – C data types. • E.g. a=fixed(5,4,s,wt,*b) fixed a,*b,c[8] 2) Array Folding: • Options for reducing storage requirements of large arrays must be explored since memory space is limited in embedded systems. • Inter – array folding method employs sharing of memory space among arrays which are not needed at overlapping time intervals. • Limited sets of components needed within an array can also be taken as at a time only a subset of array elements is needed.
  • 4.
  • 5. CODE OPTIMIZATION 3) Loop tiling/blocking: • It is utmost essential to reuse “small” memories including caches and scratch – pad memories. • Blocked or tiled algorithms improves locality of references. • Innermost loop becomes restricted as it accesses less array elements. • If a proper blocking factor is selected, the elements are still in the cache when next iteration of the innermost loop starts. • Improves performance for matrix multiplications by reducing no. of memory references using reuse factor. 4) Loop Splitting: • Efficiency of algorithm improves if loops are splitted and one loop body handles the regular cases and a second one handles the exceptions. • Total number of cycles can be saved by splitting of nested loops for various applications and target processors. • Cycle count can be reduced by 75%.
  • 6. CODE OPTIMIZATION Simple Loop Transformations Loop Permutation Loop Fusion, Loop Fission Loop Unrolling • Two loops can either be merged into a single loop – Loop Fusion. • Single loop is splitted into two loops – Loop Fission • Helps in reuse of array elements in cache as next iteration of the loop body will access an adjacent location in memory. • Number of copies of the loop is called unrolling factor (>2). • Reduces loop overhead (less branches per instruction) & improves speed but increases code size. • Restricted to loops with constant no. of iterations.
  • 7. EMBEDDED C FOR HIGH PERFORMANCE DSP PROGRAMMING • Performance is the key to digital signal processing because it translates into application – based end – user systems. • Changes in technological and economic requirements make it more and more expensive to continue programming the DSP processor in assembly languages. • DSP architectures are not easy to program optimally due to their non – orthogonality.
  • 8. • Stronger error correction and encryption algorithms must be added to match up to the increased complexity in DSP. • Communication protocols have become more sophisticated and require much more code to implement. • Multiple protocol stacks have been implemented to be compatible with multiple service providers. • In addition, backward compatibility with older protocols is also needed to stay synchronized with provider networks that are in a slow process of upgrading.
  • 9. ENTERING WITH EMBEDDED C • Embedded C is designed to bridge the performance mismatch between the signal processing algorithms, standard C and the architecture. • It is an extension of C language with the primitives that are needed by signal processing applications and that are commonly provided by DSP processors. • Maintainability and portability of code are the key winners in this process.
  • 10. REQUIREMENTS FOR I/O HARDWARE ADDRESSING INTERFACE 1. The device drive source code must be portable. 2. The interface must not prevent implementations to produce machine code that is as efficient as other methods. 3. The design should permit encapsulation of the system dependent access method.
  • 11. MEMORY MANAGEMENT IN AN AEROSPACE EMBEDDED CODE • Dynamic Allocation eases development by providing system memory to application processes as needed at runtime and retrieving the memory when it is no longer needed. • C’s runtime library function malloc() can exhibit wildly unpredictable performance and become a bottleneck in multithread programs on multi core systems. • Hence, dynamic memory allocation is forbidden in a safety – critical embedded avionics code.
  • 12. WHY NOT DYNAMIC MEMORY ALLOCATION IN AVIONICS? • Dynamic memory is a poor – choice for a mission – critical code as it is based on list allocator algorithms that organize memory pools into contiguous locations in a single linked list. • These list allocators allocates a memory using malloc() and de – allocates the memory location for reuse using free(). But it places a burden on the programmer to balance each call to malloc() with a corresponding call to free().
  • 13. THEN WHAT IS THE SOLUTION? • Customized memory allocation functions that more closely match specific allocation scenarios are used such as: 1. Stack – based allocator 2. Thread – local allocator 3. In – Memory Database Systems (IMDS) • The performance, stability and predictability of the safety – critical code increases using above custom allocators.
  • 14. STACK – BASED ALLOCATOR • In this algorithm, each allocation returns the address of the current position of the stack pointer and advances the pointer by the amount of the request. • When memory is no longer needed, the stack pointer is rewound. • Processing Overhead is reduced because there is no chain of pointers to manage nor are there any allocation sizes or contiguous locations to track. • A memory leak can’t be accidentally introduced through improper de – allocation because the application does not have to track specific allocations.
  • 15. CUSTOM STACK – BASED ALLOCATOR
  • 16. THREAD – LOCAL ALLOCATOR • A custom thread – local allocator avoids conflicts by assigning a specific memory pool to each thread. • The thread’s allocation is performed from this block without interference with other thread’s requests, thus enhancing performance and predictability. • It uses a Pending Request List or PRL for each thread to coordinate the release of memory blocks that are freed by a thread other than the one that performed the original allocation. • Memory that is allocated and de - allocated by the same thread requires no coordination, and therefore no lock conflicts occur.
  • 17. IN – MEMORY DATABASE SYSTEMS (IMDS) • Benefits of Custom memory allocators can also be harnessed by integrating third – party software like IMDS. • IMDS manages application objects in RAM. • Memory allocation & de – allocation of application objects is also done using malloc() and free(). • With an IMDS, concurrency among multithreads is maintained automatically via transactions.
  • 18. APPLICATIONS IN MILITARY • A sensor object could represent either optical sensors for tracking missile targets or biosensors for defense in chemical warfare or motion sensors to aid in navigating an aircraft. • This sensor object occupies memory from the memory pool and free() returns memory back to the heap & space is relinquished for reuse when the code completes. • malloc() is responsible for memory fragmentation and for deciding the allocator type.
  • 19. EMBEDDED C IN FPGA SWITCHING TECHNOLOGY • C algorithms can be applied to programmable & flexible FPGAs using ultra – low latency. • Parallelism involves unrolling a software process into multiple parallel hardware processes. • Recently applied in Wall Street • Possesses potential use for military purposes.