Lecture 5 - Assembly Programming(II), Intro to Digital Filters€¦ · Lecture 5 - Assembly...
Transcript of Lecture 5 - Assembly Programming(II), Intro to Digital Filters€¦ · Lecture 5 - Assembly...
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 1 / 22
Lecture 5 - Assembly Programming(II), Intro toDigital Filters
James Barnes ([email protected])
Spring 2014
Assembly Programming (II)
Assembly Programming(II)
❖ Instuction PipelineHardware
❖ Pipeline Phases
❖ Delay Slots (NOPs)and the Pipeline
❖ Assembly Example -Inner Product❖ Assembly Example -Inner Product AssemblyFunction❖ Optimized InnerProduct AssemblyFunction
❖ Addressing Modes
❖ Address ModeRegister
❖ AMR AddressingConfiguration Fields(SPRU189f)
❖ Memory Map
Introduction to DigitalFilters
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 2 / 22
Instuction Pipeline Hardware
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 3 / 22
Pipeline Phases
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 4 / 22
Pipeline advances once per cpu clock (4.44ns)
Stage Phase Symbol
Fetch Program Address Generation PG
Fetch Program Address Sent PS
Fetch Program Wait PW
Fetch Program Data Receive PR
Decode Dispatch DP
Decode Decode DC
Execute Execute 1 E1
Execute — —
Execute Execute 10 E10
Delay Slots (NOPs) and the Pipeline
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 5 / 22
NOPs may be needed because
1. Instruction requires multiple execute steps (ex: MPYx, LDx/STx) OR2. Pipeline may need to be flushed (branch not taken). Example below.
Assembly Example - Inner Product
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 6 / 22
Assembly Example - Inner ProductAssembly Function
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 7 / 22
Optimized Inner Product AssemblyFunction
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 8 / 22
Addressing Modes
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 9 / 22
● We have seen linear indirect addressing. An example
LDW .D1 *A4++(2),A2
This loads the memory location in A4 into A2 and then skips 2 WORDS (adds 8 to A4)● In many filtering applications, a more useful addressing mode is Circular Addressing.
● Circular addressing is useful in computing convolution sums such as y[n] =∑N
k=0h[k]x[n− k]
because it allows adding of a new datapoint at the end of the circular FIFO just by moving thepointer to the oldest added data point.
Address Mode Register
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 10 / 22
● Circular convolution can be setup by writing a CSR (Control/Status Register) called AMR.
●
Example of setting up AMR for circular convolution (described in Lab4). Must use B side and S2.
MVKL .S2 0x0004,B2
MVKH .S2 0x0005,B2
MVC .S2 B2,AMR
● This will set up a circular buffer 25 = 32 HWORDs deep and select A5 as the pointer.● MVC is the only way to write bits into the CSRs.● Text Appendix B has a nice summary of the CSRs, but they can all be found in SPRU189f
AMR Addressing Configuration Fields(SPRU189f)
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 11 / 22
Memory Map
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 12 / 22
User memory (for programs, data) at 0x00000 to 0x30000 (about 200KB). Someof this space can be reconfigured as L2 cache. Ref:Spectrum Digital TMS320C6713 DSK Technical Reference
Introduction to Digital Filters
Assembly Programming(II)
Introduction to DigitalFilters
❖ References❖ Review: AnalogComputer WiringDiagram
❖ RepresentingDiscrete-time LTI: DigitalComputer WiringDiagram
❖ Finite ImpulseResponse Digital Filter
❖ Frequency Responseof Filter❖ Specifying a (Digital)Filter❖ FIR Design MethodsOverview❖ ”Hand” DesignMethods (next lecture)
❖ Linear Phase FIRFilter
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 13 / 22
References
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 14 / 22
● Chaissing 2005, Chapter 4● Signals and Systems MATLAB labs (link on course_info website)
Review: Analog Computer Wiring Diagram
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 15 / 22
A Continuous-time Linear Time-Invariant system can be represented two ways:
1. Differential equation in the time domain
y(t) + a1dy
dt+ · · ·+ aN
dNy
dtN= b0x(t) + b1
dxdt
+ · · ·+ bMdMx
dtM
2. Polynomial equation in the S-domain(1 + a1s+ · · ·+ aNSN )Y (s) = (b0 + b1s+ · · ·+ bM sM )X(s)
Representing Discrete-time LTI: DigitalComputer Wiring Diagram
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 16 / 22
1. Difference equation in the time domainy[n] + a1y[n− 1] + · · ·+ aNy[n−N ] = b0x[n] + b1x[n− 1] + · · ·+ bMx[n−M ]
2. Polynomial equation in the Z-domain(1 + a1z
−1 + · · ·+ aNz−N )Y (z) = (b0 + b1Z−1 + · · ·+ bMz−M )X(z)
The transfer function H(z)=Y(z)/X(z) can therefore be written as
H(z) =
M∑
k=0
bkz−k
1+
N∑
k=1
akz−k
Finite Impulse Response Digital Filter
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 17 / 22
● The ”b-part” is sometimes called the feed-forward part, and the ”a-part” the feedback part. If thea’s are all zero, we have a Finite-Impulse Response (F.I.R) filter, so called because the responseto any finite-duration stimulus such as a unit impulse δ[n] will die out in a finite time.
● For a FIR filter, the b coefficients are just the coefficients of the impulse response function h[n].We can write the impulse response in the z-domain as
H[z] =
M∑
k=0
bkz−k =
M∑
k=0
h[k]z−k
● The response of the filter to an arbitrary input sequence x[n] is given by the convolution sum
y[n] =
M∑
k=0
h[k]x[n − k]
● Fun facts about FIR filters
✦ For real input and output signals, the h[k] coefficients are real✦ For a causal filter, h[k] is non-zero for a range k=0 · · · M✦ FIR filters are unconditionally-stable (poles of the transfer function are all at z=0)✦ If the h[k] coefficients satisfy certain conditions, the filter transfer function will have linear
phase vs frequency, so the filter will look like a pure delay for all frequencies it will pass (tobe shown later).
Frequency Response of Filter
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 18 / 22
● In the continuous-time domain, we measure the LTI frequency response byevaluating the Laplace Transform H(s) of the time-domain system impulseresponse function h(t) on the positive imaginary axis, i.e. H(ω) = H(s = jω).
✦ For the Bode plot, we plot |H(ω)| and arg(H(ω)).
● For DT LTI systems, we measure the frequency response by evaluating theZ-Transform of the impulse response function h[k] on the unit circle, i.e.H(ω) = H(z = ejω). Here ω is the digital (angular) frequency, which rangesfrom [−π, π] radians/sec.
✦ For the Bode plot, we again plot |H(ω)| and arg(H(ω) for 0 < ω < π.
Specifying a (Digital) Filter
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 19 / 22
● How do we specify (design) a filter– must specify the frequency and/or phase response. For manyapplications, such as audio, the phase response is not important, but for others (control systems), it is critical.
● Generally specify the ripple (max and min attenuation) in the passband and stopband and the width of therolloff.
FIR Design Methods Overview
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 20 / 22
”Hand” Design Methods (next lecture)
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 21 / 22
1. Impulse Invariance - sampling in the time domain2. Fourier Series Method - sampling in the frequency domain3. Pole/Zero Placement in z-domain
Linear Phase FIR Filter
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 22 / 22
● The response of an FIR filter can be written
✦y[n] =
M∑
k=0
h[k]x[n− k]
= h[0]x[n] + h[1]x[n− 1] + · · ·✦ Each term x[n− k]k represents a delay of k sample times of the input sequence, which is
equivalent to multiplying the input by a factor z−k. When evaluated on the unit circle(z = jω), this represents a phase factor θ = −ωkTs, which is a linear function of frequency.The group delay dθ
dω= −kT is a constant.
■ This means all Fourier components of a pulse are delayed equally and a pulse retainsits shape. This is important in certain applications.
✦ We will see (next lecture) that the filter has linear phase if the the impulse response functionh[k] is either symmetric or anti-symmetric, i.e.
■ h[M-k]=h[k] (symmetric) or■ h[M-k]=- h[k] (anti-symmetric)
Reference http://sip.cua.edu/res/docs/courses/ee515/chapter04/ch4-4.pdf