You are on page 1of 76

Vaishnavi Institute of Technology,Tirupati

EXP :01

SUM OF TWO SINUSOIDAL SIGNALS

AIM: To write a matlab program to generate and add two sinusoidal signals EQUIPMENTS: PROGRAM: clear all; close all; clc; a1 a2 f1 f2 p1 p2 = = = = = = input('amplitude of signal 1'); input('amplitude of signal 2'); input('frequency of signal 1'); input('frequency of signal 2'); input('phase of signal 1'); input('phase of signal 2'); PC with Matlab Software

t = 0 : 2*pi/100 : 2*pi; x = a1 * sin (f1*t + p1); y = a2 * sin(f2*t + p2); z = x+y; subplot(4,1,1); plot(t,x,'-g');%displays subplot(4,1,2); plot(t,y,'-g');%displays subplot(4,1,3); plot(t,z,'-b');%displays subplot(4,1,4); plot(x,y,'-r');%displays title('LISSAJOUS'); sine signal 1 sine signal 2 sum of two signals Lissazous pattern

RESULT: Sum of Two Sinusoidal signals is obtained using the matlab software and its corresponding waveforms are observed.

1|Page

Vaishnavi Institute of Technology,Tirupati

Inputs given: Amplitude of signal 1 : 2 Amplitude of signal 2 : 2 Frequency of signal 1 : 5 Frequency of signal 2 : 5 Phase of signal 1 : 0 Phase of signal 2 : pi/2 Wave forms:

EXP :02

N-POINT FFT 2|Page

Vaishnavi Institute of Technology,Tirupati

AIM: To perform MATLAB program to find out N-point fft of the given sequence. EQUIPMENTS: PROGRAM: clear all; close all; clc; x=[1 1 1 1 1 1 1 1]; disp(input sequence is:); disp(x); y=fft(x,8); disp(FFT of input sequence is:); disp(y); y1=ifft(y); disp(IFFT of the sequence is :); disp(y1); PC with Matlab Software

RESULT: FFT of a given sequence is obtained using the matlab software and its IFFT is found.
OUTPUT: Input sequence is: 1 1 1 1 1 1 1 1

FFT of input sequence is: 8 0 0 0 0 0 0 0

IFFT of the sequence is : 1 1 1 1 1 1 1 1

EXP :03

FREQUENCY RESPONSE OF 1-D SEQUENCE 3|Page

Vaishnavi Institute of Technology,Tirupati

AIM: To write a matlab program to find out the frequency response of 1-D sequence EQUIPMENTS: PC with Matlab Software PROGRAM: clear all; close all; clc; fs=2000; t=0: 2*pi/fs :2*pi; x=sin(40*t)+sin (50*t)+sin(60*t); plot(t,x); y=fft(x); y(1)=[]; n=length(y); pwr=abs(y(1:floor(n/2))); nq=fs/2; frq=(1:n/2)/(n/2)*nq; figure; stem(frq,pwr);

RESULT: Frequency response of a 1-D sequence is found using Matlab software.

4|Page

Vaishnavi Institute of Technology,Tirupati

Waveforms:
SIGNAL: x=sin(40*t)+sin (50*t)+sin(60*t) Vs Time;

ABSOLUTE VALUES OF FFT OF X Vs FREQUENCY:

EXP :04(A)

FREQUENCY RESPONSE OF ANALOG LPF (USING ELLIP TYPE FILTER)

5|Page

Vaishnavi Institute of Technology,Tirupati

AIM: To write a matlab program for finding the frequency response of analog LPF using ellip type. EQUIPMENTS: PROGRAM: close all; clc; clear all; Fs = 100; t = (1:100)/Fs; s1 = sin(2*pi*t*5); s2=sin(2*pi*t*15); s3=sin(2*pi*t*30); s = s1+s2+s3; subplot(2,3,1);plot(t,s); xlabel('Time (seconds)'); ylabel('Time waveform'); [b,a] = ellip(4,0.1,40,[10]*2/Fs,'low'); [H,w] = freqz(b,a,512); subplot(2,3,2); plot(w*Fs/(2*pi),abs(H)); xlabel('Frequency (Hz)'); ylabel('Mag. of frequency response'); grid; sf = filter(b,a,s); subplot(2,3,3); plot(t,sf); xlabel('Time (seconds)'); ylabel('Time waveform'); axis([0 1 -1 1]); S = fft(s,512); SF = fft(sf,512); w = (0:255)/256*(Fs/2); subplot(2,3,4); plot(w,abs(S(1:256))); subplot(2,3,5); plot(w,abs(SF(1:256))); xlabel('Frequency (Hz)'); ylabel('Mag. of Fourier transform'); PC with Matlab Software

RESULT:
Matlab program for finding the frequency response of analog LPF using ellip type is written.

6|Page

Vaishnavi Institute of Technology,Tirupati

Waveforms:

EXP :04(B)

FREQUENCY RESPONSE OF ANALOG HPF(USING BUTTERWORTH FILTER)

7|Page

Vaishnavi Institute of Technology,Tirupati

AIM: To write a matlab program for finding the frequency response of analog HPF using Butterworth type. EQUIPMENTS: PROGRAM: close all; clc; clear all; Fs = 100; t = (1:100)/Fs; s1 = sin(2*pi*t*5); s2=sin(2*pi*t*15); s3=sin(2*pi*t*30); s = s1+s2+s3; subplot(3,2,1);plot(t,s); xlabel('Time (seconds)'); ylabel('Time waveform'); [b,a] = butter(4,[25]*2/Fs,'high'); [H,w] = freqz(b,a,512); subplot(3,2,2); plot(w*Fs/(2*pi),abs(H));
xlabel('Frequency (Hz)'); ylabel('Mag. of frequency response');

PC with Matlab Software

grid; sf = filter(b,a,s); subplot(3,2,3); plot(t,sf); xlabel('Time (seconds)'); ylabel('Time waveform'); axis([0 1 -1 1]); S = fft(s,512); SF = fft(sf,512); w = (0:255)/256*(Fs/2); subplot(3,2,4); plot(w,abs(S(1:256))); subplot(3,2,5); plot(w,abs(SF(1:256))); xlabel('Frequency (Hz)'); ylabel('Mag. of Fourier transform');

RESULT:
Matlab program for finding the frequency response of analog HPF using Butterworth type is written.

Waveforms:

8|Page

Vaishnavi Institute of Technology,Tirupati

EXP :4(c)

FREQUENCY RESPONSE OF ANALOG BPF(USING CHEBY1 FILTER)

AIM: To write Matlab program for finding the frequency response of analog BPF using cheby-1 type.

9|Page

Vaishnavi Institute of Technology,Tirupati

EQUIPMENTS: PROGRAM: close all; clc; clear all; Fs = 100; t = (1:100)/Fs; s1 = sin(2*pi*t*5); s3 = sin(2*pi*t*30); s = s1+s2+s3+s4; subplot(3,2,1);plot(t,s); xlabel('Time (seconds)'); ylabel('Time waveform'); [b,a] = cheby1(4,0.5,[15 30]*2/Fs); [H,w] = freqz(b,a,512); subplot(3,2,2); plot(w*Fs/(2*pi),abs(H)); xlabel('Frequency (Hz)'); ylabel('Mag. of frequency response'); grid; sf = filter(b,a,s); subplot(3,2,3); plot(t,sf); xlabel('Time (seconds)'); ylabel('Time waveform'); axis([0 1 -1 1]); S = fft(s,512); SF = fft(sf,512); w = (0:255)/256*(Fs/2); subplot(3,2,4); plot(w,abs(S(1:256))); subplot(3,2,5); plot(w,abs(SF(1:256))); xlabel('Frequency (Hz)'); ylabel('Mag. of Fourier transform'); s2 = sin(2*pi*t*15); s4 = sin(2*pi*t*40); PC with Matlab Software

RESULT:
Matlab program for finding the frequency response of analog BPF using cheby-1 type is written.

Waveforms:

10 | P a g e

Vaishnavi Institute of Technology,Tirupati

EXP :04(D)

FREQUENCY RESPONSE OF ANALOG BSF(USING CHEBY2 FILTER)

11 | P a g e

Vaishnavi Institute of Technology,Tirupati

AIM: To write Matlab program for finding the frequency response of analog BSF using cheby-2 type. EQUIPMENTS: PROGRAM: close all; clc; clear all; Fs = 300; t = (1:100)/Fs; s1 = sin(2*pi*t*5); s3 = sin(2*pi*t*30); s = s1+s2+s3+s4; s2 = sin(2*pi*t*15); s4 = sin(2*pi*t*40); PC with Matlab Software

subplot(3,2,1);plot(t,s); xlabel('Time (seconds)'); ylabel('Time waveform'); [b,a] = cheby2(4,25,[10 35]*2/Fs,'stop'); [H,w] = freqz(b,a,512); subplot(3,2,2); plot(w*Fs/(2*pi),abs(H)); xlabel('Frequency (Hz)'); ylabel('Mag. of frequency response'); grid; sf = filter(b,a,s); subplot(3,2,3); plot(t,sf); xlabel('Time (seconds)'); ylabel('Time waveform'); axis([0 1 -1 1]); S = fft(s,512); SF = fft(sf,512); w = (0:255)/256*(Fs/2); subplot(3,2,4); plot(w,abs(S(1:256))); subplot(3,2,5); plot(w,abs(SF(1:256))); xlabel('Frequency (Hz)'); ylabel('Mag. of Fourier transform');

RESULT:
Matlab program for finding the frequency response of analog BSF using cheby-2 type is written.

Waveforms:

12 | P a g e

Vaishnavi Institute of Technology,Tirupati

EXP :5a(1)

FREQUENCY RESPONSE OF FIR FILTER (USING KAISER WINDOW)

AIM: To write a matlab program to find the frequency response of LPF using Kaiser window.

13 | P a g e

Vaishnavi Institute of Technology,Tirupati

EQUIPMENTS: PROGRAM: clear all; close all; clc; n=20; fp=300; fs=1000; fn=2*fp/fs; window=kaiser(n+1); b=fir1(n,fn,'low',window); [h,w]=freqz(b,1,128); subplot(2,1,1); plot(w/pi,abs(h)); title('mag response of lpf'); ylabel('gain'); xlabel('normalised freq'); subplot(2,1,2); plot(w/pi,angle(h)); title('phase response of lpf'); ylabel('angle'); xlabel('normalised freq'); PC with Matlab Software

RESULT:
Matlab program to find the frequency response of LPF using Kaiser window is written.

Waveforms:

14 | P a g e

Vaishnavi Institute of Technology,Tirupati

EXP :5a(2)

FREQUENCY RESPONSE OF HPF USING KAISER WINDOW

AIM:

To write a Matlab program to find the frequency response

15 | P a g e

Vaishnavi Institute of Technology,Tirupati

of HPF using Kaiser window. EQUIPMENTS: PROGRAM: clear all; close all; clc; n=50; fp=300; fs=1000; fn=2*fp/fs; window=kaiser(n+1); b=fir1(n,fn,'high',window); [h,w]=freqz(b,1,256); subplot(2,1,1); plot(w/pi,abs(h)); title('mag response of hpf'); ylabel('gain'); xlabel('normalised freq'); subplot(2,1,2); plot(w/pi,angle(h)); title('phase response of hpf'); ylabel('angle'); xlabel('normalised freq');

PC with Matlab Software

RESULT:
Matlab program to find the frequency response of HPF using Kaiser window is written.

Waveforms:

16 | P a g e

Vaishnavi Institute of Technology,Tirupati

17 | P a g e

Vaishnavi Institute of Technology,Tirupati

EXP :5a(3) BPF

FREQUENCY RESPONSE OF USING KAISER WINDOW

AIM: To write a Matlab program to find the frequency response of BPF using Kaiser window. EQUIPMENTS: PROGRAM: clear all; close all; clc; n=50; fp=300; fst=400; fs=1000; window=kaiser(n+1); b=fir1(n,[fp fst]*2/fs,window); [h,w]=freqz(b,1,256); subplot(2,1,1); plot(w/pi,abs(h)); title('mag response of bpf'); ylabel('gain'); xlabel('normalised freq'); subplot(2,1,2); plot(w/pi,angle(h)); title('phase response of bpf'); ylabel('angle'); xlabel('normalised freq'); PC with Matlab Software

RESULT:
Matlab program to find the frequency response of BPF using Kaiser window is written.

18 | P a g e

Vaishnavi Institute of Technology,Tirupati

Waveforms:

19 | P a g e

Vaishnavi Institute of Technology,Tirupati

EXP :5a(4)

FREQUENCY RESPONSE OF BSF USING KAISER WINDOW

AIM: To write a Matlab program to find the frequency response of BSF using Kaiser window. EQUIPMENTS: PROGRAM: clear all; close all; clc; n=50; fp=300; fst=400; fs=1000; window=kaiser(n+1); b=fir1(n,[fp fst]*2/fs,'stop',window); [h,w]=freqz(b,1,256); subplot(2,1,1); plot(w/pi,abs(h)); title('mag response of bsf'); ylabel('gain'); xlabel('normalised freq'); subplot(2,1,2); plot(w/pi,angle(h)); title('phase response of bsf'); ylabel('angle'); xlabel('normalised freq'); PC with Matlab Software

RESULT:
Matlab program to find the frequency response of BSF using Kaiser window is written.

20 | P a g e

Vaishnavi Institute of Technology,Tirupati

Waveforms:

EXP :5b(1)

FREQUENCY RESPONSE OF LPF USING RECTANGULAR WINDOW 21 | P a g e

Vaishnavi Institute of Technology,Tirupati

AIM: To write a Matlab program to find the frequency response of LPF using Rectangular window is written. EQUIPMENTS: PROGRAM: clear all; close all; clc; n=1000; fp=300; fs=1000; fn=2*fp/fs; window=rectwin(n+1); b=fir1(n,fn,'low',window); [h,w]=freqz(b,1,256); subplot(2,1,1); plot(w/pi,abs(h)); title('mag response of lpf'); ylabel('gain'); xlabel('normalised freq'); subplot(2,1,2); plot(w/pi,angle(h)); title('phase response of lpf'); ylabel('angle'); xlabel('normalised freq');

PC with Matlab Software

RESULT:
Matlab program to find the frequency response of LPF using Rectangular window is written.

Waveforms:

22 | P a g e

Vaishnavi Institute of Technology,Tirupati

EXP :5b(2)

FREQUENCY RESPONSE OF HPF USING RECTANGULAR WINDOW 23 | P a g e

Vaishnavi Institute of Technology,Tirupati

AIM: To write a Matlab program to find the frequency response of HPF using Rectangular window. EQUIPMENTS: PROGRAM: clear all; close all; clc; n=1000; fp=300; fs=1000; fn=2*fp/fs; window=rectwin(n+1); b=fir1(n,fn,'high',window); [h,w]=freqz(b,1,256); subplot(2,1,1); plot(w/pi,abs(h)); title('mag response of hpf'); ylabel('gain'); xlabel('normalised freq'); subplot(2,1,2); plot(w/pi,angle(h)); title('phase response of hpf'); ylabel('angle'); xlabel('normalised freq'); PC with Matlab Software

RESULT:
Matlab program to find the frequency response of HPF using Rectangular window is written.

Waveforms:

24 | P a g e

Vaishnavi Institute of Technology,Tirupati

25 | P a g e

Vaishnavi Institute of Technology,Tirupati

EXP : 5b(3)

FREQUENCY RESPONSE OF BPF USING RECTANGULAR WINDOW

AIM: To write a Matlab program to find the frequency response of BPF using Rectangular. EQUIPMENTS: PROGRAM: clear all; close all; clc; n=50; fp=300; fst=400; fs=1000; window=rectwin(n+1); b=fir1(n,[fp fst]*2/fs,window); [h,w]=freqz(b,1,256); subplot(2,1,1); plot(w/pi,abs(h)); title('mag response of bpf'); ylabel('gain'); xlabel('normalised freq'); subplot(2,1,2); plot(w/pi,angle(h)); title('phase response of bpf'); ylabel('angle'); xlabel('normalised freq'); PC with Matlab Software

RESULT:
Matlab program to find the frequency response of BPF using Rectangular window is written.

26 | P a g e

Vaishnavi Institute of Technology,Tirupati

Waveforms:

27 | P a g e

Vaishnavi Institute of Technology,Tirupati

EXP : 5b(4)

FREQUENCY RESPONSE OF BSF USING RECTANGULAR WINDOW

AIM: To write a Matlab program to find the frequency response of BSF using Rectangular window EQUIPMENTS: PROGRAM: clear all; close all; clc; n=50; fp=300; fst=400; fs=1000; window=rectwin(n+1); b=fir1(n,[fp fst]*2/fs,'stop',window); [h,w]=freqz(b,1,256); subplot(2,1,1); plot(w/pi,abs(h)); title('mag response of bsf'); ylabel('gain'); xlabel('normalised freq'); subplot(2,1,2); plot(w/pi,angle(h)); title('phase response of bsf'); ylabel('angle'); xlabel('normalised freq'); PC with Matlab Software

RESULT:
Matlab program to find the frequency response of BSF using Rectangular window is written.

28 | P a g e

Vaishnavi Institute of Technology,Tirupati

Waveforms:

EXP :5c(1)

FREQUENCY RESPONSE OF LPF USING TRIANGULAR WINDOW 29 | P a g e

Vaishnavi Institute of Technology,Tirupati

AIM: To write a Matlab program to find the frequency response of LPF using traingular window. EQUIPMENTS: PC with Matlab Software PROGRAM: clear all; close all; clc; n=1000; fp=300; fs=1000; fn=2*fp/fs; window=triang(n+1); b=fir1(n,fn,'low',window); [h,w]=freqz(b,1,256); subplot(2,1,1); plot(w/pi,abs(h)); title('mag response of lpf'); ylabel('gain'); xlabel('normalised freq'); subplot(2,1,2); plot(w/pi,angle(h)); title('phase response of lpf'); ylabel('angle'); xlabel('normalised freq');

RESULT:
a Matlab program to find the frequency response of LPF using traingular window is written.

Waveforms:

30 | P a g e

Vaishnavi Institute of Technology,Tirupati

EXP :5c(2)

FREQUENCY RESPONSE OF HPF USING TRIANGULAR WINDOW 31 | P a g e

Vaishnavi Institute of Technology,Tirupati

AIM: To write a Matlab program to find the frequency response of hPF using traingular window. EQUIPMENTS: PROGRAM: clear all; close all; clc; n=1000; fp=300; fs=1000; fn=2*fp/fs; window=triang(n+1); b=fir1(n,fn,'high',window); [h,w]=freqz(b,1,256); subplot(2,1,1); plot(w/pi,abs(h)); title('mag response of hpf'); ylabel('gain'); xlabel('normalised freq'); subplot(2,1,2); plot(w/pi,angle(h)); title('phase response of hpf'); ylabel('angle'); xlabel('normalised freq');

PC with Matlab Software

RESULT:
a Matlab program to find the frequency response of hPF using traingular window is written.

Waveforms:
32 | P a g e

Vaishnavi Institute of Technology,Tirupati

EXP :5c(3)

FREQUENCY RESPONSE OF BPF USING TRIANGULAR WINDOW

AIM: To write a Matlab program to find the frequency response of bPF using traingular window is written.

33 | P a g e

Vaishnavi Institute of Technology,Tirupati

EQUIPMENTS: PROGRAM: clear all; close all; clc; n=50; fp=300; fst=400; fs=1000; window=triang(n+1); b=fir1(n,[fp fst]*2/fs,window); [h,w]=freqz(b,1,256); subplot(2,1,1); plot(w/pi,abs(h)); title('mag response of bpf'); ylabel('gain'); xlabel('normalised freq'); subplot(2,1,2); plot(w/pi,angle(h)); title('phase response of bpf'); ylabel('angle'); xlabel('normalised freq'); PC with Matlab Software

RESULT:

a Matlab program to find the frequency response of LPF using traingular window is written.

Waveforms:

34 | P a g e

Vaishnavi Institute of Technology,Tirupati

EXP :5c(4)

FREQUENCY RESPONSE OF BSF USING TRIANGULAR 35 | P a g e

Vaishnavi Institute of Technology,Tirupati

WINDOW
AIM: To write a Matlab program to find the frequency response of bsF using traingular window. EQUIPMENTS: PROGRAM: clear all; close all; clc; n=50; fp=300; fst=400; fs=1000; window=triang(n+1); b=fir1(n,[fp fst]*2/fs,'stop',window); [h,w]=freqz(b,1,256); subplot(2,1,1); plot(w/pi,abs(h)); title('mag response of bsf'); ylabel('gain'); xlabel('normalised freq'); subplot(2,1,2); plot(w/pi,angle(h)); title('phase response of bsf'); ylabel('angle'); xlabel('normalised freq'); PC with Matlab Software

RESULT:

a Matlab program to find the frequency response of bsfusing traingular window is written.

36 | P a g e

Vaishnavi Institute of Technology,Tirupati

Waveforms:

37 | P a g e

Vaishnavi Institute of Technology,Tirupati

EXP :5d(1)

FREQUENCY RESPONSE OF LPF USING HAMMING WINDOW

AIM: To write a Matlab program to find the frequency response of LPF using hammining window. EQUIPMENTS: PROGRAM: clear all; close all; clc; n=1000; fp=300; fs=1000; fn=2*fp/fs; window=hamming(n+1); b=fir1(n,fn,'low',window); [h,w]=freqz(b,1,256); subplot(2,1,1); plot(w/pi,abs(h)); title('mag response of lpf'); ylabel('gain'); xlabel('normalised freq'); subplot(2,1,2); plot(w/pi,angle(h)); title('phase response of lpf'); ylabel('angle'); xlabel('normalised freq'); PC with Matlab Software

RESULT:
a Matlab program to find the frequency response of LPF using hammining window is written..

38 | P a g e

Vaishnavi Institute of Technology,Tirupati

Waveforms:

39 | P a g e

Vaishnavi Institute of Technology,Tirupati

EXP :5d(2)

FREQUENCY RESPONSE OF HPF USING HAMMING WINDOW

AIM: To write a Matlab program to find the frequency response of HPF using hammining window. EQUIPMENTS: PROGRAM: clear all; close all; clc; n=1000; fp=300; fs=1000; fn=2*fp/fs; window=hamming(n+1); b=fir1(n,fn,'high',window); [h,w]=freqz(b,1,256); subplot(2,1,1); plot(w/pi,abs(h)); title('mag response of hpf'); ylabel('gain'); xlabel('normalised freq'); subplot(2,1,2); plot(w/pi,angle(h)); title('phase response of hpf'); ylabel('angle'); xlabel('normalised freq'); PC with Matlab Software

RESULT:
a Matlab program to find the frequency response of HPF using hammining window is written.

40 | P a g e

Vaishnavi Institute of Technology,Tirupati

Waveforms:

41 | P a g e

Vaishnavi Institute of Technology,Tirupati

EXP :5d(3)

FREQUENCY RESPONSE OF BPF USING HAMMING WINDOW

AIM: To write a Matlab program to find the frequency response of BPF using hammining window. EQUIPMENTS: PROGRAM: clear all; close all; clc; n=50; fp=300; fst=400; fs=1000; window=hamming (n+1); b=fir1(n,[fp fst]*2/fs,window); [h,w]=freqz(b,1,256); subplot(2,1,1); plot(w/pi,abs(h)); title('mag response of bpf'); ylabel('gain'); xlabel('normalised freq'); subplot(2,1,2); plot(w/pi,angle(h)); title('phase response of bpf'); ylabel('angle'); xlabel('normalised freq'); PC with Matlab Software

RESULT:
To write a Matlab program to find the frequency response of BSP using hammining window is written.

Waveforms:

42 | P a g e

Vaishnavi Institute of Technology,Tirupati

EXP :5d(4)

FREQUENCY RESPONSE OF BSF USING HAMMING WINDOW

AIM: To write a Matlab program to find the frequency response

43 | P a g e

Vaishnavi Institute of Technology,Tirupati

of BSF using hammining window is written. EQUIPMENTS: PROGRAM: clear all; close all; clc; n=50; fp=300; fst=400; fs=1000; window=hamming(n+1); b=fir1(n,[fp fst]*2/fs,'stop',window); [h,w]=freqz(b,1,256); subplot(2,1,1); plot(w/pi,abs(h)); title('mag response of bsf'); ylabel('gain'); xlabel('normalised freq'); subplot(2,1,2); plot(w/pi,angle(h)); title('phase response of bsf'); ylabel('angle'); xlabel('normalised freq'); PC with Matlab Software

RESULT:
a Matlab program to find the frequency response of BSF using hammining window is written.

Waveforms:

44 | P a g e

Vaishnavi Institute of Technology,Tirupati

EXP :6

POWER DENSITY SPECTRUM OF AM WAVE

45 | P a g e

Vaishnavi Institute of Technology,Tirupati

AIM: To write a matlab program power density spectrum of the sequence in matlab. EQUIPMENTS: PROGRAM: clear all; close all; clc; PC with Matlab Software

% Sample the signal 6000 times per second, for 2 seconds. Fs = 6000; t = [0:2*Fs+1]'/Fs; Fc = 1000; % Carrier frequency x = sin(200*pi*t); % Sinusoidal signal % Modulate x using single- and double-sideband AM. ydouble = ammod(x,Fc,Fs); ysingle = ssbmod(x,Fc,Fs); % Compute zdouble = zdouble = frqdouble zsingle = zsingle = frqsingle spectra of both modulated signals. fft(ydouble); abs(zdouble(1:length(zdouble)/2+1)); = [0:length(zdouble)-1]*Fs/length(zdouble)/2; fft(ysingle); abs(zsingle(1:length(zsingle)/2+1)); = [0:length(zsingle)-1]*Fs/length(zsingle)/2;

% Plot spectra of both modulated signals. figure; subplot(2,1,1); plot(frqdouble,zdouble); title('Spectrum of double-sideband signal'); subplot(2,1,2); plot(frqsingle,zsingle); title('Spectrum of single-sideband signal'); % spectogram of both modulated signals. specgramdemo(zdouble); specgramdemo(zsingle);

RESULT: By using matlab programme, power density spectrum is


found.

Waveforms:

46 | P a g e

Vaishnavi Institute of Technology,Tirupati

Absolute value of FFT of Zdouble & Zsingle Vs Frequency:

Specgramdemo output for zdouble:

47 | P a g e

Vaishnavi Institute of Technology,Tirupati

Specgramdemo output for zsingle:

EXP :7

GENERATION OF SINE WAVE USING C

48 | P a g e

Vaishnavi Institute of Technology,Tirupati

AIM: To generate a sine wave by writing c program and using DSP Kit. EQUIPMENTS: PC with 6713 CC studio 3.0 software DSP C6713 Kit. USB connecting cable. Power Cord. PROCEDURE: 1. Open Code Composer Studio and make sure DSP kit is Switched ON 2. Start a new Project using new project from project menu icon and save it. 3. Write a program for generating sinewave in c language and save it with .c extension. 4. Add runtime support library file rts6700.lib to the library icon of the project 5. Add linear command file Hello.cmd to the source icon of the project. 6. Compile the program using icon in task bar and make corrections if any errors occur. 7. Build in and Build on the project; using icons in the task bar. 8. Go to debug and double click on connect option. 9. Go to the file and click on load program and then open the file we find extension .out project file. 10. Go to debug and run the program. 11. To view graphically, select view graph time/frequency.

Program in C: # include <stdio.h> # include <math.h> float y[1000]; main() { int f = 5; int i; for(i=0;i<1000;i++) y[i] = sin (2*3.14*f*i/1000); printf(%f,y[i]); } Display Properties for Graph: Display type-single time Graph title-sine wave Status Address-y Aquist buffersize-1000 Index increment-1 Display data size-1000 DSP data size-32 bit IEEE floating point Sampling rate (Hz)-1
49 | P a g e

Vaishnavi Institute of Technology,Tirupati

Plot data from-left to right Left shifted data display- yes Auto scale ON Time display unit-s Status bar display-ON Magnitude disply scale-linear Data plot style- line Grid scale-zero line Cursor mode-Data Cursor RESULT:
sine wave is generated by writing c program and using DSP Kit

Waveforms:

EXP :8

FFT USING C

50 | P a g e

Vaishnavi Institute of Technology,Tirupati

AIM: To determine the FFT of the one-dimensional signal by writing c program and using DSP Kit. EQUIPMENTS: PC with 6713 CC studio 3.0 software DSP C6713 Kit. USB connecting cable. Power Cord.

THEORY: The Fast Fourier Transform is useful to map the time-domain sequence into a continuous function of a frequency variable. The FFT of a sequence {x(n)} of length N is given by a complexvalued sequence X(k).

X ( k ) = x ( n) e
k =0

j 2

nk n

;0 < k < N 1

The above equation is the mathematical representation of the DFT. As the number of computations involved in transforming a N point time domain signal into its corresponding frequency domain signal was found to be N2 complex multiplications, an alternative algorithm involving lesser number of computations is opted. When the sequence x(n) is divided into 2 sequences and the DFT performed separately, the resulting number of computations would be N2/2 (i.e.)
N2 21 N2 21

( 2 n +1) k x(k ) = x (2n) WN2 nk + x(2n + 1) WN n =0 n =0

Consider x(2n) be the even sample sequences and x(2n+1) be the odd sample sequence derived form x(n).
N2 21

x ( 2n)
n =0

2 nk WN

would result
N2 21

(N/2)2multiplications

x(2n + 1)
n =0

( 2 n +1) k WN

an other (N/2)2 multiplication's finally resulting in (N/2) 2 + (N/2)2 =


N2 N2 N2 + = Computations 4 4 2

Further solving Eg. (2)

51 | P a g e

Vaishnavi Institute of Technology,Tirupati

( 2 nk ) x(k ) = x(2n) WN2 nk + x(2n + 1) WN W (9) n=0 n =0 N

N2 21

N 21

2 nk ( 2 nk ) (10) = x ( 2n ) WN + W x(2n + 1) WN n =0 N n =0

N 21

N 21

Dividing the sequence x (2n) into further 2 odd and even sequences would reduce the computations. WN is the twiddle factor

=e
W
W
nk N

j 2 n

=e

j 2 nk n

N K+ 2 N

= WN W
j 2 n n 2

N K+ 2 N

(11)

=e

j 2 k n

k = WN

j 2 k n

k = WN (cos j sin )

=W

N K+ 2 N

k = WN (1)

= WN

N K+ 2

k = WN

(12)

Employing this equation, we deduce


( 2 nk ) (13) x(k ) = x(2n) WN2 nk + x(2n + 1) WN n=0 n =0 N2 2 1 N 21

52 | P a g e

Vaishnavi Institute of Technology,Tirupati

K N ( 2 nk ) (14) x (k + ) = x (2n) WN2 nk W x (2n + 1) 21 WN 2 n=0 N

N 2 1

The time burden created by this large number of computations limits the usefulness of DFT in many applications. Tremendous efforts devoted to develop more efficient ways of computing DFT resulted in the above explained Fast Fourier Transform algorithm. This mathematical shortcut reduces the number of calculations the DFT requires drastically. The above mentioned radix-2 decimation in time FFT is employed for domain transformation. Dividing the DFT into smaller DFTs is the basis of the FFT. A radix-2 FFT divides the DFT into two smaller DFTs, each of which is divided into smaller DFTs and so on, resulting in a combination of two-point DFTs. The Decimation -In-Time (DIT) FFT divides the input (time) sequence into two groups, one of even samples and the other of odd samples. N/2 point DFT are performed on the these sub-sequences and their outputs are combined to form the N point DFT.

FIG. 3A.1

The above shown mathematical representation forms the basis of N point FFT and is called the Butterfly Structure.

53 | P a g e

Vaishnavi Institute of Technology,Tirupati

STAGE I

STAGE - II

54 | P a g e

Vaishnavi Institute of Technology,Tirupati

STAGE III FIG. 3A.2 8 POINT DIT

ALGORITHM Step 1 sample the input (N) of any desired frequency. Convert it to fixed-point format and scale the input to avoid overflow during manipulation. Step 2 Declare four buffers namely real input, real exponent, imaginary exponent and imaginary input. Step 3 Declare three counters for stage, group and butterfly. Step 4 Implement the Fast Fourier Transform for the input signal. Step 5 Store the output (Real and Imaginary) in the output buffer. Step 6 Decrement the counter of butterfly. Repeat from the Step 4 until the counter reaches zero. Step 7 If the butterfly counter is zero, modify the exponent value. Step 8 Repeat from the Step 4 until the group counter reaches zero. Step 9 If the group counter is zero, multiply the butterfly value by two and divide the group value by two. Step 10 Repeat from the Step 4 until the stage counter reaches zero. Step 11 Transmit the FFT output through line out port.

55 | P a g e

Vaishnavi Institute of Technology,Tirupati

PROCEDURE: 1. Open Code Composer Studio and make sure DSP kit is Switched ON 2. Start a new Project using new project from project menu icon and save it. 3. Write a program for generating sinewave in c language and save it with .c extension. 4. Add runtime support library file rts6700.lib to the library icon of the project 5. Add linear command file Hello.cmd to the source icon of the project. 6. Compile the program using icon in task bar and make corrections if any errors occur. 7. Build in and Build on the project; using icons in the task bar. 8. Go to debug and double click on connect option. 9. Go to the file and click on load program and then open the file we find extension .out project file. 10. Go to debug and run the program. 11. To view graphically, select view graph time/frequency.

56 | P a g e

Vaishnavi Institute of Technology,Tirupati

PROGRAM: #include <math.h> #define PTS 128 //# of points for FFT #define PI 3.14159265358979 typedef struct {float real,imag;} COMPLEX; void FFT(COMPLEX *Y, int n); //FFT prototype float iobuffer[PTS]; //as input and output buffer float x1[PTS],x[PTS]; //intermediate buffer short i; //general purpose index variable short buffercount = 0; //number of new samples in iobuffer short flag = 0; //set to 1 by ISR when iobuffer full float y[128]; COMPLEX w[PTS]; //twiddle constants stored in w COMPLEX samples[PTS]; //primary working buffer main() { float j,sum=0.0 ; int n,k,i,a; for (i = 0 ; i<PTS ; i++) // set up twiddle constants in w { w[i].real = cos(2*PI*i/(PTS*2.0)); //Re component of twiddle constants w[i].imag =-sin(2*PI*i/(PTS*2.0)); /*Im component of twiddle constants*/ } /****************InputSignalX(n)**********************************/ for(i=0,j=0;i<PTS;i++) { x[i] = sin(2*PI*5*i/PTS); samples[i].real=0.0; samples[i].imag=0.0; } // Signal x(Fs)=sin(2*pi*f*i/Fs);

/********************** FFT of R(t) *****************************/ for (i = 0 ; i < PTS ; i++) //swap buffers { samples[i].real=iobuffer[i]; //buffer with new data } for (i = 0 ; i < PTS ; i++) samples[i].imag = 0.0; //imag components = 0
57 | P a g e

Vaishnavi Institute of Technology,Tirupati

FFT(samples,PTS);

//call function FFT.c

/******************** PSD ********************************/ for (i = 0 ; i < PTS ; i++) //compute magnitude { x1[i] = sqrt(samples[i].real*samples[i].real + samples[i].imag*samples[i].imag); } } //end of main

void FFT(COMPLEX *Y, int N) //input sample array, # of points { COMPLEX temp1,temp2; //temporary storage variables int i,j,k; //loop counter variables int upper_leg, lower_leg; //index of upper/lower butterfly leg int leg_diff; //difference between upper/lower leg int num_stages = 0; //number of FFT stages (iterations) int index, step; //index/step through twiddle constant i = 1; //log(base2) of N points= # of stages do { num_stages +=1; i = i*2; }while (i!=N); leg_diff = N/2; //difference between upper&lower legs step = (PTS*2)/N; //step between values in twiddle.h // 512 for (i = 0;i < num_stages; i++) //for N-point FFT { index = 0; for (j = 0; j < leg_diff; j++) { for (upper_leg = j; upper_leg < N; upper_leg += (2*leg_diff)) { lower_leg = upper_leg+leg_diff; temp1.real = (Y[upper_leg]).real + (Y[lower_leg]).real; temp1.imag = (Y[upper_leg]).imag + (Y[lower_leg]).imag; temp2.real = (Y[upper_leg]).real - (Y[lower_leg]).real; temp2.imag = (Y[upper_leg]).imag - (Y[lower_leg]).imag; (Y[lower_leg]).real = temp2.real*(w[index]).real -temp2.imag*(w[index]).imag; (Y[lower_leg]).imag = temp2.real*(w[index]).imag +temp2.imag*(w[index]).real;
58 | P a g e

Vaishnavi Institute of Technology,Tirupati

(Y[upper_leg]).real = temp1.real; (Y[upper_leg]).imag = temp1.imag; } index += step; } leg_diff = leg_diff/2; step *= 2; } j = 0; for (i = 1; i < (N-1); i++) //bit reversal for resequencing data { k = N/2; while (k <= j) { j = j - k; k = k/2; } j = j + k; if (i<j) { temp1.real = (Y[j]).real; temp1.imag = (Y[j]).imag; (Y[j]).real = (Y[i]).real; (Y[j]).imag = (Y[i]).imag; (Y[i]).real = temp1.real; (Y[i]).imag = temp1.imag; } } return; } Display Properties for Graph: Display type-dual time Graph title-FFT Interleaved data sources-NO Start address_upper display-io buffer Lower address: X1 Aquist buffersize-64 Index increment-1 Display data size-64 DSP data size-32 bit IEEE floating point Sampling rate (Hz)-1 Plot data from-left to right Left shifted data display- yes Auto scale ON Time display unit-s Status bar display-ON Magnitude disply scale-linear Data plot style- line Grid scale-zero line Cursor mode-Data Cursor
59 | P a g e

Vaishnavi Institute of Technology,Tirupati

OUTPUT:

DFT or FFT spectrum of sinusoidal signal f= 10 Hz


Result:
The FFT of the one-dimensional signal is determined c program and using DSP Kit. by writing

60 | P a g e

Vaishnavi Institute of Technology,Tirupati

EXP :9

LINEAR CONVOLUTION USING C

AIM: To determine the Linear Convolution of the one-dimensional signal by writing c program and using DSP Kit. EQUIPMENTS: PC with 6713 CC studio 3.0 software DSP C6713 Kit. USB connecting cable. Power Cord.

THEORY
Convolution is a formal mathematical operation, just as multiplication, addition, and integration. Addition takes two numbers and produces a third number, while convolution takes two signals and produces a third signal. Convolution is used in the mathematics of many fields, such as probability and statistics. In linear systems, convolution is used to describe the relationship between three signals of interest: the input signal, the impulse response, and the output signal.

In this equation, x1(k), x2 (n-k) and y(n) represent the input to and output from the system at time n. Here we could see that one of the input is shifted in time by a value everytime it is multiplied with the other input signal. Linear Convolution is quite often used as a method of implementing filters of various types. PROCEDURE: 1. Open Code Composer Studio and make sure DSP kit is Switched ON 2. Start a new Project using new project from project menu icon and save it. 3. Write a program for generating sinewave in c language and save it with .c extension. 4. Add runtime support library file rts6700.lib to the library icon of the project 5. Add linear command file Hello.cmd to the source icon of the project. 6. Compile the program using icon in task bar and make corrections if any errors occur. 7. Build in and Build on the project; using icons in the task bar. 8. Go to debug and double click on connect option. 9. Go to the file and click on load program and then open the file we find extension .out project file. 10. Go to debug and run the program. 11. To view graphically, select view graph time/frequency.

61 | P a g e

Vaishnavi Institute of Technology,Tirupati

ALGORITHM
Step 1 Declare three buffers namely Input buffer, Temporary Buffer, Output Buffer. Step 2 Get the input from the CODEC, store it in Input buffer and transfer it to the first location of the Temporary buffer. Step 3 Make the Temporary buffer to point to the last location. Step 4 Multiply the temporary buffer with the coefficients in the data memory and accumulate it with the previous output. Step 5 Store the output in the output buffer. Step 6 Repeat the steps from 2 to 5. PROGRAM: #include<stdio.h> int x[15],h[15],y[15]; main() { int i,j,m,n; printf("\n enter value for m"); scanf("%d",&m); printf("\n enter value for n"); scanf("%d",&n); printf("Enter values for i/p\n"); for(i=0;i<m;i++) scanf("%d",&x[i]); printf("Enter Values for n \n"); for(i=0;i<n;i++) scanf("%d",&h[i]); for(i=m;i<=m+n-1;i++) x[i]=0; for(i=n;i<=m+n-1;i++) h[i]=0; for(i=0;i<m+n-1;i++) { y[i]=0; for(j=0;j<=i;j++) { y[i]=y[i]+(x[j]*h[i-j]); } } for(i=0;i<m+n-1;i++) printf("\n The Value of output y[%d]=%d",i,y[i]); } 62 | P a g e

Vaishnavi Institute of Technology,Tirupati

Result: enter value for m4 enter value for n4 Enter values for i/p 1234 Enter Values for n 1234

The Value of output y[0]=1 The Value of output y[1]=4 The Value of output y[2]=10 The Value of output y[3]=20 The Value of output y[4]=25 The Value of output y[5]=24 The Value of output y[6]=16
Result: Hence Linear Convolution of the one-dimensional signal is determined by writing c program and using DSP Kit.

EXP :10

CIRCULAR CONVOLUTION USING C

AIM: To determine the Circular Convolution of the onedimensional signal by writing c program and using DSP Kit.

63 | P a g e

Vaishnavi Institute of Technology,Tirupati

EQUIPMENTS: PC with 6713 CC studio 3.0 software DSP C6713 Kit. USB connecting cable. Power Cord.

THEORY
Circular convolution is another way of finding the convolution sum of two input signals. It resembles the linear convolution, except that the sample values of one of the input signals is folded and right shifted before the convolution sum is found. Also note that circular convolution could also be found by taking the DFT of the two input signals and finding the product of the two frequency domain signals. The Inverse DFT of the product would give the output of the signal in the time domain which is the circular convolution output. The two input signals could have been of varying sample lengths. But we take the DFT of higher point, which ever signals levels to. For eg. If one of the signal is of length 256 and the other spans 51 samples, then we could only take 256 point DFT. So the output of IDFT would be containing 256 samples instead of 306 samples, which follows N1+N2 1 where N1 & N2 are the lengths 256 and 51 respectively of the two inputs. Thus the output which should have been 306 samples long is fitted into 256 samples. The 256 points end up being a distorted version of the correct signal. This process is called circular convolution. PROCEDURE: 1. Open Code Composer Studio and make sure DSP kit is Switched ON 2. Start a new Project using new project from project menu icon and save it. 3. Write a program for generating sinewave in c language and save it with .c extension. 4. Add runtime support library file rts6700.lib to the library icon of the project 5. Add linear command file Hello.cmd to the source icon of the project. 6. Compile the program using icon in task bar and make corrections if any errors occur. 7. Build in and Build on the project; using icons in the task bar. 8. Go to debug and double click on connect option. 9. Go to the file and click on load program and then open the file we find extension .out project file. 10. Go to debug and run the program. 11. To view graphically, select view graph time/frequency.

PROGRAM: /* prg to implement circular convolution */ #include<stdio.h> int m,n,x[30],h[30],y[30],i,j,temp[30],k,x2[30],a[30]; 64 | P a g e

Vaishnavi Institute of Technology,Tirupati

void main() { printf(" enter the length of the first sequence\n"); scanf("%d",&m); printf(" enter the length of the second sequence\n"); scanf("%d",&n); printf(" enter the first sequence\n"); for(i=0;i<m;i++) scanf("%d",&x[i]); printf(" enter the second sequence\n"); for(j=0;j<n;j++) scanf("%d",&h[j]); if(m-n!=0) /*If length of both sequences are not equal*/ { if(m>n) /* Pad the smaller sequence with zero*/ { for(i=n;i<m;i++) h[i]=0; n=m; } for(i=m;i<n;i++) x[i]=0; m=n; } y[0]=0; a[0]=h[0]; for(j=1;j<n;j++) a[j]=h[n-j]; /*Circular convolution*/ for(i=0;i<n;i++) y[0]+=x[i]*a[i]; for(k=1;k<n;k++) { y[k]=0; /*circular shift*/ for(j=1;j<n;j++) x2[j]=a[j-1]; x2[0]=a[n-1]; for(i=0;i<n;i++) { a[i]=x2[i]; y[k]+=x[i]*x2[i]; } } /*displaying the result*/ printf(" the circular convolution is\n"); 65 | P a g e

/*folding h(n) to h(-n)*/

Vaishnavi Institute of Technology,Tirupati

for(i=0;i<n;i++) printf("%d \t",y[i]); } OUTPUT:Enter the first sequence 5 6 7 Enter the second sequence 7 8 5 4 OUTPUT ;the circular convolution is

94

110

122

106

Result:
The Circular Convolution of the one-dimensional signal by writing c program and using DSP Kit.

EXP :11

BUILDING A SIMPLE I/O SYSTEM WITH C6713 DSK

AIM: To built the model for single audio effect using C6713 DSK,CCS and Matlab. EQUIPMENTS: PC with 6713 CC studio 3.0 software

66 | P a g e

Vaishnavi Institute of Technology,Tirupati

DSP C6713 Kit. USB connecting cable. Power Cord.

Theory:
Introduction to Simulink and Code Composer Studio This experiment describes how to use Simulink in conjunction with code composer studio for basic signal representation and manipulation. In this experiment, an audio effects processor is created to echo, reveberation and flange. To run this model, a microphone is connected to the Mic In connector of the C6713 DSK and speakers are connected to the Line Out of the DSK. To download and run the model, the following tasks are completed: Use blocks from Simulink and other blocksets to complete the model Add the Embedded Target for TI C6000 DSP blocks that let your signal sources and output devices communicate with your C6713 DSK Add the C6713 DSK target preferences block from the C6000 Target Preferences library to your model. Verify and set the block parameters for the target hardware. Set the configuration parameters for the model, including Configuration Parameters such as simulation start and stop time and solver options. Real-Time Workshop options such as target configuration and target compiler selection Build the model to the selected target. Test the model running on the target by changing the input to the target and observe the output from the target. PROCEDURE: Building a Simple I/O system with the C6713 DSK File name: simpleioworks.mdl To build the model for a Single Audio Effect, follow these steps: The Out, that that DSK has four input and output jacks: Headphone, Line Line In, and Mic In. The goal is to implement a system accepts an audio signal via the Mic In jack and passes signal through, unchanged, to the Headphone jack.

Select the Simulink Library Browser window and select Embedded Target for TI C6000. Within this group, select the C6713 DSK Board Support library. There will be five (5) blocks displayed: ADC, DAC, LED, Reset, and Switch. Place the ADC (Analog-to-Digital Converter) (Digital-to-Analog Converter) blocks on your clicking and dragging. and DAC model by

Once they are on your model, connect the two, as shown below:

67 | P a g e

Vaishnavi Institute of Technology,Tirupati

Double clicking a block displays the block parameters. While some parameters are userdefinable, others are not. The ADC source field can be set to either Iic In or Line In. If the input is from the microphone then the field should be set to Mic In; otherwise, it should be set to Line In. In the ADC block, Stereo should be unchecked and the output data type set to integer. NOTE: The sample rate can also be set here. For most applications, this is either set to 8kHz (speech applications) or 44.1kHz (music applications). The Samples per Frame parameter tells the system how many samples to process at one time. The greater the samples per frame, the longer it takes to process the signal (due to memory needs and computational load). Double click the DAC block. Ensure that the Word Length field is the same (16-bit) for both the ADC and DAC blocks. Save the model: Select File > Save As > ...location Ensure that the hardware is connected properly by: Connecting the microphone to the Mic In jack. Connecting the headphones to the Headphone jack. The model is now complete and ready to run. Verify that the DSK board is connected properly .Use the Incremental Build command on the Simulink model toolbar (the icon with the 3 arrows) to begin compiling the model and transferring the code to the DSK. If this is the first time the board has been used since turning on the computer, a DSK Startup window will open temporarily to configure the board. The system will first compile code in Matlab, then Code Composer Studio (CCS) will be opened, where assembly code will be compiled and loaded onto the DSP. Once in CCS, a progress window will open as the code is loaded onto the board. The program (File ! Load Lab1.out), once loaded will begin to run. Test the model by speaking into the microphone and listening to your speech through the headphones. After verifying that the code works, stop the program by using the Halt command in CCS. Close CCS and return to the model in Simulink. The model is built for a single audio effect using C6713 DSK and Matlab

Result:

68 | P a g e

Vaishnavi Institute of Technology,Tirupati

EXP :12

ARCHITECTURE OF C6713 DSP PROCESSOR

69 | P a g e

Vaishnavi Institute of Technology,Tirupati

AIM: To study the architecture of C6713 DSP Processor EQUIPMENTS: PC with 6713 CC studio 3.0 software DSP C6713 Kit. USB connecting cable. Power Cord.

Theory:
A signal can be defined as a function that conveys information, generally about the state or behavior of a physical system. There are two basic types of signals viz Analog (continuous time signals which are defined along a continuum of times) and Digital (discrete-time). Remarkably, under reasonable constraints, a continuous time signal can be adequately represented by samples, obtaining discrete time signals. Thus digital signal processing is an ideal choice for anyone who needs the performance advantage of digital manipulation along with todays analog reality. Hence a processor which is designed to perform the special operations(digital manipulations) on the digital signal within very less time can be called as a Digital signal processor. The difference between a DSP processor, conventional microprocessor and a microcontroller are listed below. Microprocessor or General Purpose Processor such as Intel xx86 or Motorola 680xx family Contains - only CPU -No RAM -No ROM -No I/O ports -No Timer Microcontroller such as 8051 family Contains - CPU - RAM - ROM -I/O ports - Timer & - Interrupt circuitry Some Micro Controllers also contain A/D, D/A and Flash Memory DSP Processors such as Texas instruments and Analog Devices Contains - CPU - RAM -ROM 70 | P a g e

Vaishnavi Institute of Technology,Tirupati

- I/O ports - Timer Optimized for fast arithmetic Extended precision Dual operand fetch Zero overhead loop Circular buffering

The basic features of a DSP Processor are Feature Fast-Multiply accumulate Use Most DSP algorithms, including filtering, transforms, etc. are multiplication- intensive Many data-intensive DSP operations require reading a program instruction and multiple data items during each instruction cycle for best performance

Multiple access memory architecture

Specialized addressing modes Efficient handling of data arrays and first-in, first-out buffers in memory Specialized program control Efficient control of loops for many iterative DSP algorithms. Fast interrupt handling for frequent I/O operations. On-chip peripherals like A/D converters allow for small low cost system designs. Similarly I/O interfaces tailored for common peripherals allow clean interfaces to off-chip I/O devices.

On-chip peripherals and I/O interfaces

ARCHITECTURE OF 6713 DSP PROCESSOR


This chapter provides an overview of the architectural structure of the TMS320C67xx DSP, which comprises the central processing unit (CPU), memory, and on-chip peripherals. The C67xE DSPs use an advanced modified Harvard architecture that maximizes processing power with eight buses. Separate program and data spaces allow simultaneous access to program instructions and data, providing a high degree of parallelism. For example, three reads and one write can be performed in a single cycle. Instructions with parallel store and application-specific instructions fully

71 | P a g e

Vaishnavi Institute of Technology,Tirupati

utilize this architecture. In addition, data can be transferred between data and program spaces. Such Parallelism supports a powerful set of arithmetic, logic, and bit-manipulation operations that can all be performed in a single machine cycle. Also, the C67xx DSP includes the control mechanisms to manage interrupts, repeated operations, and function calling. Fig :BLOCK DIAGRAM OF TMS 320VC 6713

Bus Structure The C67xx DSP architecture is built around eight major 16-bit buses (four program/data buses and four address buses): _ The program bus (PB) carries the instruction code and immediate operands from program memory. _ Three data buses (CB, DB, and EB) interconnect to various elements, such as the CPU, data address generation logic, program address 72 | P a g e

Vaishnavi Institute of Technology,Tirupati

generation logic, on-chip peripherals, and data memory. _ The CB and DB carry the operands that are read from data memory. _ The EB carries the data to be written to memory. _ Four address buses (PAB, CAB, DAB, and EAB) carry the addresses needed for instruction execution. The C67xx DSP can generate up to two data-memory addresses per cycle using the two auxiliary register arithmetic units (ARAU0 and ARAU1). The PB can carry data operands stored in program space (for instance, a coefficient table) to the multiplier and adder for multiply/accumulate operations or to a destination in data space for data move instructions (MVPD and READA). This capability, in conjunction with the feature of dualoperand read, supports the execution of single-cycle, 3-operand instructions such as the FIRS instruction. The C67xx DSP also has an onchip bidirectional bus for accessing on-chip peripherals. This bus is connected to DB and EB through the bus exchanger in the CPU interface. Accesses that use this bus can require two or more cycles for reads and writes, depending on the peripherals structure. Central Processing Unit (CPU) The CPU is common to all C67xE devices. The C67x CPU contains: _ _ _ _ _ _ _ _ 40-bit arithmetic logic unit (ALU) Two 40-bit accumulators Barrel shifter 17 17-bit multiplier 40-bit adder Compare, select, and store unit (CSSU) Data address generation unit Program address generation unit

Arithmetic Logic Unit (ALU) The C67x DSP performs 2s-complement arithmetic with a 40-bit arithmetic logic unit (ALU) and two 40-bit accumulators (accumulators A and B). The ALU can also perform Boolean operations. The ALU uses these inputs: _ _ _ _ _ _ 16-bit immediate value 16-bit word from data memory 16-bit value in the temporary register, T Two 16-bit words from data memory 32-bit word from data memory 40-bit word from either accumulator

The ALU can also function as two 16-bit ALUs and perform two 16-bit operations simultaneously. 73 | P a g e

Vaishnavi Institute of Technology,Tirupati

Fig :ALU UNIT Accumulators Accumulators A and B store the output from the ALU or the multiplier/adder block. They can also provide a second input to the ALU; accumulator A can be an input to the multiplier/adder. Each accumulator is divided into three parts: _ Guard bits (bits 3932) _ High-order word (bits 3116) _ Low-order word (bits 150) Instructions are provided for storing the guard bits, for storing the highand the low-order accumulator words in data memory, and for transferring 32-bit accumulator words in or out of data memory. Also, either of the accumulators can be used as temporary storage for the other. Barrel Shifter The C67x DSP barrel shifter has a 40-bit input connected to the accumulators or to data memory (using CB or DB), and a 40-bit output connected to the ALU or to data memory (using EB). The barrel shifter can produce a left shift of 0 to 31 bits and a right shift of 0 to 16 bits on the input data. The shift requirements are defined in the shift count field of the 74 | P a g e

Vaishnavi Institute of Technology,Tirupati

instruction, the shift count field (ASM) of status register ST1, or in temporary register T (when it is designated as a shift count register).The barrel shifter and the exponent encoder normalize the values in an accumulator in a single cycle. The LSBs of the output are filled with 0s, and the MSBs can be either zero filled or sign extended, depending on the state of the sign-extension mode bit (SXM) in ST1. Additional shift capabilities enable the processor to perform numerical scaling, bit extraction, extended arithmetic, and overflow prevention operations. Multiplier/Adder Unit The multiplier/adder unit performs 17 _ 17-bit 2s-complement multiplication with a 40-bit addition in a single instruction cycle. The multiplier/adder block consists of several elements: a multiplier, an adder, signed/unsigned input control logic, fractional control logic, a zero detector, a rounder (2s complement), overflow/saturation logic, and a 16bit temporary storage register (T). The multiplier has two inputs: one input is selected from T, a data-memory operand, or accumulator A; the other is selected from program memory, data memory, accumulator A, or an immediate value. The fast, on-chip multiplier allows the C54x DSP to perform operations efficiently such as convolution, correlation, and filtering. In addition, the multiplier and ALU together execute multiply/accumulate (MAC) computations and ALU operations in parallel in a single instruction cycle. This function is used in determining the Euclidian distance and in implementing symmetrical and LMS filters, which are required for complex DSP algorithms.

Fig :MULTIPLIER/ADDER UNIT These are the some of the important parts of the processor and you are

75 | P a g e

Vaishnavi Institute of Technology,Tirupati

instructed to go through the detailed architecture once which helps you in developing the optimized code for the required application. Result: The architecture of C6713 DSP Processor is studied.

76 | P a g e

You might also like