249 lines
10 KiB
TeX
249 lines
10 KiB
TeX
|
\documentclass[a4paper,fontsize=14bp]{article}
|
|||
|
|
|||
|
\input{../common-preamble}
|
|||
|
\input{../bmstu-preamble}
|
|||
|
\input{../fancy-listings-preamble}
|
|||
|
\setcounter{secnumdepth}{0}
|
|||
|
\numerationTop
|
|||
|
|
|||
|
\begin{document}
|
|||
|
\thispagestyle{empty}
|
|||
|
\makeBMSTUHeader
|
|||
|
|
|||
|
% ... работе, номер, тема, предмет, ?а, кто
|
|||
|
\makeReportTitle{лабораторной}{2}{Исследование процессов обработки сигналов}{Микропроцессорные устройства обработки сигналов}{}{А.И. Германчук}
|
|||
|
\newpage
|
|||
|
\thispagestyle{empty}
|
|||
|
\tableofcontents
|
|||
|
\newpage
|
|||
|
\pagestyle{fancy}
|
|||
|
\section{Цель}
|
|||
|
Целью работы является изучение стандартных процедур обработки сигналов и данных, а также их реализация в интегрированной среде проектирования Code Composer Studio версии 5 и на микропроцессоре TMS320C5515 компании Texas Instruments Incorporated. При выполнении лабораторной работы используется симулятор микропроцессора TMS320C5515 или оценочноя плата TMS320C5515 DSP Evaluation Module (TMDXEVM5515).
|
|||
|
|
|||
|
\section{Выполнение}
|
|||
|
Индивидуальным заданием было написание функции вычисления арктангенса числа: \code{ushort atan16(DATA *x, DATA *r, ushort nx)}.
|
|||
|
|
|||
|
\section{Результаты работы}
|
|||
|
После запуска проверочной программы (\hrf{code:prog-c}) представленной в приложении \hrf{appendix:fulls} было доказано совпадение результатов библиотечной функции (листинг \hrf{code:std-asm}) и описанной в дизассемблированном листинге \hrf{code:asm}. Результаты работы профилировщика отражены в таблице \hrf{table:profiler}. Снимки экрана, демонстрирующие идентичность полученных результатов представлены на рис. \hrf{pic:result}.
|
|||
|
|
|||
|
\begin{table}[H]
|
|||
|
\centering
|
|||
|
\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|}
|
|||
|
\hline
|
|||
|
Name & Calls & EC Av & EC Ttl & IC Av & IC Ttl & File \\
|
|||
|
\hline
|
|||
|
atan(short *, short *, int) & 1 & 969.0 & 969.0 & 3384.0 & 3384.0 & main.c \\
|
|||
|
\hline
|
|||
|
null() & 1 & 49.0 & 49.0 & 49.0 & 49.0 & atan16.asm \\
|
|||
|
\hline
|
|||
|
\end{tabular}
|
|||
|
\caption{Результат работы профилировщика}
|
|||
|
\label{table:profiler}
|
|||
|
\end{table}
|
|||
|
|
|||
|
\begin{figure}[H]
|
|||
|
\centering
|
|||
|
\includegraphics[width=12cm]{02lab-rpt-1.png}
|
|||
|
\caption{Результат вычислений}
|
|||
|
\label{pic:result}
|
|||
|
\end{figure}
|
|||
|
|
|||
|
|
|||
|
\newpage
|
|||
|
\printbibliography[heading=bibintoc, title={Список литературы}, resetnumbers=1]
|
|||
|
|
|||
|
\newpage
|
|||
|
\appendix
|
|||
|
\section*{Приложения}
|
|||
|
\addcontentsline{toc}{section}{Приложения}
|
|||
|
\renewcommand{\thesubsection}{\Alph{subsection}}
|
|||
|
|
|||
|
\subsection{Полные листинги программ}
|
|||
|
\label{appendix:fulls}
|
|||
|
\begin{lstlisting}[style=ASMStyle,caption={Стандартный ассемблерный листинг}, label=code:std-asm]
|
|||
|
_atan16:
|
|||
|
;* AR0 assigned to _x
|
|||
|
;* AR1 assigned to _r
|
|||
|
;* T0 assigned to _nx
|
|||
|
PSH T3
|
|||
|
|| BSET FRCT ;fractional mode
|
|||
|
SUB #1, T0 ;nx-1
|
|||
|
MOV T0, BRC0 ;repeat nx times
|
|||
|
MOV #2596 << #16, AC3 ; AC3.Hi = C5
|
|||
|
MOV #-9464 << #16, AC1 ; AC1.Hi = C3
|
|||
|
MOV #32617 << #16, AC2 ; AC2.Hi = C1
|
|||
|
|
|||
|
MPYMR T3=*AR0+, AC3, AC0 ; (Prime the Pump)
|
|||
|
|| RPTBLOCAL loop1-1
|
|||
|
MACR AC0, T3, AC1, AC0
|
|||
|
MPYR T3, AC0
|
|||
|
||MOV *AR0+, T1 ; (for next iteration)
|
|||
|
MACR AC0, T3, AC2, AC0
|
|||
|
MPYR T3, AC0
|
|||
|
||MOV T1, T3
|
|||
|
MOV HI(AC0), *AR1+ ;save result
|
|||
|
||MPYR T1, AC3, AC0 ; (for next iteration)
|
|||
|
|
|||
|
loop1:
|
|||
|
POP T3
|
|||
|
|| BCLR FRCT ;return to standard C
|
|||
|
MOV #0, T0 ;return OK value (no possible error)
|
|||
|
|| RET
|
|||
|
\end{lstlisting}
|
|||
|
|
|||
|
\newpage
|
|||
|
\begin{lstlisting}[language=C,style=CCodeStyle,caption={Программа на языке С}, label=code:prog-c]
|
|||
|
#include "TMS320.h"
|
|||
|
|
|||
|
#define NX 7
|
|||
|
#define FNAME "t1"
|
|||
|
#define MAXERROR 40
|
|||
|
|
|||
|
ushort atan16(DATA *x, DATA *r, ushort nx);
|
|||
|
|
|||
|
short atan(DATA *x, DATA *r, int nx) {
|
|||
|
long long ac3 = ((long long) 2596) << 16; // AC3.Hi = C5 0.0396118164062500
|
|||
|
long long ac1 = ((long long) -9464) << 16; // AC1.Hi = C3 -0.1444091796875000
|
|||
|
long long ac2 = ((long long) 32617) << 16; // AC2.Hi = C1 0.4976959228515625
|
|||
|
while (--nx >= 0) {
|
|||
|
long long ac0;
|
|||
|
DATA t3 = *(x + nx);
|
|||
|
ac0 = (t3 * (ac3 >> 15)) << 1; // MPYMR T3=*AR0+, AC3, AC0
|
|||
|
ac0 = ((ac0 >> 15) * t3) + ac1; // MACR AC0, T3, AC1, AC0
|
|||
|
ac0 = ((ac0 >> 15) * t3); // MPYR T3, AC0
|
|||
|
|
|||
|
ac0 = ((ac0 >> 15) * t3) + ac2; // MACR AC0, T3, AC2, AC0
|
|||
|
ac0 = ((ac0 >> 15) * t3); // MPYR T3, AC0
|
|||
|
*(r + nx) = ac0 >> 16; // MOV HI(AC0), *AR1+
|
|||
|
}
|
|||
|
return 0;
|
|||
|
}
|
|||
|
|
|||
|
int main(void) {
|
|||
|
DATA x[NX] = {8192,16384,24576,32767,-8192,-16384,-24576};
|
|||
|
DATA rtest[NX] ={8027,15192,21086,25735,-8028,-15193,-21087};
|
|||
|
DATA r[NX];
|
|||
|
DATA r0[NX];
|
|||
|
|
|||
|
(void)atan16(x, r0, NX);
|
|||
|
atan(x, r, NX);
|
|||
|
|
|||
|
return 0;
|
|||
|
}
|
|||
|
\end{lstlisting}
|
|||
|
|
|||
|
\newpage
|
|||
|
\begin{lstlisting}[style=ASMStyle,caption={Дизассемблированная программа}, label=code:asm]
|
|||
|
atan:
|
|||
|
4ee9 AADD #-23,SP
|
|||
|
c408 MOV T0,*SP(#04h)
|
|||
|
eb0495 MOV XAR1,dbl(*SP(#02h))
|
|||
|
eb0085 MOV XAR0,dbl(*SP(#00h))
|
|||
|
long long ac3 = ((long long) 2596) << 16;
|
|||
|
7a0a240a MOV #2596 << #16,AC0
|
|||
|
46a3_110700 BSET ST1_M40 || SFTL AC0,#0,AC0
|
|||
|
104720 SFTL AC0,#-32,AC1
|
|||
|
eb0c18 MOV AC1,dbl(*SP(#06h))
|
|||
|
eb1008 MOV AC0,dbl(*SP(#08h))
|
|||
|
long long ac1 = ((long long) -9464) << 16;
|
|||
|
7adb080a MOV #-9464 << #16,AC0
|
|||
|
104720 SFTL AC0,#-32,AC1
|
|||
|
eb1418 MOV AC1,dbl(*SP(#0ah))
|
|||
|
eb1808 MOV AC0,dbl(*SP(#0ch))
|
|||
|
long long ac2 = ((long long) 32617) << 16;
|
|||
|
7a7f690a_47a2 MOV #32617 << #16,AC0 || BCLR ST1_M40
|
|||
|
46a3_110700 BSET ST1_M40 || SFTL AC0,#0,AC0
|
|||
|
104720 SFTL AC0,#-32,AC1
|
|||
|
eb1c18 MOV AC1,dbl(*SP(#0eh))
|
|||
|
eb2008 MOV AC0,dbl(*SP(#10h))
|
|||
|
while (--nx >= 0)
|
|||
|
a908 MOV *SP(#04h),AR1
|
|||
|
4219 SUB #1,AR1
|
|||
|
c908 MOV AR1,*SP(#04h)
|
|||
|
6d2900d6 BCC C$DW$L$_atan$2$E,AR1 < #0
|
|||
|
DATA t3 = *(x + nx);
|
|||
|
2294 MOV AR1,T0
|
|||
|
ed00bf MOV dbl(*SP(#00h)),XAR3
|
|||
|
a96b MOV *AR3(T0),AR1
|
|||
|
c92c MOV AR1,*SP(#16h)
|
|||
|
ac0 = (t3 * (ac3 >> 15)) << 1;
|
|||
|
ed1018 MOV dbl(*SP(#08h)),AC1
|
|||
|
ed0c28 MOV dbl(*SP(#06h)),AC2
|
|||
|
c21a_98 MOV AC2,mmap(@AC1G)
|
|||
|
a02c MOV *SP(#16h),AC0
|
|||
|
46a2_115531 BCLR ST1_M40 || SFTS AC1,#-15,AC1
|
|||
|
6c00207d CALL _mpylli
|
|||
|
46a3 BSET ST1_M40
|
|||
|
4450 SFTS AC0,#1
|
|||
|
104720 SFTL AC0,#-32,AC1
|
|||
|
eb2418 MOV AC1,dbl(*SP(#12h))
|
|||
|
eb2808 MOV AC0,dbl(*SP(#14h))
|
|||
|
ac0 = ((ac0 >> 15) * t3) + ac1;
|
|||
|
ed2808 MOV dbl(*SP(#14h)),AC0
|
|||
|
ed2418 MOV dbl(*SP(#12h)),AC1
|
|||
|
c114_98 MOV AC1,mmap(@AC0G)
|
|||
|
a12c MOV *SP(#16h),AC1
|
|||
|
46a2_110531 BCLR ST1_M40 || SFTS AC0,#-15,AC0
|
|||
|
6c00207d CALL _mpylli
|
|||
|
ed1428 MOV dbl(*SP(#0ah)),AC2
|
|||
|
ed1818 MOV dbl(*SP(#0ch)),AC1
|
|||
|
c21a_98 MOV AC2,mmap(@AC1G)
|
|||
|
46a3 BSET ST1_M40
|
|||
|
2401 ADD AC0,AC1
|
|||
|
101720 SFTL AC1,#-32,AC0
|
|||
|
eb2408 MOV AC0,dbl(*SP(#12h))
|
|||
|
eb2818 MOV AC1,dbl(*SP(#14h))
|
|||
|
ac0 = ((ac0 >> 15) * t3);
|
|||
|
ed2418 MOV dbl(*SP(#12h)),AC1
|
|||
|
ed2808 MOV dbl(*SP(#14h)),AC0
|
|||
|
c114_98 MOV AC1,mmap(@AC0G)
|
|||
|
a12c MOV *SP(#16h),AC1
|
|||
|
46a2_110531 BCLR ST1_M40 || SFTS AC0,#-15,AC0
|
|||
|
6c00207d CALL _mpylli
|
|||
|
46a3 BSET ST1_M40
|
|||
|
104720 SFTL AC0,#-32,AC1
|
|||
|
eb2418 MOV AC1,dbl(*SP(#12h))
|
|||
|
eb2808 MOV AC0,dbl(*SP(#14h))
|
|||
|
ac0 = ((ac0 >> 15) * t3) + ac2;
|
|||
|
ed2808 MOV dbl(*SP(#14h)),AC0
|
|||
|
ed2418 MOV dbl(*SP(#12h)),AC1
|
|||
|
c114_98 MOV AC1,mmap(@AC0G)
|
|||
|
a12c MOV *SP(#16h),AC1
|
|||
|
46a2_110531 BCLR ST1_M40 || SFTS AC0,#-15,AC0
|
|||
|
6c00207d CALL _mpylli
|
|||
|
ed1c28 MOV dbl(*SP(#0eh)),AC2
|
|||
|
ed2018 MOV dbl(*SP(#10h)),AC1
|
|||
|
c21a_98 MOV AC2,mmap(@AC1G)
|
|||
|
46a3 BSET ST1_M40
|
|||
|
2401 ADD AC0,AC1
|
|||
|
101720 SFTL AC1,#-32,AC0
|
|||
|
eb2408 MOV AC0,dbl(*SP(#12h))
|
|||
|
eb2818 MOV AC1,dbl(*SP(#14h))
|
|||
|
ac0 = ((ac0 >> 15) * t3);
|
|||
|
ed2418 MOV dbl(*SP(#12h)),AC1
|
|||
|
ed2808 MOV dbl(*SP(#14h)),AC0
|
|||
|
c114_98 MOV AC1,mmap(@AC0G)
|
|||
|
a12c MOV *SP(#16h),AC1
|
|||
|
46a2_110531 BCLR ST1_M40 || SFTS AC0,#-15,AC0
|
|||
|
6c00207d CALL _mpylli
|
|||
|
46a3 BSET ST1_M40
|
|||
|
104720 SFTL AC0,#-32,AC1
|
|||
|
eb2418 MOV AC1,dbl(*SP(#12h))
|
|||
|
eb2808 MOV AC0,dbl(*SP(#14h))
|
|||
|
*(r + nx) = ac0 >> 16;
|
|||
|
a408 MOV *SP(#04h),T0
|
|||
|
ed04bf MOV dbl(*SP(#02h)),XAR3
|
|||
|
ed2418 MOV dbl(*SP(#12h)),AC1
|
|||
|
ed2808 MOV dbl(*SP(#14h)),AC0
|
|||
|
c114_98 MOV AC1,mmap(@AC0G)
|
|||
|
bc6b MOV HI(AC0),*AR3(T0)
|
|||
|
a908 MOV *SP(#04h),AR1
|
|||
|
4219 SUB #1,AR1
|
|||
|
c908 MOV AR1,*SP(#04h)
|
|||
|
6d59ff2a BCC C$L1,AR1 >= #0
|
|||
|
return 0;
|
|||
|
\end{lstlisting}
|
|||
|
|
|||
|
\end{document}
|
|||
|
|