I am writing a Verilog analysis system, and I came across a number of
things that are not clear in the Verilog LRM.
The following questions relate to IEEE Std 1364-1995.
Section 12.1, p. 136:
The grammar indicates that complex port expressions such as:
module bar(.foo({a,b}));
can be used. Is this true, or is this an error in the grammar?
(Look at the two possible expansions of the nonterminal "port")
Section 4.1.9, p. 33:
&& and || are not explicitly defined for any data type! I assume that they
work the way they do in C. However, how are && and || to be interpreted for
reals? I assume that if A is a real argument to one of these, then it can be
evaluated as (A != 0.0). There is a (weak) statement defining !A as (A==0.0).
Section 2.5.1, p. 8 and section 4.1.6, p. 32:
The default width of a based integer without a size is at least 32 bits, but
implementations are free to use more. However, the examples on p. 32 make
sense only if the size is exactly 32 bits. How much Verilog code would
break if the default size for integers was 64 bits instead?
Section 3.9.1 - 3.9.2, p. 25:
What happens if a real number and based register are used in an operation?
e.g.:
reg[15:0] a,b;
real c,d;
a = 16'h01X3;
c = 3.14;
b = a + c; // Is result X due to X's in a?
d = a + c; // Is result zero (due to X's being converted) or 262.14?
Section 4.3, p. 42:
"The min:typ:max format can be used wherever expressions may appear".
How, then, are all the operators defined?
+ and - are obvious, but what about > or <? Can simple expressions be
mixed with mintypmax? e.g. does 3+(1:2:4) have any meaning?
Section 16:
What is the relative priority of multiline comments and compiler directives?
e.g.:
/*
`define foo bar
*/
Does foo get defined or not?
Similarly, when the preprocessor is skipping text due to a `ifdef whose
test symbol is not defined, should it respect `include and other directives?
(It must examine `ifdef, `else and `endif to nest properly, but this is only
stated in the explanatory note 2 on p. 223!)
e.g.:
`define foo bar
`ifdef foo
`else
`include "otherfile"
`endif
// Must "otherfile" be opened and read in? It might contain:
`endif
`ifdef gloob