Int
The Int
type extends Bits
to support interger mathmatical operators.
Constructor
Int(width: Nat)
Operators
Int
s support all operators support by Bits
, with the addition of +
, -
, *
, /
, %
, <
, <=
, >
, and >=
. These operators translate to verilog, but arithmetic operators have their results truncated to the width of the operands (ie, no carry bit and result will overflow).
Methods
Like with operators, all Bits
methods are supported, as well as:
sextend(width: Nat)
: sign extend the value to widthwidth
. Errors ifwidth
is less than the value's width.slt(other: LogicVal)
: signed less than comparison with other, where other is anInt
of the same width.slte(other: LogicVal)
: signed less than or equal comparison with other, where other is anInt
of the same width.sgt(other: LogicVal)
: signed greater than comparison with other, where other is anInt
of the same width.sgte(other: LogicVal)
: signed greater than or equal comparison with other, where other is anInt
of the same width.