1

Topic: Any downside to composite blocks?

I really like using the composite blocks because it really helps to keep the diagram clean and readable.  Plus I like using the EN input to control conditions of when that section of the input is executed.

I don't see many examples posted that use the composite blocks, and I was just wondering if there is any downside (performance or otherwise) to them. 
What about nested composite blocks?

2

Re: Any downside to composite blocks?

Composite blocks are a relatively new feature in the CannyLab. And I like using the composite blocks too! But as for me, a flat diagram is more visual when you need an algorithm implementation illustration or some example.

Composite blocks without the EN/nRST input have zero overhead. Composite blocks with the EN/nRST input have a minimum overhead comparable to adding an additional "Equal to" functional block to the diagram. Nesting composite blocks by itself does not append any additional overhead.

Also, you can always check the effect of adding one or another element on the controller's ROM/RAM consumption by running the simulator.

Post's attachments

cannylab_simulator_2.png, 105.17 kb, 727 x 339
cannylab_simulator_2.png 105.17 kb, 101 downloads since 2022-04-14 

3

Re: Any downside to composite blocks?

Thanks Konstantin.  The composite blocks are nice, especially if you're used to using functions in programming languages.  Or in my case, database stored procedures.  I like having a certain piece of logic neatly contained in a block where you can provide inputs and get a computed output.

I definitely realized that there would be a == check on the entry point, but doing this check can save me from not executing multiple steps inside the composite block when it isn't necessary.

Can you explain what the nRST input is for?  That's not mentionedin the documentation.

4

Re: Any downside to composite blocks?

You're right, the documentation is a bit behind. We will fix it.
The nRST stands for "Negative Reset", 1=Run, 0=Reset. This is similar to "EN" but with all internal states set to zero when the this special input is 0.
This is useful when you want the composite block to be executed the next time it's EN = 1 as it was the first time. Or/and that all outputs of the composite block be set to zero when EN = 0.