⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exp3.html

📁 (Ebook-Pdf) Dsp - Real Time Digital Signal Processing (Usando Tms320-55Xx). 有书
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<p class=MsoNormal style='margin-right:72.0pt;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:108.0pt;text-indent:-18.0pt;mso-list:l5 level1 lfo2;tab-stops:list 36.0pt'><![if !supportLists]>2.<spanstyle='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp; </span><![endif]>Use<spanstyle='font-family:"Courier New"'> rts55.lib</span> for <span style='font-family:"Courier New"'>main()</span> function initialization and build the project.</p><p class=MsoNormal style='margin-right:72.0pt;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:108.0pt;text-indent:-18.0pt;mso-list:l5 level1 lfo2;tab-stops:list 36.0pt'><![if !supportLists]>3.<spanstyle='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp; </span><![endif]>Buildthe project and debug if needed.</p><p class=MsoNormal style='margin-right:72.0pt;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:108.0pt;text-indent:-18.0pt;mso-list:l5 level1 lfo2;tab-stops:list 36.0pt'><![if !supportLists]>4.<spanstyle='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp; </span><![endif]>UsingCCS to display all output buffers <span style='font-family:"Courier New"'>out16[]</span>,<span style='font-family:"Courier New"'>out12[]</span>, <span style='font-family:"Courier New"'>out8[]</span>, and <span style='font-family:"Courier New"'>out6[]</span>,set integer data type with data length 40 for viewing, see Figure E3-1.</p><p class=MsoNormal style='margin-right:72.0pt;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:108.0pt;text-indent:-18.0pt;mso-list:l5 level1 lfo2;tab-stops:list 36.0pt'><![if !supportLists]>5.<spanstyle='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp; </span><![endif]>Comparethe results of each output stream and describe the differences between thewaveform represented by different wordlength.</p><p style='margin-right:72.0pt;margin-left:72.0pt'>&nbsp;</p><p style='margin-right:72.0pt;margin-left:72.0pt'><img border=0 width=794height=471 id="_x0000_i1027" src="exp3/fe3-1.jpg"></p><p align=center style='margin-right:72.0pt;margin-left:72.0pt;text-align:center'>FigureE3-1 Quantization effects of 12, 8, and 6 bits to a sinusoid signal.</p><p><a href="#top"><span style='font-size:7.5pt'>Back to Top</span></a> <input type=button value="go back" onclick="history.go(-1)"></p><div class=MsoNormal align=center style='text-align:center'><hr size=3 width="100%" align=center></div></form><form><p align=center style='text-align:center'><strong><span style='font-size:13.5pt;color:blue'>Experiment 3B - Quantization of Speech Signals</span></strong></p><p style='margin-right:72.0pt;margin-left:72.0pt'>Speech is one of most usedsignals in DSP applications, from cell phone to MP3 player. To understand thequztization effects to the speech signals, this experiment uses a digitizedspeech file <a href="exp3/timit1.asc"><span style='font-family:"Courier New"'>timit1.asc</span></a>as input for demonstration. The function <a href="exp3/exp3b.c"><spanstyle='font-family:"Courier New"'>exp3b.c</span></a> for this experiment islisted below.</p><p style='margin-right:72.0pt;margin-left:72.0pt'>&nbsp;</p><p align=center style='text-align:center'>Table E3-2 List of C function forExperiment 3B.</p><p align=center style='text-align:center'><TEXTAREA ROWS="7" COLS="70" NAME="exp3bc">/* ---------------------------------------------------------------&#13;&#10;&#13;&#10;    exp3b.c&#13;&#10;&#9;&#13;&#10;    Quantization effect  &#13;&#10;&#9;&#13;&#10;    1. Use timit1.asc as input file&#9;&#13;&#10;    2. Add the format line to timit1.asc for CCS probe point&#13;&#10;    Example:&#13;&#10;        1651 2 c4 1 1           &#13;&#10;         ^   ^  ^ ^ ^&#13;&#10;         |   |  | | |_ one data a time&#13;&#10;         |   |  | |___ data page&#13;&#10;         |   |  |_____ variable address (it may change in your case)&#13;&#10;         |   |________ deciaml formated data  &#13;&#10;         |____________ magic number&#13;&#10;&#13;&#10;    3. Set probe points on each C statement inside the for loop&#9; &#13;&#10;    4. Connect input file, timit1.asc to the 1st statement&#13;&#10;    5. Connect 4 output files to the 4 statements     &#13;&#10;    6. After obtained output files, remove the format header from each file&#13;&#10;&#9;&#13;&#10;------------------------------------------------------------------- */ &#13;&#10;&#13;&#10; &#13;&#10;#define&#9;FILELENGTH 27956  /* # of sample of input file timit1.asc */&#13;&#10;&#13;&#10;int indata,out16,out12,out8,out4;&#13;&#10;&#13;&#10;void main(void)&#13;&#10;{&#13;&#10;    int i;&#13;&#10;&#9;&#9;                  &#13;&#10;    for(i = 0; i &lt; FILELENGTH; i++)&#13;&#10;    {&#9;&#9;&#13;&#10;        out16 = indata&amp;0xffff; /* Direct output to simulate a 16-bit A/D */&#13;&#10;        out12 = indata&amp;0xfff0; /* Direct output to simulate a 12-bit A/D */ &#13;&#10;        out8 = indata&amp;0xff00;  /* Direct output to simulate an 8-bit A/D */&#13;&#10;        out4 = indata&amp;0xf000;  /* Direct output to simulate a 4-bit A/D */&#9;&#13;&#10;    }&#13;&#10;}&#9;&#13;&#10;                                                       </TEXTAREA></p><p align=center style='text-align:center'>&nbsp;</p><p style='margin-right:72.0pt;margin-left:72.0pt'>To conduct Experiment 3B,following these steps:</p><p class=MsoNormal style='margin-right:72.0pt;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:108.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo3;tab-stops:list 36.0pt'><![if !supportLists]>1.<spanstyle='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp; </span><![endif]>Createthe project, <span style='font-family:"Courier New"'>exp3b</span> and includethe linker command file <span style='font-family:"Courier New"'>exp3.cmd</span>,the function <span style='font-family:"Courier New"'>exp3b()</span>.</p><p class=MsoNormal style='margin-right:72.0pt;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:108.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo3;tab-stops:list 36.0pt'><![if !supportLists]>2.<spanstyle='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp; </span><![endif]>Use<span style='font-family:"Courier New"'>rts55.lib</span> for <spanstyle='font-family:"Courier New"'>main()</span> function initialization andbuild the project.</p><p class=MsoNormal style='margin-right:72.0pt;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:108.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo3;tab-stops:list 36.0pt'><![if !supportLists]>3.<spanstyle='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp; </span><![endif]>Buildthe project. Debug is needed.</p><p class=MsoNormal style='margin-right:72.0pt;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:108.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo3;tab-stops:list 36.0pt'><![if !supportLists]>4.<spanstyle='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp; </span><![endif]>Usethe File I/O capability of the CCS to connect the speech data file timit1.ascto your project using probe points.</p><p class=MsoNormal style='margin-right:72.0pt;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:108.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo3;tab-stops:list 36.0pt'><![if !supportLists]>5.<spanstyle='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp; </span><![endif]>Afterquantizing the speech file to 12-bit, 8-bit, and 4-bit, using File I/O to savethe quantized speech files to disk. Then, using MATLAB or other programs tolisten to the original speech file and comparing it with three quantized speechfiles at 12, 8, and 4 bits.</p><p><a href="#top"><span style='font-size:7.5pt'>Back to Top</span></a> <input type=button value="go back" onclick="history.go(-1)"></p><div class=MsoNormal align=center style='text-align:center'><hr size=3 width="100%" align=center></div><p align=center style='text-align:center'><strong><span style='font-size:13.5pt;color:blue'>Experiment 3C - Overflow and Saturation Arithmetic</span></strong></p><p style='margin-right:72.0pt;margin-left:72.0pt'>Overflow may occur infixed-point DSP system when the number is larger than the register or memorycan handle. In this experiment, we use assembly routine <ahref="exp3/ovf_sat.asm"><span style='font-family:"Courier New"'>ovf_sat.asm</span></a>to demonstrate the overflow and overflow handling. The function<spanstyle='font-family:"Courier New"'> </span><a href="exp3/exp3c.c"><spanstyle='font-family:"Courier New"'>exp3c.c</span></a><span style='font-family:"Courier New"'> </span>for this experiment and the assembly routine <ahref="exp3/ovf_sat.asm"><span style='font-family:"Courier New"'>ovf_sat.asm</span></a><spanstyle='font-family:"Courier New"'> </span>are listed in Table E3-3 and TableE3-4, respectively.</p><p style='margin-right:72.0pt;margin-left:72.0pt'>&nbsp;</p><p align=center style='text-align:center'>Table E3-3 List of C function forExperiment 3C.</p><p align=center style='text-align:center'><TEXTAREA ROWS="7" COLS="70" NAME="exp3c.c">/* --------------------------------------------&#13;&#10;&#13;&#10;    exp3c.c              &#13;&#10;&#9;&#13;&#10;    Understand overflow&#13;&#10;&#9;&#13;&#10;----------------------------------------------- */&#13;&#10;&#9;     &#13;&#10;&#9;     &#13;&#10;#define&#9;BUF_SIZE 40&#13;&#10;&#13;&#10;int sineTable[BUF_SIZE]={&#13;&#10;0x0000,0x000f,0x001e,0x002d,0x003a,0x0046,0x0050,0x0059,&#13;&#10;0x005f,0x0062,0x0063,0x0062,0x005f,0x0059,0x0050,0x0046,&#13;&#10;0x003a,0x002d,0x001e,0x000f,0x0000,0xfff1,0xffe2,0xffd3,&#13;&#10;0xffc6,0xffba,0xffb0,0xffa7,0xffa1,0xff9e,0xff9d,0xff9e,&#13;&#10;0xffa1,0xffa7,0xffb0,0xffba,0xffc6,0xffd3,0xffe2,0xfff1}; &#13;&#10;&#9;&#9;&#9;&#13;&#10;extern int ovftest(int, int *); &#13;&#10;&#13;&#10;&#13;&#10;void main()&#13;&#10;{&#13;&#10;    int ovrflow_flag;  &#13;&#10;    int *ptr=sineTable;&#13;&#10;&#13;&#10;    while(1)&#13;&#10;    {&#9;         &#13;&#10;        ovrflow_flag=0;&#13;&#10;        ovrflow_flag=ovftest(ovrflow_flag, ptr); &#13;&#10;&#9;&#13;&#10;        if (ovrflow_flag != 0)&#13;&#10;            ovrflow_flag=ovftest(ovrflow_flag, ptr);&#13;&#10;    }  &#9;&#13;&#10;}                                    </TEXTAREA></p><p align=center style='text-align:center'>&nbsp;</p><p align=center style='text-align:center'>Table E3-4 List of the overfolw andsaturation demo routine for Experiment 3C.</p><p align=center style='text-align:center'><TEXTAREA ROWS="7" COLS="70" NAME="ovf_sat.asm">;&#13;&#10;;   ovf_sat.asm&#13;&#10;;                &#13;&#10;;   perform add and sub with and without overflow protection  &#13;&#10;;&#13;&#10;&#13;&#10;    .def&#9;_ovftest      &#13;&#10;&#9;&#13;&#10;    .bss&#9;buff,(0x100)&#9;&#13;&#10;    .bss&#9;buff1,(0x100)&#9;&#9;&#13;&#10;&#13;&#10;;&#13;&#10;;   Code start&#13;&#10;;&#13;&#10;&#13;&#10;_ovftest         &#13;&#10;    bclr    SATD           ; Clear saturation bit if set  &#13;&#10;    xcc     start,T0!=#0   ; If T0!=0, set saturation bit&#13;&#10;    bset    SATD&#13;&#10;&#9;&#13;&#10;start&#9;        &#13;&#10;    pshboth XAR5           ; Save XAR5 &#13;&#10;&#13;&#10;    mov     #0,AC0&#9;    &#13;&#10;    amov    #buff,XAR5     ; Set buffer pointer&#13;&#10;    rpt     #0x100-1       ; Clear buff&#13;&#10;    mov     AC0,*AR5+&#13;&#10;&#13;&#10;    amov    #buff1,XAR5    ; Set buffer pointer&#13;&#10;    rpt     #0x100-1       ; Clear buff1&#13;&#10;    mov     AC0,*AR5+&#13;&#10;&#9;&#13;&#10;    mov    #0x80-1,BRC0    ; Initialize loop counts for addition&#13;&#10;    amov   #buff+0x80,XAR5 ; Initialize buffer pointer&#13;&#10;&#9;&#13;&#10;    rptblocal add_loop_end-1&#13;&#10;    add    #0x140&lt;&lt;#16,AC0 ; Use upper AC0 as a ramp up counter&#13;&#10;    mov    hi(AC0),*AR5+   ; Save the counter to buffer&#13;&#10;add_loop_end &#13;&#10;&#13;&#10;    mov    #0x80-1,BRC0    ; Initialize loop counts for subtraction&#13;&#10;    mov    #0,AC0           &#13;&#10;    amov   #buff+0x7f,XAR5 ; Initialize buffer pointer&#9;&#13;&#10;    rptblocal sub_loop_end-1&#13;&#10;    sub    #0x140&lt;&lt;#16,AC0 ; Use upper AC0 as a ramp down counter&#13;&#10;    mov    hi(AC0),*AR5-   ; Save the counter to buffer&#13;&#10;sub_loop_end&#13;&#10;&#13;&#10;    mov    #0x100-1,BRC0   ; Initialize loop counts for sinewave&#13;&#10;    amov   #buff1,XAR5     ; Initialize buffer pointer&#9;&#13;&#10;    mov    mmap(@AR0),BSA01; Initialize base register&#13;&#10;    mov    #40,BK03        ; Set buffer as size 40 &#13;&#10;    mov    #20,AR0         ; Start with an offset of 20 samples&#13;&#10;    bset   AR0LC           ; Active circular buffer&#13;&#10;&#13;&#10;    rptblocal sine_loop_end-1&#13;&#10;    mov    *ar0+&lt;&lt;#16,AC0  ; Get sine value into high AC0&#13;&#10;    sfts   AC0,#9          ; Scale the sine value&#13;&#10;    mov    hi(AC0),*AR5+   ; Save scaled value&#13;&#10;sine_loop_end&#13;&#10;&#13;&#10;    mov     #0,T0           ; Return 0 if no overflow &#13;&#10;    xcc&#9;    set_ovf_flag,overflow(AC0)   &#9;&#13;&#10;    mov     #1,T0           ; Return 1 if overflow detected&#13;&#10;set_ovf_flag&#9;&#13;&#10;&#13;&#10;    bclr    AR0LC           ; Reset circilar buffer bit&#13;&#10;    bclr    SATD            ; Reset saturation bit&#9; &#13;&#10;    popboth XAR5            ; Restore AR5&#13;&#10;&#9;&#13;&#10;    ret&#13;&#10;&#9;&#13;&#10;    .end&#13;&#10;                      </TEXTAREA></p><p style='margin-right:72.0pt;margin-left:72.0pt'>To conduct Experiment 3C,following these steps:</p><p class=MsoNormal style='margin-right:72.0pt;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:108.0pt;text-indent:-18.0pt;mso-list:l3 level1 lfo4;tab-stops:list 36.0pt'><![if !supportLists]>1.<spanstyle='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp; </span><![endif]>Createthe project, <span style='font-family:"Courier New"'>exp3c</span> and includethe linker command file <span style='font-family:"Courier New"'>exp3.cmd</span>,the function <span style='font-family:"Courier New"'>exp3c()</span>, andassembly routine <span style='font-family:"Courier New"'>ovf_sat.asm</span>.</p><p class=MsoNormal style='margin-right:72.0pt;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:108.0pt;text-indent:-18.0pt;mso-list:l3 level1 lfo4;tab-stops:list 36.0pt'><![if !supportLists]>2.<spanstyle='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp; </span><![endif]>Use<span style='font-family:"Courier New"'>rts55.lib</span> for <spanstyle='font-family:"Courier New"'>main()</span> function initialization andbuild the project.</p><p class=MsoNormal style='margin-right:72.0pt;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:108.0pt;text-indent:-18.0pt;mso-list:l3 level1 lfo4;tab-stops:list 36.0pt'><![if !supportLists]>3.<spanstyle='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp; </span><![endif]>Buildthe project. Debug is needed.</p><p class=MsoNormal style='margin-right:72.0pt;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:108.0pt;text-indent:-18.0pt;mso-list:l3 level1 lfo4;tab-stops:list 36.0pt'><![if !supportLists]>4.<spanstyle='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp; </span><![endif]>Usethe CCS graphic function to view the ramp counter and sinewave. See Figure E3-2for reference.</p><p align=center style='margin-right:72.0pt;margin-left:72.0pt;text-align:center'><imgborder=0 width=532 height=448 id="_x0000_i1030" src="exp3/fe3-2a.jpg"></p>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -