Re: [vhdl-200x] conditional compilation proposal

From: Evan Lavelle <>
Date: Tue Aug 16 2011 - 08:41:17 PDT

On 16/08/2011 15:42, Higgs, Chris wrote:

> Our task is change the language to facilitate user requirements. If
> users are generating code or scripting pre-processors to work around
> some language deficiency, we should tackle the deficiency, not provide a
> standard mechanism for working around them!

Well, yes, but the deficiency *is* that there is no conditional
compilation mechanism. Conditional inclusion is not a workaround - it's
the requirement.

> What is the purpose of conditional compilation? Surely it's to
> optionally select compile paths, which is essentially what generate
> does.

Well... no. All paths are compiled, although code may not be generated
on some paths. As an engineer, I would say that the purpose of generate
is just that - model and hardware generation. As a programmer, I would
certainly not say that its purpose is conditional compilation - it isn't.

> The caveat (as you point out) that the code must be syntactically
> correct, however this is not a bad thing (see my comment on the twiki
> page). One of VHDL's strengths is that as much as possible it enforces
> correctness at compile time.

It is a bad thing, if the code is not ready for compiling, or cannot be
compiled. This isn't related to type correctness.

> If you have code which you're never planning on compiling (#if 0) then
> there's no need for conditional compilation as you're not going to
> conditionally compile it. Isn't commenting out code in this case (or
> removing it completely) preferable?

With a delimited/block comment? Doesn't work if there's already a
delimited comment in there. That takes you back to the old arguments
about using emacs C-c C-c, and so on, that I've been seeing for 20 years
on usenet. And please don't reply that you should just delete and use
your revision control system, because this is what revision control
systems are for... they're not.

> For other cases (#if _SOME_CONDITIONAL_FEATURE_) the generate should be
> used. If there is functionality not possible using generate then that is
> the issue we should address. Adding an entire pre-processing stage to
> mimic #if 0 sounds rather extreme.

Generate is a concurrent statement, enclosing concurrent statements. As
such, it misses a large part, if not most, of the use cases that #if
covers. Of course, it's fine if you want to get rid of a few concurrent
statements, and they're already syntactically correct, and you can't be
bothered to comment them out or delete them.


This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Tue Aug 16 08:41:52 2011

This archive was generated by hypermail 2.1.8 : Tue Aug 16 2011 - 08:41:59 PDT