test_fastbus_asm.S 904 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. This little bit of code is executed in-place by one CPU, but copied to a different memory region
  3. by the other CPU. Make sure it stays position-independent.
  4. */
  5. .text
  6. .align 4
  7. .global test_fastbus_cp
  8. .type test_fastbus_cp,@function
  9. //Args:
  10. //a2 - fifo addr
  11. //a3 - buf addr
  12. //a4 - len
  13. //a5 - ptr to int to use
  14. test_fastbus_cp:
  15. entry a1,64
  16. back:
  17. beqi a4, 0, out //check if loop done
  18. s32i a4, a5, 0 //store value, for shits and/or giggles
  19. memw //make sure write happens
  20. l32i a4, a5, 0 //load value again, to thwart any prediction in the pipeline
  21. bbsi a4, 0, pred //Random jump to check predictive reads. Both branches should do the same.
  22. l32i a6, a2, 0 //read from fifo 1
  23. j predout
  24. pred:
  25. l32i a6, a2, 0 //read from fifo 2
  26. predout:
  27. s8i a6, a3, 0 //store result
  28. addi a3, a3, 1 //inc ptr
  29. addi a4, a4, -1 //next
  30. j back //loop again
  31. out:
  32. retw //and we are done