def generator(dut): yield dut.reset.eq(1) yield yield dut.reset.eq(0) for i in range(512): yield dut.sink.data.eq(swap_bytes(seed_to_data(i, True), 4)) yield if i >= dut.latency: reference = model.scramble(seed_to_data(i-dut.latency, True), 32) reference = swap_bytes(reference, 4) if (yield dut.source.data) != reference: dut.errors += 1