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

📄 filter.v.bak

📁 插值滤波器,用于音频解码调制解调,滤波器系数用移位相加实现
💻 BAK
📖 第 1 页 / 共 3 页
字号:
module FFD_hf(data,clock,reset,q);
output q;
input  data,clock,reset;
reg q;
always@(posedge clock or negedge reset)
    if(~reset)
       q<=0;
    else
       q<=data;     
endmodule

module FFD_hf_18(data,clock,reset,q);

output [18:1]       q;
input         clock,reset;
input  [18:1]       data;


FFD_hf        f1(data[1],clock,reset,q[1]),
              f2(data[2],clock,reset,q[2]),
              f3(data[3],clock,reset,q[3]),
              f4(data[4],clock,reset,q[4]),
              f5(data[5],clock,reset,q[5]),
              f6(data[6],clock,reset,q[6]),
              f7(data[7],clock,reset,q[7]),
              f8(data[8],clock,reset,q[8]),
              f9(data[9],clock,reset,q[9]),
              f10(data[10],clock,reset,q[10]),
              f11(data[11],clock,reset,q[11]),
              f12(data[12],clock,reset,q[12]),
              f13(data[13],clock,reset,q[13]),
              f14(data[14],clock,reset,q[14]),
              f15(data[15],clock,reset,q[15]),
              f16(data[16],clock,reset,q[16]),
              f17(data[17],clock,reset,q[17]),
              f18(data[18],clock,reset,q[18]);
endmodule

module FFD_hf_18_2(data,clock,reset,q);

input [18:1] data;
input clock,reset;
output [18:1] q;

wire [18:1] connect;

FFD_hf_18 FFD1(data,clock,reset,connect),
          FFD2(connect,clock,reset,q);

endmodule

module FFD_lp(data,clock,reset,q);
output q;
input  data,clock,reset;
reg q;
always@(posedge clock or negedge reset)
    if(~reset)
       q<=0;
    else
       q<=data;     
endmodule

module FFD_lp_18(data,clock,reset,q);

output [18:1]       q;
input         clock,reset;
input  [18:1]       data;


FFD_lp        f1(data[1],clock,reset,q[1]),
              f2(data[2],clock,reset,q[2]),
              f3(data[3],clock,reset,q[3]),
              f4(data[4],clock,reset,q[4]),
              f5(data[5],clock,reset,q[5]),
              f6(data[6],clock,reset,q[6]),
              f7(data[7],clock,reset,q[7]),
              f8(data[8],clock,reset,q[8]),
              f9(data[9],clock,reset,q[9]),
              f10(data[10],clock,reset,q[10]),
              f11(data[11],clock,reset,q[11]),
              f12(data[12],clock,reset,q[12]),
              f13(data[13],clock,reset,q[13]),
              f14(data[14],clock,reset,q[14]),
              f15(data[15],clock,reset,q[15]),
              f16(data[16],clock,reset,q[16]),
              f17(data[17],clock,reset,q[17]),
              f18(data[18],clock,reset,q[18]);
endmodule


module add_half(in1,in2,out);

input [18:1] in1,in2;
output [19:1] out;
 
assign out={1'b0,in1}+{1'b0,in2};

endmodule

module add_multi(in1,in2,out);

input [18:1] in1,in2;
output [19:1] out;
 
assign out={1'b0,in1}+{1'b0,in2};

endmodule

module add_plus(in1,in2,in3,in4,in5,in6,in7,out);

input [18:1] in1,in2,in3,in4,in5,in6,in7;
output [19:1] out;

assign out={1'b0,in1}+{1'b0,in2}+{1'b0,in3}+{1'b0,in4}+{1'b0,in5}+{1'b0,in6}+{1'b0,in7};

endmodule

module add_negative(in1,in2,in3,in4,in5,in6,out);

input [18:1] in1,in2,in3,in4,in5,in6;
output [19:1] out;

assign out={1'b0,in1}+{1'b0,in2}+{1'b0,in3}+{1'b0,in4}+{1'b0,in5}+{1'b0,in6};

endmodule

module add_z(in1,in2,in3,in4,in5,in6,out);

input [18:1] in1,in2,in3,in4,in5,in6;
output [19:1] out;

assign out={1'b0,in1}+{1'b0,in2}+{1'b0,in3}+{1'b0,in4}+{1'b0,in5}+{1'b0,in6};

endmodule

module add_f(in1,in2,in3,in4,in5,out);

input [18:1] in1,in2,in3,in4,in5;
output [19:1] out;

assign out={1'b0,in1}+{1'b0,in2}+{1'b0,in3}+{1'b0,in4}+{1'b0,in5};

endmodule

//module buffer(buf_in,buf_out);

//input [18:1] buf_in;
//output [18:1] buf_out;

//assign buf_out=~(~buf_in);

//endmodule

module hf_division1(data_in,clock,reset,data_out);

input [19:1] data_in;
input clock,reset;
output [18:1] data_out;

reg [18:1] data_out;
reg [38:1] temp_data;

always@(posedge clock or negedge reset)
   begin
     if(!reset)
        begin
          data_out=0;
          temp_data=0;
        end  
     else
        begin
          temp_data={data_in,19'b0000000000000000000};
          temp_data=(temp_data>>10)+(temp_data>>12)+(temp_data>>14)+(temp_data>>18);
          if(temp_data[19]==1)
             data_out=temp_data[37:20]+1;
          else
             data_out=temp_data[37:20];   
         end    
   end 
endmodule           

module hf_division2(data_in,clock,reset,data_out);

input [19:1] data_in;
input clock,reset;
output [18:1] data_out;

reg [18:1] data_out;
reg [38:1] temp_data;

always@(posedge clock or negedge reset)
   begin
     if(!reset)
        begin
          data_out=0;
          temp_data=0;
        end  
     else
        begin
          temp_data={data_in,19'b0000000000000000000};
          temp_data=(temp_data>>9)+(temp_data>>15)+(temp_data>>18);
          if(temp_data[19]==1)
             data_out=temp_data[37:20]+1;
          else
             data_out=temp_data[37:20];   
         end    
   end 
endmodule           

module hf_division3(data_in,clock,reset,data_out);

input [19:1] data_in;
input clock,reset;
output [18:1] data_out;

reg [18:1] data_out;
reg [38:1] temp_data;

always@(posedge clock or negedge reset)
   begin
     if(!reset)
        begin
          data_out=0;
          temp_data=0;
        end  
     else
        begin
          temp_data={data_in,19'b0000000000000000000};
          temp_data=(temp_data>>8)+(temp_data>>15)+(~(temp_data>>11)+1)+(~(temp_data>>18)+1);
          if(temp_data[19]==1)
             data_out=temp_data[37:20]+1;
          else
             data_out=temp_data[37:20];   
         end    
   end 
endmodule          

module hf_division4(data_in,clock,reset,data_out);

input [19:1] data_in;
input clock,reset;
output [18:1] data_out;

reg [18:1] data_out;
reg [38:1] temp_data;

always@(posedge clock or negedge reset)
   begin
     if(!reset)
        begin
          data_out=0;
          temp_data=0;
        end  
     else
        begin
          temp_data={data_in,19'b0000000000000000000};
          temp_data=(temp_data>>8)+(temp_data>>10)+(temp_data>>11)+(temp_data>>13)+(temp_data>>15)+(temp_data>>17)+(temp_data>>18);
          if(temp_data[19]==1)
             data_out=temp_data[37:20]+1;
          else
             data_out=temp_data[37:20];   
         end    
   end 
endmodule  

module hf_division5(data_in,clock,reset,data_out);

input [19:1] data_in;
input clock,reset;
output [18:1] data_out;

reg [18:1] data_out;
reg [38:1] temp_data;

always@(posedge clock or negedge reset)
   begin
     if(!reset)
        begin
          data_out=0;
          temp_data=0;
        end  
     else
        begin
          temp_data={data_in,19'b0000000000000000000};
          temp_data=(temp_data>>7)+(temp_data>>11)+(temp_data>>13)+(temp_data>>15)+(temp_data>>18);
          if(temp_data[19]==1)
             data_out=temp_data[37:20]+1;
          else
             data_out=temp_data[37:20];   
         end    
   end 
endmodule    

module hf_division6(data_in,clock,reset,data_out);

input [19:1] data_in;
input clock,reset;
output [18:1] data_out;

reg [18:1] data_out;
reg [38:1] temp_data;

always@(posedge clock or negedge reset)
   begin
     if(!reset)
        begin
          data_out=0;
          temp_data=0;
        end  
     else
        begin
          temp_data={data_in,19'b0000000000000000000};
          temp_data=(temp_data>>7)+(temp_data>>8)+(temp_data>>11)+(temp_data>>12)+(temp_data>>16)+(temp_data>>17);
          if(temp_data[19]==1)
             data_out=temp_data[37:20]+1;
          else
             data_out=temp_data[37:20];   
         end    
   end 
endmodule      

module hf_division7(data_in,clock,reset,data_out);

input [19:1] data_in;
input clock,reset;
output [18:1] data_out;

reg [18:1] data_out;
reg [38:1] temp_data;

always@(posedge clock or negedge reset)
   begin
     if(!reset)
        begin
          data_out=0;
          temp_data=0;
        end  
     else
        begin
          temp_data={data_in,19'b0000000000000000000};
          temp_data=(temp_data>>6)+(temp_data>>9)+(temp_data>>12)+(temp_data>>13)+(temp_data>>14)+(temp_data>>16);
          if(temp_data[19]==1)
             data_out=temp_data[37:20]+1;
          else
             data_out=temp_data[37:20];   
         end    
   end 
endmodule           

module hf_division8(data_in,clock,reset,data_out);

input [19:1] data_in;
input clock,reset;
output [18:1] data_out;

reg [18:1] data_out;
reg [38:1] temp_data;

always@(posedge clock or negedge reset)
   begin
     if(!reset)
        begin
          data_out=0;
          temp_data=0;
        end  
     else
        begin
          temp_data={data_in,19'b0000000000000000000};
          temp_data=(temp_data>>6)+(temp_data>>7)+(temp_data>>9)+(temp_data>>11)+(temp_data>>18);
          if(temp_data[19]==1)
             data_out=temp_data[37:20]+1;
          else
             data_out=temp_data[37:20];   
         end    
   end 
endmodule          

module hf_division9(data_in,clock,reset,data_out);

input [19:1] data_in;
input clock,reset;
output [18:1] data_out;

reg [18:1] data_out;
reg [38:1] temp_data;

always@(posedge clock or negedge reset)
   begin
     if(!reset)
        begin
          data_out=0;
          temp_data=0;
        end  
     else
        begin
          temp_data={data_in,19'b0000000000000000000};
          temp_data=(temp_data>>5)+(temp_data>>8)+(temp_data>>9)+(temp_data>>11)+(temp_data>>13)+(temp_data>>17);
          if(temp_data[19]==1)
             data_out=temp_data[37:20]+1;
          else
             data_out=temp_data[37:20];   
         end    
   end 
endmodule      

module hf_division10(data_in,clock,reset,data_out);

input [19:1] data_in;
input clock,reset;
output [18:1] data_out;

reg [18:1] data_out;
reg [38:1] temp_data;

always@(posedge clock or negedge reset)
   begin
     if(!reset)
        begin
          data_out=0;
          temp_data=0;
        end  
     else
        begin
          temp_data={data_in,19'b0000000000000000000};
          temp_data=(temp_data>>4)+(temp_data>>9)+(temp_data>>10)+(temp_data>>12)+(temp_data>>14)+(temp_data>>18)+{~(temp_data>>7)+1};
          if(temp_data[19]==1)
             data_out=temp_data[37:20]+1;
          else
             data_out=temp_data[37:20];   
         end    
   end 
endmodule          

module hf_division11(data_in,clock,reset,data_out);

⌨️ 快捷键说明

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