[email protected] (Bin Li) wrote in message news:<
[email protected] com>...
>
> My question is: I cannot find corresponding information about
> mismatched "by order" port connection in the LRM (IEEE 1364-2001). Do
> above ncelab's outputs accord with standard Verilog-2001?
The LRM does not always describe all possible situations. Sometimes
you have to rely on common sense, based on what the LRM does say. Where
it is still unclear (and doesn't involve new Verilog-2001 functionality),
you can check the behavior of the "de facto" standard, Verilog-XL.
Unattached ports are definitely allowed, since 12.3.6 states that you
can leave out a port expression in connection by name to document that
you are leaving it unconnected. The fact that it says that you do this
only to document leaving it unconnected implies that you can also just
not mention that port. Too few port expressions would be the equivalent
of this for connection by ordered list. So this is legal, but could
still produce a warning. The LRM doesn't restrict where tools can produce
warnings.
(Note that you can also explicitly leave null expressions in your
ordered list, by just putting in commas with nothing between them.
For example, "foo f(1,,2);" lets you leave the second port unconnected,
and "foo f(1,2,);" explicitly leaves the third port unconnected, which
documents that you knew there was another port, but you are deliberately
leaving it unconnected. In this case, you won't get a warning.)
Too many port expressions is clearly a mistake. There are no ports to
connect them to, so this doesn't make sense. So this is an error.
If you test this with Verilog-XL, it produces a warning for the
short list, and an error for the long list. So the first is legal
(though dangerous), but the second is illegal.