diff --git a/cmsisdsp/cg/static/scheduler/config.py b/cmsisdsp/cg/static/scheduler/config.py index c5039d91..fac56072 100644 --- a/cmsisdsp/cg/static/scheduler/config.py +++ b/cmsisdsp/cg/static/scheduler/config.py @@ -54,7 +54,7 @@ class Configuration: # Prefix to add before the global FIFO buffer names self.prefix = "" - # Experimental so disbaled by default + # Experimental so disabled by default self.memoryOptimization = False # Path to CG module for Python simu diff --git a/cmsisdsp/cg/static/scheduler/description.py b/cmsisdsp/cg/static/scheduler/description.py index 5d712d89..9ae1edb8 100644 --- a/cmsisdsp/cg/static/scheduler/description.py +++ b/cmsisdsp/cg/static/scheduler/description.py @@ -359,7 +359,7 @@ class Graph(): allBuffers=[] # Compute a graph describing when FIFOs are used at the same time - # The use graph coloring to allocate buffer to those FIFOs. + # Then use graph coloring to allocate buffer to those FIFOs. # Then size the buffer based on the longest FIFO using it if config.memoryOptimization: G = nx.Graph() @@ -376,7 +376,7 @@ class Graph(): currentTime=0 while currentTime<=maxTime: # Remove fifo no more active. - # Thei stop time < currenTime + # Their stop time < currentTime toDelete=[] for k in active: start,stop=k._liveInterval @@ -394,9 +394,11 @@ class Graph(): start,stop=fifo._liveInterval # If a src -> node -> dst # At time t, node will read for src and the stop time - # will be currentTime t. + # will be currentTime t because once read + # the buffer can be reused. # And it will write to dst and the start time will be - # currentTime + # currentTime because once written the buffer + # cannot be used again until it has been read. # So, src and dst are both live at this time. # Which means the condition on the stop time must be # stop >= currentTime and not a strict comparison @@ -410,6 +412,7 @@ class Graph(): # To debug and display the graph if False: + import matplotlib.pyplot as plt labels={} for n in G.nodes: labels[n]="%s -> %s" % (n.src.owner.nodeName,n.dst.owner.nodeName) @@ -450,6 +453,9 @@ class Graph(): sharedA = FifoBuffer(theID,CType(UINT8),maxSizes[theID]) allBuffers.append(sharedA) + + # bufferID must start after all shared buffers + bufferID = bufferID + 1 for fifo in allFIFOs: # Use shared buffer if memory optimization if fifo.isArray and config.memoryOptimization: @@ -472,6 +478,7 @@ class Graph(): #for fifo in allFIFOs: # fifo.dump() + return(allBuffers) diff --git a/cmsisdsp/cg/static/scheduler/templates/codeSwitch.cpp b/cmsisdsp/cg/static/scheduler/templates/codeSwitch.cpp index 35155b69..d6685e43 100644 --- a/cmsisdsp/cg/static/scheduler/templates/codeSwitch.cpp +++ b/cmsisdsp/cg/static/scheduler/templates/codeSwitch.cpp @@ -3,8 +3,7 @@ {% block schedArray %} /* -Description of the scheduling. It is a list of nodes to call. -The values are indexes in the previous array. +Description of the scheduling. */ static unsigned int schedule[{{schedLen}}]= diff --git a/cmsisdsp/version.py b/cmsisdsp/version.py index 87108abf..6ed13a85 100755 --- a/cmsisdsp/version.py +++ b/cmsisdsp/version.py @@ -1,2 +1,2 @@ # Python wrapper version -__version__ = "1.7.0" +__version__ = "1.7.1"