|
|
@@ -1,4 +1,4 @@
|
|
|
-# Generic and functions bodes
|
|
|
+# Generic and functions nodes
|
|
|
|
|
|
The generic and function nodes are the basic nodes that you use to create other kind of nodes in the graph.
|
|
|
|
|
|
@@ -16,7 +16,7 @@ There are 3 other classes that can be used to create new nodes from functions:
|
|
|
* `Binary`
|
|
|
* `Dsp`
|
|
|
|
|
|
-## Generic Nodes
|
|
|
+# Generic Nodes
|
|
|
|
|
|
Any new kind of node must inherit from one of those classes. Those classes are providing the methods `addInput` and/or `addOutput` to define new IOs.
|
|
|
|
|
|
@@ -38,7 +38,7 @@ class ProcessingNode(GenericNode):
|
|
|
|
|
|
See the [simple](../examples/simple/README.md) example for more explanation about how to define a new node.
|
|
|
|
|
|
-### Methods
|
|
|
+## Methods
|
|
|
|
|
|
The constructor of the node is using the `addInput` and/or `addOutput` to define new IOs.
|
|
|
|
|
|
@@ -66,16 +66,17 @@ def typeName(self):
|
|
|
|
|
|
This method defines the name of the C++ class implementing the wrapper for this node.
|
|
|
|
|
|
-### Datatypes
|
|
|
+# Datatypes
|
|
|
|
|
|
Datatypes for the IOs are inheriting from `CGStaticType`.
|
|
|
|
|
|
-Currently there are two classes defined:
|
|
|
+Currently there are 3 classes defined:
|
|
|
|
|
|
* `CType` for the standard CMSIS-DSP types
|
|
|
* `CStructType` for a C struct
|
|
|
+* `PythonClassType` to create structured datatype for the Python scheduler
|
|
|
|
|
|
-#### CType
|
|
|
+## CType
|
|
|
|
|
|
You create such a type with `CType(id)` where `id` is one of the constant coming from the Python wrapper:
|
|
|
|
|
|
@@ -94,25 +95,28 @@ You create such a type with `CType(id)` where `id` is one of the constant coming
|
|
|
|
|
|
For instance, to define a `float32_t` type for an IO you can use `CType(F32)`
|
|
|
|
|
|
-#### CStructType
|
|
|
+## CStructType
|
|
|
|
|
|
The constructor has the following definition
|
|
|
|
|
|
```python
|
|
|
-def __init__(self,name,python_name,size_in_bytes):
|
|
|
+def __init__(self,name,size_in_bytes):
|
|
|
```
|
|
|
|
|
|
* `name` is the name of the C struct
|
|
|
-* `python_name` is the name of the Python class implementing this type (when you generate a Python schedule)
|
|
|
-* `size_in_bytes` is the size of the struct. It should take into account padding. It is used in case of buffer sharing since the datatype of the shared buffer is `int8_t`. The Python script must be able to compute the size of those buffers and needs to know the size of the structure.
|
|
|
+* `size_in_bytes` is the size of the struct. It should take into account padding. It is used in case of buffer sharing since the datatype of the shared buffer is `int8_t`. The Python script must be able to compute the size of those buffers and needs to know the size of the structure including padding.
|
|
|
|
|
|
-In Python, there is no `struct`. This datatype is mapped to an object. Object have reference type. Compute graph FIFOs are assuming a value type semantic.
|
|
|
+## PythonClassType
|
|
|
|
|
|
-As consequence, in Python side you should never copy those structs since it would copy the reference. You should instead copy the members of the struct.
|
|
|
+```python
|
|
|
+def __init__(self,python_name)
|
|
|
+```
|
|
|
+
|
|
|
+In Python, there is no `struct`. This datatype is mapped to an object. Object have reference type. Compute graph FIFOs are assuming a value type semantic.
|
|
|
|
|
|
-If you don't plan on generating a Python scheduler, you can just use whatever name you want for the `python_name`. It will be ignored by the C++ code generation.
|
|
|
+As consequence, in Python side you should never copy those structs since it would copy the reference. You should instead copy the members of the struct and they should be scalar values.
|
|
|
|
|
|
-## Function and constant nodes
|
|
|
+# Function and constant nodes
|
|
|
|
|
|
A Compute graph C++ wrapper is useful when the software components you use have a state that needs to be initialized in the C++ constructor, and preserved between successive calls to the `run` method of the wrapper.
|
|
|
|