>From: "Brad Pierce" <Brad.Pierce@synopsys.com> >In your example, the self-determined type of "a+6" is "integer". Minor quibble: I would say that it is a 32-bit signed 4-state vector, which happens to be what "integer" is also. >And the self-determined type of "a+int'(6)" would be "int". Major quibble: The result of all the operators are defined to be 4-state, even if the operands are all 2-state. Implementations are free to optimize them and perform 2-state operations when the results are equivalent, but they are formally defined to be 4-state. So the type of this is the same as "integer" also. >But I don't know what the self-determined type of, say, "{3{2'b01}}" is, >so neither do I know the result of "type({3{2'b01}})". Those are 6-bit unsigned 4-state vectors. You are assuming that the type of a multiple concatenation is less clear than that of an addition. Presumably that is because it is obvious that the type must be synthesized, because it does not match any of the operands in it. But the same is true of an addition. Here is an example that makes that more obvious. With "int a", (a+1'bx) is a 32-bit unsigned 4-state vector. It is not type int, since it is 4-state and unsigned. But it obviously is not a 1-bit unsigned vector either. Its type does not match any of its operands. Its type has to be synthesized from the properties of the expression. For Verilog integral types, we have to give up the concept from other languages of the operand types being propagated. Instead, their size and signedness get propagated, and the type has to be synthesized. Since the general case requires that, I don't see any point in trying to claim that operand types have been preserved and propagated in other situations. As soon as an integral value is used in an expression, it loses its type and becomes a generic vector. > I could say the >same even for "2'b01" and "type(2'b01)". Is it legal to apply "$left" >to a literal? If it's legal, what is "$left(2'b01)"? I agree that the ranges associated with types extracted from expressions are unclear. Steven Sharp sharp@cadence.com -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Mon Oct 15 15:15:54 2007
This archive was generated by hypermail 2.1.8 : Mon Oct 15 2007 - 15:16:04 PDT