by liu3hao · 5mo ago · 0 comments
In the last month, I have added support for more ERC rules (pin type compatibility checks), added initial support for net classes and also cleaned up the language a little (backslash line continuation, similar to python).
Recently, I just completed a 161-LED charlieplexed array design that uses nested for-loops to simplify the array design. It is currently in production and I plan to write a blog post soon to document this design.
As always, the motivation for creating Circuitscript is to describe schematics in terms of code rather than graphical UIs after using different CAD packages extensively (Allegro, Altium, KiCad) for work in the past. I wanted to spend more time thinking about the design itself rather than fiddling around with GUIs. With code, the design intentions become explicit and reviewable.
Feedback welcome, especially from anyone else frustrated with graphical schematic tools! If you have a KiCad design that you would like to convert to Circuitscript, please reach out to me as well and I will help you to do so as I am trying to challenge/test the limits of Circuitscript.
I'm not sure how an object oriented approach would make things easier for schematic generation. The objects (components) themselves do not undergo much data interactions/manipulations. Maybe if you have some examples, this would be helpful for me to understand. As much as possible I am leaning towards a more functional approach, where inputs, data transformations and outputs are more defined.
With a new language, I could decide features that I wanted and more importantly, include more circuit specific features (branch/join/parallel statements). Of course, a python library would be able to produce the same data representation that circuitscript ultimately generates, but one aim of circuitscript is to make it much easier to do so.
The standard lib provides led, supply, res and cap as component functions (basically normal functions that return a component). For LED and supply, they take strings as parameters, this defines the led color and the name of the supply net respectively. Res and cap take a number parameter like 1k, 1u, 100n, etc. Such number expressions are very common in schematics and CAD packages, so this is a important feature to support (python equivalent of using 1e3, 1e-6, etc.).