Which to learn: Verilog vs. VHDL?

I can see the rationale for that use case.

I appreciate the desire for this in a future VHDL.

Meanwhile, this is a good place for a function.

It can be declared locally, but my solution is to treat bar_record_t as an abstract type. Wrap it in a package along with functions to manipulate it.

package bar_type is type bar_record_t is... function validate (B : bar_record_t; V : bar_valid_t) return bar_record_t; ... end bar_type;

-- in the package body function validate (B : bar_record_t; V : bar_valid_t) return bar_record_t is variable temp: bar_record_t := B; begin temp.valid := V; return temp; end validate;

Then the main code simply reads:

bar0

Reply to
Brian Drummond
Loading thread data ...

That's what I do today, more or less. Except I prefer to keep things as local as possible, so, unless it is used by more than one entity, I'll not put validate() function into package. It works, but it takes few minutes when writing code - not a big deal. More importantly, when reading a code, understanding what's going on takes few tens of second, unless similar technique already appeared many times in the project an the reader already caught with writer's patterns.

BTW, in order to facilitate reader's pattern recognition I'd call the helper function set_valid() rather than validate().

The advantage of built in tool, i.e. non-existent "others=>from" syntax, is that reader already knows what it means. The advantage of solution with combinatorial process is that although reader does not know what it means, he is able to figure it out without jumping back and and force between different source LOCs and files.

Reply to
Michael S

...

Fair enough - for single uses, I do use locally declared functions too.

A good argument for adopting a small and consistent set of patterns!

It's your example; you have the context to name it better than I do!

However you won't be able to sell anyone the idea of a new reserved word "from" on such a lightweight justification. How about "others => bar.others" instead?

Equally clear, I think, and quite in keeping with the language.

- Brian

Reply to
Brian Drummond

e:

ax,

Or others => unaffected

--
Rob Gaddi, Highland Technology -- www.highlandtechnology.com 
Email address domain is currently out of order.  See above to fix.
Reply to
Rob Gaddi

:

as

l
.

on

ntax,

d

Why unaffected? I want other fields of bar1 to get values from bar. Remember, we are discussing concurrent assignments, not assignments in the process

Reply to
Michael S

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.