mirror of
https://github.com/corundum/corundum.git
synced 2025-01-30 08:32:52 +08:00
Add tkeep signal and update testbench for stat counter
This commit is contained in:
parent
ad0e3e1eb5
commit
b00eaf4d3c
@ -32,6 +32,7 @@ THE SOFTWARE.
|
||||
module axis_stat_counter #
|
||||
(
|
||||
parameter DATA_WIDTH = 64,
|
||||
parameter KEEP_ENABLE = (DATA_WIDTH>8),
|
||||
parameter KEEP_WIDTH = (DATA_WIDTH/8),
|
||||
parameter TAG_ENABLE = 1,
|
||||
parameter TAG_WIDTH = 16,
|
||||
@ -213,18 +214,22 @@ always @* begin
|
||||
// stats collection
|
||||
|
||||
// increment tick count by number of words that can be transferred per cycle
|
||||
tick_count_next = tick_count_next + KEEP_WIDTH;
|
||||
tick_count_next = tick_count_next + (KEEP_ENABLE ? KEEP_WIDTH : 1);
|
||||
|
||||
if (monitor_axis_tready & monitor_axis_tvalid) begin
|
||||
// valid transfer cycle
|
||||
|
||||
// increment byte count by number of words transferred
|
||||
if (KEEP_ENABLE) begin
|
||||
bit_cnt = 0;
|
||||
for (i = 0; i <= KEEP_WIDTH; i = i + 1) begin
|
||||
//bit_cnt = bit_cnt + monitor_axis_tkeep[i];
|
||||
if (monitor_axis_tkeep == ({KEEP_WIDTH{1'b1}}) >> (KEEP_WIDTH-i)) bit_cnt = i;
|
||||
end
|
||||
byte_count_next = byte_count_next + bit_cnt;
|
||||
end else begin
|
||||
byte_count_next = byte_count_next + 1;
|
||||
end
|
||||
|
||||
// count frames
|
||||
if (monitor_axis_tlast) begin
|
||||
|
@ -268,10 +268,13 @@ def bench():
|
||||
yield clk.posedge
|
||||
trigger.next = 0
|
||||
|
||||
test_frame = axis_ep.AXIStreamFrame(b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
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')
|
||||
b'\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10'
|
||||
)
|
||||
|
||||
source.send(test_frame)
|
||||
yield clk.posedge
|
||||
|
||||
@ -320,10 +323,13 @@ def bench():
|
||||
yield clk.posedge
|
||||
trigger.next = 0
|
||||
|
||||
test_frame = axis_ep.AXIStreamFrame(b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
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)))
|
||||
bytearray(range(256))
|
||||
)
|
||||
|
||||
source.send(test_frame)
|
||||
yield clk.posedge
|
||||
|
||||
@ -372,10 +378,13 @@ def bench():
|
||||
yield clk.posedge
|
||||
trigger.next = 0
|
||||
|
||||
test_frame = axis_ep.AXIStreamFrame(b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
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)))
|
||||
bytearray(range(256))
|
||||
)
|
||||
|
||||
source.send(test_frame)
|
||||
yield clk.posedge
|
||||
|
||||
@ -438,14 +447,19 @@ def bench():
|
||||
yield clk.posedge
|
||||
trigger.next = 0
|
||||
|
||||
test_frame1 = axis_ep.AXIStreamFrame(b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
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'\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')
|
||||
b'\x02\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10'
|
||||
)
|
||||
|
||||
source.send(test_frame1)
|
||||
source.send(test_frame2)
|
||||
yield clk.posedge
|
||||
@ -495,14 +509,19 @@ def bench():
|
||||
yield clk.posedge
|
||||
trigger.next = 0
|
||||
|
||||
test_frame1 = axis_ep.AXIStreamFrame(b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
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'\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')
|
||||
b'\x02\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10'
|
||||
)
|
||||
|
||||
source.send(test_frame1)
|
||||
source.send(test_frame2)
|
||||
yield clk.posedge
|
||||
@ -552,14 +571,19 @@ def bench():
|
||||
yield clk.posedge
|
||||
trigger.next = 0
|
||||
|
||||
test_frame1 = axis_ep.AXIStreamFrame(b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
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'\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')
|
||||
b'\x02\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10'
|
||||
)
|
||||
|
||||
source.send(test_frame1)
|
||||
source.send(test_frame2)
|
||||
yield clk.posedge
|
||||
@ -613,10 +637,12 @@ def bench():
|
||||
test_frame = []
|
||||
|
||||
for i in range(len(lens)):
|
||||
test_frame.append(axis_ep.AXIStreamFrame(b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
test_frame.append(axis_ep.AXIStreamFrame(
|
||||
b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
bytearray(range(lens[i]))))
|
||||
bytearray(range(lens[i])))
|
||||
)
|
||||
|
||||
for f in test_frame:
|
||||
source.send(f)
|
||||
@ -671,10 +697,12 @@ def bench():
|
||||
test_frame = []
|
||||
|
||||
for i in range(len(lens)):
|
||||
test_frame.append(axis_ep.AXIStreamFrame(b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
test_frame.append(axis_ep.AXIStreamFrame(
|
||||
b'\xDA\xD1\xD2\xD3\xD4\xD5' +
|
||||
b'\x5A\x51\x52\x53\x54\x55' +
|
||||
b'\x80\x00' +
|
||||
bytearray(range(lens[i]))))
|
||||
bytearray(range(lens[i])))
|
||||
)
|
||||
|
||||
for f in test_frame:
|
||||
source.send(f)
|
||||
|
Loading…
x
Reference in New Issue
Block a user