Constants

Floating-point constants are specified in the same syntax as C99. Integer constants can be specified in two alternative forms; one is based on C integer constants, while the other is based on Verilog integer constants.

Integer constants may be specified in a C-like form, with the additions that 0b and 0B prefixes may be used to specify binary data, and underscores may be inserted arbitrarily into the constant to improve readability. These constants may not include metadata (x and z bits), and are scanned to the number of bits set by the _DefaultWordSize pragma. An overflow is reported if the constant cannot be represented in this many bits.

Integer constants may alternatively be specified in a Verilog-like syntax; this allows metadata to be entered, and also allows constants of arbitrary width to be specified. These constants are specified identically to Verilog "based constants", with the following exceptions:

  1. the size prefix may be followed by a back-tick (`) character, rather than an apostrophe (') character. See FAQ 20 for more details.
  2. there must be no whitespace anywhere in the constant
  3. the s designator is illegal (as in Verilog-1995)
  4. if a size prefix is present and the constant cannot be represented in the specified size, an overflow error is reported
  5. if a size prefix is not present, the constant is scanned to the number of bits specified by _DefaultWordSize, and an overflow error is reported if it cannot be represented in this many bits
  6. if there is not enough data in the constant to fill the specified number of bits, then the data is always padded with 0 bits to the left; x and z padding is never used

Maia has no concept of 'signed' and 'unsigned' constants (this is why the s designator is illegal). 'Signedness' is a property of operators, rather than objects.