This repository was archived by the owner on Nov 11, 2025. It is now read-only.
Update the evaluator: DAG schematic support (globals), new CLI and other fixes#25
Merged
Conversation
Member
|
Builds on my machine and seems to be working without any issues. The dependency loop fix is required to run the evaluator in any nontrivial design so I'll merge this to get |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This PR finally completes the last of the originally planned features for the KiCad evaluator in #14: support for sheet-level global definitions. After some discussions with @chiplet we came to the conclusion that the most native way to support this in KiCad is not to allow parent sheets to update their children (causing potential dependency loops between sheets), but instead treat the schematic hierarchy as a DAG with dedicated sheets for defining global properties at the bottom of the graph. Supporting this model in the evaluator also required minimal changes, this PR just updates the indexing of sub-schematics to use their (proper) filename, and fixes a bug with the dependency loop detection when dealing with diamond inheritance.
Note: Internally the tooling (and our data structures) still treat schematics as a tree, which means that shared child schematics (under diamond inheritance) are processed and saved as many times as they are referred to from different parent schematics. Functionally it doesn't make a big difference right now since parent schematics aren't allowed to update children (to not break the DAG), but especially with complex functions (such as
vdiv) in common child schematics processing times might become an issue later on. Tracking issue: #26.The expression evaluation library we use,
evalexpr, is also having a hard time with filenames with dashes (-) as it isn't advanced enough to handle those as complete variable identifiers (trying to apply subtraction instead), so I've updated the KiCad schematics and projects underhat-psuto use dashes in their filenames instead.Finally this PR also adds in a nicer CLI using
clapfor the evaluator, which should be easy to port over to the parser and other tooling as well.