Texas Instruments ExpressDSP Algorithm Standard. Prof. Brian L. Evans Dept. of Electrical and Computer Engineering The University of Texas at Austin

Similar documents
TMS320 DSP Algorithm Standard

TMS320 DSP Algorithm Standard. Rules and Guidelines. User's Guide

A Technical Overview of expressdsp-compliant Algorithms for DSP Software Producers

TMS320 DSP Algorithm Standard Rules and Guidelines

TMS320 DSP Algorithm Standard Rules and Guidelines

Reference Frameworks for expressdsp Software: API Reference

C Programming. Course Outline. C Programming. Code: MBD101. Duration: 10 Hours. Prerequisites:

Secure software guidelines for ARMv8-M. for ARMv8-M. Version 0.1. Version 2.0. Copyright 2017 ARM Limited or its affiliates. All rights reserved.

A DSP/BIOS AIC23 Codec Device Driver for the TMS320C5510 DSK

Bill Bridge. Oracle Software Architect NVM support for C Applications

Conclusions. Introduction. Objectives. Module Topics

A Multichannel/Algorithm Implementation on the TMS320C6000 DSP

Programs in memory. The layout of memory is roughly:

Low-Level C Programming. Memory map Pointers Arrays Structures

The TMS320 DSP Algorithm Standard

Table of Figures Figure 1. High resolution PWM based DAC...2 Figure 2. Connecting the high resolution buck converter...8

Declaring Pointers. Declaration of pointers <type> *variable <type> *variable = initial-value Examples:

Using the TMS320 DSP Algorithm Standard in a Dynamic DSP System

Using a XDAIS Algorithm

Reminder: compiling & linking

Recitation #11 Malloc Lab. November 7th, 2017

DSP/BIOS Kernel Scalable, Real-Time Kernel TM. for TMS320 DSPs. Product Bulletin

xdais DSKT2 User s Guide

SmartHeap for Multi-Core

Dynamic Data Structures. CSCI 112: Programming in C

TMS320 DSP Algorithm Standard Demonstration Application

A DSP/BIOS AIC23 Codec Device Driver for the TMS320C6416 DSK

Memory Management. q Basic memory management q Swapping q Kernel memory allocation q Next Time: Virtual memory

Q1: /8 Q2: /30 Q3: /30 Q4: /32. Total: /100

Department of Electrical and Computer Engineering The University of Texas at Austin

Storage in Programs. largest. address. address

National Aeronautics and Space and Administration Space Administration. cfe Release 6.6

Object-Oriented Programming

CS61C : Machine Structures

CP2 Revision. theme: dynamic datatypes & data structures

Dynamic Memory Management. Bin Li Assistant Professor Dept. of Electrical, Computer and Biomedical Engineering University of Rhode Island

Dynamic Allocation of Memory

C Review. MaxMSP Developers Workshop Summer 2009 CNMAT

CPSC 213, Winter 2016, Term 2 Final Exam Solution Date: April 19, 2017; Instructor: Mike Feeley and Alan Wagner

Malloc Lab & Midterm Solutions. Recitation 11: Tuesday: 11/08/2016

The UtePC/Yalnix Memory System

Memory. What is memory? How is memory organized? Storage for variables, data, code etc. Text (Code) Data (Constants) BSS (Global and static variables)

L2 - C language for Embedded MCUs

ECE 15B COMPUTER ORGANIZATION

Exception Namespaces C Interoperability Templates. More C++ David Chisnall. March 17, 2011

ECE 2035 Programming Hw/Sw Systems Spring problems, 8 pages Final Exam Solutions 1 May 2013

Writing TMS320C8x PP Code Under the Multitasking Executive

Memory Management. To do. q Basic memory management q Swapping q Kernel memory allocation q Next Time: Virtual memory

Memory Allocation Techniques in System with Dynamic Swapping of Application Codes

Short Notes of CS201

Embedded Systems. Input/Output Programming

IA-64 Software Conventions and Runtime Architecture Guide September 2000

SH-5 Generic and C Specific ABI

A Microprocessor Systems Fall 2009

CS201 - Introduction to Programming Glossary By

In Java we have the keyword null, which is the value of an uninitialized reference type

Unix System Programming - Chapter 2, part a

Lecture 4: Outline. Arrays. I. Pointers II. III. Pointer arithmetic IV. Strings

INITIALISING POINTER VARIABLES; DYNAMIC VARIABLES; OPERATIONS ON POINTERS

Dynamic Memory: Alignment and Fragmentation

The basic operations defined on a symbol table include: free to remove all entries and free the storage of a symbol table

D SP TEXAS INSTRUMENTS TECHNOLOGY. Memory management for algorithms in Codec Engine based applications

Review of the C Programming Language for Principles of Operating Systems

CS 11 C track: lecture 5

EL6483: Brief Overview of C Programming Language

High Performance Computing and Programming, Lecture 3

Reference Frameworks. Introduction

CPSC 213, Winter 2016, Term 2 Final Exam Date: April 19, 2017; Instructor: Mike Feeley and Alan Wagner

ECE 2035 Programming HW/SW Systems Fall problems, 5 pages Exam Three 20 November 2013

Memory and C/C++ modules

Compilation/linking revisited. Memory and C/C++ modules. Layout of C/C++ programs. A sample C program demo.c. A possible structure of demo.

Lecture Notes on Memory Management

CS 326 Operating Systems C Programming. Greg Benson Department of Computer Science University of San Francisco

xdais-dm (Digital Media) User Guide

QUIZ. What are 3 differences between C and C++ const variables?

Memory and C/C++ modules

Requirements, Partitioning, paging, and segmentation

Operating System Labs. Yuanbin Wu

TMS320VC5503/5507/5509/5510 DSP Direct Memory Access (DMA) Controller Reference Guide

CS201 Some Important Definitions

Using Code Composer Studio IDE with MSP432

Run-time Environment

Dynamic Allocation of Memory

Data Storage. August 9, Indiana University. Geoffrey Brown, Bryce Himebaugh 2015 August 9, / 19

C Programming SYLLABUS COVERAGE SYLLABUS IN DETAILS

CSE 504: Compiler Design. Runtime Environments

NOTE: Debug and DebugSingle are the only MPI library configurations that will produce trace output.

Naming in OOLs and Storage Layout Comp 412

Separate compilation. Topic 6: Runtime Environments p.1/21. CS 526 Topic 6: Runtime Environments The linkage convention

Contract Programming For C++0x

Achieving Efficient Memory System Performance with the I-Cache on the TMS320VC5501/02

3/7/2018. Sometimes, Knowing Which Thing is Enough. ECE 220: Computer Systems & Programming. Often Want to Group Data Together Conceptually

Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology

Review of the C Programming Language

Whatever can go wrong will go wrong. attributed to Edward A. Murphy. Murphy was an optimist. authors of lock-free programs LOCK FREE KERNEL

CodeWarrior Development Studio Processor Expert RTOS Adapter User Guide

Lecture 8 Dynamic Memory Allocation

ECE 2035 A Programming Hw/Sw Systems Fall problems, 10 pages Final Exam Solutions 14 December 2016

CSCI 171 Chapter Outlines

Advanced use of the C language

Transcription:

Texas Instruments ExpressDSP Algorithm Standard Prof. Brian L. Evans Dept. of Electrical and Computer Engineering The University of Texas at Austin August 7, 2001

Outline Introduction ExpressDSP requirements and rules Source code Algorithm performance characterization C6000-specific guidelines Direct memory access (DMA) resource rules Conclusion Reference: http://www-s.ti.com/sc/techlit/spru352 24-2

Introduction: Algorithm Model inputs object code (function) algorithm performance outputs source code (function) Transformation of inputs into outputs Interoperate (play well) with other algorithms Decoupled from scheduling and resource allocation (e.g. dynamic memory allocation) 24-3

Introduction: Abstraction Maurice Wilkes: There is no problem in computer programming that cannot be solved by an added level of indirection. Achieve device independence by decoupling algorithms and physical peripherals Achieve algorithm interchangeability by using function pointers Maurice Wilkes is a hardware designer and the father of microcoding. He is from England and is 88 years old. He is one of the few foreign members of the US National Academy of Engineering. 24-4

Introduction: Abstraction Jim Gray: There is no performance problem that cannot be solved by eliminating a level of indirection. Jim Gray is software designer who is an expert in transaction processing and databases. He is in his early 50s and works at Microsoft Research in the San Francisco Bay Area. Jim is a member of the US National Academy of Engineering. 24-5

ExpressDSP Requirements Algorithms from multiple vendors can be integrated into a single system Algorithms are framework agnostic Algorithms can be deployed in statically scheduled and dynamically scheduled run-time environments Algorithms can be distributed in binary form (e.g. Hyperception s Hypersignal approach) Algorithm integration does not require compilation but may require reconfiguration and relinking 24-6

ExpressDSP Rules Source code (levels 1 and 2) Programming guidelines: C callable, reentrant, etc. Component model: modules, naming conventions, etc. Algorithm performance characterization (level 2) Data and program memory Interrupt latency (delay upon invocation) Execution time (throughput) DMA resource rules (level 2) DSP-specific (level 3) 24-7

Programming Guidelines (level 1) R1 Algorithms must follow run-time conventions imposed by TI s implementation of the C language Only externally visible functions must be C callable All functions must be careful in use of the stack R2 Algorithms must be reentrant Only modify data on stack or in instance object Treat global and static variables as read-only data Do not employ self-modifying code Disable interrupts (disabling all thread scheduling) around sections of code that violate these rules 24-8

Reentrant Example /* previous input values */ int iz0 = 0, iz1 = 0; void PRE_filter(int piinput[], int ilength) { int i; for (i = 0; i < ilength; i++) { int tmp = piinput[i] iz0 + (13*iz1 + 16) / 32; iz1 = iz0; iz0 = piinput[i]; piinput[i] = tmp; } } Not reentrant state void PRE_filter(int piinput[], int ilength, int piprevinput[]) { int i; for (i = 0; i < ilength; i++) { int itmp = piinput[i] piprevinput[0] + (13*piPrevInput[1] + 16) / 32; piprevinput[1] = piprevinput[0]; piprevinput[0] = piinput[i]; piinput[i] = itmp; } } Reentrant 24-9

Component Model (level 2) R7 All header files must support multiple inclusions within a single source file R8 All external definitions must be API identifiers or API and vendor prefixed (e.g. H263_UT) R11 All modules must supply an initialization (e.g. FIR_init) and finalization (e.g. FIR_exit) method Init function: initialize global data Exit function: run-time debugging assertions for sanity checks (usually empty in production code) 24-10

Component Model (level 2) Convention Variables and functions Constants Data types Structure fields Macros Description Begin with lower case (after prefix) All uppercase Title case after prefix Lowercase Same as constants or functions as appropriate Example LOG_printf() G729_FRAMELEN LOG_Obj or int buffer LOG_getbuf() R10 Naming Conventions 24-11

FIR Module typedef struct FIR_Params { int iframelen; int *picoeff; } FIR_Params; const FIR_Params FIR_PARAMS = { 64, NULL }; typedef struct FIR_Obj { int ihist[16]; int iframelen; int *picoeff; } FIR_Obj; void FIR_init(void) { } void FIR_exit(void) { } typedef struct FIR_Obj* FIR_Handle; FIR_Handle FIR_create( FIR_Obj *pfir, const FIR_Params *pparams) { if (pfir) { if (pparams == NULL) { pparams = &FIR_PARAMS; } pfir->iframelen = pparams->iframelen; pfir->picoeff = pparams->picoeff; memset(pfir->ihist, 0, sizeof(pfir->ihist)); } return(pfir); } void FIR_delete(FIR_Handle fir) { } 24-12

Algorithm Performance (level 2) Algorithms declare memory usage in bytes R19 Worst-case heap data memory (inc. alignment) R20 Worst-case stack space data memory R21 Worst-case static data memory R22 Program memory Algorithms declare R23 Worst-case interrupt latency R24 Typical period and worst case execution time Include this information in the comment header 24-13

Example: Worst-case Heap Usage DARAM SARAM External Size Align Size Align Size Align Scratch 0 0 1920 0 0 0 Persistent 0 0 0 0 1440 0 Example requires 960 16-bit words of single-access on-chip memory, 720 16-bit words of external persistent memory. Entries in table may be functions of algorithm parameters. 24-14

C6000-specific Rules R25 All C6000 algorithms must be supplied in little endian format. Guideline 13 All C6000 algorithms should be supplied in both little and big endian formats R26 All C6000 algorithms must access all static and global data as far data. R27 C6000 algorithms must never assume placement in on-chip memory; they must properly operate with program memory operated in cache mode. 24-15

C6000 Register Usage Register Usage Type Register Usage Type A0-A9 General purpose Scratch B0-B9 General purpose Scratch A10-A14 General purpose Preserve B10-B13 General purpose Preserve A15 Frame pointer Preserve B14 Data page pointer Preserve A16-A31 (C64x) General purpose Scratch B15 Stack pointer Preserve Preserve: function must restore its value on exit B16-B31 (C64x) General purpose Scratch 24-16

DMA Resource Rules DMA is used to move large blocks of memory on and off chip Algorithms cannot access DMA registers directly Algorithms cannot assume a particular physical DMA channel Algorithms must access the DMA resources through a handle using the specific asynchronous copy (ACPY) APIs. IDMA R1 All data transfer must be completed before return to caller 24-17

DMA Resource Rules IDMA R2 All algorithms using the DMA resource must implement the IDMA interface IDMA R3 Each of the IDMA methods implemented must be independently relocateable. IDMA R4 All algorithms must state the maximum number of concurrent DMA transfers for each logical channel IDMA R5 All algorithms must characterize the average and maximum size of the data transfers per logical channel for each operation. 24-18

Top 10 XDAIS Rules 1. All global and static variables must be constants 2. Must use C calling conventions 3. All include (.h) files must have an #ifdef structure to prevent it from being evaluated twice 4. All visible (external) variables, functions, and constants must be prefixed by PACKAGE_ORG, e.g. H263_UT. 5. Never use absolute (hardcoded) addresses (allows data to be relocated and properly aligned) 24-19

Top 10 XDAIS Rules 6. Must use IDMA instead of regular DMA (i.e. DAT_copy) 7. Never allocate or deallocate dynamic memory (no use of malloc, calloc, or free) 8. Disable interrupts (disables all thread scheduling) around sections of code that are not reentrant 9. Always check to see if a DSP/BIOS, chipset library, or I/O function is allowed (most are not) 10. Compile in far mode, e.g. in Code Composer 24-20

Issues for Future Standards Version control Licensing, encryption, and IP protection Installation and verification (digital signatures) Documentation and online help 24-21