mirror of
https://github.com/alexforencich/verilog-ethernet.git
synced 2025-01-28 07:03:08 +08:00
Consolidate, add configuration parameters, and add tid and tdest ports to AXI stream SRL FIFO
This commit is contained in:
parent
d16f19f67e
commit
b0d7820f5b
@ -32,6 +32,15 @@ THE SOFTWARE.
|
||||
module axis_srl_fifo #
|
||||
(
|
||||
parameter DATA_WIDTH = 8,
|
||||
parameter KEEP_ENABLE = (DATA_WIDTH>8),
|
||||
parameter KEEP_WIDTH = (DATA_WIDTH/8),
|
||||
parameter LAST_ENABLE = 1,
|
||||
parameter ID_ENABLE = 0,
|
||||
parameter ID_WIDTH = 8,
|
||||
parameter DEST_ENABLE = 0,
|
||||
parameter DEST_WIDTH = 8,
|
||||
parameter USER_ENABLE = 1,
|
||||
parameter USER_WIDTH = 1,
|
||||
parameter DEPTH = 16
|
||||
)
|
||||
(
|
||||
@ -42,19 +51,25 @@ module axis_srl_fifo #
|
||||
* AXI input
|
||||
*/
|
||||
input wire [DATA_WIDTH-1:0] input_axis_tdata,
|
||||
input wire [KEEP_WIDTH-1:0] input_axis_tkeep,
|
||||
input wire input_axis_tvalid,
|
||||
output wire input_axis_tready,
|
||||
input wire input_axis_tlast,
|
||||
input wire input_axis_tuser,
|
||||
input wire [ID_WIDTH-1:0] input_axis_tid,
|
||||
input wire [DEST_WIDTH-1:0] input_axis_tdest,
|
||||
input wire [USER_WIDTH-1:0] input_axis_tuser,
|
||||
|
||||
/*
|
||||
* AXI output
|
||||
*/
|
||||
output wire [DATA_WIDTH-1:0] output_axis_tdata,
|
||||
output wire [KEEP_WIDTH-1:0] output_axis_tkeep,
|
||||
output wire output_axis_tvalid,
|
||||
input wire output_axis_tready,
|
||||
output wire output_axis_tlast,
|
||||
output wire output_axis_tuser,
|
||||
output wire [ID_WIDTH-1:0] output_axis_tid,
|
||||
output wire [DEST_WIDTH-1:0] output_axis_tdest,
|
||||
output wire [USER_WIDTH-1:0] output_axis_tuser,
|
||||
|
||||
/*
|
||||
* Status
|
||||
@ -62,14 +77,42 @@ module axis_srl_fifo #
|
||||
output wire [$clog2(DEPTH+1)-1:0] count
|
||||
);
|
||||
|
||||
reg [DATA_WIDTH+2-1:0] data_reg[DEPTH-1:0];
|
||||
localparam KEEP_OFFSET = DATA_WIDTH;
|
||||
localparam LAST_OFFSET = KEEP_OFFSET + (KEEP_ENABLE ? KEEP_WIDTH : 0);
|
||||
localparam ID_OFFSET = LAST_OFFSET + (LAST_ENABLE ? 1 : 0);
|
||||
localparam DEST_OFFSET = ID_OFFSET + (ID_ENABLE ? ID_WIDTH : 0);
|
||||
localparam USER_OFFSET = DEST_OFFSET + (DEST_ENABLE ? DEST_WIDTH : 0);
|
||||
localparam WIDTH = USER_OFFSET + (USER_ENABLE ? USER_WIDTH : 0);
|
||||
|
||||
reg [WIDTH-1:0] data_reg[DEPTH-1:0];
|
||||
reg [$clog2(DEPTH+1)-1:0] ptr_reg = 0;
|
||||
reg full_reg = 0, full_next;
|
||||
reg empty_reg = 1, empty_next;
|
||||
|
||||
assign {output_axis_tlast, output_axis_tuser, output_axis_tdata} = data_reg[ptr_reg-1];
|
||||
wire [WIDTH-1:0] input_axis;
|
||||
|
||||
wire [WIDTH-1:0] output_axis = data_reg[ptr_reg-1];
|
||||
|
||||
assign input_axis_tready = ~full_reg;
|
||||
|
||||
generate
|
||||
assign input_axis[DATA_WIDTH-1:0] = input_axis_tdata;
|
||||
if (KEEP_ENABLE) assign input_axis[KEEP_OFFSET +: KEEP_WIDTH] = input_axis_tkeep;
|
||||
if (LAST_ENABLE) assign input_axis[LAST_OFFSET] = input_axis_tlast;
|
||||
if (ID_ENABLE) assign input_axis[ID_OFFSET +: ID_WIDTH] = input_axis_tid;
|
||||
if (DEST_ENABLE) assign input_axis[DEST_OFFSET +: DEST_WIDTH] = input_axis_tdest;
|
||||
if (USER_ENABLE) assign input_axis[USER_OFFSET +: USER_WIDTH] = input_axis_tuser;
|
||||
endgenerate
|
||||
|
||||
assign output_axis_tvalid = ~empty_reg;
|
||||
|
||||
assign output_axis_tdata = output_axis[DATA_WIDTH-1:0];
|
||||
assign output_axis_tkeep = KEEP_ENABLE ? output_axis[KEEP_OFFSET +: KEEP_WIDTH] : {KEEP_WIDTH{1'b1}};
|
||||
assign output_axis_tlast = LAST_ENABLE ? output_axis[LAST_OFFSET] : 1'b1;
|
||||
assign output_axis_tid = ID_ENABLE ? output_axis[ID_OFFSET +: ID_WIDTH] : {ID_WIDTH{1'b0}};
|
||||
assign output_axis_tdest = DEST_ENABLE ? output_axis[DEST_OFFSET +: DEST_WIDTH] : {DEST_WIDTH{1'b0}};
|
||||
assign output_axis_tuser = USER_ENABLE ? output_axis[USER_OFFSET +: USER_WIDTH] : {USER_WIDTH{1'b0}};
|
||||
|
||||
assign count = ptr_reg;
|
||||
|
||||
wire ptr_empty = ptr_reg == 0;
|
||||
@ -131,7 +174,7 @@ always @(posedge clk) begin
|
||||
end
|
||||
|
||||
if (shift) begin
|
||||
data_reg[0] <= {input_axis_tlast, input_axis_tuser, input_axis_tdata};
|
||||
data_reg[0] <= input_axis;
|
||||
for (i = 0; i < DEPTH-1; i = i + 1) begin
|
||||
data_reg[i+1] <= data_reg[i];
|
||||
end
|
||||
|
@ -1,144 +0,0 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2014-2017 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
|
||||
|
||||
/*
|
||||
* AXI4-Stream SRL-based FIFO (64 bit datapath)
|
||||
*/
|
||||
module axis_srl_fifo_64 #
|
||||
(
|
||||
parameter DATA_WIDTH = 64,
|
||||
parameter KEEP_WIDTH = (DATA_WIDTH/8),
|
||||
parameter DEPTH = 16
|
||||
)
|
||||
(
|
||||
input wire clk,
|
||||
input wire rst,
|
||||
|
||||
/*
|
||||
* AXI input
|
||||
*/
|
||||
input wire [DATA_WIDTH-1:0] input_axis_tdata,
|
||||
input wire [KEEP_WIDTH-1:0] input_axis_tkeep,
|
||||
input wire input_axis_tvalid,
|
||||
output wire input_axis_tready,
|
||||
input wire input_axis_tlast,
|
||||
input wire input_axis_tuser,
|
||||
|
||||
/*
|
||||
* AXI output
|
||||
*/
|
||||
output wire [DATA_WIDTH-1:0] output_axis_tdata,
|
||||
output wire [KEEP_WIDTH-1:0] output_axis_tkeep,
|
||||
output wire output_axis_tvalid,
|
||||
input wire output_axis_tready,
|
||||
output wire output_axis_tlast,
|
||||
output wire output_axis_tuser,
|
||||
|
||||
/*
|
||||
* Status
|
||||
*/
|
||||
output wire [$clog2(DEPTH+1)-1:0] count
|
||||
);
|
||||
|
||||
reg [DATA_WIDTH+KEEP_WIDTH+2-1:0] data_reg[DEPTH-1:0];
|
||||
reg [$clog2(DEPTH+1)-1:0] ptr_reg = 0;
|
||||
reg full_reg = 0, full_next;
|
||||
reg empty_reg = 1, empty_next;
|
||||
|
||||
assign {output_axis_tlast, output_axis_tuser, output_axis_tkeep, output_axis_tdata} = data_reg[ptr_reg-1];
|
||||
assign input_axis_tready = ~full_reg;
|
||||
assign output_axis_tvalid = ~empty_reg;
|
||||
assign count = ptr_reg;
|
||||
|
||||
wire ptr_empty = ptr_reg == 0;
|
||||
wire ptr_empty1 = ptr_reg == 1;
|
||||
wire ptr_full = ptr_reg == DEPTH;
|
||||
wire ptr_full1 = ptr_reg == DEPTH-1;
|
||||
|
||||
reg shift;
|
||||
reg inc;
|
||||
reg dec;
|
||||
|
||||
integer i;
|
||||
|
||||
initial begin
|
||||
for (i = 0; i < DEPTH; i = i + 1) begin
|
||||
data_reg[i] <= 0;
|
||||
end
|
||||
end
|
||||
|
||||
always @* begin
|
||||
shift = 0;
|
||||
inc = 0;
|
||||
dec = 0;
|
||||
full_next = full_reg;
|
||||
empty_next = empty_reg;
|
||||
|
||||
if (output_axis_tready & input_axis_tvalid & ~full_reg) begin
|
||||
shift = 1;
|
||||
inc = ptr_empty;
|
||||
empty_next = 0;
|
||||
end else if (output_axis_tready & output_axis_tvalid) begin
|
||||
dec = 1;
|
||||
full_next = 0;
|
||||
empty_next = ptr_empty1;
|
||||
end else if (input_axis_tvalid & input_axis_tready) begin
|
||||
shift = 1;
|
||||
inc = 1;
|
||||
full_next = ptr_full1;
|
||||
empty_next = 0;
|
||||
end
|
||||
end
|
||||
|
||||
always @(posedge clk) begin
|
||||
if (rst) begin
|
||||
ptr_reg <= 0;
|
||||
full_reg <= 0;
|
||||
empty_reg <= 1;
|
||||
end else begin
|
||||
if (inc) begin
|
||||
ptr_reg <= ptr_reg + 1;
|
||||
end else if (dec) begin
|
||||
ptr_reg <= ptr_reg - 1;
|
||||
end else begin
|
||||
ptr_reg <= ptr_reg;
|
||||
end
|
||||
|
||||
full_reg <= full_next;
|
||||
empty_reg <= empty_next;
|
||||
end
|
||||
|
||||
if (shift) begin
|
||||
data_reg[0] <= {input_axis_tlast, input_axis_tuser, input_axis_tkeep, input_axis_tdata};
|
||||
for (i = 0; i < DEPTH-1; i = i + 1) begin
|
||||
data_reg[i+1] <= data_reg[i];
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
@ -45,6 +45,15 @@ def bench():
|
||||
# Parameters
|
||||
DEPTH = 4
|
||||
DATA_WIDTH = 8
|
||||
KEEP_ENABLE = (DATA_WIDTH>8)
|
||||
KEEP_WIDTH = (DATA_WIDTH/8)
|
||||
LAST_ENABLE = 1
|
||||
ID_ENABLE = 1
|
||||
ID_WIDTH = 8
|
||||
DEST_ENABLE = 1
|
||||
DEST_WIDTH = 8
|
||||
USER_ENABLE = 1
|
||||
USER_WIDTH = 1
|
||||
|
||||
# Inputs
|
||||
clk = Signal(bool(0))
|
||||
@ -52,18 +61,23 @@ def bench():
|
||||
current_test = Signal(intbv(0)[8:])
|
||||
|
||||
input_axis_tdata = Signal(intbv(0)[DATA_WIDTH:])
|
||||
input_axis_tkeep = Signal(intbv(1)[KEEP_WIDTH:])
|
||||
input_axis_tvalid = Signal(bool(0))
|
||||
input_axis_tlast = Signal(bool(0))
|
||||
input_axis_tuser = Signal(bool(0))
|
||||
input_axis_tid = Signal(intbv(0)[ID_WIDTH:])
|
||||
input_axis_tdest = Signal(intbv(0)[DEST_WIDTH:])
|
||||
input_axis_tuser = Signal(intbv(0)[USER_WIDTH:])
|
||||
output_axis_tready = Signal(bool(0))
|
||||
|
||||
# Outputs
|
||||
input_axis_tready = Signal(bool(0))
|
||||
output_axis_tdata = Signal(intbv(0)[DATA_WIDTH:])
|
||||
output_axis_tkeep = Signal(intbv(1)[KEEP_WIDTH:])
|
||||
output_axis_tvalid = Signal(bool(0))
|
||||
output_axis_tlast = Signal(bool(0))
|
||||
output_axis_tuser = Signal(bool(0))
|
||||
|
||||
output_axis_tid = Signal(intbv(0)[ID_WIDTH:])
|
||||
output_axis_tdest = Signal(intbv(0)[DEST_WIDTH:])
|
||||
output_axis_tuser = Signal(intbv(0)[USER_WIDTH:])
|
||||
count = Signal(intbv(0)[3:])
|
||||
|
||||
# sources and sinks
|
||||
@ -76,9 +90,12 @@ def bench():
|
||||
clk,
|
||||
rst,
|
||||
tdata=input_axis_tdata,
|
||||
tkeep=input_axis_tkeep,
|
||||
tvalid=input_axis_tvalid,
|
||||
tready=input_axis_tready,
|
||||
tlast=input_axis_tlast,
|
||||
tid=input_axis_tid,
|
||||
tdest=input_axis_tdest,
|
||||
tuser=input_axis_tuser,
|
||||
pause=source_pause,
|
||||
name='source'
|
||||
@ -90,9 +107,12 @@ def bench():
|
||||
clk,
|
||||
rst,
|
||||
tdata=output_axis_tdata,
|
||||
tkeep=output_axis_tkeep,
|
||||
tvalid=output_axis_tvalid,
|
||||
tready=output_axis_tready,
|
||||
tlast=output_axis_tlast,
|
||||
tid=output_axis_tid,
|
||||
tdest=output_axis_tdest,
|
||||
tuser=output_axis_tuser,
|
||||
pause=sink_pause,
|
||||
name='sink'
|
||||
@ -109,15 +129,21 @@ def bench():
|
||||
current_test=current_test,
|
||||
|
||||
input_axis_tdata=input_axis_tdata,
|
||||
input_axis_tkeep=input_axis_tkeep,
|
||||
input_axis_tvalid=input_axis_tvalid,
|
||||
input_axis_tready=input_axis_tready,
|
||||
input_axis_tlast=input_axis_tlast,
|
||||
input_axis_tid=input_axis_tid,
|
||||
input_axis_tdest=input_axis_tdest,
|
||||
input_axis_tuser=input_axis_tuser,
|
||||
|
||||
output_axis_tdata=output_axis_tdata,
|
||||
output_axis_tkeep=output_axis_tkeep,
|
||||
output_axis_tvalid=output_axis_tvalid,
|
||||
output_axis_tready=output_axis_tready,
|
||||
output_axis_tlast=output_axis_tlast,
|
||||
output_axis_tid=output_axis_tid,
|
||||
output_axis_tdest=output_axis_tdest,
|
||||
output_axis_tuser=output_axis_tuser,
|
||||
|
||||
count=count
|
||||
@ -144,10 +170,15 @@ def bench():
|
||||
print("test 1: test packet")
|
||||
current_test.next = 1
|
||||
|
||||
test_frame = axis_ep.AXIStreamFrame(b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
b'\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10')
|
||||
test_frame = axis_ep.AXIStreamFrame(
|
||||
b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
b'\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10',
|
||||
id=1,
|
||||
dest=1
|
||||
)
|
||||
|
||||
source.send(test_frame)
|
||||
yield clk.posedge
|
||||
|
||||
@ -165,10 +196,14 @@ def bench():
|
||||
print("test 2: longer packet")
|
||||
current_test.next = 2
|
||||
|
||||
test_frame = axis_ep.AXIStreamFrame(b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
bytearray(range(256)))
|
||||
test_frame = axis_ep.AXIStreamFrame(
|
||||
b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
bytearray(range(256)),
|
||||
id=2,
|
||||
dest=1)
|
||||
|
||||
source.send(test_frame)
|
||||
yield clk.posedge
|
||||
|
||||
@ -184,10 +219,15 @@ def bench():
|
||||
print("test 3: test packet with pauses")
|
||||
current_test.next = 3
|
||||
|
||||
test_frame = axis_ep.AXIStreamFrame(b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
b'\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10')
|
||||
test_frame = axis_ep.AXIStreamFrame(
|
||||
b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
b'\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10',
|
||||
id=3,
|
||||
dest=1
|
||||
)
|
||||
|
||||
source.send(test_frame)
|
||||
yield clk.posedge
|
||||
|
||||
@ -219,14 +259,23 @@ def bench():
|
||||
print("test 4: back-to-back packets")
|
||||
current_test.next = 4
|
||||
|
||||
test_frame1 = axis_ep.AXIStreamFrame(b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
b'\x01\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10')
|
||||
test_frame2 = axis_ep.AXIStreamFrame(b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
b'\x02\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10')
|
||||
test_frame1 = axis_ep.AXIStreamFrame(
|
||||
b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
b'\x01\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10',
|
||||
id=4,
|
||||
dest=1
|
||||
)
|
||||
test_frame2 = axis_ep.AXIStreamFrame(
|
||||
b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
b'\x02\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10',
|
||||
id=4,
|
||||
dest=2
|
||||
)
|
||||
|
||||
source.send(test_frame1)
|
||||
source.send(test_frame2)
|
||||
yield clk.posedge
|
||||
@ -251,14 +300,23 @@ def bench():
|
||||
print("test 5: alternate pause source")
|
||||
current_test.next = 5
|
||||
|
||||
test_frame1 = axis_ep.AXIStreamFrame(b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
b'\x01\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10')
|
||||
test_frame2 = axis_ep.AXIStreamFrame(b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
b'\x02\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10')
|
||||
test_frame1 = axis_ep.AXIStreamFrame(
|
||||
b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
b'\x01\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10',
|
||||
id=5,
|
||||
dest=1
|
||||
)
|
||||
test_frame2 = axis_ep.AXIStreamFrame(
|
||||
b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
b'\x02\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10',
|
||||
id=5,
|
||||
dest=2
|
||||
)
|
||||
|
||||
source.send(test_frame1)
|
||||
source.send(test_frame2)
|
||||
yield clk.posedge
|
||||
@ -288,14 +346,23 @@ def bench():
|
||||
print("test 6: alternate pause sink")
|
||||
current_test.next = 6
|
||||
|
||||
test_frame1 = axis_ep.AXIStreamFrame(b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
b'\x01\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10')
|
||||
test_frame2 = axis_ep.AXIStreamFrame(b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
b'\x02\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10')
|
||||
test_frame1 = axis_ep.AXIStreamFrame(
|
||||
b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
b'\x01\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10',
|
||||
id=6,
|
||||
dest=1
|
||||
)
|
||||
test_frame2 = axis_ep.AXIStreamFrame(
|
||||
b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
b'\x02\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10',
|
||||
id=6,
|
||||
dest=2
|
||||
)
|
||||
|
||||
source.send(test_frame1)
|
||||
source.send(test_frame2)
|
||||
yield clk.posedge
|
||||
@ -325,11 +392,16 @@ def bench():
|
||||
print("test 7: tuser assert")
|
||||
current_test.next = 7
|
||||
|
||||
test_frame = axis_ep.AXIStreamFrame(b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
b'\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10')
|
||||
test_frame.user = 1
|
||||
test_frame = axis_ep.AXIStreamFrame(
|
||||
b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
b'\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10',
|
||||
id=7,
|
||||
dest=1,
|
||||
last_cycle_user=1
|
||||
)
|
||||
|
||||
source.send(test_frame)
|
||||
yield clk.posedge
|
||||
|
||||
@ -340,7 +412,7 @@ def bench():
|
||||
rx_frame = sink.recv()
|
||||
|
||||
assert rx_frame == test_frame
|
||||
assert rx_frame.user[-1]
|
||||
assert rx_frame.last_cycle_user
|
||||
|
||||
yield delay(100)
|
||||
|
||||
@ -348,7 +420,11 @@ def bench():
|
||||
print("test 8: initial sink pause")
|
||||
current_test.next = 8
|
||||
|
||||
test_frame = axis_ep.AXIStreamFrame(b'\x01\x02\x03')
|
||||
test_frame = axis_ep.AXIStreamFrame(
|
||||
b'\x01\x02\x03',
|
||||
id=8,
|
||||
dest=1
|
||||
)
|
||||
|
||||
sink_pause.next = 1
|
||||
source.send(test_frame)
|
||||
@ -372,7 +448,11 @@ def bench():
|
||||
print("test 9: initial sink pause, reset")
|
||||
current_test.next = 9
|
||||
|
||||
test_frame = axis_ep.AXIStreamFrame(b'\x01\x02\x03')
|
||||
test_frame = axis_ep.AXIStreamFrame(
|
||||
b'\x01\x02\x03',
|
||||
id=9,
|
||||
dest=1
|
||||
)
|
||||
|
||||
sink_pause.next = 1
|
||||
source.send(test_frame)
|
||||
|
@ -34,6 +34,15 @@ module test_axis_srl_fifo;
|
||||
// Parameters
|
||||
parameter DEPTH = 4;
|
||||
parameter DATA_WIDTH = 8;
|
||||
parameter KEEP_ENABLE = (DATA_WIDTH>8);
|
||||
parameter KEEP_WIDTH = (DATA_WIDTH/8);
|
||||
parameter LAST_ENABLE = 1;
|
||||
parameter ID_ENABLE = 1;
|
||||
parameter ID_WIDTH = 8;
|
||||
parameter DEST_ENABLE = 1;
|
||||
parameter DEST_WIDTH = 8;
|
||||
parameter USER_ENABLE = 1;
|
||||
parameter USER_WIDTH = 1;
|
||||
|
||||
// Inputs
|
||||
reg clk = 0;
|
||||
@ -41,17 +50,23 @@ reg rst = 0;
|
||||
reg [7:0] current_test = 0;
|
||||
|
||||
reg [DATA_WIDTH-1:0] input_axis_tdata = 0;
|
||||
reg [KEEP_WIDTH-1:0] input_axis_tkeep = 0;
|
||||
reg input_axis_tvalid = 0;
|
||||
reg input_axis_tlast = 0;
|
||||
reg input_axis_tuser = 0;
|
||||
reg [ID_WIDTH-1:0] input_axis_tid = 0;
|
||||
reg [DEST_WIDTH-1:0] input_axis_tdest = 0;
|
||||
reg [USER_WIDTH-1:0] input_axis_tuser = 0;
|
||||
reg output_axis_tready = 0;
|
||||
|
||||
// Outputs
|
||||
wire input_axis_tready;
|
||||
wire [DATA_WIDTH-1:0] output_axis_tdata;
|
||||
wire [KEEP_WIDTH-1:0] output_axis_tkeep;
|
||||
wire output_axis_tvalid;
|
||||
wire output_axis_tlast;
|
||||
wire output_axis_tuser;
|
||||
wire [ID_WIDTH-1:0] output_axis_tid;
|
||||
wire [DEST_WIDTH-1:0] output_axis_tdest;
|
||||
wire [USER_WIDTH-1:0] output_axis_tuser;
|
||||
|
||||
wire [2:0] count;
|
||||
|
||||
@ -62,16 +77,22 @@ initial begin
|
||||
rst,
|
||||
current_test,
|
||||
input_axis_tdata,
|
||||
input_axis_tkeep,
|
||||
input_axis_tvalid,
|
||||
input_axis_tlast,
|
||||
input_axis_tid,
|
||||
input_axis_tdest,
|
||||
input_axis_tuser,
|
||||
output_axis_tready
|
||||
);
|
||||
$to_myhdl(
|
||||
input_axis_tready,
|
||||
output_axis_tdata,
|
||||
output_axis_tkeep,
|
||||
output_axis_tvalid,
|
||||
output_axis_tlast,
|
||||
output_axis_tid,
|
||||
output_axis_tdest,
|
||||
output_axis_tuser,
|
||||
count
|
||||
);
|
||||
@ -83,22 +104,37 @@ end
|
||||
|
||||
axis_srl_fifo #(
|
||||
.DEPTH(DEPTH),
|
||||
.DATA_WIDTH(DATA_WIDTH)
|
||||
.DATA_WIDTH(DATA_WIDTH),
|
||||
.KEEP_ENABLE(KEEP_ENABLE),
|
||||
.KEEP_WIDTH(KEEP_WIDTH),
|
||||
.LAST_ENABLE(LAST_ENABLE),
|
||||
.ID_ENABLE(ID_ENABLE),
|
||||
.ID_WIDTH(ID_WIDTH),
|
||||
.DEST_ENABLE(DEST_ENABLE),
|
||||
.DEST_WIDTH(DEST_WIDTH),
|
||||
.USER_ENABLE(USER_ENABLE),
|
||||
.USER_WIDTH(USER_WIDTH)
|
||||
)
|
||||
UUT (
|
||||
.clk(clk),
|
||||
.rst(rst),
|
||||
// AXI input
|
||||
.input_axis_tdata(input_axis_tdata),
|
||||
.input_axis_tkeep(input_axis_tkeep),
|
||||
.input_axis_tvalid(input_axis_tvalid),
|
||||
.input_axis_tready(input_axis_tready),
|
||||
.input_axis_tlast(input_axis_tlast),
|
||||
.input_axis_tid(input_axis_tid),
|
||||
.input_axis_tdest(input_axis_tdest),
|
||||
.input_axis_tuser(input_axis_tuser),
|
||||
// AXI output
|
||||
.output_axis_tdata(output_axis_tdata),
|
||||
.output_axis_tkeep(output_axis_tkeep),
|
||||
.output_axis_tvalid(output_axis_tvalid),
|
||||
.output_axis_tready(output_axis_tready),
|
||||
.output_axis_tlast(output_axis_tlast),
|
||||
.output_axis_tid(output_axis_tid),
|
||||
.output_axis_tdest(output_axis_tdest),
|
||||
.output_axis_tuser(output_axis_tuser),
|
||||
// Status
|
||||
.count(count)
|
||||
|
@ -28,8 +28,8 @@ import os
|
||||
|
||||
import axis_ep
|
||||
|
||||
module = 'axis_srl_fifo_64'
|
||||
testbench = 'test_%s' % module
|
||||
module = 'axis_srl_fifo'
|
||||
testbench = 'test_%s_64' % module
|
||||
|
||||
srcs = []
|
||||
|
||||
@ -45,7 +45,15 @@ def bench():
|
||||
# Parameters
|
||||
DEPTH = 4
|
||||
DATA_WIDTH = 64
|
||||
KEEP_ENABLE = (DATA_WIDTH>8)
|
||||
KEEP_WIDTH = (DATA_WIDTH/8)
|
||||
LAST_ENABLE = 1
|
||||
ID_ENABLE = 1
|
||||
ID_WIDTH = 8
|
||||
DEST_ENABLE = 1
|
||||
DEST_WIDTH = 8
|
||||
USER_ENABLE = 1
|
||||
USER_WIDTH = 1
|
||||
|
||||
# Inputs
|
||||
clk = Signal(bool(0))
|
||||
@ -53,20 +61,23 @@ def bench():
|
||||
current_test = Signal(intbv(0)[8:])
|
||||
|
||||
input_axis_tdata = Signal(intbv(0)[DATA_WIDTH:])
|
||||
input_axis_tkeep = Signal(intbv(0)[KEEP_WIDTH:])
|
||||
input_axis_tkeep = Signal(intbv(1)[KEEP_WIDTH:])
|
||||
input_axis_tvalid = Signal(bool(0))
|
||||
input_axis_tlast = Signal(bool(0))
|
||||
input_axis_tuser = Signal(bool(0))
|
||||
input_axis_tid = Signal(intbv(0)[ID_WIDTH:])
|
||||
input_axis_tdest = Signal(intbv(0)[DEST_WIDTH:])
|
||||
input_axis_tuser = Signal(intbv(0)[USER_WIDTH:])
|
||||
output_axis_tready = Signal(bool(0))
|
||||
|
||||
# Outputs
|
||||
input_axis_tready = Signal(bool(0))
|
||||
output_axis_tdata = Signal(intbv(0)[DATA_WIDTH:])
|
||||
output_axis_tkeep = Signal(intbv(0)[KEEP_WIDTH:])
|
||||
output_axis_tkeep = Signal(intbv(1)[KEEP_WIDTH:])
|
||||
output_axis_tvalid = Signal(bool(0))
|
||||
output_axis_tlast = Signal(bool(0))
|
||||
output_axis_tuser = Signal(bool(0))
|
||||
|
||||
output_axis_tid = Signal(intbv(0)[ID_WIDTH:])
|
||||
output_axis_tdest = Signal(intbv(0)[DEST_WIDTH:])
|
||||
output_axis_tuser = Signal(intbv(0)[USER_WIDTH:])
|
||||
count = Signal(intbv(0)[3:])
|
||||
|
||||
# sources and sinks
|
||||
@ -83,6 +94,8 @@ def bench():
|
||||
tvalid=input_axis_tvalid,
|
||||
tready=input_axis_tready,
|
||||
tlast=input_axis_tlast,
|
||||
tid=input_axis_tid,
|
||||
tdest=input_axis_tdest,
|
||||
tuser=input_axis_tuser,
|
||||
pause=source_pause,
|
||||
name='source'
|
||||
@ -98,6 +111,8 @@ def bench():
|
||||
tvalid=output_axis_tvalid,
|
||||
tready=output_axis_tready,
|
||||
tlast=output_axis_tlast,
|
||||
tid=output_axis_tid,
|
||||
tdest=output_axis_tdest,
|
||||
tuser=output_axis_tuser,
|
||||
pause=sink_pause,
|
||||
name='sink'
|
||||
@ -118,6 +133,8 @@ def bench():
|
||||
input_axis_tvalid=input_axis_tvalid,
|
||||
input_axis_tready=input_axis_tready,
|
||||
input_axis_tlast=input_axis_tlast,
|
||||
input_axis_tid=input_axis_tid,
|
||||
input_axis_tdest=input_axis_tdest,
|
||||
input_axis_tuser=input_axis_tuser,
|
||||
|
||||
output_axis_tdata=output_axis_tdata,
|
||||
@ -125,6 +142,8 @@ def bench():
|
||||
output_axis_tvalid=output_axis_tvalid,
|
||||
output_axis_tready=output_axis_tready,
|
||||
output_axis_tlast=output_axis_tlast,
|
||||
output_axis_tid=output_axis_tid,
|
||||
output_axis_tdest=output_axis_tdest,
|
||||
output_axis_tuser=output_axis_tuser,
|
||||
|
||||
count=count
|
||||
@ -151,10 +170,15 @@ def bench():
|
||||
print("test 1: test packet")
|
||||
current_test.next = 1
|
||||
|
||||
test_frame = axis_ep.AXIStreamFrame(b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
b'\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10')
|
||||
test_frame = axis_ep.AXIStreamFrame(
|
||||
b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
b'\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10',
|
||||
id=1,
|
||||
dest=1
|
||||
)
|
||||
|
||||
source.send(test_frame)
|
||||
yield clk.posedge
|
||||
|
||||
@ -172,10 +196,14 @@ def bench():
|
||||
print("test 2: longer packet")
|
||||
current_test.next = 2
|
||||
|
||||
test_frame = axis_ep.AXIStreamFrame(b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
bytearray(range(256)))
|
||||
test_frame = axis_ep.AXIStreamFrame(
|
||||
b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
bytearray(range(256)),
|
||||
id=2,
|
||||
dest=1)
|
||||
|
||||
source.send(test_frame)
|
||||
yield clk.posedge
|
||||
|
||||
@ -191,10 +219,15 @@ def bench():
|
||||
print("test 3: test packet with pauses")
|
||||
current_test.next = 3
|
||||
|
||||
test_frame = axis_ep.AXIStreamFrame(b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
bytearray(range(256)))
|
||||
test_frame = axis_ep.AXIStreamFrame(
|
||||
b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
bytearray(range(256)),
|
||||
id=3,
|
||||
dest=1
|
||||
)
|
||||
|
||||
source.send(test_frame)
|
||||
yield clk.posedge
|
||||
|
||||
@ -226,14 +259,23 @@ def bench():
|
||||
print("test 4: back-to-back packets")
|
||||
current_test.next = 4
|
||||
|
||||
test_frame1 = axis_ep.AXIStreamFrame(b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
b'\x01\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10')
|
||||
test_frame2 = axis_ep.AXIStreamFrame(b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
b'\x02\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10')
|
||||
test_frame1 = axis_ep.AXIStreamFrame(
|
||||
b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
b'\x01\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10',
|
||||
id=4,
|
||||
dest=1
|
||||
)
|
||||
test_frame2 = axis_ep.AXIStreamFrame(
|
||||
b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
b'\x02\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10',
|
||||
id=4,
|
||||
dest=2
|
||||
)
|
||||
|
||||
source.send(test_frame1)
|
||||
source.send(test_frame2)
|
||||
yield clk.posedge
|
||||
@ -258,14 +300,23 @@ def bench():
|
||||
print("test 5: alternate pause source")
|
||||
current_test.next = 5
|
||||
|
||||
test_frame1 = axis_ep.AXIStreamFrame(b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
b'\x01\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10')
|
||||
test_frame2 = axis_ep.AXIStreamFrame(b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
b'\x02\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10')
|
||||
test_frame1 = axis_ep.AXIStreamFrame(
|
||||
b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
b'\x01\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10',
|
||||
id=5,
|
||||
dest=1
|
||||
)
|
||||
test_frame2 = axis_ep.AXIStreamFrame(
|
||||
b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
b'\x02\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10',
|
||||
id=5,
|
||||
dest=2
|
||||
)
|
||||
|
||||
source.send(test_frame1)
|
||||
source.send(test_frame2)
|
||||
yield clk.posedge
|
||||
@ -295,14 +346,23 @@ def bench():
|
||||
print("test 6: alternate pause sink")
|
||||
current_test.next = 6
|
||||
|
||||
test_frame1 = axis_ep.AXIStreamFrame(b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
b'\x01\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10')
|
||||
test_frame2 = axis_ep.AXIStreamFrame(b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
b'\x02\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10')
|
||||
test_frame1 = axis_ep.AXIStreamFrame(
|
||||
b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
b'\x01\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10',
|
||||
id=6,
|
||||
dest=1
|
||||
)
|
||||
test_frame2 = axis_ep.AXIStreamFrame(
|
||||
b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
b'\x02\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10',
|
||||
id=6,
|
||||
dest=2
|
||||
)
|
||||
|
||||
source.send(test_frame1)
|
||||
source.send(test_frame2)
|
||||
yield clk.posedge
|
||||
@ -332,11 +392,16 @@ def bench():
|
||||
print("test 7: tuser assert")
|
||||
current_test.next = 7
|
||||
|
||||
test_frame = axis_ep.AXIStreamFrame(b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
b'\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10')
|
||||
test_frame.user = 1
|
||||
test_frame = axis_ep.AXIStreamFrame(
|
||||
b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
b'\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10',
|
||||
id=7,
|
||||
dest=1,
|
||||
last_cycle_user=1
|
||||
)
|
||||
|
||||
source.send(test_frame)
|
||||
yield clk.posedge
|
||||
|
||||
@ -347,7 +412,7 @@ def bench():
|
||||
rx_frame = sink.recv()
|
||||
|
||||
assert rx_frame == test_frame
|
||||
assert rx_frame.user[-1]
|
||||
assert rx_frame.last_cycle_user
|
||||
|
||||
yield delay(100)
|
||||
|
||||
@ -355,7 +420,11 @@ def bench():
|
||||
print("test 8: initial sink pause")
|
||||
current_test.next = 8
|
||||
|
||||
test_frame = axis_ep.AXIStreamFrame(bytearray(range(24)))
|
||||
test_frame = axis_ep.AXIStreamFrame(
|
||||
bytearray(range(24)),
|
||||
id=8,
|
||||
dest=1
|
||||
)
|
||||
|
||||
sink_pause.next = 1
|
||||
source.send(test_frame)
|
||||
@ -379,7 +448,11 @@ def bench():
|
||||
print("test 9: initial sink pause, reset")
|
||||
current_test.next = 9
|
||||
|
||||
test_frame = axis_ep.AXIStreamFrame(bytearray(range(24)))
|
||||
test_frame = axis_ep.AXIStreamFrame(
|
||||
bytearray(range(24)),
|
||||
id=9,
|
||||
dest=1
|
||||
)
|
||||
|
||||
sink_pause.next = 1
|
||||
source.send(test_frame)
|
||||
|
@ -27,14 +27,22 @@ THE SOFTWARE.
|
||||
`timescale 1ns / 1ps
|
||||
|
||||
/*
|
||||
* Testbench for axis_srl_fifo_64
|
||||
* Testbench for axis_srl_fifo
|
||||
*/
|
||||
module test_axis_srl_fifo_64;
|
||||
|
||||
// Parameters
|
||||
parameter DEPTH = 4;
|
||||
parameter DATA_WIDTH = 64;
|
||||
parameter KEEP_ENABLE = (DATA_WIDTH>8);
|
||||
parameter KEEP_WIDTH = (DATA_WIDTH/8);
|
||||
parameter LAST_ENABLE = 1;
|
||||
parameter ID_ENABLE = 1;
|
||||
parameter ID_WIDTH = 8;
|
||||
parameter DEST_ENABLE = 1;
|
||||
parameter DEST_WIDTH = 8;
|
||||
parameter USER_ENABLE = 1;
|
||||
parameter USER_WIDTH = 1;
|
||||
|
||||
// Inputs
|
||||
reg clk = 0;
|
||||
@ -45,7 +53,9 @@ reg [DATA_WIDTH-1:0] input_axis_tdata = 0;
|
||||
reg [KEEP_WIDTH-1:0] input_axis_tkeep = 0;
|
||||
reg input_axis_tvalid = 0;
|
||||
reg input_axis_tlast = 0;
|
||||
reg input_axis_tuser = 0;
|
||||
reg [ID_WIDTH-1:0] input_axis_tid = 0;
|
||||
reg [DEST_WIDTH-1:0] input_axis_tdest = 0;
|
||||
reg [USER_WIDTH-1:0] input_axis_tuser = 0;
|
||||
reg output_axis_tready = 0;
|
||||
|
||||
// Outputs
|
||||
@ -54,7 +64,9 @@ wire [DATA_WIDTH-1:0] output_axis_tdata;
|
||||
wire [KEEP_WIDTH-1:0] output_axis_tkeep;
|
||||
wire output_axis_tvalid;
|
||||
wire output_axis_tlast;
|
||||
wire output_axis_tuser;
|
||||
wire [ID_WIDTH-1:0] output_axis_tid;
|
||||
wire [DEST_WIDTH-1:0] output_axis_tdest;
|
||||
wire [USER_WIDTH-1:0] output_axis_tuser;
|
||||
|
||||
wire [2:0] count;
|
||||
|
||||
@ -68,6 +80,8 @@ initial begin
|
||||
input_axis_tkeep,
|
||||
input_axis_tvalid,
|
||||
input_axis_tlast,
|
||||
input_axis_tid,
|
||||
input_axis_tdest,
|
||||
input_axis_tuser,
|
||||
output_axis_tready
|
||||
);
|
||||
@ -77,6 +91,8 @@ initial begin
|
||||
output_axis_tkeep,
|
||||
output_axis_tvalid,
|
||||
output_axis_tlast,
|
||||
output_axis_tid,
|
||||
output_axis_tdest,
|
||||
output_axis_tuser,
|
||||
count
|
||||
);
|
||||
@ -86,10 +102,18 @@ initial begin
|
||||
$dumpvars(0, test_axis_srl_fifo_64);
|
||||
end
|
||||
|
||||
axis_srl_fifo_64 #(
|
||||
axis_srl_fifo #(
|
||||
.DEPTH(DEPTH),
|
||||
.DATA_WIDTH(DATA_WIDTH),
|
||||
.KEEP_WIDTH(KEEP_WIDTH)
|
||||
.KEEP_ENABLE(KEEP_ENABLE),
|
||||
.KEEP_WIDTH(KEEP_WIDTH),
|
||||
.LAST_ENABLE(LAST_ENABLE),
|
||||
.ID_ENABLE(ID_ENABLE),
|
||||
.ID_WIDTH(ID_WIDTH),
|
||||
.DEST_ENABLE(DEST_ENABLE),
|
||||
.DEST_WIDTH(DEST_WIDTH),
|
||||
.USER_ENABLE(USER_ENABLE),
|
||||
.USER_WIDTH(USER_WIDTH)
|
||||
)
|
||||
UUT (
|
||||
.clk(clk),
|
||||
@ -100,6 +124,8 @@ UUT (
|
||||
.input_axis_tvalid(input_axis_tvalid),
|
||||
.input_axis_tready(input_axis_tready),
|
||||
.input_axis_tlast(input_axis_tlast),
|
||||
.input_axis_tid(input_axis_tid),
|
||||
.input_axis_tdest(input_axis_tdest),
|
||||
.input_axis_tuser(input_axis_tuser),
|
||||
// AXI output
|
||||
.output_axis_tdata(output_axis_tdata),
|
||||
@ -107,6 +133,8 @@ UUT (
|
||||
.output_axis_tvalid(output_axis_tvalid),
|
||||
.output_axis_tready(output_axis_tready),
|
||||
.output_axis_tlast(output_axis_tlast),
|
||||
.output_axis_tid(output_axis_tid),
|
||||
.output_axis_tdest(output_axis_tdest),
|
||||
.output_axis_tuser(output_axis_tuser),
|
||||
// Status
|
||||
.count(count)
|
||||
|
Loading…
x
Reference in New Issue
Block a user