GoBack
Lecture 5 - Assembly Programming(II), Intro to Digital Filters James Barnes (James.Barnes@colostate.edu) Spring 2009 Colorado State University Dept of Electrical and Computer Engineering ECE423 1 / 20
Assembly Programming (II) Instuction Pipeline Hardware Pipeline Phases Delay Slots (NOPs) and the Pipeline Assembly Example - Inner Product Assembly Example - Inner Product Assembly Function Optimized Inner Product Assembly Function Addressing Modes Address Mode Register AMR Addressing Configuration Fields (SPRU189f) Assembly Programming (II) Introduction to Digital Filters Colorado State University Dept of Electrical and Computer Engineering ECE423 2 / 20
Instuction Pipeline Hardware Colorado State University Dept of Electrical and Computer Engineering ECE423 3 / 20
Pipeline Phases 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 Colorado State University Dept of Electrical and Computer Engineering ECE423 4 / 20
Delay Slots (NOPs) and the Pipeline NOPs may be needed because 1. Instruction requires multiple execute steps (ex: MPYx, LDx/STx) OR 2. Pipeline may need to be flushed (branch not taken). Example below. Colorado State University Dept of Electrical and Computer Engineering ECE423 5 / 20
Assembly Example - Inner Product Colorado State University Dept of Electrical and Computer Engineering ECE423 6 / 20
Assembly Example - Inner Product Assembly Function Colorado State University Dept of Electrical and Computer Engineering ECE423 7 / 20
Optimized Inner Product Assembly Function Colorado State University Dept of Electrical and Computer Engineering ECE423 8 / 20
Addressing Modes 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 N y[n] = h[k]x[n k] because it allows adding of a new datapoint at the end of the k=0 circular FIFO just by moving the pointer to the oldest added data point. Colorado State University Dept of Electrical and Computer Engineering ECE423 9 / 20
Address Mode Register 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 2 5 = 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 Colorado State University Dept of Electrical and Computer Engineering ECE423 10 / 20
AMR Addressing Configuration Fields (SPRU189f) Colorado State University Dept of Electrical and Computer Engineering ECE423 11 / 20
Assembly Programming (II) Introduction to Digital Filters Review: Analog Computer Wiring Diagram Representing Discrete-time LTI: Digital Computer Wiring Diagram Finite Impulse Response Digital Filter Frequency Response of Filter Specifying a (Digital) Filter FIR Design Methods Overview Hand Design Methods (next lecture) Linear Phase FIR Filter (next lecture) Introduction to Digital Filters Colorado State University Dept of Electrical and Computer Engineering ECE423 12 / 20
Review: Analog Computer Wiring Diagram A Continuous-time Linear Time-Invariant system can be represented two ways: 1. Differential equation in the time domain dy y(t) + a 1 dt + + a N dn y dx dt N = b 0 x(t) + b 1 dt + + b M dm x dt M 2. Polynomial equation in the S-domain (1 + a 1 s + + a N S N )Y (s) = (b 0 + b 1 s + + b M s M )X(s) Colorado State University Dept of Electrical and Computer Engineering ECE423 13 / 20
Representing Discrete-time LTI: Digital Computer Wiring Diagram 1. Difference equation in the time domain y[n] + a 1 y[n 1] + + a N y[n N] = b 0 x[n] + b 1 x[n 1] + + b M x[n M] 2. Polynomial equation in the Z-domain (1 + a 1 z 1 + + a N z N )Y (z) = (b 0 + b 1 Z 1 + + b M z M )X(z) The transfer function H(z)=Y(z)/X(z) can therefore be written as H(z) = 1+ M k=0 N k=1 b k z k a k z k Colorado State University Dept of Electrical and Computer Engineering ECE423 14 / 20
Finite Impulse Response Digital Filter The b-part is sometimes called the feed-forward part, and the a-part the feedback part. If the a s are all zero, we have a Finite-Impulse Response (F.I.R) filter, so called because the response to 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 b k z k = k=0 M h[k]z k k=0 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 (to be shown later). Colorado State University Dept of Electrical and Computer Engineering ECE423 15 / 20
Frequency Response of Filter In the continuous-time domain, we measure the LTI frequency response by evaluating the Laplace Transform 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 the Z-Transform on the unit circle, i.e. H(ω) = H(z = e jω ). Here ω is the digital (angular) frequency, which ranges from [ π, π] radians/sec. For the Bode plot, we again plot H(ω) and arg(h(ω) for 0 < ω < π. Colorado State University Dept of Electrical and Computer Engineering ECE423 16 / 20
Specifying a (Digital) Filter How do we specify (design) a filter must specify the frequency and/or phase response. For many applications, 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 the rolloff. Colorado State University Dept of Electrical and Computer Engineering ECE423 17 / 20
FIR Design Methods Overview Colorado State University Dept of Electrical and Computer Engineering ECE423 18 / 20
Hand Design Methods (next lecture) 1. Impulse Invariance - sampling in the time domain 2. Fourier Series Method - sampling in the frequency domain 3. Pole/Zero Placement in z-domain Colorado State University Dept of Electrical and Computer Engineering ECE423 19 / 20
Linear Phase FIR Filter (next lecture) Colorado State University Dept of Electrical and Computer Engineering ECE423 20 / 20