Repository navigation
Conversation
A package instantiated in an architecture is made visible with a use clause naming the instance, such as use my_inst.all. The dependency scanner read my_inst as a library and warned "failed to find library 'my_inst'". Skip use clauses that name a package instantiated in the same file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
reflection_check_pkg has generic check_equal and check_equal_with_checker
procedures with the parameters of check_pkg's check_equal. They check
with the predefined "=" of the type, and on a mismatch walk the
reflection mirrors of both values and list every element that differs,
one per row:
Equality check failed (tb_packet.vhd:21)
hdr.addr: got 6, expected 5
data(0): got '1', expected '0'
reflection_check_generic_pkg instantiates both for one type, so one
package instantiation gives the same call shape as check_pkg:
package packet_checks is new vunit_lib.reflection_check_generic_pkg
generic map (t => packet_t);
The packages are opt-in through vu.add_reflection(), which fails early
when the standard is older than VHDL-2019 or the simulator lacks
reflection. A new supports_vhdl_reflection() simulator capability is True
for NVC and Riviera-PRO. Riviera-PRO needs -dbg for the call path
locations the tests check.
The default of msg is written as the value of check_result_tag, since
NVC can't call an instance of a generic subprogram that leaves out a
parameter with a string constant default (nickg/nvc#1695).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
record_dict_pkg converts a value of any record type to a dict_t, and reflection_queue_pkg pushes a value of any type onto a queue_t, element by element with the queue_pkg push of each type. Both walk the VHDL-2019 reflection mirror of the value. Both are one-way. Reflection can read a value but can't create one, and 'image/'value aren't allowed on a generic type, so there is no from_dict and no generic pop that returns the value. The elements are read back one by one, as with a hand-written conversion. The generic push is instantiated with the selected name vunit_lib.reflection_queue_pkg.push, since Riviera-PRO reports a plain "is new push" as ambiguous with the queue_pkg procedures. The array helpers that both packages use move to reflection_util_pkg. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Warning
Both features in this PR are one-way. VHDL-2019 reflection can read a value of any type, but it can't create one:
std.reflectionhas no procedures and no function that builds or writes a value. That's true of the package on both NVC and Riviera-PRO.t'image/t'valuearen't allowed on a generic type either: NVC says "non-representable type T" and Riviera-PRO says "Illegal prefix for attribute 'IMAGE". So there is nofrom_dictand no genericpopthat returns the value. Getting a record back still means reading its elements one by one, as with a hand-written conversion. Is a one-way conversion worth adding to VUnit?Draft, depends on #1242. It builds on the reflection setup there (
vu.add_reflection(),reflection_util_pkg). Until #1242 merges, this diff also shows its two commits. The changes of this PR are the last two commits.This brings back
to_dictfrom the closed #1239 and adds a genericpushonto a queue. The closed #1243 explored symmetric push/pop alternatives that don't use reflection.to_dict: any record to adict_tAs in #1239: element names become lower-case keys, the supported scalar and vector types keep their type, other enumerations become the name of their value, and nested records become nested dicts. Any other element type fails on
record_dict_logger, naming the element.push: any type onto aqueue_tqueue_pkgpush of its type, recursing into nested records. So the queue holds real, typed data: it can be popped with the usual functions, encoded and copied.to_dict. Other enumerations are pushed as the name of their value, which'valueturns back. Unsupported types fail onreflection_queue_logger, naming the element.vunit_lib.reflection_queue_pkg.push. A plainprocedure push is new pushworks on NVC, but Riviera-PRO reports it as ambiguous with thequeue_pkgprocedures (COMP96_0334). The selected name only refers to this package'spush, which works on both, so the instance is still calledpush.queue_pkgalready covers, such asinteger.Other changes
get_pos,to_std_ulogic_vector,to_stringof an array mirror) move toreflection_util_pkg.Testing
vunit/vhdl/reflection/run.pywith VHDL-2019: 21/21 on NVC 1.23-devel and on Riviera-PRO 2026.04. That's the 9check_equaltests from Add check_equal for any type using VHDL-2019 reflection #1242, 6to_dicttests and 6 newpushtests: scalars, arrays, a nested record pushed in place, a non-record value, order when mixed with other queue items, and the error for an unsupported element.This PR was written with the help of an AI assistant (Claude).
🤖 Generated with Claude Code