Question: Please convert the following Verilog code with testbench from 6 th order to 8 th order, and from 4 - bit word size to 8

Please convert the following Verilog code with testbench from 6th order to 8th order, and from 4-bit word size to 8-bit word size. Thank you!
module FIR_pipeline ( FIR_A, FIR_B, FIR_C, Sample_in, clock, reset);
parameter FIR_order =6;
parameter sample_size =4; // maximum sample value is 15
parameter weight_size =4; // maximum value may be 15
parameter word_size_out =11; // log2(15*15*7)
//output [word_size_out -1: 0] FIR_assign;
output [word_size_out -1: 0] FIR_A;
output [word_size_out -1: 0] FIR_B;
output [word_size_out -1: 0] FIR_C;
input [sample_size -1: 0] Sample_in;
input clock, reset;
FIR_pipeline_none U1(FIR_A, Sample_in, clock, reset);
FIR_pipeline_multiplier U2(FIR_B, Sample_in, clock, reset);
FIR_pipeline_3adders U3(FIR_C, sample_in, clock, reset);
endmodule
module FIR_pipeline_multiplier (FIR_out, Sample_in, clock, reset);
parameter FIR_order =6;
parameter sample_size =4; // maximum sample value is 15
parameter weight_size =4; // maximum value may be 15
parameter word_size_out =11; // Tog2(2^4*2^4*(order+1))
parameter product_size = sample_size+weight_size;
output reg [word_size_out -1: 0] FIR_out;
input [sample_size -1: 0] Sample_in;
input clock, reset;
wire [weight_size -1: 0] coefficients [0: FIR_order];
// Filter coefficients
parameter b0=4'd2; assign coefficients [0]= b0;
parameter b1=4'd5; assign coefficients [1]= b1;
parameter b2=4'd9; assign coefficients [2]= b2;
parameter b3=4'd14; assign coefficients [3]= b3;
parameter b4=4'd9; assign coefficients [4]= b4;
parameter b5=4'd5; assign coefficients [5]= b5;
parameter b6=4'd2; assign coefficients [6]= b6;
reg [sample_size -1 : 0] Sample_Array [1: FIR_order]; //7th coefficient multiplied by Data_in
integer k, n;
reg [product_size -1: 0] PR [0: FIR_order]; // Array format
always @(posedge clock)
if (reset ==1) begin
// The input shift register
for (k =1; k <= FIR_order; k = k+1)// to save on code lines
// The pipeline register
for (k =0; k <= FIR_order; k = k+1)// to save on code lines
PR[k]<=0;
// The output register
FIR_out <=0;
end
else begin
// The input shift register
Sample_Array [1]<= Sample_in;
for (k =2; k <= FIR_order; k = k+1)
Sample_Array[k]<= Sample_Array[k-1];
// The Pipeline Register
PR[0]<= coefficients [0]* Sample_in;
for (n =1; n<= FIR_order; n = n+1)
PR[n]<= coefficients [n]* Sample_Array[n];
// The output register
FIR_out <=PR[0]+ PR[1]+ PR[2]+ PR[3]+ PR[4]+ PR[5]+ PR[6];
end
endmodule
module FIR_pipeline_tb ();
parameter FIR_order =8;
parameter sample_size =8;
parameter weight_size =8;
parameter word_size_out = sample_size + weight_size +3;
parameter product_size = sample_size + weight_size;
wire [word_size_out -1: 0] FIR_A;
wire [word_size_out -1: 0] FIR_B;
wire [word_size_out -1: 0] FIR_C;
reg [sample_size -1: 0] Sample_in;
reg clock, reset;
FIR_pipeline UUT ( FIR_A, FIR_B, FIR_C, Sample_in, clock, reset);
wire [product_size -1: 0] PR0; assign PRO = UUT.U2.PR[0];
wire [product_size -1: 0] PR1; assign PR1= UUT.U2.PR[1];
wire [product_size -1: 0] PR2; assign PR2= UUT.U2.PR[2];
wire [product_size -1: 0] PR3; assign PR3= UUT.U2.PR[3];
wire [product_size -1: 0] PR4; assign PR4= UUT.U2.PR[4];
wire [product_size -1: 0] PR5; assign PR5= UUT.U2.PR[5];
wire [product_size -1: 0] PR6; assign PR6= UUT.U2.PR[6];
// Probes to observe the pipleine register PR0 at the input of adder 1
wire [product_size -1: 0] PR00; assign PR00= UUT.U3.PR[0];
wire [product_size -1: 0] PR01; assign PR01= UUT.U3.PR[1];
wire [product_size -1: 0] PR02; assign PR02= UUT.U3.PR[2];
wire [product_size -1: 0] PR03; assign PR03= UUT.U3.PR[3];
wire [product_size -1: 0] PR04; assign PR04= UUT.U3.PR[4];
wire [product_size -1: 0] PR05; assign PR05= UUT.U3.PR[5];
wire [product_size -1: 0] PR06; assign PR06= UUT.U3.PR[6];
// Probes to observe the pipleine register PR1 at the input of adder 3
wire [product_size -1: 0] PR12; assign PR12= UUT.U3.PR[2];
wire [product_size -1: 0] PR13; assign PR13= UUT.U3.PR[3];
wire [product_size -1: 0] PR14; assign PR14= UUT.U3.PR[4];
wire [product_size -1: 0] PR15; assign PR15= UUT.U3.PR[5];
wire [product_size -1: 0] PR16; assign PR16= UUT.U3.PR[6];
// Probes to observe the pipleine register PR2 at the input of adder 5
wire [product_size -1: 0] PR24; assign PR24= UUT.U3.PR[4];
wire [product_size -1: 0] PR25; assign PR25= UUT.U3.PR[5];
wire [product_size -1: 0] PR26; assign PR26= UUT.U3.PR[6];

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!