@pytest.mark.parametrize( "stall_prob,latency",
                          [ (0,0), (0.2,2), (0.5,4) ] )
def test( dump_vcd, stall_prob, latency ):

  # Test data we want to write into memory

  data = [ random.randint(0,0xffffffff) for _ in range(8) ]

  # Convert test data into byte array

  data_bytes = struct.pack("<{}I".format(len(data)),*data)

  # Instantiate and elaborate the model

  th = TestHarness( 0x1000, 0x2000, len(data_bytes), stall_prob, latency )
  th.vcd_file = dump_vcd
  th.elaborate()

  # Write the data into the test memory

  th.mem.write_mem( 0x1000, data_bytes )

  # Create a simulator using the simulation tool

  sim = SimulationTool( th )

  # Run the simulation

  print()

  sim.reset()
  while not th.done():
    sim.print_line_trace()
    sim.cycle()

  # Add a couple extra ticks so that the VCD dump is nicer

  sim.cycle()
  sim.cycle()
  sim.cycle()

  # Read the data back out of the test memory

  result_bytes = th.mem.read_mem( 0x2000, len(data_bytes) )

  # Convert result bytes into list of ints

  result = list(struct.unpack("<{}I".format(len(data)),buffer(result_bytes)))

  # Compare result to original data

  assert result == data
dataset/ETHPy150Open cornell-brg/pymtl/pclib/fl/BytesMemPortAdapter_test.py/test/original