nodes.py 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # Include definitions from the Python package
  2. from cmsisdsp.cg.scheduler import GenericNode,GenericSink,GenericSource
  3. class Sink(GenericSink):
  4. """
  5. Definition of a Sink node for the graph
  6. Parameters
  7. ----------
  8. name : str
  9. Name of the C variable identifying this node
  10. in the C code
  11. theType : CGStaticType
  12. The datatype for the input
  13. inLength : int
  14. The number of samples consumed by input
  15. """
  16. def __init__(self,name,theType,inLength):
  17. GenericSink.__init__(self,name)
  18. self.addInput("i",theType,inLength)
  19. @property
  20. def typeName(self):
  21. """The name of the C++ class implementing this node"""
  22. return "Sink"
  23. class Source(GenericSource):
  24. """
  25. Definition of a Source node for the graph
  26. Parameters
  27. ----------
  28. name : str
  29. Name of the C variable identifying this node
  30. in the C code
  31. theType : CGStaticType
  32. The datatype for the output
  33. outLength : int
  34. The number of samples produced on output
  35. """
  36. def __init__(self,name,theType,outLength):
  37. GenericSource.__init__(self,name)
  38. self.addOutput("o",theType,outLength)
  39. @property
  40. def typeName(self):
  41. """The name of the C++ class implementing this node"""
  42. return "Source"