Builtin Type
4-state data type which has variable width
logic
is 4-state (0
, 1
, x
, z
) data type.
The variable width can be specified by <>
after logic
.
Multi-dimentional can be specified by <X, Y, Z,,,>
.
module ModuleA {
let _a: logic = 1;
let _b: logic<10> = 1;
let _c: logic<10, 10> = 1;
}
2-state data type which has variable width
bit
is 2-state (0
, 1
) data type.
The variable width can be specified by <>
after bit
.
Multi-dimentional can be specified by <X, Y, Z,,,>
.
module ModuleA {
let _a: bit = 1;
let _b: bit<10> = 1;
let _c: bit<10, 10> = 1;
}
Type modifier
The following type modifiers can be added to logic
and bit
type.
signed
: the MSB is treated as sign-bittri
: tri-state type
module ModuleA {
let _a: signed logic<10> = 1;
let _b: tri logic <10> = 1;
let _c: signed bit <10> = 1;
let _d: tri bit <10> = 1;
}
Integer type
There are some integer types:
u32
: 32bit unsigned integeru64
: 64bit unsigned integeri32
: 32bit signed integeri64
: 64bit signed integer
module ModuleA {
let _a: u32 = 1;
let _b: u64 = 1;
let _c: i32 = 1;
let _d: i64 = 1;
}
Floating point type
There are some floating point types:
f32
: 32bit floating pointf64
: 64bit floating point
Both of them are represented as described by IEEE Std 754.
module ModuleA {
let _a: f32 = 1.0;
let _b: f64 = 1.0;
}
String type
string
is string type.
module ModuleA {
let _a: string = "";
}
Type type
type
is a type which represents type kind.
Variable of type
can be defined as param
or const
only.
module ModuleA {
const a: type = logic;
const b: type = logic<10>;
const c: type = u32;
}