# 3.8 Linear assembly implementation of fir filters on tms320c62x

 Page 1 / 1
This module is an exercise to implement FIR filters using TI linear assembly on TMS320C62x.

## What is linear assembly?

TI's linear assembly language enables you to write an assembly-like programs without worrying about register usage, pipelining, delayslots, etc. The assembler optimizer program reads the linear assembly code to figure out the algorithm, and then it producesan optimized list of assembly code to perform the operations. The linear assembly programming lets you:

• use symbolic names,
• forget pipeline issues,
• ignore putting NOPs, parallel bars, functional units, register names,
• more efficiently use CPU resources than C.

The linear assembly files have `.sa` extensions. When you have a linear assembly file in your Code Composer Studio project, the assembly optimizer isinvoked automatically to generate optimized actual assembly routine. You can consider the linear assemblylanguage as a tool to describe algorithms. To effectively convey the intent of the programmer to the assemblyoptimizer for proper optimization, there are quite a few extra directives in linear assembly.

## C callable linear assembly procedure

The following is an example of C callable linear assembly routine that computes the dot product of two vectors. Itimplements a C function

`short dotp(short* a, short* x, int count);`

If `a[]` and `x[]` are two length-40 vectors, the C function call has the form

```short a[]; short x[]; short z; ... ... z = dotp(a,x,40); ...```

(see below how the arguments are passed and the pointers are used.) In the following, you learn various assembler directivesused below and how the optimized assembly code is generated by the assembler optimizer.

```_dotp: .cproc ap,xp,cnt .reg a,x,prod,y MVK 40,cnt loop: .trip 40 LDH *ap++,a LDH *ax++,x MPY a,x,prod ADD y,prod,y SUB cnt,1,cnt [cnt] B loop .return y .endproc```

The `.cproc` directive starts a C callable procedure. It must be used with `.endproc` to end a C procedure. `_dotp:` is the label used to name the procedure. By using `.cproc` to start the procedure, the assembly optimizer performs someoperations automatically in a `.cproc` region in order to make the function conform to the C callingconventions and to C register usage convention. The following optional variables ( `ap,xp,cnt` above) represent function parameters. The variable entries are very similar to parameters declared in a C function.

The arguments to the `.cproc` directive can be either machine-register names or symbolic names. Whenregister names are specified, its position in the argument list must correspond to the argument passing conventionsfor C. For example, the first argument in C function must be register A4. When symbolic names are specified, theassembly optimizer ensures proper allocation and initialization (if necessary) of registers at thebeginning of the procedure. To represent a 40-bit argument, a register pair can be specified as anargument. In this lab, however, we only use 32bit values as arguments.

The `.reg` directive allows you to use descriptive names for values that will be stored in registers. It isvalid only within procedures only.

The `.return` directive functionality is equivalent to the return statement in C code. It placesthe optional argument in the appropriate register for a return value as per the C calling conventions. If noargument is specified, no value is returned, similar to a `void` function in C code. To perform a conditional `.return` , you can simply put conditional branch around a `.return` as:

```[!cc] B around .return around:```

The `.trip` directive specifies the value of the trip count. The trip count indicates how many times a loop will iterate. By giving this extra information to the assembler optimizer, abetter optimization is achieved for loops. The label preceding `.trip` directive represents the beginning of the loop. This is a required parameter.

For more information on writing C callable linear assembly procedure, refer to TMS320C6x Optimizing C Compiler User's Guide . For C6x assembly instructions, refer to TMS320C62x/C67x CPU and Instruction Set Reference Guide .

Write a C callable FIR filtering routine in linear assembly. When using different optimization levels, what is the numberof clock cycles of each FIR filtering?

use the y -intercept and slope to sketch the graph of the equation y=6x
how do we prove the quadratic formular
hello, if you have a question about Algebra 2. I may be able to help. I am an Algebra 2 Teacher
thank you help me with how to prove the quadratic equation
Seidu
may God blessed u for that. Please I want u to help me in sets.
Opoku
what is math number
4
Trista
x-2y+3z=-3 2x-y+z=7 -x+3y-z=6
Need help solving this problem (2/7)^-2
x+2y-z=7
Sidiki
what is the coefficient of -4×
-1
Shedrak
the operation * is x * y =x + y/ 1+(x × y) show if the operation is commutative if x × y is not equal to -1
An investment account was opened with an initial deposit of \$9,600 and earns 7.4% interest, compounded continuously. How much will the account be worth after 15 years?
lim x to infinity e^1-e^-1/log(1+x)
given eccentricity and a point find the equiation
12, 17, 22.... 25th term
12, 17, 22.... 25th term
Akash
College algebra is really hard?
Absolutely, for me. My problems with math started in First grade...involving a nun Sister Anastasia, bad vision, talking & getting expelled from Catholic school. When it comes to math I just can't focus and all I can hear is our family silverware banging and clanging on the pink Formica table.
Carole
I'm 13 and I understand it great
AJ
I am 1 year old but I can do it! 1+1=2 proof very hard for me though.
Atone
Not really they are just easy concepts which can be understood if you have great basics. I am 14 I understood them easily.
Vedant
hi vedant can u help me with some assignments
Solomon
find the 15th term of the geometric sequince whose first is 18 and last term of 387
I know this work
salma
The given of f(x=x-2. then what is the value of this f(3) 5f(x+1)
hmm well what is the answer
Abhi
If f(x) = x-2 then, f(3) when 5f(x+1) 5((3-2)+1) 5(1+1) 5(2) 10
Augustine
A soccer field is a rectangle 130 meters wide and 110 meters long. The coach asks players to run from one corner to the other corner diagonally across. What is that distance, to the nearest tenths place.
Jeannette has \$5 and \$10 bills in her wallet. The number of fives is three more than six times the number of tens. Let t represent the number of tens. Write an expression for the number of fives.
What is the expressiin for seven less than four times the number of nickels
How do i figure this problem out.
how do you translate this in Algebraic Expressions
why surface tension is zero at critical temperature
Shanjida
I think if critical temperature denote high temperature then a liquid stats boils that time the water stats to evaporate so some moles of h2o to up and due to high temp the bonding break they have low density so it can be a reason
s.
Need to simplify the expresin. 3/7 (x+y)-1/7 (x-1)=
. After 3 months on a diet, Lisa had lost 12% of her original weight. She lost 21 pounds. What was Lisa's original weight?
where are the solutions?
where are the solutions?  By Anonymous User    By Prateek Ashtikar By Rhodes By  By