Skip to content

Commit b00a654

Browse files
committed
modules/zstd: improve zstd cocotb testbench
Signed-off-by: Pawel Czarnecki <[email protected]>
1 parent 4b1db47 commit b00a654

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

xls/modules/zstd/zstd_dec_cocotb_test.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,8 @@ async def test_decoder(dut, test_cases, block_type):
240240

241241
scoreboard = Scoreboard(dut)
242242

243-
terminate = Event()
244-
set_termination_event(monitor_notify, terminate, 1)
243+
assert_notify = Event()
244+
set_termination_event(monitor_notify, assert_notify, 1)
245245

246246
cpu = AxiMaster(csr_bus, dut.clk, dut.rst)
247247

@@ -251,24 +251,27 @@ async def test_decoder(dut, test_cases, block_type):
251251
mem_size = MAX_ENCODED_FRAME_SIZE_B
252252
ibuf_addr = 0x0
253253
obuf_addr = mem_size // 2
254+
assert_expected_output = Event()
254255
GenerateFrame(i+1, block_type, encoded.name)
255256
expected_decoded_frame = get_decoded_frame_bytes(encoded)
256257
print("Expected decoded frame: {}".format(expected_decoded_frame))
257258
expected_output_packets = generate_expected_output(expected_decoded_frame)
258259
print("Expected output: {}".format(expected_output_packets))
260+
set_termination_event(monitor_output, assert_expected_output, len(expected_output_packets))
259261
scoreboard.add_interface(monitor_output, expected_output_packets)
260262
encoded.close()
261263
memory = AxiRamFromFile(bus=memory_bus, clock=dut.clk, reset=dut.rst, path=encoded.name, size=mem_size)
262264
memory.hexdump(0, mem_size)
263265
await configure_decoder(cpu, ibuf_addr, obuf_addr)
264266
await start_decoder(cpu)
265267
##await mock_decoder(dut, memory, memory_bus, csr, csr_bus, encoded.name, obuf_addr)
266-
#await terminate.wait()
267-
#await wait_for_idle(cpu)
268+
await assert_notify.wait()
269+
await assert_expected_output.wait()
270+
await wait_for_idle(cpu)
268271
#decoded_frame = memory.read(obuf_addr, memory.size-obuf_addr)
269272
#assert decoded_frame == expected_decoded_frame
270273

271-
await ClockCycles(dut.clk, 5000)
274+
await ClockCycles(dut.clk, 20)
272275

273276
@cocotb.test(timeout_time=50, timeout_unit="ms")
274277
async def zstd_csr_test(dut):

0 commit comments

Comments
 (0)