Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversions between arrays with closely related elements #2520

Open
1 task done
nickg opened this issue Oct 17, 2023 · 1 comment
Open
1 task done

Conversions between arrays with closely related elements #2520

nickg opened this issue Oct 17, 2023 · 1 comment
Labels
FeaReq: VHDL-2008 Requested feature addition related to VHDL-2008.

Comments

@nickg
Copy link

nickg commented Oct 17, 2023

Description
The 2008 LRM relaxed requirements for closely related array types to allow conversions when the elements are only closely related rather than exactly the same. This should allow conversion between, for example, an array of reals and an array of integers.

Expected behaviour
The test case below passes with Questa and Riviera-PRO but not with GHDL

How to reproduce?

entity ent is
end entity;

architecture test of ent is
begin

    p1: process is
        variable i : integer_vector(1 to 3);
        variable r : real_vector(1 to 3);
    begin
        i := (1, 2, 3);
        r := real_vector(i);
        assert r = (1.0, 2.0, 3.0);
        r := (4.2, 5.9, 7.1);
        i := integer_vector(r);
        assert i = (4, 6, 7);
        r := (1.0, real'left, 5.3);
--      i := integer_vector(r);     -- Range error
        wait;
    end process;

end architecture;
ghdl -a --std=08 ent.vhd
ghdl --elab-run ent

Context

  • OS: Linux
  • Origin:
@tgingold
Copy link
Member

tgingold commented Oct 18, 2023 via email

@Paebbels Paebbels added the FeaReq: VHDL-2008 Requested feature addition related to VHDL-2008. label Oct 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeaReq: VHDL-2008 Requested feature addition related to VHDL-2008.
Projects
None yet
Development

No branches or pull requests

3 participants