create.py 987 B

12345678910111213141516171819202122232425262728293031
  1. # Include definition of the nodes
  2. from nodes import *
  3. # Include definition of the graph
  4. from graph 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. # Compute a static scheduling of the graph
  15. # The size of FIFO is also computed
  16. scheduling = the_graph.computeSchedule(config=conf)
  17. # Print some statistics about the compute schedule
  18. # and the memory usage
  19. print("Schedule length = %d" % scheduling.scheduleLength)
  20. print("Memory usage %d bytes" % scheduling.memory)
  21. # Generate the C++ code for the static scheduler
  22. scheduling.ccode("generated",conf)
  23. # Generate a graphviz representation of the graph
  24. with open("simple.dot","w") as f:
  25. scheduling.graphviz(f)