🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

Bug: Applying a custom VHDL attribute to an array of records fails to compile

User: "Alexander Gomperts"
New Altair Community Member
Updated by Jocelyn

Compiling the following package fails in DSim version 20240422.0.0 with

87Ln68ggOvV1znWOuArz8PT15p0Gu9nUgQ.png

library ieee;use ieee.std_logic_1164.all;use ieee.numeric_std.all;package attribute_def_pkg is  attribute type_length_attribute : natural;  type record_type is record    field_1 : std_logic;    field_2 : std_logic;  end record;  attribute type_length_attribute of record_type : type is 2;  -- Works fine  type array_of_records_type is array (1 downto 0) of record_type;  attribute type_length_attribute of array_of_records_type : type is 4;  -- Fails: E:[ClassHidden]end package attribute_def_pkg;

Find more posts tagged with

Sort by:
1 - 1 of 11
    User: "d3jones"
    Altair Employee
    Accepted Answer

    Does this work on other simulators?


    The declaration of array_of_records_type creates both a type and a subtype.  The (anonymous) type is array(<>) of record_type, and the (named) subtype is array(1 downto 0) of record_type. When you provide the name array_of_records_type, you are actually targeting the subtype, not the base type. For this reason, the attribute specification is invalid.


    The VHDL LRM is not the clearest work of prose, and it is possible that other tools let this slide, and treat types and subtypes as interchangeable for the purposes of assigning attributes.