Last week's work was adding array-to-array connects, but array-valued expressions (eg, [1, 2, 3]) are helpful in parameterizing variable-sized devices, like a n-ported resistive divider. So that's what this week was, but as with everything else, easier said than done.

The main issue is trying to achieve two goals: full static checking with mypy, and fully-parameterized (composable) arrays (eg, ArrayExpr(BoolExpr()), instead of a special class for each case like ArrayBoolExpr()). The former is pretty straightforward in dynamically typed Python and in simpler statically typed (mypy) code, but additional features we support like castable (eg, float and int can be assigned to FloatExpr) and extractable (eg, generator requiring FloatExpr provides a value of type float) types combined with limitations on mypy make these mutually exclusive. Intersection types or type members (a feature in Scala) possibly could enable this, but neither are supported in mypy.

In any case, the code is done as a pull request - hooray, the array infrastructure saga finally comes to a close.

Next Post Previous Post