sched.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #
  2. # Generated with CMSIS-DSP Compute Graph Scripts.
  3. # The generated code is not covered by CMSIS-DSP license.
  4. #
  5. # The support classes and code is covered by CMSIS-DSP license.
  6. #
  7. import sys
  8. import numpy as np
  9. import cmsisdsp as dsp
  10. from cmsisdsp.cg.nodes.simu import *
  11. from appnodes import *
  12. from custom import *
  13. DEBUGSCHED=False
  14. #
  15. # FIFO buffers
  16. #
  17. FIFOSIZE0=128
  18. buf0=np.empty(FIFOSIZE0,dtype=np.int16)
  19. for i in range(FIFOSIZE0):
  20. buf0[i] = 0
  21. FIFOSIZE1=128
  22. buf1=np.empty(FIFOSIZE1,dtype=np.int16)
  23. for i in range(FIFOSIZE1):
  24. buf1[i] = 0
  25. def scheduler():
  26. cgStaticError=0
  27. nbSchedule=0
  28. #
  29. # Create FIFOs objects
  30. #
  31. fifo0=FIFO(FIFOSIZE0,buf0)
  32. fifo1=FIFO(FIFOSIZE1,buf1)
  33. #
  34. # Create node objects
  35. #
  36. proc = Processing(128,128,fifo0,fifo1)
  37. sink = VHTSink(128,fifo1,0)
  38. src = VHTSource(128,fifo0,0)
  39. while(cgStaticError==0):
  40. nbSchedule = nbSchedule + 1
  41. cgStaticError = src.run()
  42. if cgStaticError < 0:
  43. break
  44. cgStaticError = proc.run()
  45. if cgStaticError < 0:
  46. break
  47. cgStaticError = sink.run()
  48. if cgStaticError < 0:
  49. break
  50. return(nbSchedule,cgStaticError)