0

Consider these types

type pipi is array (natural range <>) of bit;
type papa is array (natural range <>) of pipi;

This constant declaration is allowed and the index constraint on (each?) pipi is inferred from the required default expression. The type of the inner expressions are also inferred. So, I am assuming that foo has type papa(0 to 1) and each element thereof has type pipi(0 to 1)

constant foo : papa := (0 => ('1', '1'), 1 => ('1', '1'))

This declaration is not allowed. In this case (each??) pipi has a different inferred index constraint.

constant foo : papa := (0 => ('1', '1'), 1 => ('1'))

If it really is the case that foo(0) have type pipi(0 to 1) and foo(1) have type pipi(0 to 0), then are they both subtypes of pipi? If yes, why are they not legal elements of papa? My only theory is that there is no each pipi and only one subtype exists for the elements of papa, whose index constraint clearly cannot be inferred.

6
  • 2
    IEEE Std 1076-2008 5.3.2 Array types 5.3.2.1 General "An array object is a composite object consisting of elements that have the same subtype." Commented Feb 11 at 0:49
  • You can do arrays of access types (pointers). The access type objects may be arrays and be different sizes. Commented Feb 11 at 19:13
  • Your intended usage is not apparent nor is any code and error messages presenting an actual programming problem in search of a solution. If you’ve found stack overflow search doesn’t provide a specific answer you could demonstrate research effort in your question. The first comment quote is reflected in at least two answers. Commented Feb 11 at 20:45
  • @JimLewis I will try this. Will this permit me to have the papa-like type, in which case it'd be an array of accesses to pipi of different sizes? Commented Feb 11 at 23:25
  • You shouldn't ask additional questions in comments and expect answers, but YES. In a hardware description intended to synthesis you'd need to use a fixed maximum sized pipi array and either a separate array for effective length or a record type with a length element. Commented Feb 12 at 1:23

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.