Skip to content

Integer Types

Bit

v1.0.0

bit is a integer data type with default properties: unsigned, 1-bit width, {0, 1} domain.

Declare a bit

bit singleBit;

Declare 8-bits wide bit type

Possible values specified by bit width are {0..(2width-1)}

bit [8] singleByte;     //  possible values: {0..127};
bit [7:0] singleByte;   //  possible values: {0..127};

lower bound must be 0

dual bounds may be removed in future version

Declared with specified value domain

Not support yet

Values of variable are within intersection of possible values by width and value domain.

1
2
3
4
5
bit [8] in [0, 1, 5]             singleByte;    //  value domain: {0, 1, 5}
bit [8] in [..2]                 singleByte;    //  value domain: {0, 1, 2}
bit [8] in [6..8]                singleByte;    //  value domain: {6, 7, 8}
bit [8] in [254..]               singleByte;    //  value domain: {254, 255}
bit [8] in [5, ..2, 6..8, 254..] singleByte;    //  value domain: {0, 1, 2, 5, 6, 7, 8, 254, 255}

Tip

Specify value domain is useful for random variable. Following examples are equalize:

rand bit [8] in [5, ..2, 6..8, 253..] singleByte;
1
2
3
4
rand bit [8] singleByte;
constraint {
    singleByte in [5, ..2, 6..8, 253..];
}

Integer

v1.0.0

int is a integer data type with default properties: signed, 32-bits width, {-231..(231-1)} domain.

Declare an integer:

int int32;

Declare 8-bits wide int type

Possible values specified by bit width are {-2width-1..(2width-1-1)}

int [8] int8;       //  possible values: {-128..127}
int [7:0] int8;     //  possible values: {-128..127}

lower bound must be 0

dual bounds may be removed in future version

Declared with specified value domain

Not support yet

Values of variable are within intersection of possible values by width and value domain.

1
2
3
4
5
int [8] in [0, 1, 5]                  int8; //  value domain: {0, 1, 5}
int [8] in [..(-127)]                 int8; //  value domain: {-128, -127}
int [8] in [6..8]                     int8; //  value domain: {6, 7, 8}
int [8] in [126..]                    int8; //  value domain: {126, 127}
int [8] in [5, ..(-127), 6..8, 253..] int8; //  value domain: {-128, -127, 5, 6, 7, 8, 126, 127}

Tip

Specify value domain is useful for random variable. Following examples are equalize:

rand int [8] in [5, ..(-127), 6..8, 253..] int8;
1
2
3
4
rand int [8] int8;
constraint {
    int8 in [5, ..(-127), 6..8, 253..];
}

Last update: 2023-10-24
Created: 2023-10-11