create_sync.py 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. # Include definition of the nodes
  2. from nodes import *
  3. # Include definition of the graph
  4. from graph_complex import *
  5. # Create a configuration object
  6. conf=Configuration()
  7. # The number of schedule iteration is limited to 1
  8. # to prevent the scheduling from running forever
  9. # (which should be the case for a stream computation)
  10. conf.debugLimit=1
  11. # Disable inclusion of CMSIS-DSP headers so that we don't have
  12. # to recompile CMSIS-DSP for such a simple example
  13. conf.CMSISDSP = False
  14. conf.appNodesCName = "ComplexAppNodes.h"
  15. # Compute a static scheduling of the graph
  16. # The size of FIFO is also computed
  17. scheduling = the_graph.computeSchedule(config=conf)
  18. # Print some statistics about the compute schedule
  19. # and the memory usage
  20. print("Schedule length = %d" % scheduling.scheduleLength)
  21. print("Memory usage %d bytes" % scheduling.memory)
  22. # Generate the C++ code for the static scheduler
  23. scheduling.ccode("sync",conf)
  24. # Generate a graphviz representation of the graph
  25. with open("dot/sync.dot","w") as f:
  26. scheduling.graphviz(f)