Question: As shown below, the two memory outputs ( TRAN _ out, DIRE _ out ) 0 are output for two clock cycles, and then the

As shown below, the two memory outputs (TRAN_out, DIRE_out)0 are output for two clock cycles, and then the x output is output for seven cycles before the desired output comes out. Please let me know we have to modify in the top module or in the stimulus file so that the desired output comes out immediately(without 0 unlike i uploaded.)(out_mat has to come out with TRAN_out and DIRE_out at the same time) Assume that the modules instantiated in the top module are well defined.
module top_FIR_filter (input clk, rstn,
input signed [14-1:0] C0, C1, C2, C3, C4, C5
);
wire signed [16-1:0] X_direct, X_transpose;
wire signed [26-1:0] Y_direct, Y_transpose;
reg NCE_in, NCE_out;
wire NWRT_in, NWRT_out;
reg [8-1:0] ADDR_in, ADDR_out;
reg [3-1:0] state_count;
assign NWRT_in =1'b1; //read
assign NWRT_out =1'b0; //write
always @ (posedge clk or negedge rstn)
begin
if(!rstn)
begin
ADDR_in =8'b0;
ADDR_out =8'b0;
NCE_in =1'b1;
NCE_out =1'b1;
end
else
begin
ADDR_in = ADDR_in+1'b1;
ADDR_out = ADDR_out+1'b1;
NCE_in =1'b0;
NCE_out =1'b0;
end
end
//Memory for direct FIR filter
rflp256x16mx2 DIRECT_INPUT_MEM (.NWRT(NWRT_in),.DIN(),.RA(ADDR_in[7:2]),.CA(ADDR_in[1:0]),.NCE(NCE_in),.CLK(clk),.DO(X_direct));
FIR_filter_direct DIRECT_FIR (.clk(clk),.rstn(rstn),.X(X_direct),.C0(C0),.C1(C1),.C2(C2),.C3(C3),.C4(C4),.C5(C5),.Y(Y_direct));
rflp256x26mx2 DIRECT_OUTPUT_MEM (.NWRT(NWRT_out),.DIN(Y_direct),.RA(ADDR_out[7:2]),.CA(ADDR_out[1:0]),.NCE(NCE_out),.CLK(clk),.DO());
//Memory for transpose FIR filter
rflp256x16mx2 TRANS_INPUT_MEM (.NWRT(NWRT_in),.DIN(),.RA(ADDR_in[7:2]),.CA(ADDR_in[1:0]),.NCE(NCE_in),.CLK(clk),.DO(X_transpose));
FIR_filter_transpose TRANS_FIR (.clk(clk),.rstn(rstn),.X(X_transpose),.C0(C0),.C1(C1),.C2(C2),.C3(C3),.C4(C4),.C5(C5),.Y(Y_transpose));
rflp256x26mx2 TRANS_OUTPUT_MEM (.NWRT(NWRT_out),.DIN(Y_transpose),.RA(ADDR_out[7:2]),.CA(ADDR_out[1:0]),.NCE(NCE_out),.CLK(clk),.DO());
endmodule
`timescale 1ns/10ps
module sti_FIR_filter;
reg clk, reset;
reg [25:0] sig_mat [0:255];
reg [25:0] out_mat;
reg [25:0] TRAN_out;
reg [25:0] DIRE_out;
wire [13:0] c0=14'h3aa4 ;
wire [13:0] c1=14'h1433;
wire [13:0] c2=14'he37;
wire [13:0] c3=14'h1a57;
wire [13:0] c4=14'h917;
wire [13:0] c5=14'h2c1d;
top_FIR_filter FIR(clk, reset, c0, c1, c2, c3, c4, c5);
integer err=0;
initial
begin
clk =1;
reset =0;
#10
reset =1;
end
always #5 clk = ~clk;
initial $readmemh("input_vector_hex.txt", FIR.DIRECT_INPUT_MEM.array); //check the path of memory rocation (module instance)
initial $readmemh("input_vector_hex.txt", FIR.TRANS_INPUT_MEM.array); //check the path of memory rocation (module instance)
integer i=0;
initial
begin
$readmemh("output_vector_hex.txt", sig_mat);
#(140);
for (i=0; i256; i=i+1)
begin
out_mat = sig_mat[i];
TRAN_out = FIR.DIRECT_OUTPUT_MEM.array[i];
DIRE_out = FIR.TRANS_OUTPUT_MEM.array[i];
if((TRAN_out != out_mat)||(DIRE_out != out_mat)) err = err +1;
#(10);
end
$stop;
end
endmoduleL.
As shown below, the two memory outputs ( TRAN _

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 Programming Questions!