Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Adds
accumulator_model, a component with a stateful Python model, to theembedded_pythonexample. The new test caseTest independent models of two instancesinstantiates it twice; each instance makes a session withnew_session(accumulator_model'instance_name), executes the sameaccumulator_model.pyinto it withexec_fileaftertest_runner_setup, and passes the session to every call. The two instances get different inputs, and the test checks that each one keeps its own total.The user guide gets a new section, Independent models of component instances, under Sessions. It explains why repeated instances need a session each, why a fixed name doesn't separate them and how
'instance_namedoes, and that NVC, GHDL or Questa is needed. It links to the runnable example and shows the class-based alternative (one object per session, state onself). The caveats now also say that state in the globals of an imported module isn't isolated.The session is made in the statement part of the process. GHDL (7.0.0-dev) leaves the instance labels out of
'instance_name(and'path_name) when it is evaluated in a declaration: both instances got:tb_example(tb)accumulator_model(python):, so they shared one session. The docs mention this.Fixes #8
Testing
examples/embedded_python/run.py --without-attributes .optional_deps --without-attributes .expected_failure: 18 of 18 pass on NVC and on GHDL.tests/run.py: 106 of 106 pass on NVC and on GHDL.pytest tests/test_python_bridge.py: 85 passed.Got 12. Expected 3.).sphinx-buildof the docs: no warnings.🤖 Generated with Claude Code