test: add full testbenches for accum
This commit is contained in:
92
rtl/accum/src/accum_top.sv
Normal file
92
rtl/accum/src/accum_top.sv
Normal file
@ -0,0 +1,92 @@
|
||||
`timescale 1ns / 1ps
|
||||
|
||||
module accumulator_top
|
||||
#(
|
||||
parameter DATA_WIDTH = 12,
|
||||
parameter ACCUM_WIDTH = 32,
|
||||
parameter N_MAX = 4096,
|
||||
parameter WINDOW_SIZE = 4,
|
||||
parameter PACKET_SIZE = 8,
|
||||
parameter READ_BATCH_SIZE =(PACKET_SIZE*8)/(ACCUM_WIDTH)
|
||||
)
|
||||
(
|
||||
// main clk
|
||||
input clk_in,
|
||||
input rst,
|
||||
|
||||
// input data
|
||||
input [DATA_WIDTH-1:0] s_axis_tdata,
|
||||
input s_axis_tvalid,
|
||||
|
||||
// parameters
|
||||
input start,
|
||||
input [31:0] smp_num,
|
||||
input [15:0] seq_num,
|
||||
|
||||
// eth signals
|
||||
input eth_clk_in,
|
||||
input req_ready,
|
||||
output send_req,
|
||||
|
||||
// output axis
|
||||
output logic [7:0] m_axis_tdata,
|
||||
output logic m_axis_tvalid,
|
||||
input logic m_axis_tready,
|
||||
output logic m_axis_tlast,
|
||||
|
||||
output logic finish
|
||||
);
|
||||
|
||||
wire [ACCUM_WIDTH-1:0] out_data;
|
||||
wire out_valid;
|
||||
wire readout_begin;
|
||||
wire batch_req;
|
||||
|
||||
accumulator #(
|
||||
.DATA_WIDTH(DATA_WIDTH),
|
||||
.ACCUM_WIDTH(ACCUM_WIDTH),
|
||||
.N_MAX(N_MAX),
|
||||
.WINDOW_SIZE(WINDOW_SIZE),
|
||||
.PACKET_SIZE(PACKET_SIZE)
|
||||
) accum_main (
|
||||
.clk_in(clk_in),
|
||||
.rst(rst),
|
||||
.s_axis_tdata(s_axis_tdata),
|
||||
.s_axis_tvalid(s_axis_tvalid),
|
||||
.start(start),
|
||||
.smp_num(smp_num),
|
||||
.seq_num(seq_num),
|
||||
.out_data(out_data),
|
||||
.out_valid(out_valid),
|
||||
.readout_begin(readout_begin),
|
||||
.batch_req(batch_req),
|
||||
.finish(finish)
|
||||
);
|
||||
|
||||
out_axis_fifo #(
|
||||
.ACCUM_WIDTH(ACCUM_WIDTH),
|
||||
.WINDOW_SIZE(WINDOW_SIZE),
|
||||
.PACKET_SIZE(PACKET_SIZE)
|
||||
) output_async_fifo (
|
||||
.eth_clk_in (eth_clk_in),
|
||||
.acc_clk_in (clk_in),
|
||||
.rst (rst),
|
||||
.smp_num (smp_num),
|
||||
|
||||
.m_axis_tdata (m_axis_tdata),
|
||||
.m_axis_tvalid (m_axis_tvalid),
|
||||
.m_axis_tready (m_axis_tready),
|
||||
.m_axis_tlast (m_axis_tlast),
|
||||
|
||||
.acc_din (out_data),
|
||||
.din_valid (out_valid),
|
||||
|
||||
.readout_begin (readout_begin),
|
||||
|
||||
.req_ready (req_ready),
|
||||
.send_req (send_req),
|
||||
|
||||
.batch_req (batch_req),
|
||||
.finish (finish)
|
||||
);
|
||||
endmodule
|
||||
Reference in New Issue
Block a user