On Jun 24, 7:07=A0pm, Reuven <rpaley...@[EMAIL PROTECTED]
> wrote:
> On Jun 24, 1:27=A0pm, Andrew <sharp...@[EMAIL PROTECTED]
> wrote:
>
>
>
> > On Jun 24, 11:48=A0am, Tricky <Trickyh...@[EMAIL PROTECTED]
> wrote:
>
> > > Can I do what I asked, I suspect not, so Im thinking along the
lines:
>
> > > type my_record_type is
> > > =A0 record
> > > =A0 =A0 name =A0 =A0: string(1 to 20);
> > > =A0 =A0 ....
> > > =A0 end record my_record;
>
> > > Basically, I want to be able to give the record name a constant
strin=
g
> > > when it is delcared like:
>
> > > CONSTANT my_record : my_record_type :=3D ( name =3D> "Betty
Swollocks=
",
> > > --length only 15, complains unless I pad to 20 chars.
> > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0
=
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0
...=
.....)
>
> > > Or am I just going to have to pad the name with whitespace to make
it
> > > up to name'length?
>
> > If you want variable length strings you can use an access type to
> > define a string pointer.
>
> > eg: type string_ptr is access string;
>
> > Your record would look something like this:
>
> > type my_record_type is
> > =A0 record
> > =A0 =A0 name =A0 =A0: string_ptr;
> > =A0 =A0 ....
> > =A0 end record my_record;
>
> > To set the string you use the "new" keyword to allocate memory.
>
> > my_record.name <=3D new string'("Betty Swollocks");
>
> > When you are done using my_record.name, you deallocate the memory
> > using the deallocate procedure.
>
> > Read up on access types.- Hide quoted text -
>
> > - Show quoted text -
>
> Can a record containing access types be an entity ****t?
I don't think so... Signals and constants can't be declared as access
types. Access types are not synthesizable but they are incredibly
useful for testbenches.


|