Re: [sv-bc] implicit declarations in port expressions

From: Steven Sharp <sharp_at_.....>
Date: Mon Jun 12 2006 - 11:24:08 PDT
>From: "Feldman, Yulik" <yulik.feldman@intel.com>

>"If an identifier is used in a port expression declaration, then an
>implicit net of default net type shall be assumed, with the vector width
>of the port expression declaration. See 12.3.3 for a discussion of port
>expression declarations".
> 
>
>However, the term "port expression declaration" is not defined and is
>not referenced anywhere except the above paragraph. Was the intention to
>write "port expression in a port declaration", to refer to identifiers
>like the identifier "b" in "module m(.a(b));"?
> 
>
>If the answer is "yes", then there is also a semantics question with
>regard to that paragraph. Consider that we have an implicit declaration
>"b" like in the example above. However, section 12.3.3 "Port
>declarations" says: 
>
>
>"Each port_identifier in a port_expression in the list of ports for the
>module declaration shall also be declared in the body of the module as
>one of the following port declarations: input, output, or inout
>(bidirectional)".
> 
>
>Which means that if the direction is not declared in the body of the
>module, such an implicit declaration is an error anyway. And if the
>direction is declared, should the identifier indeed be treated as an
>implicit declaration?


The port_expression must be declared as a port with a direction.
However, you may leave out the declaration as a net or reg.  In that
case, you get an implicit declaration of a net with the default
net type, and with the vector width (if any) taken from the declaration
of the port.


> So, what is the intention of the text in section
>4.5 and what is the expected semantics?


That if you declare a port, but do not declare it as a net or reg,
it becomes a net of the default net type.  This was very common in
Verilog-1995, because there was no syntax for combining the port
and net/reg declaration in a single declaration.  The name had to
be declared twice.  It was common to leave out the net declaration
and just provide the port declaration, to save typing.

Unfortunately, while users were aware of this (or did it without
being aware they were doing it), section 3.5 of the 1995 standard
didn't actually say this.  So this text was added in the 2001 standard,
and cleaned up some in the 2005 standard (where it is now in 4.5).

I'm sure it could be made clearer, but it is still an improvement over
the 1995 standard, which didn't specify it at all.

Steven Sharp
sharp@cadence.com
Received on Mon Jun 12 11:23:41 2006

This archive was generated by hypermail 2.1.8 : Mon Jun 12 2006 - 11:23:50 PDT