2015-03-21 03:32:19 -07:00
|
|
|
#!/usr/bin/env python
|
2014-10-22 10:47:03 -07:00
|
|
|
"""
|
|
|
|
|
2018-02-26 12:25:20 -08:00
|
|
|
Copyright (c) 2014-2018 Alex Forencich
|
2014-10-22 10:47:03 -07:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
from myhdl import *
|
|
|
|
import os
|
|
|
|
import struct
|
|
|
|
|
|
|
|
import axis_ep
|
|
|
|
|
2018-10-24 17:07:22 -07:00
|
|
|
module = 'axis_frame_join'
|
|
|
|
testbench = 'test_%s_4' % module
|
2014-10-22 10:47:03 -07:00
|
|
|
|
|
|
|
srcs = []
|
|
|
|
|
|
|
|
srcs.append("../rtl/%s.v" % module)
|
2016-09-12 13:38:34 -07:00
|
|
|
srcs.append("%s.v" % testbench)
|
2014-10-22 10:47:03 -07:00
|
|
|
|
|
|
|
src = ' '.join(srcs)
|
|
|
|
|
2016-09-12 13:38:34 -07:00
|
|
|
build_cmd = "iverilog -o %s.vvp %s" % (testbench, src)
|
2014-10-22 10:47:03 -07:00
|
|
|
|
|
|
|
def bench():
|
|
|
|
|
2016-09-12 13:38:34 -07:00
|
|
|
# Parameters
|
2018-10-24 17:07:22 -07:00
|
|
|
S_COUNT = 4
|
2018-10-25 10:20:17 -07:00
|
|
|
DATA_WIDTH = 8
|
2016-09-12 13:38:34 -07:00
|
|
|
TAG_ENABLE = 1
|
|
|
|
TAG_WIDTH = 16
|
|
|
|
|
2014-10-22 10:47:03 -07:00
|
|
|
# Inputs
|
|
|
|
clk = Signal(bool(0))
|
|
|
|
rst = Signal(bool(0))
|
|
|
|
current_test = Signal(intbv(0)[8:])
|
|
|
|
|
2018-10-24 17:07:22 -07:00
|
|
|
s_axis_tdata_list = [Signal(intbv(0)[DATA_WIDTH:]) for i in range(S_COUNT)]
|
|
|
|
s_axis_tvalid_list = [Signal(bool(0)) for i in range(S_COUNT)]
|
|
|
|
s_axis_tlast_list = [Signal(bool(0)) for i in range(S_COUNT)]
|
|
|
|
s_axis_tuser_list = [Signal(bool(0)) for i in range(S_COUNT)]
|
|
|
|
|
|
|
|
s_axis_tdata = ConcatSignal(*reversed(s_axis_tdata_list))
|
|
|
|
s_axis_tvalid = ConcatSignal(*reversed(s_axis_tvalid_list))
|
|
|
|
s_axis_tlast = ConcatSignal(*reversed(s_axis_tlast_list))
|
|
|
|
s_axis_tuser = ConcatSignal(*reversed(s_axis_tuser_list))
|
|
|
|
|
|
|
|
m_axis_tready = Signal(bool(0))
|
2016-09-12 13:38:34 -07:00
|
|
|
tag = Signal(intbv(0)[TAG_WIDTH:])
|
2014-10-22 10:47:03 -07:00
|
|
|
|
|
|
|
# Outputs
|
2018-10-24 17:07:22 -07:00
|
|
|
s_axis_tready = Signal(intbv(0)[S_COUNT:])
|
|
|
|
|
|
|
|
s_axis_tready_list = [s_axis_tready(i) for i in range(S_COUNT)]
|
|
|
|
|
|
|
|
m_axis_tdata = Signal(intbv(0)[8:])
|
|
|
|
m_axis_tvalid = Signal(bool(0))
|
|
|
|
m_axis_tlast = Signal(bool(0))
|
|
|
|
m_axis_tuser = Signal(bool(0))
|
2014-10-22 10:47:03 -07:00
|
|
|
busy = Signal(bool(0))
|
|
|
|
|
|
|
|
# sources and sinks
|
2018-10-24 17:07:22 -07:00
|
|
|
source_pause_list = []
|
|
|
|
source_list = []
|
|
|
|
source_logic_list = []
|
2014-10-22 10:47:03 -07:00
|
|
|
sink_pause = Signal(bool(0))
|
|
|
|
|
2018-10-24 17:07:22 -07:00
|
|
|
for k in range(S_COUNT):
|
|
|
|
s = axis_ep.AXIStreamSource()
|
|
|
|
p = Signal(bool(0))
|
|
|
|
|
|
|
|
source_list.append(s)
|
|
|
|
source_pause_list.append(p)
|
|
|
|
|
|
|
|
source_logic_list.append(s.create_logic(
|
|
|
|
clk,
|
|
|
|
rst,
|
|
|
|
tdata=s_axis_tdata_list[k],
|
|
|
|
tvalid=s_axis_tvalid_list[k],
|
|
|
|
tready=s_axis_tready_list[k],
|
|
|
|
tlast=s_axis_tlast_list[k],
|
|
|
|
tuser=s_axis_tuser_list[k],
|
|
|
|
pause=p,
|
|
|
|
name='source_%d' % k
|
|
|
|
))
|
2016-09-12 13:38:34 -07:00
|
|
|
|
|
|
|
sink = axis_ep.AXIStreamSink()
|
|
|
|
|
|
|
|
sink_logic = sink.create_logic(
|
|
|
|
clk,
|
|
|
|
rst,
|
2018-10-24 17:07:22 -07:00
|
|
|
tdata=m_axis_tdata,
|
|
|
|
tvalid=m_axis_tvalid,
|
|
|
|
tready=m_axis_tready,
|
|
|
|
tlast=m_axis_tlast,
|
|
|
|
tuser=m_axis_tuser,
|
2016-09-12 13:38:34 -07:00
|
|
|
pause=sink_pause,
|
|
|
|
name='sink'
|
|
|
|
)
|
2014-10-22 10:47:03 -07:00
|
|
|
|
|
|
|
# DUT
|
2016-09-12 13:38:34 -07:00
|
|
|
if os.system(build_cmd):
|
|
|
|
raise Exception("Error running build command")
|
|
|
|
|
|
|
|
dut = Cosimulation(
|
|
|
|
"vvp -m myhdl %s.vvp -lxt2" % testbench,
|
|
|
|
clk=clk,
|
|
|
|
rst=rst,
|
|
|
|
current_test=current_test,
|
|
|
|
|
2018-10-24 17:07:22 -07:00
|
|
|
s_axis_tdata=s_axis_tdata,
|
|
|
|
s_axis_tvalid=s_axis_tvalid,
|
|
|
|
s_axis_tready=s_axis_tready,
|
|
|
|
s_axis_tlast=s_axis_tlast,
|
|
|
|
s_axis_tuser=s_axis_tuser,
|
|
|
|
|
|
|
|
m_axis_tdata=m_axis_tdata,
|
|
|
|
m_axis_tvalid=m_axis_tvalid,
|
|
|
|
m_axis_tready=m_axis_tready,
|
|
|
|
m_axis_tlast=m_axis_tlast,
|
|
|
|
m_axis_tuser=m_axis_tuser,
|
2016-09-12 13:38:34 -07:00
|
|
|
|
|
|
|
tag=tag,
|
|
|
|
busy=busy
|
|
|
|
)
|
2014-10-22 10:47:03 -07:00
|
|
|
|
|
|
|
@always(delay(4))
|
|
|
|
def clkgen():
|
|
|
|
clk.next = not clk
|
|
|
|
|
|
|
|
@instance
|
|
|
|
def check():
|
|
|
|
yield delay(100)
|
|
|
|
yield clk.posedge
|
|
|
|
rst.next = 1
|
|
|
|
yield clk.posedge
|
|
|
|
rst.next = 0
|
|
|
|
yield clk.posedge
|
|
|
|
yield delay(100)
|
|
|
|
yield clk.posedge
|
|
|
|
|
|
|
|
yield clk.posedge
|
|
|
|
tag.next = 1
|
|
|
|
|
|
|
|
yield clk.posedge
|
|
|
|
print("test 1: test packet")
|
|
|
|
current_test.next = 1
|
|
|
|
|
2015-03-21 03:32:19 -07:00
|
|
|
test_frame_0 = axis_ep.AXIStreamFrame(b'\x00\xAA\xBB\xCC\xDD\x00')
|
|
|
|
test_frame_1 = axis_ep.AXIStreamFrame(b'\x01\xAA\xBB\xCC\xDD\x01')
|
|
|
|
test_frame_2 = axis_ep.AXIStreamFrame(b'\x02\xAA\xBB\xCC\xDD\x02')
|
|
|
|
test_frame_3 = axis_ep.AXIStreamFrame(b'\x03\xAA\xBB\xCC\xDD\x03')
|
2018-10-24 17:07:22 -07:00
|
|
|
source_list[0].send(test_frame_0)
|
|
|
|
source_list[1].send(test_frame_1)
|
|
|
|
source_list[2].send(test_frame_2)
|
|
|
|
source_list[3].send(test_frame_3)
|
2014-10-22 10:47:03 -07:00
|
|
|
|
2018-07-02 16:19:35 -07:00
|
|
|
yield sink.wait()
|
2016-09-12 13:38:34 -07:00
|
|
|
rx_frame = sink.recv()
|
2014-10-22 10:47:03 -07:00
|
|
|
|
2018-10-24 17:07:22 -07:00
|
|
|
assert rx_frame.data == struct.pack('<H', tag) + test_frame_0.data + test_frame_1.data + test_frame_2.data + test_frame_3.data
|
2014-10-22 10:47:03 -07:00
|
|
|
|
|
|
|
yield delay(100)
|
|
|
|
|
|
|
|
yield clk.posedge
|
|
|
|
print("test 2: longer packet")
|
|
|
|
current_test.next = 2
|
|
|
|
|
2015-03-21 03:32:19 -07:00
|
|
|
test_frame_0 = axis_ep.AXIStreamFrame(b'\x00' + bytearray(range(256)) + b'\x00')
|
|
|
|
test_frame_1 = axis_ep.AXIStreamFrame(b'\x01\xAA\xBB\xCC\xDD\x01')
|
|
|
|
test_frame_2 = axis_ep.AXIStreamFrame(b'\x02\xAA\xBB\xCC\xDD\x02')
|
|
|
|
test_frame_3 = axis_ep.AXIStreamFrame(b'\x03\xAA\xBB\xCC\xDD\x03')
|
2018-10-24 17:07:22 -07:00
|
|
|
source_list[0].send(test_frame_0)
|
|
|
|
source_list[1].send(test_frame_1)
|
|
|
|
source_list[2].send(test_frame_2)
|
|
|
|
source_list[3].send(test_frame_3)
|
2014-10-22 10:47:03 -07:00
|
|
|
|
2018-07-02 16:19:35 -07:00
|
|
|
yield sink.wait()
|
2016-09-12 13:38:34 -07:00
|
|
|
rx_frame = sink.recv()
|
2014-10-22 10:47:03 -07:00
|
|
|
|
2018-10-24 17:07:22 -07:00
|
|
|
assert rx_frame.data == struct.pack('<H', tag) + test_frame_0.data + test_frame_1.data + test_frame_2.data + test_frame_3.data
|
2014-10-22 10:47:03 -07:00
|
|
|
|
|
|
|
yield delay(100)
|
|
|
|
|
|
|
|
yield clk.posedge
|
|
|
|
print("test 3: test packet with pauses")
|
|
|
|
current_test.next = 3
|
|
|
|
|
2015-03-21 03:32:19 -07:00
|
|
|
test_frame_0 = axis_ep.AXIStreamFrame(b'\x00\xAA\xBB\xCC\xDD\x00')
|
|
|
|
test_frame_1 = axis_ep.AXIStreamFrame(b'\x01\xAA\xBB\xCC\xDD\x01')
|
|
|
|
test_frame_2 = axis_ep.AXIStreamFrame(b'\x02\xAA\xBB\xCC\xDD\x02')
|
|
|
|
test_frame_3 = axis_ep.AXIStreamFrame(b'\x03\xAA\xBB\xCC\xDD\x03')
|
2018-10-24 17:07:22 -07:00
|
|
|
source_list[0].send(test_frame_0)
|
|
|
|
source_list[1].send(test_frame_1)
|
|
|
|
source_list[2].send(test_frame_2)
|
|
|
|
source_list[3].send(test_frame_3)
|
2014-10-22 10:47:03 -07:00
|
|
|
yield clk.posedge
|
|
|
|
|
|
|
|
yield delay(64)
|
|
|
|
yield clk.posedge
|
2018-10-24 17:07:22 -07:00
|
|
|
source_pause_list[1].next = True
|
2014-10-22 10:47:03 -07:00
|
|
|
yield delay(32)
|
|
|
|
yield clk.posedge
|
2018-10-24 17:07:22 -07:00
|
|
|
source_pause_list[1].next = False
|
2014-10-22 10:47:03 -07:00
|
|
|
|
|
|
|
yield delay(64)
|
|
|
|
yield clk.posedge
|
|
|
|
sink_pause.next = True
|
|
|
|
yield delay(32)
|
|
|
|
yield clk.posedge
|
|
|
|
sink_pause.next = False
|
|
|
|
|
2018-07-02 16:19:35 -07:00
|
|
|
yield sink.wait()
|
2016-09-12 13:38:34 -07:00
|
|
|
rx_frame = sink.recv()
|
2014-10-22 10:47:03 -07:00
|
|
|
|
2018-10-24 17:07:22 -07:00
|
|
|
assert rx_frame.data == struct.pack('<H', tag) + test_frame_0.data + test_frame_1.data + test_frame_2.data + test_frame_3.data
|
2014-10-22 10:47:03 -07:00
|
|
|
|
|
|
|
yield delay(100)
|
|
|
|
|
|
|
|
yield clk.posedge
|
|
|
|
print("test 4: back-to-back packets")
|
|
|
|
current_test.next = 4
|
|
|
|
|
2015-03-21 03:32:19 -07:00
|
|
|
test_frame_0a = axis_ep.AXIStreamFrame(b'\x00\xAA\xBB\xCC\xDD\x00')
|
|
|
|
test_frame_0b = axis_ep.AXIStreamFrame(b'\x00\xAA\xBB\xCC\xDD\x00')
|
|
|
|
test_frame_1a = axis_ep.AXIStreamFrame(b'\x01\xAA\xBB\xCC\xDD\x01')
|
|
|
|
test_frame_1b = axis_ep.AXIStreamFrame(b'\x01\xAA\xBB\xCC\xDD\x01')
|
|
|
|
test_frame_2a = axis_ep.AXIStreamFrame(b'\x02\xAA\xBB\xCC\xDD\x02')
|
|
|
|
test_frame_2b = axis_ep.AXIStreamFrame(b'\x02\xAA\xBB\xCC\xDD\x02')
|
|
|
|
test_frame_3a = axis_ep.AXIStreamFrame(b'\x03\xAA\xBB\xCC\xDD\x03')
|
|
|
|
test_frame_3b = axis_ep.AXIStreamFrame(b'\x03\xAA\xBB\xCC\xDD\x03')
|
2018-10-24 17:07:22 -07:00
|
|
|
source_list[0].send(test_frame_0a)
|
|
|
|
source_list[0].send(test_frame_0b)
|
|
|
|
source_list[1].send(test_frame_1a)
|
|
|
|
source_list[1].send(test_frame_1b)
|
|
|
|
source_list[2].send(test_frame_2a)
|
|
|
|
source_list[2].send(test_frame_2b)
|
|
|
|
source_list[3].send(test_frame_3a)
|
|
|
|
source_list[3].send(test_frame_3b)
|
2014-10-22 10:47:03 -07:00
|
|
|
|
2018-07-02 16:19:35 -07:00
|
|
|
yield sink.wait()
|
2016-09-12 13:38:34 -07:00
|
|
|
rx_frame = sink.recv()
|
2014-10-22 10:47:03 -07:00
|
|
|
|
2018-10-24 17:07:22 -07:00
|
|
|
assert rx_frame.data == struct.pack('<H', tag) + test_frame_0a.data + test_frame_1a.data + test_frame_2a.data + test_frame_3a.data
|
2014-10-22 10:47:03 -07:00
|
|
|
|
2018-07-02 16:19:35 -07:00
|
|
|
yield sink.wait()
|
2016-09-12 13:38:34 -07:00
|
|
|
rx_frame = sink.recv()
|
2014-10-22 10:47:03 -07:00
|
|
|
|
2018-10-24 17:07:22 -07:00
|
|
|
assert rx_frame.data == struct.pack('<H', tag) + test_frame_0b.data + test_frame_1b.data + test_frame_2b.data + test_frame_3b.data
|
2014-10-22 10:47:03 -07:00
|
|
|
|
|
|
|
yield delay(100)
|
|
|
|
|
|
|
|
yield clk.posedge
|
|
|
|
print("test 5: alternate pause source")
|
|
|
|
current_test.next = 5
|
|
|
|
|
2015-03-21 03:32:19 -07:00
|
|
|
test_frame_0a = axis_ep.AXIStreamFrame(b'\x00\xAA\xBB\xCC\xDD\x00')
|
|
|
|
test_frame_0b = axis_ep.AXIStreamFrame(b'\x00\xAA\xBB\xCC\xDD\x00')
|
|
|
|
test_frame_1a = axis_ep.AXIStreamFrame(b'\x01\xAA\xBB\xCC\xDD\x01')
|
|
|
|
test_frame_1b = axis_ep.AXIStreamFrame(b'\x01\xAA\xBB\xCC\xDD\x01')
|
|
|
|
test_frame_2a = axis_ep.AXIStreamFrame(b'\x02\xAA\xBB\xCC\xDD\x02')
|
|
|
|
test_frame_2b = axis_ep.AXIStreamFrame(b'\x02\xAA\xBB\xCC\xDD\x02')
|
|
|
|
test_frame_3a = axis_ep.AXIStreamFrame(b'\x03\xAA\xBB\xCC\xDD\x03')
|
|
|
|
test_frame_3b = axis_ep.AXIStreamFrame(b'\x03\xAA\xBB\xCC\xDD\x03')
|
2018-10-24 17:07:22 -07:00
|
|
|
source_list[0].send(test_frame_0a)
|
|
|
|
source_list[0].send(test_frame_0b)
|
|
|
|
source_list[1].send(test_frame_1a)
|
|
|
|
source_list[1].send(test_frame_1b)
|
|
|
|
source_list[2].send(test_frame_2a)
|
|
|
|
source_list[2].send(test_frame_2b)
|
|
|
|
source_list[3].send(test_frame_3a)
|
|
|
|
source_list[3].send(test_frame_3b)
|
2014-10-22 10:47:03 -07:00
|
|
|
yield clk.posedge
|
|
|
|
|
2018-10-24 17:07:22 -07:00
|
|
|
while s_axis_tvalid or m_axis_tvalid:
|
2014-10-22 10:47:03 -07:00
|
|
|
yield clk.posedge
|
|
|
|
yield clk.posedge
|
2019-03-07 22:51:40 -08:00
|
|
|
for k in range(S_COUNT):
|
|
|
|
source_pause_list[k].next = False
|
2014-10-22 10:47:03 -07:00
|
|
|
yield clk.posedge
|
2019-03-07 22:51:40 -08:00
|
|
|
for k in range(S_COUNT):
|
|
|
|
source_pause_list[k].next = True
|
2014-10-22 10:47:03 -07:00
|
|
|
yield clk.posedge
|
|
|
|
|
2019-03-07 22:51:40 -08:00
|
|
|
for k in range(S_COUNT):
|
|
|
|
source_pause_list[k].next = False
|
|
|
|
|
2018-07-02 16:19:35 -07:00
|
|
|
yield sink.wait()
|
2016-09-12 13:38:34 -07:00
|
|
|
rx_frame = sink.recv()
|
2014-10-22 10:47:03 -07:00
|
|
|
|
2018-10-24 17:07:22 -07:00
|
|
|
assert rx_frame.data == struct.pack('<H', tag) + test_frame_0a.data + test_frame_1a.data + test_frame_2a.data + test_frame_3a.data
|
2014-10-22 10:47:03 -07:00
|
|
|
|
2018-07-02 16:19:35 -07:00
|
|
|
yield sink.wait()
|
2016-09-12 13:38:34 -07:00
|
|
|
rx_frame = sink.recv()
|
2014-10-22 10:47:03 -07:00
|
|
|
|
2018-10-24 17:07:22 -07:00
|
|
|
assert rx_frame.data == struct.pack('<H', tag) + test_frame_0b.data + test_frame_1b.data + test_frame_2b.data + test_frame_3b.data
|
2014-10-22 10:47:03 -07:00
|
|
|
|
|
|
|
yield delay(100)
|
|
|
|
|
|
|
|
yield clk.posedge
|
|
|
|
print("test 6: alternate pause sink")
|
|
|
|
current_test.next = 6
|
|
|
|
|
2015-03-21 03:32:19 -07:00
|
|
|
test_frame_0a = axis_ep.AXIStreamFrame(b'\x00\xAA\xBB\xCC\xDD\x00')
|
|
|
|
test_frame_0b = axis_ep.AXIStreamFrame(b'\x00\xAA\xBB\xCC\xDD\x00')
|
|
|
|
test_frame_1a = axis_ep.AXIStreamFrame(b'\x01\xAA\xBB\xCC\xDD\x01')
|
|
|
|
test_frame_1b = axis_ep.AXIStreamFrame(b'\x01\xAA\xBB\xCC\xDD\x01')
|
|
|
|
test_frame_2a = axis_ep.AXIStreamFrame(b'\x02\xAA\xBB\xCC\xDD\x02')
|
|
|
|
test_frame_2b = axis_ep.AXIStreamFrame(b'\x02\xAA\xBB\xCC\xDD\x02')
|
|
|
|
test_frame_3a = axis_ep.AXIStreamFrame(b'\x03\xAA\xBB\xCC\xDD\x03')
|
|
|
|
test_frame_3b = axis_ep.AXIStreamFrame(b'\x03\xAA\xBB\xCC\xDD\x03')
|
2018-10-24 17:07:22 -07:00
|
|
|
source_list[0].send(test_frame_0a)
|
|
|
|
source_list[0].send(test_frame_0b)
|
|
|
|
source_list[1].send(test_frame_1a)
|
|
|
|
source_list[1].send(test_frame_1b)
|
|
|
|
source_list[2].send(test_frame_2a)
|
|
|
|
source_list[2].send(test_frame_2b)
|
|
|
|
source_list[3].send(test_frame_3a)
|
|
|
|
source_list[3].send(test_frame_3b)
|
2014-10-22 10:47:03 -07:00
|
|
|
yield clk.posedge
|
|
|
|
|
2018-10-24 17:07:22 -07:00
|
|
|
while s_axis_tvalid or m_axis_tvalid:
|
2014-10-22 10:47:03 -07:00
|
|
|
sink_pause.next = True
|
|
|
|
yield clk.posedge
|
|
|
|
yield clk.posedge
|
|
|
|
yield clk.posedge
|
|
|
|
sink_pause.next = False
|
|
|
|
yield clk.posedge
|
|
|
|
|
2018-07-02 16:19:35 -07:00
|
|
|
yield sink.wait()
|
2016-09-12 13:38:34 -07:00
|
|
|
rx_frame = sink.recv()
|
2014-10-22 10:47:03 -07:00
|
|
|
|
2018-10-24 17:07:22 -07:00
|
|
|
assert rx_frame.data == struct.pack('<H', tag) + test_frame_0a.data + test_frame_1a.data + test_frame_2a.data + test_frame_3a.data
|
2014-10-22 10:47:03 -07:00
|
|
|
|
2018-07-02 16:19:35 -07:00
|
|
|
yield sink.wait()
|
2016-09-12 13:38:34 -07:00
|
|
|
rx_frame = sink.recv()
|
2014-10-22 10:47:03 -07:00
|
|
|
|
2018-10-24 17:07:22 -07:00
|
|
|
assert rx_frame.data == struct.pack('<H', tag) + test_frame_0b.data + test_frame_1b.data + test_frame_2b.data + test_frame_3b.data
|
2014-10-22 10:47:03 -07:00
|
|
|
|
|
|
|
yield delay(100)
|
|
|
|
|
|
|
|
yield clk.posedge
|
|
|
|
print("test 7: tuser assert")
|
|
|
|
current_test.next = 7
|
|
|
|
|
2015-03-21 03:32:19 -07:00
|
|
|
test_frame_0 = axis_ep.AXIStreamFrame(b'\x00\xAA\xBB\xCC\xDD\x00')
|
|
|
|
test_frame_1 = axis_ep.AXIStreamFrame(b'\x01\xAA\xBB\xCC\xDD\x01')
|
|
|
|
test_frame_2 = axis_ep.AXIStreamFrame(b'\x02\xAA\xBB\xCC\xDD\x02')
|
|
|
|
test_frame_3 = axis_ep.AXIStreamFrame(b'\x03\xAA\xBB\xCC\xDD\x03')
|
2017-11-21 00:16:15 -08:00
|
|
|
test_frame_0.last_cycle_user = 1
|
2018-10-24 17:07:22 -07:00
|
|
|
source_list[0].send(test_frame_0)
|
|
|
|
source_list[1].send(test_frame_1)
|
|
|
|
source_list[2].send(test_frame_2)
|
|
|
|
source_list[3].send(test_frame_3)
|
2014-10-22 10:47:03 -07:00
|
|
|
|
2018-07-02 16:19:35 -07:00
|
|
|
yield sink.wait()
|
2016-09-12 13:38:34 -07:00
|
|
|
rx_frame = sink.recv()
|
2014-10-22 10:47:03 -07:00
|
|
|
|
2018-10-24 17:07:22 -07:00
|
|
|
assert rx_frame.data == struct.pack('<H', tag) + test_frame_0.data + test_frame_1.data + test_frame_2.data + test_frame_3.data
|
2017-11-21 00:16:15 -08:00
|
|
|
assert rx_frame.last_cycle_user
|
2014-10-22 10:47:03 -07:00
|
|
|
|
|
|
|
yield delay(100)
|
|
|
|
|
|
|
|
raise StopSimulation
|
|
|
|
|
2018-06-13 22:26:10 -07:00
|
|
|
return instances()
|
2014-10-22 10:47:03 -07:00
|
|
|
|
|
|
|
def test_bench():
|
|
|
|
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
sim = Simulation(bench())
|
|
|
|
sim.run()
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
print("Running test...")
|
|
|
|
test_bench()
|
|
|
|
|