create.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  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. # Enable generation of event recorder calls in the C++
  15. conf.eventRecorder = True
  16. # Compute a static scheduling of the graph
  17. # The size of FIFO is also computed
  18. scheduling = the_graph.computeSchedule(config=conf)
  19. # Print some statistics about the compute schedule
  20. # and the memory usage
  21. print("Schedule length = %d" % scheduling.scheduleLength)
  22. print("Memory usage %d bytes" % scheduling.memory)
  23. # Generate the C++ code for the static scheduler
  24. scheduling.ccode("generated",conf)
  25. # Generate a graphviz representation of the graph
  26. with open("event_recorder.dot","w") as f:
  27. scheduling.graphviz(f)