EDAboard.com | EDAboard.eu | EDAboard.de | EDAboard.co.uk | RTV forum PL | NewsGroups PL

Is Partial Record Assignment Possible?

Ask a question - edaboard.com

elektroda.net NewsGroups Forum Index - VHDL Language - Is Partial Record Assignment Possible?

Goto page Previous  1, 2

Jonathan Bromley
Guest

Sat Jul 30, 2011 1:59 pm   



On Fri, 6 Aug 2010 10:34:38 -0700 (PDT), Sudoer
<TheProperNoun_at_psychophile.com> wrote:

Quote:
I often use records within records, or records within records within
records, ad nausea. It's nice that I can currently do the following:

A.A.A <= X;
A.A.B <= Y;
A.A.C <= Z;

However, there's a lot of repetition in my code, so I often prefer the
following:

A <= ( A => ( A => X,
B => Y,
C => Z ) );

The benefit is more noticeable with long and descriptive names for the
elements, but the problem is that if my intention is to set only the
A, B, and C leaf elements and leave any others unchanged it doesn't
seem possible.

How about an alias?

alias AA: ABC_record_type is A.A;
...
AA.A <= X;

Doesn't quite do what you asked for (I don't think that's
possible) but it does simplify the naming problem somewhat.

Functions and procedures might be useful too:
procedure tweakJustTheLeafParts(signal T: inout ABC_record_type) is
begin
T.A <= X;
...
end;
...
tweakJustTheLeafParts(A.A); -- does A.A.A <= X;

Watch out for multiple drivers, though, as Rob Gaddi points out.
--
Jonathan Bromley

Jonathan Bromley
Guest

Sat Jul 30, 2011 2:01 pm   



On Sat, 30 Jul 2011 14:59:57 +0100, Jonathan Bromley

..... sent a long-dead post by mistake. Sorry, please ignore.


Quote:
On Fri, 6 Aug 2010 10:34:38 -0700 (PDT), Sudoer
TheProperNoun_at_psychophile.com> wrote:

I often use records within records, or records within records within
records, ad nausea. It's nice that I can currently do the following:

A.A.A <= X;
A.A.B <= Y;
A.A.C <= Z;

However, there's a lot of repetition in my code, so I often prefer the
following:

A <= ( A => ( A => X,
B => Y,
C => Z ) );

The benefit is more noticeable with long and descriptive names for the
elements, but the problem is that if my intention is to set only the
A, B, and C leaf elements and leave any others unchanged it doesn't
seem possible.

How about an alias?

alias AA: ABC_record_type is A.A;
...
AA.A <= X;

Doesn't quite do what you asked for (I don't think that's
possible) but it does simplify the naming problem somewhat.

Functions and procedures might be useful too:
procedure tweakJustTheLeafParts(signal T: inout ABC_record_type) is
begin
T.A <= X;
...
end;
...
tweakJustTheLeafParts(A.A); -- does A.A.A <= X;

Watch out for multiple drivers, though, as Rob Gaddi points out.


Goto page Previous  1, 2

elektroda.net NewsGroups Forum Index - VHDL Language - Is Partial Record Assignment Possible?

Ask a question - edaboard.com

Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
RTV map EDAboard.com map News map EDAboard.eu map EDAboard.de map EDAboard.co.uk map Opony