step DFT presque finie

This commit is contained in:
Axel Olougouna 2023-05-10 15:28:09 +02:00
parent 0ebfe3d25d
commit 2205bde264
7 changed files with 200 additions and 17 deletions

View file

@ -22,34 +22,46 @@
; écrire le code ici
DFT_ModuleAuCarre proc
push{lr, r4,r5, r6, r7}
push{lr, r4,r5, r6, r7, r8, r9, r10}
mov r2, r0 ; mettre l'adresse du signal dans r2
mov r0, #0 ; r0 peut être utilisé ;dans r1 on a la valeur de k
ldr r4,=TabCos
ldr r9,=TabSin
mov r5, #0 ; contient notre indice n
Boucle
cmp r5,#64
ble Fin
ldrsh r3,[r2, r5, LSL #1] ; x[n] ; là format 4.12
cmp r5,#63
bgt Fin
ldrsh r3,[r2, r5, LSL #1] ; x[n] ; là format 4.12 (1.12)
mul r6, r1, r5 ; kn
and r6, r6, #63 ; kn & 000000000011111
ldrsh r7,[r4, r6, LSL #1] ; TabCos[kn] ; là format 1.15
mul r3, r3, r7 ; x[n]*TabCos[n] 5.27
asr r3, r3, #6 ; 5.21
asr r0, r0, #6 ; 5.21
mul r10, r3, r7 ; x[n]*TabCos[n] 5.27
asr r10, r10, #4 ; 5.23
asr r0, r0, #4 ; 5.23
;mla r0, r7, r3, r0 ; x(k) += x[n]*TabCos[n] ;11.27
add r0, r0, r3 ; 6.21
add r0, r0, r10 ; 6.24 ; r0 contient la valeur de la somme des Cos
ldrsh r7,[r9, r6, LSL #1] ; TabSin[kn] ; là format 1.15
mul r10, r3, r7 ; x[n]*TabSin[n] 5.27
asr r10, r10, #4 ; 5.23
asr r8, r8, #4 ; 5.23
add r8, r8, r10 ; 6.24 ; r8 contient la valeur de la somme des Sin
add r5, #1
bl Boucle
Fin
asr r0, r0, #16
mul r0, r0, r0 ; 5.
pop{pc, r4, r5, r6, r7}
asr r0, r0, #16 ; 6.7
asr r8, r8, #16 ; 6.7
mul r0, r0, r0 ; 12.14
mul r8, r8, r8 ; 12.14
add r0, r0, r8 ; 13.14
pop{pc, r4, r5, r6, r7, r8, r9, r10}
endp

View file

@ -0,0 +1,68 @@
AREA Signal, DATA, READONLY
export LeSignal2
LeSignal2
DCW 0x0802 ; 0 2050 0.50049
DCW 0x0801 ; 1 2049 0.50024
DCW 0x07ff ; 2 2047 0.49976
DCW 0x07ff ; 3 2047 0.49976
DCW 0x07ff ; 4 2047 0.49976
DCW 0x0800 ; 5 2048 0.50000
DCW 0x0801 ; 6 2049 0.50024
DCW 0x0801 ; 7 2049 0.50024
DCW 0x0800 ; 8 2048 0.50000
DCW 0x07ff ; 9 2047 0.49976
DCW 0x07ff ; 10 2047 0.49976
DCW 0x0800 ; 11 2048 0.50000
DCW 0x0801 ; 12 2049 0.50024
DCW 0x0801 ; 13 2049 0.50024
DCW 0x0801 ; 14 2049 0.50024
DCW 0x07ff ; 15 2047 0.49976
DCW 0x07ff ; 16 2047 0.49976
DCW 0x07ff ; 17 2047 0.49976
DCW 0x0801 ; 18 2049 0.50024
DCW 0x0801 ; 19 2049 0.50024
DCW 0x0801 ; 20 2049 0.50024
DCW 0x0800 ; 21 2048 0.50000
DCW 0x07ff ; 22 2047 0.49976
DCW 0x07ff ; 23 2047 0.49976
DCW 0x0800 ; 24 2048 0.50000
DCW 0x0801 ; 25 2049 0.50024
DCW 0x0801 ; 26 2049 0.50024
DCW 0x0800 ; 27 2048 0.50000
DCW 0x07ff ; 28 2047 0.49976
DCW 0x07ff ; 29 2047 0.49976
DCW 0x07ff ; 30 2047 0.49976
DCW 0x0801 ; 31 2049 0.50024
DCW 0x0802 ; 32 2050 0.50049
DCW 0x0801 ; 33 2049 0.50024
DCW 0x07ff ; 34 2047 0.49976
DCW 0x07ff ; 35 2047 0.49976
DCW 0x07ff ; 36 2047 0.49976
DCW 0x0800 ; 37 2048 0.50000
DCW 0x0801 ; 38 2049 0.50024
DCW 0x0801 ; 39 2049 0.50024
DCW 0x0800 ; 40 2048 0.50000
DCW 0x07ff ; 41 2047 0.49976
DCW 0x07ff ; 42 2047 0.49976
DCW 0x0800 ; 43 2048 0.50000
DCW 0x0801 ; 44 2049 0.50024
DCW 0x0801 ; 45 2049 0.50024
DCW 0x0801 ; 46 2049 0.50024
DCW 0x07ff ; 47 2047 0.49976
DCW 0x07ff ; 48 2047 0.49976
DCW 0x07ff ; 49 2047 0.49976
DCW 0x0801 ; 50 2049 0.50024
DCW 0x0801 ; 51 2049 0.50024
DCW 0x0801 ; 52 2049 0.50024
DCW 0x0800 ; 53 2048 0.50000
DCW 0x07ff ; 54 2047 0.49976
DCW 0x07ff ; 55 2047 0.49976
DCW 0x0800 ; 56 2048 0.50000
DCW 0x0801 ; 57 2049 0.50024
DCW 0x0801 ; 58 2049 0.50024
DCW 0x0800 ; 59 2048 0.50000
DCW 0x07ff ; 60 2047 0.49976
DCW 0x07ff ; 61 2047 0.49976
DCW 0x07ff ; 62 2047 0.49976
DCW 0x0801 ; 63 2049 0.50024
END

View file

@ -3,7 +3,7 @@
#include "DriverJeuLaser.h"
extern short int LeSignal;
extern short int LeSignal2;
extern int DFT_ModuleAuCarre(short int* Signal64ech, char k);
int main(void)
@ -19,7 +19,7 @@ CLOCK_Configure();
for(int i=0; i<64; i++){
tab[i] = DFT_ModuleAuCarre(&LeSignal, i);
tab[i] = DFT_ModuleAuCarre(&LeSignal2, i);
}

View file

@ -154,6 +154,14 @@
</SetRegEntry>
</TargetDriverDllRegistry>
<Breakpoint/>
<MemoryWindow1>
<Mm>
<WinNumber>1</WinNumber>
<SubType>0</SubType>
<ItemText>0x200003A0</ItemText>
<AccSizeX>0</AccSizeX>
</Mm>
</MemoryWindow1>
<Tracepoint>
<THDelay>0</THDelay>
</Tracepoint>
@ -648,6 +656,18 @@
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>4</FileNumber>
<FileType>2</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\Src\Signal2.asm</PathWithFileName>
<FilenameWithoutPath>Signal2.asm</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
<Group>
@ -658,7 +678,7 @@
<RteFlg>0</RteFlg>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>4</FileNumber>
<FileNumber>5</FileNumber>
<FileType>2</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -678,7 +698,7 @@
<RteFlg>0</RteFlg>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>5</FileNumber>
<FileNumber>6</FileNumber>
<FileType>4</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>

View file

@ -398,6 +398,11 @@
<FileType>2</FileType>
<FilePath>.\Src\Signal.asm</FilePath>
</File>
<File>
<FileName>Signal2.asm</FileName>
<FileType>2</FileType>
<FilePath>.\Src\Signal2.asm</FilePath>
</File>
</Files>
</Group>
<Group>
@ -817,6 +822,11 @@
<FileType>2</FileType>
<FilePath>.\Src\Signal.asm</FilePath>
</File>
<File>
<FileName>Signal2.asm</FileName>
<FileType>2</FileType>
<FilePath>.\Src\Signal2.asm</FilePath>
</File>
</Files>
</Group>
<Group>
@ -1305,6 +1315,11 @@
<FileType>2</FileType>
<FilePath>.\Src\Signal.asm</FilePath>
</File>
<File>
<FileName>Signal2.asm</FileName>
<FileType>2</FileType>
<FilePath>.\Src\Signal2.asm</FilePath>
</File>
</Files>
</Group>
<Group>

View file

@ -6,11 +6,11 @@ Frel = input('Fr
Ph0 = input('Phase a l''origine (en degrés) : ');
Ph0 = Ph0 * pi / 180.0; % a present en radian
Ampl = 2048;
Ampl = 1.5;
Offset = 2048;
%% Création du fichier .asm
fileID = fopen(['Signal.asm'], 'w');
fileID = fopen(['Signal2.asm'], 'w');
fprintf(fileID,'\tAREA Signal, DATA, READONLY\n');
fprintf(fileID,'\texport LeSignal\n');

68
soft/Signal2.asm Normal file
View file

@ -0,0 +1,68 @@
AREA Signal, DATA, READONLY
export LeSignal
LeSignal
DCW 0x0802 ; 0 2050 0.50049
DCW 0x0801 ; 1 2049 0.50024
DCW 0x07ff ; 2 2047 0.49976
DCW 0x07ff ; 3 2047 0.49976
DCW 0x07ff ; 4 2047 0.49976
DCW 0x0800 ; 5 2048 0.50000
DCW 0x0801 ; 6 2049 0.50024
DCW 0x0801 ; 7 2049 0.50024
DCW 0x0800 ; 8 2048 0.50000
DCW 0x07ff ; 9 2047 0.49976
DCW 0x07ff ; 10 2047 0.49976
DCW 0x0800 ; 11 2048 0.50000
DCW 0x0801 ; 12 2049 0.50024
DCW 0x0801 ; 13 2049 0.50024
DCW 0x0801 ; 14 2049 0.50024
DCW 0x07ff ; 15 2047 0.49976
DCW 0x07ff ; 16 2047 0.49976
DCW 0x07ff ; 17 2047 0.49976
DCW 0x0801 ; 18 2049 0.50024
DCW 0x0801 ; 19 2049 0.50024
DCW 0x0801 ; 20 2049 0.50024
DCW 0x0800 ; 21 2048 0.50000
DCW 0x07ff ; 22 2047 0.49976
DCW 0x07ff ; 23 2047 0.49976
DCW 0x0800 ; 24 2048 0.50000
DCW 0x0801 ; 25 2049 0.50024
DCW 0x0801 ; 26 2049 0.50024
DCW 0x0800 ; 27 2048 0.50000
DCW 0x07ff ; 28 2047 0.49976
DCW 0x07ff ; 29 2047 0.49976
DCW 0x07ff ; 30 2047 0.49976
DCW 0x0801 ; 31 2049 0.50024
DCW 0x0802 ; 32 2050 0.50049
DCW 0x0801 ; 33 2049 0.50024
DCW 0x07ff ; 34 2047 0.49976
DCW 0x07ff ; 35 2047 0.49976
DCW 0x07ff ; 36 2047 0.49976
DCW 0x0800 ; 37 2048 0.50000
DCW 0x0801 ; 38 2049 0.50024
DCW 0x0801 ; 39 2049 0.50024
DCW 0x0800 ; 40 2048 0.50000
DCW 0x07ff ; 41 2047 0.49976
DCW 0x07ff ; 42 2047 0.49976
DCW 0x0800 ; 43 2048 0.50000
DCW 0x0801 ; 44 2049 0.50024
DCW 0x0801 ; 45 2049 0.50024
DCW 0x0801 ; 46 2049 0.50024
DCW 0x07ff ; 47 2047 0.49976
DCW 0x07ff ; 48 2047 0.49976
DCW 0x07ff ; 49 2047 0.49976
DCW 0x0801 ; 50 2049 0.50024
DCW 0x0801 ; 51 2049 0.50024
DCW 0x0801 ; 52 2049 0.50024
DCW 0x0800 ; 53 2048 0.50000
DCW 0x07ff ; 54 2047 0.49976
DCW 0x07ff ; 55 2047 0.49976
DCW 0x0800 ; 56 2048 0.50000
DCW 0x0801 ; 57 2049 0.50024
DCW 0x0801 ; 58 2049 0.50024
DCW 0x0800 ; 59 2048 0.50000
DCW 0x07ff ; 60 2047 0.49976
DCW 0x07ff ; 61 2047 0.49976
DCW 0x07ff ; 62 2047 0.49976
DCW 0x0801 ; 63 2049 0.50024
END