Skip to content

Constraints on generic types #588

@eine

Description

@eine

#557 (comment)
vunit does not support real to be passed as generic.

#557 (comment)
It's not VUnit but the simulator that sets the limitations on what generic types that are supported. GHDL used to be limited to strings only (to support VUnit runner_cfg).

#557 (comment)
Shall we update that constraint? I just tested the following in GHDL and it seems to work:

entity ent is
 generic (
    a: string := "hello";
    b: natural range 0 to 100 := 5;
    c: integer := -15;
    d: real := 2.75
 );
 end;

A proper test to see which types of generics are supported by each simulator might better fit in https://github.com/VHDL/Compliance-Tests. However, in VUnit we can test (and hopefully use) at least those four. Of course, this is out of the scope of this PR.

#557 (comment)
I think we should keep it so that we can run the acceptance test on all supported simulators


This issue is related to using JSON to pass complex generics, as it is done in example json2vhdl. As commented in 45870be#r36112229, it might be desirable to split/extend the example to three separate tests:

  • Pass path to a JSON file.
  • Pass not-too-complex JSON string.
  • Pass a complex JSON string.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions