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

📄 fir.m

📁 浮点fir设计工具
💻 M
字号:
%       AccelDSP 9.1.00 build 868 Production, compiled Feb 16 2007 
% 
%    THIS IS UNPUBLISHED, LICENSED SOFTWARE THAT IS THE CONFIDENTIAL 
%        AND PROPRIETARY PROPERTY OF XILINX OR ITS LICENSORS 
% 
%      Copyright(c) Xilinx, Inc., 2000-2007, All Rights Reserved. 
%   Reproduction or reuse, in any form, without the explicit written 
%          consent of Xilinx, Inc., is strictly prohibited. 
% 
%  User: WangQian 
%  Machine: A2D3DF917F70473 (i1586, Windows XP Service Pack 2, 5.01.2600) 
%  Date: Mon May 12 10:57:06 2008 
% 
%       AccelDSP 9.1.00 build 868 Production, compiled Feb 16 2007 
% 
%    THIS IS UNPUBLISHED, LICENSED SOFTWARE THAT IS THE CONFIDENTIAL 
%        AND PROPRIETARY PROPERTY OF XILINX OR ITS LICENSORS 
% 
%      Copyright(c) Xilinx, Inc., 2000-2007, All Rights Reserved. 
%   Reproduction or reuse, in any form, without the explicit written 
%          consent of Xilinx, Inc., is strictly prohibited. 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Description : Function definition for general FIR filter design            %
%%                                                                            %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function outdatabuf = fir ( indatabuf )
global ac_fixed_wrap_floor_12_8;
global ac_fixed_wrap_floor_24_20;
global ac_fixed_wrap_floor_26_20;
global ac_fixed_wrap_floor_29_20;
global ac_fixed_wrap_floor_2_0;
global ac_fixed_wrap_floor_6_0;
global ac_ufixed_wrap_floor_12_12;
global ac_ufixed_wrap_floor_5_0;
persistent ac_persistent_var_for_quantizer_definition;
if isempty( ac_persistent_var_for_quantizer_definition )
	ac_persistent_var_for_quantizer_definition = 1;
	ac_fixed_wrap_floor_12_8 = quantizer( 'fixed', 'wrap', 'floor', [12, 8] );
	ac_fixed_wrap_floor_24_20 = quantizer( 'fixed', 'wrap', 'floor', [24, 20] );
	ac_fixed_wrap_floor_26_20 = quantizer( 'fixed', 'wrap', 'floor', [26, 20] );
	ac_fixed_wrap_floor_29_20 = quantizer( 'fixed', 'wrap', 'floor', [29, 20] );
	ac_fixed_wrap_floor_2_0 = quantizer( 'fixed', 'wrap', 'floor', [2, 0] );
	ac_fixed_wrap_floor_6_0 = quantizer( 'fixed', 'wrap', 'floor', [6, 0] );
	ac_ufixed_wrap_floor_12_12 = quantizer( 'ufixed', 'wrap', 'floor', [12, 12] );
	ac_ufixed_wrap_floor_5_0 = quantizer( 'ufixed', 'wrap', 'floor', [5, 0] );
end

%%% The following lines were automatically inserted to insure correct input quantization
indatabuf = quantize( ac_fixed_wrap_floor_12_8, indatabuf );
%%% end of input quantization

% Load the filter coefficients
coeff = quantize( ac_ufixed_wrap_floor_12_12, load( 'C:\AccelDSP\AccelWork\FIR\coefficients.txt' ) );
persistent tap_delay;
% Clear tap delay line at beginning
if isempty( tap_delay )
    tap_delay = quantize( ac_fixed_wrap_floor_12_8, zeros( 1, 16 ) );
end


% Perform sum of products
ac_input_mtimes_1 = quantize( ac_ufixed_wrap_floor_12_12, coeff(quantize( ac_fixed_wrap_floor_6_0, 16:-1:1 ))' );
outdatabuf = quantize( ac_fixed_wrap_floor_26_20, mtimes_001( tap_delay, ac_input_mtimes_1 ) );
% Shift tap delay line
tap_delay = quantize( ac_fixed_wrap_floor_12_8, [ tap_delay(quantize( ac_ufixed_wrap_floor_5_0, 2:16 )), indatabuf ] );

⌨️ 快捷键说明

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