The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl
Design Languages >> VHDL-AMS >> Generic parameter passing in a record
https://designers-guide.org/forum/YaBB.pl?num=1106941177

Message started by nicolas on Jan 28th, 2005, 11:39am

Title: Generic parameter passing in a record
Post by nicolas on Jan 28th, 2005, 11:39am

Hello !

I have the following problem, I hope some can help me.

I've written an entity with a lot of parameters, so I decided to put them all in a type record in a package together with a constant declaration of this same type, where all default values are given:

package pck is
 type param_rec is record
   p1 : real;
   p2 : real;
   ...
 end record param_rec;
 constant default_params : param_rec :=
 ( p1 => 1.0, p2 => 2.0, ...);
end package pck;

So the bottom level entity is initialized with the default
parameter values:

entity bottom_entity is
 generic( param : param_rec := default_params );
 port( ... );
end entity bottom_entity;

In the upper level entity I would like to redeclare
only a couple of parameters, not all of them:

E1 : entity bottom_entity ( my_struct )
    generic map( param.p1 => 2.0 )
    port map ( ... );

Here the compiler issues the error: "too few values for
record aggregate". I thought one could reassign individual
fields of a record without the need to reassign all of them,
particularly because the other fields should have their default values. Does someone know a better solution or see an error above?

Thanks

Nicolas.

The Designer's Guide Community Forum » Powered by YaBB 2.2.2!
YaBB © 2000-2008. All Rights Reserved.