parameterize modules

This commit is contained in:
dada 2025-03-13 11:31:31 +08:00 committed by futh0403
parent 928978f034
commit 601600c760
4 changed files with 305 additions and 293 deletions

View File

@ -32,9 +32,9 @@
// Other: // Other:
//-FHDR-------------------------------------------------------------------------------------------------------- //-FHDR--------------------------------------------------------------------------------------------------------
module IIR_Filter_p1 #( module IIR_Filter_p1 #(
parameter data_in_width = 16 parameter coef_width = 32
,parameter data_in_width = 16
,parameter cascade_in_width = 37 ,parameter cascade_in_width = 37
,parameter coef_width = 32
,parameter temp_var_width = cascade_in_width - 1 ,parameter temp_var_width = cascade_in_width - 1
,parameter data_out_width = cascade_in_width - 2 ,parameter data_out_width = cascade_in_width - 2
) )

View File

@ -32,12 +32,10 @@
// Other: // Other:
//-FHDR-------------------------------------------------------------------------------------------------------- //-FHDR--------------------------------------------------------------------------------------------------------
module IIR_Filter_p8 #( module IIR_Filter_p8 #(
parameter data_in_width = 16 parameter coef_width = 32
,parameter coef_width = 32 ,parameter data_in_width = 16
,parameter frac_data_out_width = 20//X for in,5
,parameter frac_coef_width = 31//division
,parameter temp_var_width = 42
,parameter data_out_width = 37 ,parameter data_out_width = 37
,parameter temp_var_width = data_out_width+5
) )
// H(z) = a(1 + b*z^-1 + b^2*z^-2 + b^3*z^-3 + b^4*z^-4 + b^5*z^-5 + b^6*z^-6 + b^7*z^-7) / (1 - b^8*z^-8) // H(z) = a(1 + b*z^-1 + b^2*z^-2 + b^3*z^-3 + b^4*z^-4 + b^5*z^-5 + b^6*z^-6 + b^7*z^-7) / (1 - b^8*z^-8)
( (

View File

@ -32,8 +32,8 @@
//-FHDR-------------------------------------------------------------------------------------------------------- //-FHDR--------------------------------------------------------------------------------------------------------
module IIR_top #( module IIR_top #(
parameter temp_var_width = 37 parameter data_out_width = 23
,parameter data_out_width = 23 ,parameter temp_var_width = data_out_width + 14
) )
( (
input rstn input rstn
@ -104,7 +104,9 @@ wire signed [temp_var_width-15:0] IIRout_p7_im;
IIR_Filter_p8 inst_iir_p0 ( IIR_Filter_p8 #(
.data_out_width (temp_var_width )
) inst_iir_p0 (
.clk (clk ), .clk (clk ),
.rstn (rstn ), .rstn (rstn ),
.en (en ), .en (en ),

View File

@ -32,7 +32,7 @@
//-FHDR-------------------------------------------------------------------------------------------------------- //-FHDR--------------------------------------------------------------------------------------------------------
module TailCorr_top #( module TailCorr_top #(
parameter temp_var_width = 23 parameter temp_var_width = 22
) )
( (
input rstn input rstn
@ -364,7 +364,9 @@ end
IIR_top inst_iir_top_0 ( IIR_top #(
.data_out_width (temp_var_width )
) inst_iir_top_0 (
.clk (clk ), .clk (clk ),
.rstn (rstn ), .rstn (rstn ),
.en (en ), .en (en ),
@ -413,7 +415,9 @@ IIR_top inst_iir_top_0 (
.IIRout_p7 (IIRout_p7[0] ) .IIRout_p7 (IIRout_p7[0] )
); );
IIR_top inst_iir_top_1 ( IIR_top #(
.data_out_width (temp_var_width )
) inst_iir_top_1 (
.clk (clk ), .clk (clk ),
.rstn (rstn ), .rstn (rstn ),
.en (en ), .en (en ),
@ -462,7 +466,9 @@ IIR_top inst_iir_top_1 (
.IIRout_p7 (IIRout_p7[1] ) .IIRout_p7 (IIRout_p7[1] )
); );
IIR_top inst_iir_top_2 ( IIR_top #(
.data_out_width (temp_var_width )
) inst_iir_top_2 (
.clk (clk ), .clk (clk ),
.rstn (rstn ), .rstn (rstn ),
.en (en ), .en (en ),
@ -511,7 +517,9 @@ IIR_top inst_iir_top_2 (
.IIRout_p7 (IIRout_p7[2] ) .IIRout_p7 (IIRout_p7[2] )
); );
IIR_top inst_iir_top_3 ( IIR_top #(
.data_out_width (temp_var_width )
) inst_iir_top_3 (
.clk (clk ), .clk (clk ),
.rstn (rstn ), .rstn (rstn ),
.en (en ), .en (en ),
@ -560,7 +568,9 @@ IIR_top inst_iir_top_3 (
.IIRout_p7 (IIRout_p7[3] ) .IIRout_p7 (IIRout_p7[3] )
); );
IIR_top inst_iir_top_4 ( IIR_top #(
.data_out_width (temp_var_width )
) inst_iir_top_4 (
.clk (clk ), .clk (clk ),
.rstn (rstn ), .rstn (rstn ),
.en (en ), .en (en ),
@ -609,7 +619,9 @@ IIR_top inst_iir_top_4 (
.IIRout_p7 (IIRout_p7[4] ) .IIRout_p7 (IIRout_p7[4] )
); );
IIR_top inst_iir_top_5 ( IIR_top #(
.data_out_width (temp_var_width )
) inst_iir_top_5 (
.clk (clk ), .clk (clk ),
.rstn (rstn ), .rstn (rstn ),
.en (en ), .en (en ),