mirror of
https://github.com/alexforencich/verilog-axi.git
synced 2025-01-14 06:42:55 +08:00
207 lines
5.3 KiB
Verilog
207 lines
5.3 KiB
Verilog
/*
|
|
|
|
Copyright (c) 2018 Alex Forencich
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
in the Software without restriction, including without limitation the rights
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
all copies or substantial portions of the Software.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
// Language: Verilog 2001
|
|
|
|
`timescale 1ns / 1ps
|
|
|
|
/*
|
|
* Testbench for axi_fifo_rd
|
|
*/
|
|
module test_axi_fifo_rd;
|
|
|
|
// Parameters
|
|
parameter DATA_WIDTH = 32;
|
|
parameter ADDR_WIDTH = 16;
|
|
parameter STRB_WIDTH = (DATA_WIDTH/8);
|
|
parameter ID_WIDTH = 8;
|
|
parameter ARUSER_ENABLE = 0;
|
|
parameter ARUSER_WIDTH = 1;
|
|
parameter RUSER_ENABLE = 0;
|
|
parameter RUSER_WIDTH = 1;
|
|
parameter FIFO_DEPTH = 32;
|
|
parameter FIFO_DELAY = 0;
|
|
|
|
// Inputs
|
|
reg clk = 0;
|
|
reg rst = 0;
|
|
reg [7:0] current_test = 0;
|
|
|
|
reg [ID_WIDTH-1:0] s_axi_arid = 0;
|
|
reg [ADDR_WIDTH-1:0] s_axi_araddr = 0;
|
|
reg [7:0] s_axi_arlen = 0;
|
|
reg [2:0] s_axi_arsize = 0;
|
|
reg [1:0] s_axi_arburst = 0;
|
|
reg s_axi_arlock = 0;
|
|
reg [3:0] s_axi_arcache = 0;
|
|
reg [2:0] s_axi_arprot = 0;
|
|
reg [3:0] s_axi_arqos = 0;
|
|
reg [3:0] s_axi_arregion = 0;
|
|
reg [ARUSER_WIDTH-1:0] s_axi_aruser = 0;
|
|
reg s_axi_arvalid = 0;
|
|
reg s_axi_rready = 0;
|
|
reg m_axi_arready = 0;
|
|
reg [ID_WIDTH-1:0] m_axi_rid = 0;
|
|
reg [DATA_WIDTH-1:0] m_axi_rdata = 0;
|
|
reg [1:0] m_axi_rresp = 0;
|
|
reg m_axi_rlast = 0;
|
|
reg [RUSER_WIDTH-1:0] m_axi_ruser = 0;
|
|
reg m_axi_rvalid = 0;
|
|
|
|
// Outputs
|
|
wire s_axi_arready;
|
|
wire [ID_WIDTH-1:0] s_axi_rid;
|
|
wire [DATA_WIDTH-1:0] s_axi_rdata;
|
|
wire [1:0] s_axi_rresp;
|
|
wire s_axi_rlast;
|
|
wire [RUSER_WIDTH-1:0] s_axi_ruser;
|
|
wire s_axi_rvalid;
|
|
wire [ID_WIDTH-1:0] m_axi_arid;
|
|
wire [ADDR_WIDTH-1:0] m_axi_araddr;
|
|
wire [7:0] m_axi_arlen;
|
|
wire [2:0] m_axi_arsize;
|
|
wire [1:0] m_axi_arburst;
|
|
wire m_axi_arlock;
|
|
wire [3:0] m_axi_arcache;
|
|
wire [2:0] m_axi_arprot;
|
|
wire [3:0] m_axi_arqos;
|
|
wire [3:0] m_axi_arregion;
|
|
wire [ARUSER_WIDTH-1:0] m_axi_aruser;
|
|
wire m_axi_arvalid;
|
|
wire m_axi_rready;
|
|
|
|
initial begin
|
|
// myhdl integration
|
|
$from_myhdl(
|
|
clk,
|
|
rst,
|
|
current_test,
|
|
s_axi_arid,
|
|
s_axi_araddr,
|
|
s_axi_arlen,
|
|
s_axi_arsize,
|
|
s_axi_arburst,
|
|
s_axi_arlock,
|
|
s_axi_arcache,
|
|
s_axi_arprot,
|
|
s_axi_arqos,
|
|
s_axi_arregion,
|
|
s_axi_aruser,
|
|
s_axi_arvalid,
|
|
s_axi_rready,
|
|
m_axi_arready,
|
|
m_axi_rid,
|
|
m_axi_rdata,
|
|
m_axi_rresp,
|
|
m_axi_rlast,
|
|
m_axi_ruser,
|
|
m_axi_rvalid
|
|
);
|
|
$to_myhdl(
|
|
s_axi_arready,
|
|
s_axi_rid,
|
|
s_axi_rdata,
|
|
s_axi_rresp,
|
|
s_axi_rlast,
|
|
s_axi_ruser,
|
|
s_axi_rvalid,
|
|
m_axi_arid,
|
|
m_axi_araddr,
|
|
m_axi_arlen,
|
|
m_axi_arsize,
|
|
m_axi_arburst,
|
|
m_axi_arlock,
|
|
m_axi_arcache,
|
|
m_axi_arprot,
|
|
m_axi_arqos,
|
|
m_axi_arregion,
|
|
m_axi_aruser,
|
|
m_axi_arvalid,
|
|
m_axi_rready
|
|
);
|
|
|
|
// dump file
|
|
$dumpfile("test_axi_fifo_rd.lxt");
|
|
$dumpvars(0, test_axi_fifo_rd);
|
|
end
|
|
|
|
axi_fifo_rd #(
|
|
.DATA_WIDTH(DATA_WIDTH),
|
|
.ADDR_WIDTH(ADDR_WIDTH),
|
|
.STRB_WIDTH(STRB_WIDTH),
|
|
.ID_WIDTH(ID_WIDTH),
|
|
.ARUSER_ENABLE(ARUSER_ENABLE),
|
|
.ARUSER_WIDTH(ARUSER_WIDTH),
|
|
.RUSER_ENABLE(RUSER_ENABLE),
|
|
.RUSER_WIDTH(RUSER_WIDTH),
|
|
.FIFO_DEPTH(FIFO_DEPTH),
|
|
.FIFO_DELAY(FIFO_DELAY)
|
|
)
|
|
UUT (
|
|
.clk(clk),
|
|
.rst(rst),
|
|
.s_axi_arid(s_axi_arid),
|
|
.s_axi_araddr(s_axi_araddr),
|
|
.s_axi_arlen(s_axi_arlen),
|
|
.s_axi_arsize(s_axi_arsize),
|
|
.s_axi_arburst(s_axi_arburst),
|
|
.s_axi_arlock(s_axi_arlock),
|
|
.s_axi_arcache(s_axi_arcache),
|
|
.s_axi_arprot(s_axi_arprot),
|
|
.s_axi_arqos(s_axi_arqos),
|
|
.s_axi_arregion(s_axi_arregion),
|
|
.s_axi_aruser(s_axi_aruser),
|
|
.s_axi_arvalid(s_axi_arvalid),
|
|
.s_axi_arready(s_axi_arready),
|
|
.s_axi_rid(s_axi_rid),
|
|
.s_axi_rdata(s_axi_rdata),
|
|
.s_axi_rresp(s_axi_rresp),
|
|
.s_axi_rlast(s_axi_rlast),
|
|
.s_axi_ruser(s_axi_ruser),
|
|
.s_axi_rvalid(s_axi_rvalid),
|
|
.s_axi_rready(s_axi_rready),
|
|
.m_axi_arid(m_axi_arid),
|
|
.m_axi_araddr(m_axi_araddr),
|
|
.m_axi_arlen(m_axi_arlen),
|
|
.m_axi_arsize(m_axi_arsize),
|
|
.m_axi_arburst(m_axi_arburst),
|
|
.m_axi_arlock(m_axi_arlock),
|
|
.m_axi_arcache(m_axi_arcache),
|
|
.m_axi_arprot(m_axi_arprot),
|
|
.m_axi_arqos(m_axi_arqos),
|
|
.m_axi_arregion(m_axi_arregion),
|
|
.m_axi_aruser(m_axi_aruser),
|
|
.m_axi_arvalid(m_axi_arvalid),
|
|
.m_axi_arready(m_axi_arready),
|
|
.m_axi_rid(m_axi_rid),
|
|
.m_axi_rdata(m_axi_rdata),
|
|
.m_axi_rresp(m_axi_rresp),
|
|
.m_axi_rlast(m_axi_rlast),
|
|
.m_axi_ruser(m_axi_ruser),
|
|
.m_axi_rvalid(m_axi_rvalid),
|
|
.m_axi_rready(m_axi_rready)
|
|
);
|
|
|
|
endmodule
|