RE: [vhdl-200x] conditional compilation proposal

From: Scott Thibault <thibault@gmvhdl.com>
Date: Wed Aug 17 2011 - 05:33:14 PDT

>
> On 17/08/2011 01:40, Scott Thibault wrote:
> > For such a small function, I think a declaration generate would be
> > appropriate:
> >
> > if defined("__EDA_VENDOR_1__") generate
> > function real _ID23() is
> > begin
> > -- vendor 1 version
> > end;
>
> Ok, you're taking about defining a new generate statement, which wasn't
> clear to me. This new generate works in a declarative region, which is
clearly
> a problem, and would have to be in addition to a new sequential generate,
to
> work in sequential regions.
>

No a sequential generate is not necessary. As you pointed out, the existing
sequential if statement is suitable for that purpose. The only thing
necessary for that is a defined function. For example,

function read_ID23() return real is
begin
  if (defined("__EDA_VENDOR_1__")) then
  -- version 1
  else
  -- other version
  end if;
end function;

> If we ignore the issue of a "declarative generate", The LRM defines
> "generate" as providing a "mechanism for iterative or conditional
elaboration
> of a portion of a description", where elaboration is "defined for design
> hierarchies, declarative parts, statement parts (containing concurrent
> statements), and concurrent statements" [and declarations]. An immediate
> problem is that you're now defining elaboration in the context of
arbitrary
> sequential statements, which is not, I believe, a logical or valid thing
to do.

No, I am not suggesting a generate inside sequential statement bodies.

> If you don't mind me saying so, I believe that you're conflating two
issues
> here. You (and various others) are using 'generate' as a shorthand for a
> language construct that tests a static expression, which isn't its
purpose. The
> language is already full of requirements for static expressions, and
you're
> also defining a new one with "defined(__EDA_VENDOR_1__)". In other
> words, the "generate" in your example is redundant anyway; the new "if
> defined" does the job. Your "if defined" is, in fact, equivalent to D's
static if,
> which I've already mentioned elsewhere. The D version has the advantage
> that it doesn't introduce a new scope.

I don't know what D's static if is.

--Scott

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Wed Aug 17 05:34:02 2011

This archive was generated by hypermail 2.1.8 : Wed Aug 17 2011 - 05:34:31 PDT