New zener functions to improve mcu modelisation - #1013
Open
DamienEspitallier wants to merge 3 commits into
Open
DamienEspitallier wants to merge 3 commits into
DamienEspitallier wants to merge 3 commits into
Conversation
DamienEspitallier
force-pushed
the
pin-capability-model
branch
from
August 8, 2026 08:52
01585e9 to
ddbbbf0
Compare
DamienEspitallier
force-pushed
the
pin-capability-model
branch
from
August 8, 2026 09:06
ddbbbf0 to
8d79472
Compare
DamienEspitallier
force-pushed
the
pin-capability-model
branch
from
August 8, 2026 09:18
8d79472 to
d28c55b
Compare
DamienEspitallier
force-pushed
the
pin-capability-model
branch
from
August 8, 2026 09:25
d28c55b to
3fd6133
Compare
DamienEspitallier
force-pushed
the
pin-capability-model
branch
from
August 8, 2026 12:35
3fd6133 to
b3e8695
Compare
left a comment
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b3e8695. Configure here.
| ), | ||
| "pinmux.at_without_net", | ||
| starlark::errors::EvalSeverity::Error, | ||
| )); |
There was a problem hiding this comment.
Wrong file for at() net error
Medium Severity
The pinmux.at_without_net diagnostic uses eval.source_path() and omits the PinAt span, so it lands on the child module’s io()/config() file instead of the caller’s at() site. PinAt already carries site and span for this, and other pinmux diagnostics use them.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit b3e8695. Configure here.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


When trying to make zener model for a STM32 a did not find a good way to ensure the user use the right port for a given peripheral.
So, I have extended zener language for supporting this natively. The idea is to add a solver to automatically select the best pins for a selected peripheral (specified with zener stdlib interface). You do not select manually, you request an interface (uart, i2c). You are still free to force the use of a specific pin.
It also add basic first support for swapiness declaration.
The idea is to let zener choose best ports to ensure all peripheral constraints are met and this also allow zener to throw an error if the mcu you choose do not have enough peripheral for you need.
I tried to make it as generic as possible, and added an example for a non mcu part like a quad comparator. This even allow the quad comparator module to automatically wire unused inputs to prevent oscillation.
Disclaimer: I used claude, especially for the pinmux constraint solver
Note
High Risk
Large new elaboration solver (~3.5k LOC) on the critical eval/io/module path, plus a breaking
interface()keyword change that can fail existing designs at elaboration time.Overview
Adds a pinmux elaboration layer so multi-function parts declare peripheral capabilities and interface requests, then
pin_solvepicks a joint instance × pin assignment (with pin/instance exclusivity across repeated solves in a module). Results land in module propertiespin_assignmentandswap_classes;pin_mapturns a solve intoComponent(pins=…), tying unclaimed pads to open nets.Designers constrain placement with
at(value, pins, soft=)on module connections (recorded throughio()/config()and enforced at the root for contended or unused hard constraints).pin_requestsupports optional slots (if_connected), dict-of-roles (bind=), locks, andwhere=predicates;peripheral/pool/pindescribe what each block can provide.interface()gainsimplies(nominal capability matching over a DAG) andattrs(typed peripheral metadata);attrsandimpliesare now reserved—connection fields with those names must be renamed. Stdlib interfaces pick up attr vocabularies and newAdcIn/GpioPintypes.Smaller wiring:
builtin.pinmux, module-context claim/tie-off state, clearer errors whenat()is used on component pins, and a test that DiffPair impedance still reaches net properties through nested interfaces.Reviewed by Cursor Bugbot for commit b3e8695. Bugbot is set up for automated code reviews on this repo. Configure here.