Repository navigation
Add get_key and get_value_type to dict_pkg - #1229
Conversation
|
Needed by the Python dict support in VUnit/vunit-python-bridge#11, which enumerates a |
|
Also fixes |
Needs the new_dict fix of VUnit/vunit#1229. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The pointer pool recycles pointers that can be longer than requested, while dict_t uses the pointer lengths as the bucket count and bucket sizes. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
e719a52 to
4899efe
Compare
Needs the new_dict fix of VUnit/vunit#1229. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
to_string(natural) is VHDL-2008 only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The dict_t argument needs get_key and get_value_type of dict_pkg. Revert before merging, once a VUnit release has them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Needs the new_dict fix of VUnit/vunit#1229. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The dict_t argument needs get_key and get_value_type of dict_pkg. Revert before merging, once a VUnit release has them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| @@ -0,0 +1 @@ | |||
| Added ``get_key`` and ``get_value_type`` to ``dict_pkg`` for enumerating a ``dict_t`` and reading each value by type. | |||
There was a problem hiding this comment.
The shall be named after the PR number, i.e. 1229.feature.rst.
There was a problem hiding this comment.
Fixed in 52e807a: renamed to docs/news.d/1229.feature.rst.
| @@ -0,0 +1 @@ | |||
| Fixed ``new_dict`` crashing after ``deallocate`` of a dict that had grown beyond one bucket, caused by recycled pointers being longer than requested. | |||
There was a problem hiding this comment.
The shall be named after the PR number, i.e. 1229.bugfix.rst.
There was a problem hiding this comment.
Fixed in 52e807a: renamed to docs/news.d/1229.bugfix.rst.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Needs the new_dict fix of VUnit/vunit#1229. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The dict_t argument needs get_key and get_value_type of dict_pkg. Revert before merging, once a VUnit release has them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Needs the new_dict fix of VUnit/vunit#1229. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The dict_t argument needs get_key and get_value_type of dict_pkg. Revert before merging, once a VUnit release has them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
VUnit/vunit#1229 is merged, so CI installs VUnit master instead of the head of that pull request. Revert before merging, once a VUnit release has get_key and get_value_type of dict_pkg. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Needs the new_dict fix of VUnit/vunit#1229. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The dict_t support needs get_key and get_value_type of dict_pkg, which VUnit 5.0.0.dev15 is the first release to have (VUnit/vunit#1229). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Add Python dict support using VUnit dict_t eval_dict/call_dict (aliased eval/call) return a new dict_t from a Python dict with str keys: int, float, str, bool, list of int and nested dict values. arg/kwarg accept a dict_t and write it as a Python dict literal. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Test deallocate of returned dicts Needs the new_dict fix of VUnit/vunit#1229. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Add a news fragment Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Require VUnit 5.0.0.dev15 The dict_t support needs get_key and get_value_type of dict_pkg, which VUnit 5.0.0.dev15 is the first release to have (VUnit/vunit#1229). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Support integer_array_t values in dicts VUnit's dict_pkg stores integer_array_t refs, so the bridge converts them in both directions. In a dict_t argument the array is transferred like an integer_array_t argument and becomes a NumPy array. A NumPy array in a returned dict becomes an integer_array_t with the word size of an eval_integer_array result: from the dtype, or that of the array VHDL passed in. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Drop the simulator support wording from the dict docs Which simulators the Python bridge supports is documented for the whole package. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Send the values of a dict result instead of text records A dict result was one string of text records that VHDL parsed, with reals written as an exact mantissa and exponent and arrays as comma separated integers. Python now converts the dict and keeps its entries, and VHDL fetches each value with the eval of its type: integer, real, boolean, string, integer_vector_ptr_t and integer_array_t over their binary results, a nested dict by its handle. The text parsing functions are gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Why
The vunit-python-bridge needs to enumerate a dict_t and read each value by type through public subprograms, without touching the private p_bucket_* fields.
API added (dict_pkg)
get_key: 0 <= index < num_keys(dict); order unspecified but stable while the dict is unmodified; reports an error if out of range. get_value_type reports an error if the key is missing. dict_pkg-2008p needs no change.
Tests
New tb_dict case enumerating a dict of mixed types, checking get_key/get_value_type after remove and across a resize (200 keys). Ran with NVC: 41 of 41 pass in the data_types run.py (tb_dict). The out-of-range error path is not tested (no existing failing-check pattern in tb_dict).
A news fragment is included.
🤖 Generated with Claude Code