|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
module FIR_Gaussian_Lowpass(Data_out,Data_in,clock,reset,test,result9);
//8阶高斯低通FIR
parameter order = 8;
parameter word_size_in = 8;
parameter word_size_out = 2*word_size_in + 2;
parameter b0 = 8'd7;
parameter b1 = 8'd17;
parameter b2 = 8'd32;
parameter b3 = 8'd46;
parameter b4 = 8'd52;
parameter b5 = 8'd46;
parameter b6 = 8'd32;
parameter b7 = 8'd17;
parameter b8 = 8'd7;
parameter H = 1'b1,L = 1'b0;
output [word_size_out -1 : 0] Data_out;
input [word_size_in -1 : 0] Data_in;
input clock,reset;
reg [word_size_in -1 : 0] Samples[1rder];
output [63:0] test;
output [15:0] result9;
integer k;
//multip mult1(.datain1(b0),.datain2(Data_in),.clock(clock),.result(Data_out1));
/*assign data_out = b0*Data_in
+b1*Samples[1]
+b2*Samples[2]
+b3*Samples[3]
+b4*Samples[4]
+b5*Samples[5]
+b6*Samples[6]
+b7*Samples[7]
+b8*Samples[8];*/
/*assign data_out = result0
+result1
+result2
+result3
+result4
+result5
+result6
+result7
+result8;*/
adder16X1 (
data0x,data10x,
data11x,data12x,
data13x,data14x,
data15x,data1x,
data2x,data3x,
data4x,data5x,
data6x,data7x,
data8x,data9x,
result
);
adder add1 (.data0x(result0),.data1x(result1),
.data2x(result2),.data3x(result3),
.data4x(result4),.data5x(result5),
.data6x(result6),.data7x(result7),
.result(result9));
adder add2 (.data0x(result8),.data1x(result9),
.data2x(8'h00),.data3x(8'h00),
.data4x(8'h00),.data5x(8'h00),
.data6x(8'h00),.data7x(8'h00),
.result(result10));
assign test = {Samples[1],Samples[2],Samples[3],Samples[4],
Samples[5],Samples[6],Samples[7],Samples[8]};
wire [7:0] result0;
wire [7:0] result1;
wire [7:0] result2;
wire [7:0] result3;
wire [7:0] result4;
wire [7:0] result5;
wire [7:0] result6;
wire [7:0] result7;
wire [7:0] result8;
wire [15:0] result9;
wire [15:0] result10;
assign data_out = result9;
multiplex mult1(.dataa(b0),.datab(Data_in),.result(result0));
multiplex mult2(.dataa(b1),.datab(Samples[1]),.result(result1));
multiplex mult3(.dataa(b2),.datab(Samples[2]),.result(result2));
multiplex mult4(.dataa(b3),.datab(Samples[3]),.result(result3));
multiplex mult5(.dataa(b4),.datab(Samples[4]),.result(result4));
multiplex mult6(.dataa(b5),.datab(Samples[5]),.result(result5));
multiplex mult7(.dataa(b6),.datab(Samples[6]),.result(result6));
multiplex mult8(.dataa(b7),.datab(Samples[7]),.result(result7));
multiplex mult9(.dataa(b8),.datab(Samples[8]),.result(result8));
always @(posedge clock)
if(reset == H)
begin
/*for(k=1;k<=order;k=k+1)
Samples[k] <= 0;*/
Samples[1] <= 0;
Samples[2] <= 0;
Samples[3] <= 0;
Samples[4] <= 0;
Samples[5] <= 0;
Samples[6] <= 0;
Samples[7] <= 0;
Samples[8] <= 0;
end
else
begin
Samples[1] <= Data_in;
/*for(k=2;k<=order;k=k+1)
Samples[k] <= Samples[k-1];*/
Samples[2] <= Samples[1] ;
Samples[3] <= Samples[2] ;
Samples[4] <= Samples[3] ;
Samples[5] <= Samples[4] ;
Samples[6] <= Samples[5] ;
Samples[7] <= Samples[6] ;
Samples[8] <= Samples[7] ;
end
endmodule |
|