Chapter 7 Linear Assembly. Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2002 Chapter 7, Slide 2 Learning Objectives  Comparison of programming.

Slides:



Advertisements
Similar presentations
Chapter 17 Goertzel Algorithm
Advertisements

Chapter 7 Linear Assembly
Chapter 11 Interfacing C and Assembly Code
Chapter 14 Finite Impulse Response (FIR) Filters
Chapter 15 Infinite Impulse Response (IIR) Filters
Introduction to C Programming
Spring Semester 2013 Lecture 5
Chapter 16 Adaptive Filters
FIR Filter. C-Implementation (FIR filter) #include #include #include "coeff_ccs_16int.h" int in_buffer[300]; int out_buffer[300]; #define TRUE 1 /*Function.
Details.L and.S units TMS320C6000 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004.
TMS320C6713 Assembly Language (cont’d). Module 1 Exam (solution) 1. Functional Units a. How many can perform an ADD? Name them. a. How many can perform.
Lecture 6 Programming the TMS320C6x Family of DSPs.
Assembly and Linear Assembly Evgeny Kirshin, 05/10/2011
Review What is a virtual function? What can be achieved with virtual functions? How to define a pure virtual function? What is an abstract class? Can a.
Architecture-dependent optimizations Functional units, delay slots and dependency analysis.
Computer Architecture Lecture 7 Compiler Considerations and Optimizations.
Pipeline Optimization
TMS320C6000 Architectural and Programming Overview.
Chapter 14 Finite Impulse Response (FIR) Filters.
SPARC Architecture & Assembly Language
TMS320C6000 Architectural Overview.  Describe C6000 CPU architecture.  Introduce some basic instructions.  Describe the C6000 memory map.  Provide.
1 Homework Turn in HW2 at start of next class. Starting Chapter 2 K&R. Read ahead. HW3 is on line. –Due: class 9, but a lot to do! –You may want to get.
Chapter 17 Goertzel Algorithm Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2002 Chapter 17, Slide 2 Learning Objectives  Introduction.
Honors Compilers The Course Project Feb 28th 2002.
Chapter 12 Software Optimisation. Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2002 Chapter 12, Slide 2 Software Optimisation Chapter This.
Chapter 15 Infinite Impulse Response (IIR) Filters.
Chapter 13 Reduced Instruction Set Computers (RISC) Pipelining.
Chapter 6. 2 Objectives You should be able to describe: Function and Parameter Declarations Returning a Single Value Pass by Reference Variable Scope.
Chapter 11 Interfacing C and Assembly Code. Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2002 Chapter 11, Slide 2 Learning Objectives 
Guide To UNIX Using Linux Third Edition
Chapter 10 Interrupts. Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2002 Chapter 10, Slide 2 Learning Objectives  Introduction to interrupts.
High-Level Language Interface Chapter 13 S. Dandamudi.
Macro & Function. Function consumes more time When a function is called, the copy of the arguments are passed to the parameters in the function. After.
Chapter 6Java: an Introduction to Computer Science & Programming - Walter Savitch 1 l Array Basics l Arrays in Classes and Methods l Programming with Arrays.
C++ / G4MICE Course Session 3 Introduction to Classes Pointers and References Makefiles Standard Template Library.
Chapter 1 Introduction Dr. Frank Lee. 1.1 Why Study Compiler? To write more efficient code in a high-level language To provide solid foundation in parsing.
6-1 Chapter 6 - Languages and the Machine Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring Computer.
Computer architecture Lecture 11: Reduced Instruction Set Computers Piotr Bilski.
/* Documentations */ Pre process / Linking statements Global declarations; main( ) { Local Declarations; Program statements / Executable statements; }
Copyright 2004 Scott/Jones Publishing Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 7 Structured Data and Classes.
The LC-3 – Chapter 7 COMP 2620 Dr. James Money COMP
A Play Core Timer Interrupts Acted by the Human Microcontroller Ensemble from ENCM511.
Understanding the TigerSHARC ALU pipeline Determining the speed of one stage of IIR filter – Part 2 Understanding the pipeline.
Learners Support Publications Functions in C++
Instruction Level Parallelism Pipeline with data forwarding and accelerated branch Loop Unrolling Multiple Issue -- Multiple functional Units Static vs.
Assembly Language for x86 Processors 7th Edition Chapter 13: High-Level Language Interface (c) Pearson Education, All rights reserved. You may modify.
Chapter 1 Introduction. Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2002 Chapter 1, Slide 2 Learning Objectives  Why process signals.
Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 12P. 1Winter Quarter User-Written Functions Lecture 12.
Reduced Instruction Set Computers. Major Advances in Computers(1) The family concept —IBM System/ —DEC PDP-8 —Separates architecture from implementation.
L what are predefined functions? l what is? n function name n argument(s) n return value n function call n function invocation n nested function call l.
Functions Functions, locals, parameters, and separate compilation.
A First Book of ANSI C Fourth Edition
LLVM Simone Campanoni
CC410: System Programming Dr. Manal Helal – Fall 2014 – Lecture 11–Macro-Processors.
FILES AND EXCEPTIONS Topics Introduction to File Input and Output Using Loops to Process Files Processing Records Exceptions.
ECSE436 Tutorial Assembly and Linear Assembly Laurier Boulianne.
Invitation to Computer Science 6th Edition
User-Written Functions
Chapter 7 Linear Assembly
Topics Introduction to File Input and Output
Chapter 17 Goertzel Algorithm
Chapter 11 Interfacing C and Assembly Code
STUDY AND IMPLEMENTATION
Getting serious about “going fast” on the TigerSHARC
Chapter 12 Software Optimisation
Superscalar and VLIW Architectures
Topics Introduction to File Input and Output
EE 345S Real-Time Digital Signal Processing Lab Spring 2009
Programming II Vocabulary Review Loops & functions
Introduction to Classes and Objects
Presentation transcript:

Chapter 7 Linear Assembly

Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2002 Chapter 7, Slide 2 Learning Objectives  Comparison of programming techniques.  How to write Linear Assembly.  Interfacing Linear Assembly with C.  Assembly optimiser tool.

Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2002 Chapter 7, Slide 3Introduction  With the assembly optimiser, optimisation for loops can be made very simple.  Linear assembly takes care of the pipeline structure and generates highly parallel assembly code automatically.  The performance of the assembly optimiser can easily reach the performance of hand written assembly code.

Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2002 Chapter 7, Slide 4 100%High ASM Hand Optimised Comparison of Programming Techniques * Typical efficiency vs. hand optimized assembly. SourceEfficiency*Effort % C C ++ Low Optimising Compiler % Linear ASM Med Assembly Optimiser

Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2002 Chapter 7, Slide 5 Writing in Linear Assembly  Linear assembly is similar to hand assembly, except:  Does not require NOPs to fill empty delay slots.  The functions units do not need to be specified.  Grouping of instructions in parallel is performed automatically.  Accepts symbolic variable names. ZEROsum loopLDH*p_to_a, a LDH*p_to_b, b MPYa, b, prod ADDsum, prod, sum SUBB0, 1, B0 B loop

Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2002 Chapter 7, Slide 6 How to Write Code in Linear Assembly  File extension:  Use the “.sa” extension to specify the file is written in linear assembly.  How to write code: _sa_Function.cproc ZEROsum loopLDH*pm++, m LDH*pn++, n MPYm, n, prod ADDsum, prod, sum [count]SUBcount, 1, count [count]SUBcount, 1, count B loop.return sum.endproc.cproc defines the beginning of the code.return specifies the return value.endproc defines the end of the linear assembly code NO NOPs required NO parallel instructions required NO functional units specified NO registers required

Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2002 Chapter 7, Slide 7 Passing and Returning Arguments  “pm” and “pn” are two pointers declared in the C code that calls the linear assembly function.  The following function prototype in C calls the linear assembly function: int y = dotp (short* a, short* x, int count)  The linear assembly function receives the arguments using.cproc: _dotp.cprocpm, pn, count....return y.endproc

Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2002 Chapter 7, Slide 8 Declaring the Symbolic Variables  All the symbolic registers except those used as arguments are declared as follows:.regpm, pn, m, n, prod, sum  The assembly optimiser will attempt to assign all these values to registers.

Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2002 Chapter 7, Slide 9 Complete Linear Assembly Code  Note: Linear assembly performs automatic return to the calling function. _dotp.cproc pm, pn, count.reg m, n, prod, sum ZEROsum loopLDH*pm++, m LDH*pn++, n MPYm, n, prod ADDsum, prod, sum [count]SUBcount, 1, count [count]SUBcount, 1, count B loop.return sum.endproc

Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2002 Chapter 7, Slide 10 Function calls in Linear Assembly  In linear assembly you can call other functions written in C, linear assembly or assembly.  To do this the.call directive is used: Function1.sa _function1.cproc a, b.reg y, float1 MPYa,b,y.call float1 = _fix_to_float(y).return.endproc Fix_to_float.sa _fix_to_float.cproc fix.reg float1 INTSP fix, float1.return float1.endproc  Note: Branch out of a linear assembly routine is not allowed.

Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2002 Chapter 7, Slide 11 Invoking the Assembly Optimiser  The development tools recognise the linear assembler code by the file extension “.sa”.  The assembly optimiser uses the same options as the optimising C compiler.  Note: In CCS you can change the options of each file individually by right clicking on the file in the project view and selecting “File Specific Options…”.

Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2002 Chapter 7, Slide 12 Linear Assembly Examples  The following chapters have code written in linear assembly:  \Code\Chapter 15 - Infinite Impulse Response Filters  \Code\Chapter 17 - Goertzel Algorithm  For more details on Interfacing C and Assembly see Chapter 11.

Chapter 7 Linear Assembly - End -