You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

test_hp_dma.py 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/usr/bin/env python
  2. from migen import *
  3. from hp_dma import *
  4. def test(dut):
  5. yield from dut.addr_base.write(0x12340)
  6. yield from dut.n_bursts.write(3)
  7. for _ in range(5):
  8. yield
  9. yield dut.bus.ar.ready.eq(1)
  10. yield
  11. yield from dut.trigger.write(1)
  12. def deliver_read_word(w, last=False):
  13. yield dut.bus.r.data.eq(w)
  14. yield dut.bus.r.valid.eq(1)
  15. if last:
  16. yield dut.bus.r.last.eq(1)
  17. for _ in range(100):
  18. yield
  19. if (yield dut.bus.r.ready):
  20. yield dut.bus.r.valid.eq(0)
  21. yield dut.bus.r.last.eq(0)
  22. break
  23. yield
  24. N=(yield dut.bus.ar.len)+1
  25. for _ in range( (yield dut.n_bursts.storage)+1 ):
  26. for i in range(N):
  27. yield from deliver_read_word(2*i | (2*i+1)<<32, last=i==N-1)
  28. for _ in range(5):
  29. yield
  30. for _ in range(10):
  31. yield
  32. if __name__ == "__main__":
  33. dut = HP_DMA_READ()
  34. run_simulation(dut, test(dut), vcd_name="test.vcd", clocks={"sys": 8})