]> git.nickg.me.uk Git - nvc.git/log
nvc.git
10 months agoWIP issue 709 issue709
Nick Gasson [Fri, 9 Jun 2023 14:27:45 +0000 (15:27 +0100)]
WIP issue 709

10 months agoAdd -f analysis option to analyse a list of files
Nick Gasson [Fri, 9 Jun 2023 08:47:21 +0000 (09:47 +0100)]
Add -f analysis option to analyse a list of files

10 months agoAdd selected signal and variable assignments
Nick Gasson [Tue, 6 Jun 2023 21:25:22 +0000 (22:25 +0100)]
Add selected signal and variable assignments

10 months agoImplement "ordering on any scalar array type" VHDL-2019 feature
Nick Gasson [Tue, 6 Jun 2023 18:49:52 +0000 (19:49 +0100)]
Implement "ordering on any scalar array type" VHDL-2019 feature

10 months agoSet relaxed mode when running JIT benchmarks
Nick Gasson [Tue, 6 Jun 2023 18:18:33 +0000 (19:18 +0100)]
Set relaxed mode when running JIT benchmarks

11 months agoAdding VHDL-2019 to OSVVM installation. (#622)
Brian Padalino [Mon, 5 Jun 2023 22:17:56 +0000 (18:17 -0400)]
Adding VHDL-2019 to OSVVM installation. (#622)

11 months agoFix visibility bug with VHDL-2019 interface lists. Fixes #708
Nick Gasson [Mon, 5 Jun 2023 21:04:26 +0000 (22:04 +0100)]
Fix visibility bug with VHDL-2019 interface lists. Fixes #708

11 months agoOptimise memory allocation for access-to-array
Nick Gasson [Mon, 5 Jun 2023 08:03:46 +0000 (09:03 +0100)]
Optimise memory allocation for access-to-array

11 months agoUpdate THANKS.md
Nick Gasson [Sun, 4 Jun 2023 22:18:52 +0000 (23:18 +0100)]
Update THANKS.md

11 months agoAdd a --no-collapse option to inhibit port collapsing. Issue #704
Nick Gasson [Sun, 4 Jun 2023 21:46:32 +0000 (22:46 +0100)]
Add a --no-collapse option to inhibit port collapsing. Issue #704

11 months agoAdd a textio WRITE benchmark
Nick Gasson [Sun, 4 Jun 2023 21:46:42 +0000 (22:46 +0100)]
Add a textio WRITE benchmark

11 months agovhpi: Add support for getting/putting IndexedNames
Sean Anderson [Mon, 29 May 2023 21:39:41 +0000 (17:39 -0400)]
vhpi: Add support for getting/putting IndexedNames

This allows getting/putting nested arrays, and individual elements of an
array. The final index calculation is done lazily, although this
could be done eagerly by moving it to init_indexedName.

The tests for indexednames and the various enum types are extended now
that it is easier to access them.

11 months agovhpi: Fix vhpi_get_value with EnumVecVal format
Sean Anderson [Mon, 29 May 2023 21:49:14 +0000 (17:49 -0400)]
vhpi: Fix vhpi_get_value with EnumVecVal format

The Logic, SmallEnum, and Enum formats were not treated consistently.
Sometimes the wrong value type was used to store signals, and the
variable signal size of Enum was not handled properly. The correct
relationships for these types may be seen in the following table:

Format           Value type     Signal size
================ ============== ===========
vhpiLogicVal     vhpiEnumT      8
vhpiSmallEnumVal vhpiSmallEnumT 8
vhpiEnumVal      vhpiEnumT      variable

In order to handle the variable size of Enum, we need to use FOR_ALL_SIZES
from model.c. Move it to util.h, and rename a conflicting macro with a
similar purpose. This also adds support for getting SmallEnumVecs.

This adds a test for the Vec versions of these formats; the non-vec
versions will be tested when indexedName get/put support is added.

11 months agovhpi: Trace the object name in more cases
Sean Anderson [Mon, 29 May 2023 21:36:22 +0000 (17:36 -0400)]
vhpi: Trace the object name in more cases

Print the object's name when tracing in more cases, adding support for
names and signals.

11 months agovhpi: Support BaseIndex
Sean Anderson [Sat, 3 Jun 2023 23:28:30 +0000 (19:28 -0400)]
vhpi: Support BaseIndex

This property is not used by cocotb, but it makes testing easier.

11 months agovhpi: Support staticness
Sean Anderson [Mon, 29 May 2023 21:40:49 +0000 (17:40 -0400)]
vhpi: Support staticness

Support querying the staticness of expressions. I'm not sure how this
would work for ranges, so I've left them out.

11 months agovhpi: Add support for IndexedNames
Sean Anderson [Mon, 29 May 2023 21:04:52 +0000 (17:04 -0400)]
vhpi: Add support for IndexedNames

IndexedNames (e.g. `a(0)` or `a(2, 3)`) are necessary to access elements
of nested or multidimensional arrays (which have too many dimensions for
vhpiLogicVecVal) or to set individual elements of single-dimensional
arrays. Add basic support for these objects.

Although objDecls are names too, they also include the decl properties
which we don't want. Therefore, we use a separate hierarchy for
exprs/names. For future work, it might be nice to use the object
framework (tree_t, type_t, etc) for VHPI as well.

IndexedNames are created lazily. This is useful for nested arrays. For
example, a signal like

   type a is array(0 to 9) of std_logic_vector(31 downto 0);
   signal b: a;

might only be accessed like `b(0)` and never like `b(2)(3)`.

The encoding of prefixedName varies slightly from the UML. To reuse the
above example, while the UML says that the prefix of `b(0)` is `b`,
we set prefix as NULL in this situation, using simpleName instead. This
makes it easier to walk nested prefixes, since we don't have to compare
prefix to simpleName.

To populate IndexedNames, we must iterate over all constraints on the
array, and create `c_indexedName`s for each. One option here would be to
pass BaseIndex to init_indexedName. However, this would require decoding
the BaseIndex into indices for each constraint. Indead, I chose to pass
the indices directly, and create BaseIndex from them. I think this is
easier, because it doesn't involve any division.

11 months agovhpi: Rework size calculation
Sean Anderson [Mon, 29 May 2023 20:11:56 +0000 (16:11 -0400)]
vhpi: Rework size calculation

IndexedNames represent a subset of the elements in a signal. Their size
is dependent on their type. In preparation for adding IndexedName
support, rework the size calculation to be based on the type of the
object instead of the width of the backing signal.

11 months agovhpi: Support NumDimensions
Sean Anderson [Mon, 29 May 2023 20:06:09 +0000 (16:06 -0400)]
vhpi: Support NumDimensions

Support NumDimensions for arrays.

11 months agovhpi: Support LeftBound and RightBound
Sean Anderson [Mon, 29 May 2023 20:04:13 +0000 (16:04 -0400)]
vhpi: Support LeftBound and RightBound

Support LeftBound and RightBound for IntRanges.

11 months agovhpi: Support IsUnconstrained
Sean Anderson [Mon, 29 May 2023 20:03:13 +0000 (16:03 -0400)]
vhpi: Support IsUnconstrained

Support the IsUnconstrained property for ranges and types.

11 months agovhpi: Support constraints
Sean Anderson [Mon, 29 May 2023 19:45:06 +0000 (15:45 -0400)]
vhpi: Support constraints

Add support for range constraints on arrays and subtypes. I think the
from/to on unconstrained ranges should reflect the from/to of the
underlying type, but I have left that out for now. Currently no
properties are supported, but that will change soon.

11 months agovhpi: Support ElemType
Sean Anderson [Mon, 29 May 2023 19:34:45 +0000 (15:34 -0400)]
vhpi: Support ElemType

Support the ElemType property of Arrays.

11 months agovhpi: Add support for subtypes
Sean Anderson [Mon, 29 May 2023 19:23:07 +0000 (15:23 -0400)]
vhpi: Add support for subtypes

Add very basic support for subtypes. This is just enough to place them
in the type hierarchy, and not much else. Array subtypes are always
created as arrayTypeDecls, since this will let us expose the element
subtype properly.

11 months agovhpi: Pass type directly to init_typeDecl
Sean Anderson [Mon, 29 May 2023 23:02:31 +0000 (19:02 -0400)]
vhpi: Pass type directly to init_typeDecl

Anonymous types can't be looked up by their ident, so the decl is for
their base type instead. Pass the type directly instead of using
tree_type to ensure the type matches what it represents.

11 months agovhpi: Support iterators in vhpi_handle_by_index
Sean Anderson [Mon, 29 May 2023 18:50:52 +0000 (14:50 -0400)]
vhpi: Support iterators in vhpi_handle_by_index

Refactor vhpi_handle_by_index to work with iterators, allowing it to
work with anything that vhpi_iterator does (and vice versa).

11 months agovhpi: Support single-element iterators
Sean Anderson [Mon, 29 May 2023 18:40:44 +0000 (14:40 -0400)]
vhpi: Support single-element iterators

Instead of creating a list with one element for relations with only one
target, support single-element iterators directly.

11 months agovhpi: Move iterator initialization to init_iterator
Sean Anderson [Mon, 29 May 2023 18:36:17 +0000 (14:36 -0400)]
vhpi: Move iterator initialization to init_iterator

In preparation for merging the logic in vhpi_iterator with
vhpi_handle_for_index, split off iterator initialization into its own
function. This replaces new_iterator so we can avoid a memory
allocation if possible in vhpi_handle_for_index.

11 months agovhpi: Don't scan non-iterators
Sean Anderson [Mon, 29 May 2023 18:11:24 +0000 (14:11 -0400)]
vhpi: Don't scan non-iterators

If we get a non-iterator in vhpi_scan, just return NULL.

Fixes: fb8e5f51 ("vhpi: Support iterators")
11 months agovhpi: Move BaseType to c_typeDecl
Sean Anderson [Mon, 29 May 2023 17:09:37 +0000 (13:09 -0400)]
vhpi: Move BaseType to c_typeDecl

Each Type has a BaseType. Except for subtypes, the BaseType is the Type
itself. In preparation for adding subTypeDecls, move BaseType to
typeDecl. This allows us to calculate the BaseType when necessary,
removing the need to have a redundant BaseType reference.

11 months agovhpi: Extend is_typeDecl to work on all typeDecls
Sean Anderson [Mon, 29 May 2023 16:55:28 +0000 (12:55 -0400)]
vhpi: Extend is_typeDecl to work on all typeDecls

Make is_typeDecl work on all sub-classes of c_typeDecl, instead of just
intTypeDecls.

11 months agoFix GMT offset calculation in GMTIME
Nick Gasson [Sun, 4 Jun 2023 20:54:09 +0000 (21:54 +0100)]
Fix GMT offset calculation in GMTIME

11 months agoMake sure $GALLOC opcode never returns a null pointer
Nick Gasson [Sun, 4 Jun 2023 17:19:20 +0000 (18:19 +0100)]
Make sure $GALLOC opcode never returns a null pointer

11 months agoSimplify logic in lower_incomplete_access
Nick Gasson [Sun, 4 Jun 2023 17:19:01 +0000 (18:19 +0100)]
Simplify logic in lower_incomplete_access

11 months agoChange default exit severity to FAILURE
Nick Gasson [Sun, 4 Jun 2023 09:04:48 +0000 (10:04 +0100)]
Change default exit severity to FAILURE

11 months agoImplement remaining VHDL-2019 date/time functions
Nick Gasson [Sat, 3 Jun 2023 17:29:37 +0000 (18:29 +0100)]
Implement remaining VHDL-2019 date/time functions

11 months agoReturn a non-empty string for TOOL_EDITION
Nick Gasson [Sat, 3 Jun 2023 12:11:44 +0000 (13:11 +0100)]
Return a non-empty string for TOOL_EDITION

11 months agoAvoid crash when exiting concurrently with LLVM code generation
Nick Gasson [Sat, 3 Jun 2023 11:53:05 +0000 (12:53 +0100)]
Avoid crash when exiting concurrently with LLVM code generation

11 months agoOptimise predefined attribute parsing
Nick Gasson [Sat, 3 Jun 2023 11:40:23 +0000 (12:40 +0100)]
Optimise predefined attribute parsing

11 months agoAttribute 'ASCENDING has a dimension parameter
Nick Gasson [Fri, 2 Jun 2023 22:13:51 +0000 (23:13 +0100)]
Attribute 'ASCENDING has a dimension parameter

11 months agoImplement 'INDEX attribute from VHDL-2019 (LCS-2016-018a)
Nick Gasson [Fri, 2 Jun 2023 21:12:38 +0000 (22:12 +0100)]
Implement 'INDEX attribute from VHDL-2019 (LCS-2016-018a)

11 months agoSkip unnecessary static bounds check during elaboration. Fixes #707
Nick Gasson [Fri, 2 Jun 2023 17:17:52 +0000 (18:17 +0100)]
Skip unnecessary static bounds check during elaboration. Fixes #707

11 months agoAdd support for 'designated_subtype attribute (LCS2016_018d)
Nick Gasson [Thu, 1 Jun 2023 20:42:59 +0000 (21:42 +0100)]
Add support for 'designated_subtype attribute (LCS2016_018d)

11 months agoAdd more tests for VHDL AST dumper
Nick Gasson [Thu, 1 Jun 2023 20:14:32 +0000 (21:14 +0100)]
Add more tests for VHDL AST dumper

11 months agoCreate FST aliases for collapsed signals. Issue #704
Nick Gasson [Thu, 1 Jun 2023 19:03:53 +0000 (20:03 +0100)]
Create FST aliases for collapsed signals. Issue #704

11 months agoStart adding a unit test for dumper
Nick Gasson [Wed, 31 May 2023 20:30:25 +0000 (21:30 +0100)]
Start adding a unit test for dumper

11 months agoRework representation of VHDL-2008 element constraints
Nick Gasson [Tue, 30 May 2023 20:54:32 +0000 (21:54 +0100)]
Rework representation of VHDL-2008 element constraints

11 months agoImprove test case for issue #705
Nick Gasson [Mon, 29 May 2023 21:21:32 +0000 (22:21 +0100)]
Improve test case for issue #705

11 months agoAdd support for matching select? statements. Fixes #705
Nick Gasson [Mon, 29 May 2023 21:18:44 +0000 (22:18 +0100)]
Add support for matching select? statements. Fixes #705

11 months agoAdd support for array mode view indication
Nick Gasson [Mon, 29 May 2023 20:01:23 +0000 (21:01 +0100)]
Add support for array mode view indication

11 months agoAdd support for inout in mode view indication
Nick Gasson [Mon, 29 May 2023 18:18:03 +0000 (19:18 +0100)]
Add support for inout in mode view indication

11 months agoSimplify handling of 'CONVERSE attribute
Nick Gasson [Mon, 29 May 2023 17:20:29 +0000 (18:20 +0100)]
Simplify handling of 'CONVERSE attribute

11 months agoAdd vhdl-extras to regression tests
Nick Gasson [Mon, 29 May 2023 14:56:16 +0000 (15:56 +0100)]
Add vhdl-extras to regression tests

11 months agoAdjust GTKW save file format. Issue #703
Nick Gasson [Mon, 29 May 2023 13:24:54 +0000 (14:24 +0100)]
Adjust GTKW save file format. Issue #703

11 months agoThe GETENV function should also return conditional analysis identifiers
Nick Gasson [Mon, 29 May 2023 08:22:17 +0000 (09:22 +0100)]
The GETENV function should also return conditional analysis identifiers

11 months agoMore efficient handling of ANSI escapes in diagnostics
Nick Gasson [Sun, 28 May 2023 20:27:06 +0000 (21:27 +0100)]
More efficient handling of ANSI escapes in diagnostics

11 months agoFix typos introduced by earlier commit
Nick Gasson [Sun, 28 May 2023 20:10:35 +0000 (21:10 +0100)]
Fix typos introduced by earlier commit

From @bpadalino

11 months agoAllow VHDL-2008 rules for static expressions in relaxed mode
Nick Gasson [Sun, 28 May 2023 15:34:09 +0000 (16:34 +0100)]
Allow VHDL-2008 rules for static expressions in relaxed mode

11 months agoHandle aliases of operators
Nick Gasson [Sun, 28 May 2023 10:11:45 +0000 (11:11 +0100)]
Handle aliases of operators

11 months agoPrevent some cases of cascading errors
Nick Gasson [Sun, 28 May 2023 09:41:31 +0000 (10:41 +0100)]
Prevent some cases of cascading errors

11 months agoDo not translate ANSI escapes to UTF-8
Nick Gasson [Sun, 28 May 2023 09:16:29 +0000 (10:16 +0100)]
Do not translate ANSI escapes to UTF-8

11 months agoHandle leading NUL characters in report message. Fixes #700
Nick Gasson [Fri, 26 May 2023 08:22:04 +0000 (09:22 +0100)]
Handle leading NUL characters in report message. Fixes #700

11 months agoRework handling of VHDL-2008 nested constraints. Fixes #701
Nick Gasson [Thu, 25 May 2023 20:34:54 +0000 (21:34 +0100)]
Rework handling of VHDL-2008 nested constraints. Fixes #701

11 months agoImprove checking for mode view indication
Nick Gasson [Wed, 24 May 2023 21:21:53 +0000 (22:21 +0100)]
Improve checking for mode view indication

11 months agoInitial elaboration support for interfaces
Nick Gasson [Wed, 24 May 2023 07:57:44 +0000 (08:57 +0100)]
Initial elaboration support for interfaces

11 months agoImprove checking for interfaces
Nick Gasson [Tue, 23 May 2023 21:11:37 +0000 (22:11 +0100)]
Improve checking for interfaces

11 months agoAdd a performance test for unsigned "+"
Nick Gasson [Mon, 22 May 2023 21:27:58 +0000 (22:27 +0100)]
Add a performance test for unsigned "+"

11 months agoParsing for mode view indication
Nick Gasson [Sun, 21 May 2023 15:10:13 +0000 (16:10 +0100)]
Parsing for mode view indication

11 months agoParsing for 'CONVERSE attribute
Nick Gasson [Sun, 21 May 2023 14:40:35 +0000 (15:40 +0100)]
Parsing for 'CONVERSE attribute

11 months agoFix coverage generation for unary operators
Sean Anderson [Mon, 22 May 2023 16:01:38 +0000 (12:01 -0400)]
Fix coverage generation for unary operators

Unary functions (such as reductions) cause an assertion failure in
lower_logic_expr_coverage. As they operate on arrays, and arrays are
skipped anyway, modify this function to skip such operators. Also remove
a debug print while we're here.

Add a test case to ensure such functions are excluded from coverage.

Closes: #698
11 months agoCompile Synopsys STD_LOGIC_MISC package for 2008. Issue #696
Nick Gasson [Mon, 22 May 2023 07:20:53 +0000 (08:20 +0100)]
Compile Synopsys STD_LOGIC_MISC package for 2008. Issue #696

11 months agoMore checking for view declarations
Nick Gasson [Sun, 21 May 2023 09:00:08 +0000 (10:00 +0100)]
More checking for view declarations

11 months agoFully qualify subtype names
Nick Gasson [Sun, 21 May 2023 07:56:02 +0000 (08:56 +0100)]
Fully qualify subtype names

11 months agoIntroduce type_designated to replace type_file and type_access
Nick Gasson [Sun, 21 May 2023 07:41:08 +0000 (08:41 +0100)]
Introduce type_designated to replace type_file and type_access

11 months agovhpi: Add some additional callback tests
Sean Anderson [Sat, 20 May 2023 19:48:21 +0000 (15:48 -0400)]
vhpi: Add some additional callback tests

Add some more tests for callback disabling/removal.

11 months agovhpi: Support filling in time for object callbacks
Sean Anderson [Sat, 20 May 2023 21:12:17 +0000 (17:12 -0400)]
vhpi: Support filling in time for object callbacks

When cb_data->p is non-NULL for object callbacks, it is filled in with
the time of the callback when the callback triggers. Support this use
case.

11 months agovhpi: Don't support values for object callbacks
Sean Anderson [Sat, 20 May 2023 21:08:39 +0000 (17:08 -0400)]
vhpi: Don't support values for object callbacks

If cb_data_p->value is non-NULL for object callbacks, it must be filled
in with the value of the trigger. We don't support this, so error out
early.

11 months agovhpi: Calculate callback timeout at registration
Sean Anderson [Sat, 20 May 2023 21:02:19 +0000 (17:02 -0400)]
vhpi: Calculate callback timeout at registration

Callback timeouts must be calculated at registration, not at enabling:

> Disabling a callback simply determines whether or not the callback will
> be triggered when its trigger event occurs. For example, disabling a
> callback that is registered to trigger after a given delay and
> subsequently enabling before expiry of the delay does not postpone the
> time at which the trigger event occurs.

Additionally, any data in cb_data_p that we do not save (such as time)
may not be accessed after we return from registration.

11 months agovhpi: Fix use-after-free when removing callbacks
Sean Anderson [Sat, 20 May 2023 18:05:38 +0000 (14:05 -0400)]
vhpi: Fix use-after-free when removing callbacks

Callbacks can generally be in a few states:

- Disabled or mature
- Actively executing
- Waiting to execute

For all callbacks except for AfterDelay, when the callback is waiting to
execute then clearing it will prevent further execution. However,
AfterDelay callbacks can be absent from the eventq_heap in the driverq
workqueue awaiting execution. Clearing these callbacks will not prevent
them from executing.

To work around this, make model_clear_timeout_cb return a boolean
indicating whether a callback was actually cleared. If no callback was
cleared and the callback is not currently executing, then the callback
is in a workqueue. In this case, just free the callback later.
Otherwise, we have actually removed a callback and we can be sure that
it will not execute, so free it now.

Fixes: d6e523a4 ("vhpi: Free callbacks in remove")
11 months agovhpi: Allow disabling ValueChange callbacks
Sean Anderson [Sat, 20 May 2023 18:00:08 +0000 (14:00 -0400)]
vhpi: Allow disabling ValueChange callbacks

Allow disabling ValueChange callbacks by clearing the individual
wakeables. This function could take rt_signal_t and user data, but the
signal is calculated for VHPI callbacks, and it is easier to just store
the watch instead.

11 months agomodel: Correct timing of RT_LAST_KNOWN_DELTA_CYCLE
Sean Anderson [Sat, 20 May 2023 17:55:37 +0000 (13:55 -0400)]
model: Correct timing of RT_LAST_KNOWN_DELTA_CYCLE

According to the spec, vhpiCbLastKnownDeltaCycle callbacks can create
further delta cycles:

> h) If the next simulation cycle will be a delta cycle, the remainder of
> step h) is skipped. Otherwise, the following actions occur in the
> indicated order:
>
>   1. Each registered and enabled `vhpiCbLastKnownDeltaCycle` and
>      `vhpiCbRepLastKnownDeltaCycle` callback is executed. T_n is
>      recalculated according to the rules of 14.7.5.1.
>   2. If the next simulation cycle will be a delta cycle, the remainder
>      of step h) is skipped.
>   3. ...

Fire RT_LAST_KNOWN_DELTA_CYCLE before disabling delta cycles to allow
this to happen.

11 months agoCorrect return value for vhpi_get_val with format vhpiEnumVecVal
Nick Gasson [Fri, 19 May 2023 20:36:26 +0000 (21:36 +0100)]
Correct return value for vhpi_get_val with format vhpiEnumVecVal

11 months agoRefactor format handling in vhpi_get_value
Nick Gasson [Fri, 19 May 2023 19:59:36 +0000 (20:59 +0100)]
Refactor format handling in vhpi_get_value

11 months agoImplement vhpiDepositPropagate mode for vhpi_put_value
Nick Gasson [Thu, 18 May 2023 19:57:08 +0000 (20:57 +0100)]
Implement vhpiDepositPropagate mode for vhpi_put_value

11 months agoBuild a single shared library for all VHPI tests
Nick Gasson [Thu, 18 May 2023 18:57:51 +0000 (19:57 +0100)]
Build a single shared library for all VHPI tests

11 months agovhpi: Update callback state
Sean Anderson [Wed, 17 May 2023 21:34:02 +0000 (17:34 -0400)]
vhpi: Update callback state

Keep c_callback->State synchronized with the actual state of the
callback. Additionally, avoid enabling callbacks which start disabled.

11 months agovhpi: Free callbacks in remove
Sean Anderson [Wed, 17 May 2023 21:26:39 +0000 (17:26 -0400)]
vhpi: Free callbacks in remove

Callback handles should be released in vhpi_remove_cb. We can't just
free directly because callbacks may remove themselves while they
are executing. Instead, keep track of whether a callback is executing
and don't free the callback until after it's done.

11 months agomodel: Don't add model->now when setting a timeout
Sean Anderson [Wed, 17 May 2023 21:25:19 +0000 (17:25 -0400)]
model: Don't add model->now when setting a timeout

We do this in the caller now.

Fixes: e9ec0c70 ("vhpi: Support enabling, disabling, and removing callbacks")
11 months agoAdd install script for xpm_vhdl
Nick Gasson [Wed, 17 May 2023 20:46:42 +0000 (21:46 +0100)]
Add install script for xpm_vhdl

11 months agoFix corner case in handling of return identifier subtype
Nick Gasson [Wed, 17 May 2023 18:12:38 +0000 (19:12 +0100)]
Fix corner case in handling of return identifier subtype

11 months agovhpi: Support FileName
Sean Anderson [Wed, 17 May 2023 00:24:13 +0000 (20:24 -0400)]
vhpi: Support FileName

We already have locations for most objects, so add their FileNames as
well.

11 months agovhpi: Add support for nonstandard search strings
Sean Anderson [Tue, 16 May 2023 23:17:02 +0000 (19:17 -0400)]
vhpi: Add support for nonstandard search strings

As far as I can tell, search strings of the form

   unit.signal

are relative, and therefore cannot be used with a scope of NULL.
However, they appear to be both supported by other simulators [1], and
expected by cocotb. Add support.

[1] https://www.aldec.com/en/support/resources/documentation/articles/1456#vhpi_handle_by_name__

11 months agovhpi: Add tool object
Sean Anderson [Wed, 17 May 2023 00:04:45 +0000 (20:04 -0400)]
vhpi: Add tool object

Add a tool object, allowing applications to read the tool name and
version in a standard way. Also support a (very minimal) argv, as some
applications expect it to exist when the tool does.

11 months agovhpi: Support iterators
Sean Anderson [Tue, 16 May 2023 23:05:27 +0000 (19:05 -0400)]
vhpi: Support iterators

Add support for iterators. This is not the most useful, but at the very
least you can iterate over ports and declarations.

11 months agovhpi: Support enabling, disabling, and removing callbacks
Sean Anderson [Tue, 16 May 2023 22:41:24 +0000 (18:41 -0400)]
vhpi: Support enabling, disabling, and removing callbacks

Add support for enabling and disabling callbacks separate from
registering a new callback. Also support removing callbacks (and freeing
the handle).

11 months agovhpi: Refactor out callback enabling code
Sean Anderson [Tue, 16 May 2023 22:39:58 +0000 (18:39 -0400)]
vhpi: Refactor out callback enabling code

Split the code for registering a callback off from the code for creating
a callback.

11 months agomodel: Add support for clearing global/timeout callbacks
Sean Anderson [Tue, 16 May 2023 22:37:21 +0000 (18:37 -0400)]
model: Add support for clearing global/timeout callbacks

Add support for removing (clearing per the "set" analogy) global and
timeout callbacks. The implementation is fairly straightforward.

11 months agovhpi: Stub out prefix support
Sean Anderson [Tue, 16 May 2023 22:34:47 +0000 (18:34 -0400)]
vhpi: Stub out prefix support

As far as I can tell, none of the entities we support have prefixes.
However, some existing VHPI applications try to get prefixes without
regard to kind. Just return NULL to satisfy them.

11 months agovhpi: Implement size
Sean Anderson [Tue, 16 May 2023 22:18:34 +0000 (18:18 -0400)]
vhpi: Implement size

This property isn't defined anywhere in the spec. Fortunately, there's a
blurb in the UML diagram [1]:

> If the object or value denoted by the name is determined, the value of
> the Size property is the number of scalar values denoted by the name.
> The object or value denoted by the name is determined for a locally
> static name.  The object or value denoted by the name may also be
> determined for a globally static name in the design hierarchy information
> model.  In other cases, the object or value denoted by the name is not
> determined, and the value of the Size property is vhpiUndefined.
>
> For a name that denotes an object or value of a scalar or access type,
> the value of the Size property is 1.
>
> For a name that denotes an object or value of a composite type, the value
> of the Size property is the number of scalar subelements of the object or
> value.
>
> For a name that denotes an object or value of a file type or a protected
> type, the value of the Size property is vhpiUndefined.

Effectively, this is the number of elements in the value. Although the
spec says to return vhpiUndefined on error, we return 0 instead to
placate existing applications.

[1] https://opensource.ieee.org/vasg/Packages/-/blob/release/vhpi_uml/vhpi_uml.xml

11 months agovhpi: Support FullName
Sean Anderson [Tue, 16 May 2023 22:02:46 +0000 (18:02 -0400)]
vhpi: Support FullName

The specification for FullName is rather... inscrutable, but I've done
my best to implement it. The general form of a FullName is

   [@library][:package]:unit[:signal]

but we can leave off the library/package for the root region, which
(conveniently) is the only one currently supported.