sched.py 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #
  2. # Generated with CMSIS-DSP SDF 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.sdf.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.zeros(FIFOSIZE0,dtype=np.int16)
  19. FIFOSIZE1=128
  20. buf1=np.zeros(FIFOSIZE1,dtype=np.int16)
  21. def scheduler():
  22. sdfError=0
  23. nbSchedule=0
  24. #
  25. # Create FIFOs objects
  26. #
  27. fifo0=FIFO(FIFOSIZE0,buf0)
  28. fifo1=FIFO(FIFOSIZE1,buf1)
  29. #
  30. # Create node objects
  31. #
  32. proc = Processing(128,128,fifo0,fifo1)
  33. sink = VHTSink(128,fifo1,0)
  34. src = VHTSource(128,fifo0,0)
  35. while(sdfError==0):
  36. nbSchedule = nbSchedule + 1
  37. sdfError = src.run()
  38. if sdfError < 0:
  39. break
  40. sdfError = proc.run()
  41. if sdfError < 0:
  42. break
  43. sdfError = sink.run()
  44. if sdfError < 0:
  45. break
  46. return(nbSchedule,sdfError)