URL
https://opencores.org/ocsvn/lpffir/lpffir/trunk
Go to most recent revision |
Show entire file |
Details |
Blame |
View Log
Rev 2 |
Rev 7 |
Line 43... |
Line 43... |
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
|
|
// Verilog test bench
|
// Verilog test bench
|
module bench (
|
module bench (
|
input clk,
|
input clk,
|
input rst
|
input rstn
|
);
|
);
|
|
|
// Test case #1: check impulse response of low-pass filter.
|
logic rx_tready;
|
|
logic tx_tlast;
|
|
logic tx_tvalid;
|
logic [15:0] in = (count == 1) ? 1:0;
|
logic [15:0] in = (count == 1) ? 1:0;
|
logic [15:0] out;
|
logic [15:0] out;
|
reg [31:0] count;
|
reg [31:0] count;
|
|
|
always_ff @(posedge clk or posedge rst)
|
always_ff @(posedge clk or posedge rstn)
|
if (rst)
|
if (!rstn)
|
count <= 0;
|
count <= 0;
|
else
|
else
|
count <= count + 1;
|
count <= count + 1;
|
|
|
// unit under test(UUT)
|
// unit under test(UUT)
|
lpffir_core lpffir_core(.x_i(in),.clk_i(clk),.y_o(out));
|
lpffir_axis lpffir_axis (
|
|
.aclk_i(clk),
|
|
.aresetn_i(rstn),
|
|
.rx_tlast_i(0),
|
|
.rx_tvalid_i(1),
|
|
.rx_tready_o(rx_tready),
|
|
.rx_tdate_i(in),
|
|
.tx_tlast_o(tx_tlast),
|
|
.tx_tvalid_o(tx_tvalid),
|
|
.tx_tready_i(1),
|
|
.tx_tdate_o(out)
|
|
);
|
|
|
// Test case log
|
// Test case log
|
initial begin
|
initial begin
|
$display("Test Case #1:");
|
$display("Test Case #1:");
|
$display("Check impulse response of low-pass filter.");
|
$display("Check impulse response of low-pass filter.");
|
$display("RTL simulation results:");
|
$display("RTL simulation results:");
|
$display("Input Output");
|
$display("Input Output");
|
$display("----- ------");
|
$display("----- ------");
|
end
|
end
|
|
|
always_ff @(posedge clk or posedge rst)
|
always_ff @(posedge clk or posedge rstn)
|
if(!rst)
|
if(rstn)
|
$display(" %0d %0d", in, out);
|
$display(" %0d %0d", in, out);
|
|
|
endmodule
|
endmodule
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.