Skip to content

Commit e0da181

Browse files
committed
More tests for pipeline FIFO
1 parent 0b5fc5b commit e0da181

File tree

1 file changed

+91
-1
lines changed

1 file changed

+91
-1
lines changed

tb/axis_pipeline_fifo/test_axis_pipeline_fifo.py

Lines changed: 91 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,90 @@ async def run_test_tuser_assert(dut):
131131
await RisingEdge(dut.clk)
132132

133133

134+
async def run_test_init_sink_pause(dut):
135+
136+
tb = TB(dut)
137+
138+
await tb.reset()
139+
140+
tb.sink.pause = True
141+
142+
test_data = bytearray(itertools.islice(itertools.cycle(range(256)), 32))
143+
test_frame = AxiStreamFrame(test_data)
144+
await tb.source.send(test_frame)
145+
146+
for k in range(64):
147+
await RisingEdge(dut.clk)
148+
149+
tb.sink.pause = False
150+
151+
rx_frame = await tb.sink.recv()
152+
153+
assert rx_frame.tdata == test_data
154+
assert not rx_frame.tuser
155+
156+
assert tb.sink.empty()
157+
158+
await RisingEdge(dut.clk)
159+
await RisingEdge(dut.clk)
160+
161+
162+
async def run_test_init_sink_pause_reset(dut):
163+
164+
tb = TB(dut)
165+
166+
await tb.reset()
167+
168+
tb.sink.pause = True
169+
170+
test_data = bytearray(itertools.islice(itertools.cycle(range(256)), 32))
171+
test_frame = AxiStreamFrame(test_data)
172+
await tb.source.send(test_frame)
173+
174+
for k in range(64):
175+
await RisingEdge(dut.clk)
176+
177+
await tb.reset()
178+
179+
tb.sink.pause = False
180+
181+
for k in range(64):
182+
await RisingEdge(dut.clk)
183+
184+
assert tb.sink.empty()
185+
186+
await RisingEdge(dut.clk)
187+
await RisingEdge(dut.clk)
188+
189+
190+
async def run_test_overflow(dut):
191+
192+
tb = TB(dut)
193+
194+
await tb.reset()
195+
196+
tb.sink.pause = True
197+
198+
test_data = bytearray(itertools.islice(itertools.cycle(range(256)), 2048))
199+
test_frame = AxiStreamFrame(test_data)
200+
await tb.source.send(test_frame)
201+
202+
for k in range(2048):
203+
await RisingEdge(dut.clk)
204+
205+
tb.sink.pause = False
206+
207+
rx_frame = await tb.sink.recv()
208+
209+
assert rx_frame.tdata == test_data
210+
assert not rx_frame.tuser
211+
212+
assert tb.sink.empty()
213+
214+
await RisingEdge(dut.clk)
215+
await RisingEdge(dut.clk)
216+
217+
134218
async def run_stress_test(dut, idle_inserter=None, backpressure_inserter=None):
135219

136220
tb = TB(dut)
@@ -196,7 +280,13 @@ def incrementing_payload(length):
196280
factory.add_option("backpressure_inserter", [None, cycle_pause])
197281
factory.generate_tests()
198282

199-
for test in [run_test_tuser_assert]:
283+
for test in [
284+
run_test_tuser_assert,
285+
run_test_init_sink_pause,
286+
run_test_init_sink_pause_reset,
287+
run_test_overflow
288+
]:
289+
200290
factory = TestFactory(test)
201291
factory.generate_tests()
202292

0 commit comments

Comments
 (0)