Continuing off the implementation of port arrays for microcontroller IOs in the last post is support for array-to-array connections. While prior we could only connect ports to arrays, now, we can do something like this:


The updated RGB LED definition defines its IOs as an array of 3 digital input ports, which can be connected together as an array to the microcontroller. While this example just reduces lines of code needed, the real power comes from the ability to define blocks with arbitrarily sized ports, and to have the compiler automatically ensure width consistency. For example, if I wanted to build a multimeter ranging circuit that selects from several resistive divider ratios, I could specify the ratios I wanted, then the system could automatically generate the resistors, switch tree, and log2-n wide control IOs array. I could then directly connect that array to the microcontroller without needing to explicitly specify its width, and the list of ratios is the single source of truth with consistency managed automatically.

This should finally be the end of the port array feature, and the PR will mark the issue as resolved. There's probably a ton of code cleanup that will follow eventually, but a completed feature is a completed feature!

Next Post Previous Post