OpenCores
URL https://opencores.org/ocsvn/wdsp/wdsp/trunk

Subversion Repositories wdsp

[/] [wdsp/] [trunk/] [sw/] [matlab-scripts/] [fft/] [testveccon.m] - Blame information for rev 5

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 parrado
function testveccon(N,bw,vecfile)
2
%testveccon(N,bw,vecfile)
3
%   This function generates a concaten      ated single line input for the FFT.
4
%   It creates a single line input of the following format
5
%   resetn  load_enable  xin_r  xin_i
6
%
7
%   N is the number of points in the fft
8
%   bw is the bit width of the input
9
%   vecfile is the v ector file name
10
%
11
%    Vectors will be some initial set up, then a sinc wave input,
12
%   followe d by two square wave inputs.  This file does not generate the
13
%   MATLAB calc ulated results, only the input waves.
14
%   In put waves are 1 bit of integer, bw-1 bits of fraction
15
%
16
%   This file uses:
17
%        frac2bin.m
18
%       writebin.m
19
%
20
 
21
 dutycycle=0.12 5;
22
 d atara=1:N;
23
 datarb=1:N;
24
datara=sinc((datara-N/2)/2)  ;
25
for k=1:N
26
    if k>(N*dutycycle)   %squar     e wave input
27
         datarb(k)=0;
28
    else
29
         data rb(k)=1;
30
    end
31
end;
32
 
33
%dataia=datarb;
34
%dataib=datara;
35
%
36
%datara=(sin(2*pi*dat ara*12/64)+cos(2*pi*datara*2/64))/2;
37
dataia=0;
38
dataib=0;
39
datara=da tara*(2^bw-1) /(2^bw);
40
datar b=datarb*(2^bw-1)/(2^bw);
41
fi n=fopen(vecfile,'w');
42
writebin(fin,frac2bin(0,1,bw*2+1));
43
fprintf(fin,'\n1');
44
writebin(fin,frac2bin(0,1,bw*2     ));
45
for k=1:N
46
    fprintf(fin,'\n11');
47
    writebin(fin,frac2bin(datara(k),1,bw-1));
48
    writebin(fin,frac2bin (dataia(1),1,bw-1));
49
%    fprintf(fin,'\n');
50
end
51
 
52
 101
53
 
54
 
55
 
56
for k=1:N
57
    fprintf(fin,'\n11');
58
    w datarb(k),1,bw-1));  ritebin(fin,frac2bin(
59
    writebin(fi n,frac2bin(dataib(1),1,bw-1));
60
%     fprintf(fin,'\n');
61
end
62
 
63
for k=1:N
64
    fprintf(fin,'\n11');
65
    writebin(fin,frac2bin(datarb(k),1,bw-1));
66
    writebin(fin,frac2bin(dataib(1),1,bw-1));
67
%   fprintf(fin,'\n');
68
end
69
 
70
fclose('all');

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.