Chapter 7 Linear Assembly

Slides:



Advertisements
Similar presentations
Chapter 17 Goertzel Algorithm
Advertisements

Chapter 11 Interfacing C and Assembly Code
Chapter 14 Finite Impulse Response (FIR) Filters
Chapter 15 Infinite Impulse Response (IIR) Filters
Copyright © 2002 Pearson Education, Inc. Slide 1.
Chapter 7 Constructors and Other Tools. Copyright © 2006 Pearson Addison-Wesley. All rights reserved. 7-2 Learning Objectives Constructors Definitions.
Chapter 11 Introduction to Programming in C
Introduction to C Programming
Credit hours: 4 Contact hours: 50 (30 Theory, 20 Lab) Prerequisite: TB143 Introduction to Personal Computers.
Chapter 9 Bootloader.
Chapter 7: Arrays In this chapter, you will learn about
Chapter 17 Linked Lists.
1 Symbol Tables. 2 Contents Introduction Introduction A Simple Compiler A Simple Compiler Scanning – Theory and Practice Scanning – Theory and Practice.
Introduction to C Systems Programming Concepts. Introduction to C A simple C Program A simple C Program –Variable Declarations –printf ( ) Compiling and.
Overview of programming in C C is a fast, efficient, flexible programming language Paradigm: C is procedural (like Fortran, Pascal), not object oriented.
Spring Semester 2013 Lecture 5
Chapter 18 Discrete Cosine Transform. Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 18, Slide 2 Learning Objectives  Introduction.
Chapter 16 Adaptive Filters
Copyright 2013 – Noah Mendelsohn Compiling C Programs Noah Mendelsohn Tufts University Web:
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 12P. 1Winter Quarter User-Written Functions.
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.
TMS320C6000 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Architectural Overview.
Lecture 9: MIPS Instruction Set
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.
Superscalar and VLIW Architectures Miodrag Bolic CEG3151.
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.
TMS320C6000 Architectural and Programming Overview.
Chapter 14 Finite Impulse Response (FIR) Filters.
1 Lecture: Static ILP Topics: compiler scheduling, loop unrolling, software pipelining (Sections C.5, 3.2)
SPARC Architecture & Assembly Language
TMS320C6000 Architectural Overview.  Describe C6000 CPU architecture.  Introduce some basic instructions.  Describe the C6000 memory map.  Provide.
Generation of highly parallel code for TigerSHARC processors An introduction This presentation will probably involve audience discussion, which will create.
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.
Chapter 15 Infinite Impulse Response (IIR) Filters.
1 Lecture 5: Pipeline Wrap-up, Static ILP Basics Topics: loop unrolling, VLIW (Sections 2.1 – 2.2) Assignment 1 due at the start of class on Thursday.
Chapter 13 Reduced Instruction Set Computers (RISC) Pipelining.
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 7 Linear Assembly. Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2002 Chapter 7, Slide 2 Learning Objectives  Comparison of programming.
Chapter 10 Interrupts. Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2002 Chapter 10, Slide 2 Learning Objectives  Introduction to interrupts.
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.
Computer architecture Lecture 11: Reduced Instruction Set Computers Piotr Bilski.
/* Documentations */ Pre process / Linking statements Global declarations; main( ) { Local Declarations; Program statements / Executable statements; }
The LC-3 – Chapter 7 COMP 2620 Dr. James Money COMP
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++
Assembly Language for x86 Processors 7th Edition Chapter 13: High-Level Language Interface (c) Pearson Education, All rights reserved. You may modify.
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.
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.
User-Written Functions
Chapter 7 Linear Assembly
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
EE 345S Real-Time Digital Signal Processing Lab Spring 2009
Chapter 15 Infinite Impulse Response (IIR) Filters
Programming II Vocabulary Review Loops & functions
Presentation transcript:

Chapter 7 Linear Assembly

Learning Objectives Comparison of programming techniques. How to write Linear Assembly. Interfacing Linear Assembly with C. Assembly optimiser tool.

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

Comparison of Programming Techniques Source Efficiency* Effort 100% High ASM Hand Optimised 95 - 100% Linear ASM Med Assembly Optimiser 80 - 100% C C ++ Low Optimising Compiler * Typical efficiency vs. hand optimized assembly.

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. ZERO sum loop LDH *p_to_a, a LDH *p_to_b, b MPY a, b, prod ADD sum, prod, sum SUB B0, 1, B0 B loop

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 ZERO sum loop LDH *pm++, m LDH *pn++, n MPY m, n, prod ADD sum, prod, sum [count] SUB count, 1, count B loop .return sum .endproc .cproc defines the beginning of the code NO NOPs required NO parallel instructions required NO functional units specified NO registers required .return specifies the return value .endproc defines the end of the linear assembly code

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 .cproc pm, pn, count ... .return y .endproc

Declaring the Symbolic Variables All the symbolic registers except those used as arguments are declared as follows: .reg pm, pn, m, n, prod, sum The assembly optimiser will attempt to assign all these values to registers.

Complete Linear Assembly Code _dotp .cproc pm, pn, count .reg m, n, prod, sum ZERO sum loop LDH *pm++, m LDH *pn++, n MPY m, n, prod ADD sum, prod, sum [count] SUB count, 1, count B loop .return sum .endproc Note: Linear assembly performs automatic return to the calling function.

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 MPY a,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.

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…”.

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 -