📄 fft_tb.m
字号:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %{tool}% file : fft_tb.m%% Description : The following Matlab testbench excercises the Altera FFT Model fft_model.m% generated by Altera's FFT Megacore and outputs results to text files.%% 2001-2007 Altera Corporation, All Rights Reserved%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Read transform sizes from source text filefidnps = fopen('blksize_report.txt','r');fidinv = fopen('inverse_report.txt','r');% Note: blksize_report.txt is generated when the HDL simulation is run, so if it does% not exist then flag an errorif fidnps == -1 msgbox('Error: blksize_report does not exist, run the HDL simulation first.', 'blksize_report.txt missing', 'error');elseif fidinv == -1 msgbox('Error: inverse_report does not exist, run the HDL simulation first.', 'inverse_report.txt missing', 'error');else % Read input complex vector, and transform sizes from source text files fidr = fopen('real_input.txt','r'); fidi = fopen('imag_input.txt','r'); xreali=fscanf(fidr,'%d'); ximagi=fscanf(fidi,'%d'); nps=fscanf(fidnps,'%d'); inverse=fscanf(fidinv,'%d'); fclose(fidi); fclose(fidr); fclose(fidnps); % Create input complex row vector from source text files x = xreali' + j*ximagi'; [y] = fft_model(x,nps,inverse); fidro = fopen('real_output_c_model.txt','w'); fidio = fopen('imag_output_c_model.txt','w'); fprintf(fidro,'%d\n',real(y)); fprintf(fidio,'%d\n',imag(y)); fclose(fidro); fclose(fidio);end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -