Skip to content

Int

The Int type extends Bits to support interger mathmatical operators.

Constructor

Int(width: Nat)

Operators

Ints 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 width width. Errors if width is less than the value's width.
  • slt(other: LogicVal): signed less than comparison with other, where other is an Int of the same width.
  • slte(other: LogicVal): signed less than or equal comparison with other, where other is an Int of the same width.
  • sgt(other: LogicVal): signed greater than comparison with other, where other is an Int of the same width.
  • sgte(other: LogicVal): signed greater than or equal comparison with other, where other is an Int of the same width.