<< Chapter < Page Chapter >> Page >
This module is the exercise to implement FIR filtering in TI TMS320C62x assembly.

Implementation of fir filters in assembly

Storing filter coefficients

Rather than defining the filter coefficients in your main assembly program file, it is usually more convenient tostore them in a separate file. By defining the coefficients in a separate assembly (for example, coeff.asm ) file, you can load the coefficients at a desired memory location at the run time,although it is not essential for the current simple FIR filtering lab.

The assembly file containing the filter coefficients can be written as follows:

.def _coef .sect "coeffs" _coef: .short 0ff9bh .short 0ff06h .short 0feffh .short 0ff93h .short 070h .short 0117h .short 0120h .short 07bh

Each coefficient must be converted to the Q-15 format and defined by each .short assembly directive. For your convenience, I wrote a short MATLABscript save_coef.m that converts the filter coefficients stored as a MATLAB vector to Q-15 format andthen writes to a file exactly in the above format. (You can download save_coef.m from the course web page.) The section coeffs should be defined in the link command file so that the coefficients are tobe loaded at the correct memory location.

You can simply include the coeff.asm using the .include directive at the beginning of your main assembly program.

Make coefficient files for each of the filters you designed in the previous exercise.

Assembly implementation

Based on the codec input and output program you have written in the previous labs, you can now implement areal-time FIR filtering algorithm.

Write an assembly routine that implements the FIR filter by modifying the inner product program you havewritten in Lab 3. Combine the FIR filtering routine with the interrupt-based codec input-output code youwrote in the previous lab. Your code should perform FIR filtering on the input samples and output thefiltered result to the codec. Both the left and right channels should be filtered. To write the designedMATLAB vector of filter coefficients as a .asm file, use the provided save_coef.m matlab function. First implement the length-40 lowpass filter with 10kHzcutoff designed using the remez.m .

Implementation using circular addressing modes

As you might already have noticed, a lot of cycles are wasted in FIR filtering while maintaining the buffer tosee if you reached the end of buffer and update the address pointers properly. To avoid this unnecessarybuffer maintenance, the TI DSP processors have a special addressing mode, called circular addressing . Using circular addressing, you can define a block ofmemory as a circular buffer. As you increase (or decrease) the pointer register pointing to the buffer index beyondthe buffer limit, it automatically points to the other end of the buffer, implementing a circle of data array.Instead of moving the data samples themselves, you can move the pointer which specifies the beginning of thebuffer, as each new sample is processed. You don't need to check if you reached the end of buffer because the addresspointer returns to the beginning of the buffer immediately after reaching the end.

Of the 32 registers on the C6x, 8 of them can perform circular addressing. These registers are A4 through A7and B4 through B7. Since circular addressing is not default, each of these registers must be specified ascircular using the AMR (Address Mode Register) register. The lower 16 bits of the AMR are used to select the mode for each of the 8 registers. The upper 10 bits (6 are reserved) areused to set the length of the circular buffer. Buffer size is determined by 2 N 1 bytes, where N is the value appearing in the block size fields of the AMR register. The top address of the buffer needs to be aligned with proper physical memory blockaddress using the .align assembler directive.

First read TMS320C62x/C67x CPU and Instruction Set Reference Guide to learn how to define circularbuffers. Modify your FIR filtering assembly code to use circular addressing modes. After optimizing yourcode as much as you can, count the number of required clock cycles for each FIR filter outputcomputation. Compare the number with the code written without circular addressing.

Questions & Answers

do you think it's worthwhile in the long term to study the effects and possibilities of nanotechnology on viral treatment?
Damian Reply
absolutely yes
Daniel
how to know photocatalytic properties of tio2 nanoparticles...what to do now
Akash Reply
it is a goid question and i want to know the answer as well
Maciej
characteristics of micro business
Abigail
Do somebody tell me a best nano engineering book for beginners?
s. Reply
what is fullerene does it is used to make bukky balls
Devang Reply
are you nano engineer ?
s.
fullerene is a bucky ball aka Carbon 60 molecule. It was name by the architect Fuller. He design the geodesic dome. it resembles a soccer ball.
Tarell
what is the actual application of fullerenes nowadays?
Damian
That is a great question Damian. best way to answer that question is to Google it. there are hundreds of applications for buck minister fullerenes, from medical to aerospace. you can also find plenty of research papers that will give you great detail on the potential applications of fullerenes.
Tarell
what is the Synthesis, properties,and applications of carbon nano chemistry
Abhijith Reply
Mostly, they use nano carbon for electronics and for materials to be strengthened.
Virgil
is Bucky paper clear?
CYNTHIA
so some one know about replacing silicon atom with phosphorous in semiconductors device?
s. Reply
Yeah, it is a pain to say the least. You basically have to heat the substarte up to around 1000 degrees celcius then pass phosphene gas over top of it, which is explosive and toxic by the way, under very low pressure.
Harper
Do you know which machine is used to that process?
s.
how to fabricate graphene ink ?
SUYASH Reply
for screen printed electrodes ?
SUYASH
What is lattice structure?
s. Reply
of graphene you mean?
Ebrahim
or in general
Ebrahim
in general
s.
Graphene has a hexagonal structure
tahir
On having this app for quite a bit time, Haven't realised there's a chat room in it.
Cied
what is biological synthesis of nanoparticles
Sanket Reply
what's the easiest and fastest way to the synthesize AgNP?
Damian Reply
China
Cied
types of nano material
abeetha Reply
I start with an easy one. carbon nanotubes woven into a long filament like a string
Porter
many many of nanotubes
Porter
what is the k.e before it land
Yasmin
what is the function of carbon nanotubes?
Cesar
I'm interested in nanotube
Uday
what is nanomaterials​ and their applications of sensors.
Ramkumar Reply
what is nano technology
Sravani Reply
what is system testing?
AMJAD
preparation of nanomaterial
Victor Reply
Yes, Nanotechnology has a very fast field of applications and their is always something new to do with it...
Himanshu Reply
good afternoon madam
AMJAD
what is system testing
AMJAD
what is the application of nanotechnology?
Stotaw
In this morden time nanotechnology used in many field . 1-Electronics-manufacturad IC ,RAM,MRAM,solar panel etc 2-Helth and Medical-Nanomedicine,Drug Dilivery for cancer treatment etc 3- Atomobile -MEMS, Coating on car etc. and may other field for details you can check at Google
Azam
anybody can imagine what will be happen after 100 years from now in nano tech world
Prasenjit
after 100 year this will be not nanotechnology maybe this technology name will be change . maybe aftet 100 year . we work on electron lable practically about its properties and behaviour by the different instruments
Azam
name doesn't matter , whatever it will be change... I'm taking about effect on circumstances of the microscopic world
Prasenjit
how hard could it be to apply nanotechnology against viral infections such HIV or Ebola?
Damian
silver nanoparticles could handle the job?
Damian
not now but maybe in future only AgNP maybe any other nanomaterials
Azam
Hello
Uday
I'm interested in Nanotube
Uday
this technology will not going on for the long time , so I'm thinking about femtotechnology 10^-15
Prasenjit
how did you get the value of 2000N.What calculations are needed to arrive at it
Smarajit Reply
Privacy Information Security Software Version 1.1a
Good
Berger describes sociologists as concerned with
Mueller Reply
where are the solutions?
where are the solutions?

Get the best Algebra and trigonometry course in your pocket!





Source:  OpenStax, Finite impulse response. OpenStax CNX. Feb 16, 2004 Download for free at http://cnx.org/content/col10226/1.1
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Finite impulse response' conversation and receive update notifications?

Ask