# 4.3 Lab 3: lab  (Page 3/3)

 Page 3 / 3

## Parameter passing

The parameter passing convention between assembly and C is simple for single input, single output assembly functions.From a C program, the input to an assembly program is in the low part of accumulator A with the output returned in the same place. In this example, the function filter takes the right input sample from A and returns a single output in A (note the left shift by 16 to put the result in the low part of A ). When more than one parameter is passed to an assembly function, the parameters are passed on thestack (see the core file description for more information). We suggest that you avoid passing or returning more than oneparameter. Instead, use global memory addresses to pass in or return more than one parameter. Another alternative isto pass a pointer to the start of a buffer intended for passing and returning parameters.

## Registers modified

When entering and leaving an assembly function, the ENTER_ASM and LEAVE_ASM macros ensure that certain registers are saved and restored. Sincethe C program may use any and all registers, the state of a register cannot be expected to remain the same between callsto assembly function(s). Therefore, any information that needs to be preserved across calls to anassembly function must be saved to memory! In this example, stateptr keeps track of the location of the current sample in the circular buffer firstate . Why don't we need to keep track of the location of the coefficient pointer ( AR2 in this example) after every sample?

A working program can be produced by compiling the C code and linking assembly modules and the core module. Thecompiler translates C code to a relocatable assembly form. The linker assigns physical addresses on the DSP to therelocatable data and code segments, resolves .global references and links runtime libraries.

The procedure for compiling C code and linking assembly modules has been automated for you in the batch file v:\ece320\54x\dsptools\C_ASM.bat . Copy the files lab3main.c , and lab3filt.asm from the v:\ece320\54x\dspclib\ directory into your own directory on the W: drive. Using Matlab, write the coefficients you created in the prelabinto a coef1.asm file. Then, type c_asm lab3main lab3filt to produce a lab3main.out file to be loaded onto the DSP. Load the output file onto the DSP as usual and check that isthe FIR filter you designed.

## Cascade of fir1 and fir2

Modify the lab3filt.asm assembly module to implement a cascade of filters FIR1 and FIR2. Note thatboth _filter and _init_filter will need to be modified. Compile and link the new assemblymodule and confirm it has the frequency response which you expect from cascading FIR1 and FIR2.

## Complete multirate system

Once you have the cascaded system working, implement the multirate system composed of the three FIR filters bymodifying the assembly modules in lab3filt.asm . In order to implement the sample rate converters, you willneed to use a counter or a loop. The upsampling block and downsampling block are not implemented as seperatesections of code. Your counter or loop will determine when the decimated rate processing is to occur aswell as when to insert zeros into FIR3 to implement the zero-filling up-sampler.

Some instructions that may be useful for implementing your multirate structure are the addm (add to memory) and bc (branch conditional) instructions. You may also find the banz (branch on auxiliary register not zero) instruction useful, depending on how you implement your code. As the counter is state information that needs to be preservedbetween calls to filter , the counter must be saved in memory.

In order to experiment with multirate effects in yoursystem, make the downsampling factor ( $D=U$ ) a constant which can be changed easily in your code. Is there a critical( $D=U$ ) associated with this system above which aliasing occurs?

It will be useful both for debugging and for experimentation to show the output of your system at various points in theblock diagram. By modifying the C code in lab3main.c and the assembly modules in lab3filt.asm , send the following sequences to the DSP output

• output of FIR1
• input to FIR2 (after downsampling)
• input to FIR3 (after upsampling)
You will have to pass these samples to the main C program by storing them in memory locations as described in . Note that the input to FIR2 is at the downsampled rate.

For the quiz, you should be prepared to change the decimation rate upon request, and explain the effects ofchanging the decimation rate on the system's output.

• 1 point: Prelab
• 4 points: Code (Code which is complete and working at the beginning of the lab period gets fullcredit.)
• 5 points: Oral Quiz
The oral quiz may cover various problems in multirate sampling theory, as well as the operation of your codeitself and details about the instructions you've used in your code. Be prepared to explain, in detail, the operationof all of your code, even if your lab partner wrote it! You may also be asked to make changes to your code and topredict, and explain, the effects of these changes.

## Extra credit: 1 point

One of the main benefits of multirate systems is efficiency. Because of downsampling, the output of FIR1 is used only oneof $D$ times. Make your assembly module more efficient by using this fact.

Similarly, at the input of FIR3, $D-1$ of every $D$ samples is zero. So, for a fixed downsampling factor $D$ , it is possible to make use of this fact to create $D$ different filters (each a subset of the coefficients of FIR3) to be used at the $D$ time instances. This technique is referred to as polyphase filtering and can be found in most modern DSPtextbooks. These filters are more efficient as the sum of the lengths of the filters is equal to the length of FIR3.Apply this fact for $D=4$ .

how do they get the third part x = (32)5/4
can someone help me with some logarithmic and exponential equations.
20/(×-6^2)
Salomon
okay, so you have 6 raised to the power of 2. what is that part of your answer
I don't understand what the A with approx sign and the boxed x mean
it think it's written 20/(X-6)^2 so it's 20 divided by X-6 squared
Salomon
I'm not sure why it wrote it the other way
Salomon
I got X =-6
Salomon
ok. so take the square root of both sides, now you have plus or minus the square root of 20= x-6
oops. ignore that.
so you not have an equal sign anywhere in the original equation?
Commplementary angles
hello
Sherica
im all ears I need to learn
Sherica
right! what he said ⤴⤴⤴
Tamia
hii
Uday
what is a good calculator for all algebra; would a Casio fx 260 work with all algebra equations? please name the cheapest, thanks.
a perfect square v²+2v+_
kkk nice
algebra 2 Inequalities:If equation 2 = 0 it is an open set?
or infinite solutions?
Kim
The answer is neither. The function, 2 = 0 cannot exist. Hence, the function is undefined.
Al
y=10×
if |A| not equal to 0 and order of A is n prove that adj (adj A = |A|
rolling four fair dice and getting an even number an all four dice
Kristine 2*2*2=8
Differences Between Laspeyres and Paasche Indices
No. 7x -4y is simplified from 4x + (3y + 3x) -7y
is it 3×y ?
J, combine like terms 7x-4y
how do you translate this in Algebraic Expressions
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?
what's the easiest and fastest way to the synthesize AgNP?
China
Cied
types of nano material
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.
what is nano technology
what is system testing?
preparation of nanomaterial
Yes, Nanotechnology has a very fast field of applications and their is always something new to do with it...
what is system testing
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
can nanotechnology change the direction of the face of the world
At high concentrations (>0.01 M), the relation between absorptivity coefficient and absorbance is no longer linear. This is due to the electrostatic interactions between the quantum dots in close proximity. If the concentration of the solution is high, another effect that is seen is the scattering of light from the large number of quantum dots. This assumption only works at low concentrations of the analyte. Presence of stray light.
the Beer law works very well for dilute solutions but fails for very high concentrations. why?
how did you get the value of 2000N.What calculations are needed to arrive at it
Privacy Information Security Software Version 1.1a
Good
Got questions? Join the online conversation and get instant answers!