On 23/11/15 20:26, Brent Hayhoe wrote: > Hi Tristan, > > On 22/11/2015 11:40, Tristan Gingold wrote: >> On 22/11/15 11:56, Brent Hayhoe wrote: >>> Some thoughts: >>> >>> -- So this is the Ada 'discriminated record' type that I presume we are >>> -- discussing. The way it looks to me is just a 'constant generic' >>> applied to -- the record type: >>> >>> type Discriminated_Record (Size : Natural) is >>> record >>> A : String (1 .. Size); >>> end record; >>> >>> -- So if I VHDL'asize this we could have a generic block preceding the >>> record >>> -- block in the type declaration. >>> >>> -- We then need to 'generic map' the 'Size' value through when we >>> declare a >>> -- constant and signals: >>> >>> type MyRecType is >>> generic( >>> Size : Natural >>> ); >>> record >>> A : String (1 to Size); >>> end record MyRecType; >> >> Isn't this a little bit overkill given that it is already possible >> to have unbounded arrays as record elements ? > > Not if you want to do something like: > > entity MyEntity is > generic( > Size : Natural := 10 > ); > port( > IP : in MyRecType generic map(Size); > OP : out MyRecType generic map(Size) > ); > end entity MyEntity; > > You could decompose the records at the port, but with bigger record > structures this will become very cumbersome. My point is that this overlaps record_constraint. What would be the syntax if you have both ? Would that be readable ? Beside the syntax, the semantic is not clear to me. When you 'instantiate' a type, is it a new type or a subtype ? The complexity becomes very high. What is wrong with: type MyRecType is record A : String; end record; entity MyEntity is port (IP : in MyRecType; OP : out MyRecType); end MyEntity; [ In Ada, the discriminants is either a discrete type or an access type. I suppose vhdl is not interested in access type here. But setting the discriminant doesn't create a new type. Furthermore it is possible to change the discriminant(s) under some restrictions. ]Received on Mon Nov 23 12:40:03 2015
This archive was generated by hypermail 2.1.8 : Mon Nov 23 2015 - 12:40:20 PST