Debugging Circuit Blocks

So now I am testing out the functionality of circuit blocks where we package up a circuit into a re-useable part.

The Bus parts work OK, and the Register part worked out OK, but the Counter Part presented some issues.

The method that I am using to create tests is to first wire up the main part with Pins to provide inputs.

Then I save this as a circuit.

Counter Test Circuit

The next step is to save this circuit as a test circuit with a new name, delete the main part, and open the previous circuit as a block via the new File Menu option.

Then, wire this block up to the existing IO pins. Then we may check the Truth Table box and click on the counter icon to bring up the truth table.

We may test our circuit containing the block that is supposed to implement the counter to test it against the Truth Table.

Block Test

The first observation that may be made here is that the pins of the Counter block are not in the same order as the original part. This is a consequence of the Nodes of the pins being out of sync with the pin ordering in the scene tree.

This is a good thing since (to highlight a potential bug), later when users build a circuit, they could create the inputs in any order they like. The important thing is the connectivity.

So, I need to fix the code that generates the block part so that the ordering of the IO parts reflect their vertical positioning in the source circuit. I can do this by sorting them in a dictionary where their keys are based on the offset.y positions of them.

When actually running the Truth Table test, it fails at some point, and after investigation I don’t think that it has anything to do with the above issue. So that is what I need to debug next.

Comments Forum

More Devlog entries

Most recent first