Number

LRM §2.5.

An integer or real mathematical number.

Syntax:

[ sign ] [ size ] [ 'base ] value                 // integer
[ sign ] value.value | [ sign ] baseEexponent     // real

sign = + | -

Description:

In integer numbers, the size specifies the number of bits. Unsized integers default to at least 32-bits. The base represents the radix as specified in the table:

Base

Symbol

Legal values

Binary

b or B

0, 1, x, X, z, Z, ?, _

Octal

o or O

0 - 7, x, X, z, Z, ?, _

Hexadecimal

h or H

0 - 9, a - f, A - F, x, X, Z, Z, ?, _

Decimal (default)

d or D

0 - 9, _

The ? is another way of representing the Z logic value. The underscore (_) may be included for readability, and are ignored. The first and last character of a number may not be an underscore.

When the specified size is less than the value, the upper bits are truncated. When the size is larger than the value, the value is padded on the left with zeros when the left-most bit of the value is 0 or 1. When the left-most bit is X or Z, the value is padded on the left with X or Z.

Real numbers are limited to the values 0 - 9 and the underscore for readability. There must be an value on either side of the decimal point. The E in the scientific notation is not case sensitive

Example:

24
1'b1
8'hA8
-0.5
5.8E3
2e-4

See also:

Operator, String