Common#

class rtlsim.FxpProps#

Fixed-point properties.

class Overflow#

Overflow behavior

SATURATE = 1#
WRAP = 0#

Wrap around (default behavior)

class Rounding#

Rounding behavior

AROUND = 1#
CEIL = 3#
FIX = 4#
FLOOR = 2#
TRUNCATE = 0#

Truncate the fractional part (default behavior)

overflow_dict = {'saturate': 1, 'wrap': 0}#
overflow_options = ['wrap', 'saturate']#
rounding_dict = {'around': 1, 'ceil': 3, 'fix': 4, 'floor': 2, 'truncate': 0}#
rounding_options = ['truncate', 'around', 'floor', 'ceil', 'fix']#
static vMax(S, W, F)#

Maximum value of the fixed-point number.

Parameters:
  • S (boolean) – Sign bit (True for signed, False for unsigned)

  • W (positive integer) – Word bit width

  • F (integer) – Fractional bit width

static vMaxInt(S, W)#

Maximum value of the integer number (disregarding F).

Parameters:
  • S (boolean) – Sign bit (True for signed, False for unsigned)

  • W (positive integer) – Word bit width

static vMin(S, W, F)#

Minimum value of the fixed-point number.

Parameters:
  • S (boolean) – Sign bit (True for signed, False for unsigned)

  • W (positive integer) – Word bit width

  • F (integer) – Fractional bit width

static vMinInt(S, W)#

Minimum value of the integer number (disregarding F).

Parameters:
  • S (boolean) – Sign bit (True for signed, False for unsigned)

  • W (positive integer) – Word bit width

static vPrecision(F)#

Precision of the fixed-point number (\(2^{-F}\)).

Parameters:

F (integer) – Fractional bit width

static vRange(S, W, F)#

Range of the fixed-point number.

Parameters:
  • S (boolean) – Sign bit (True for signed, False for unsigned)

  • W (positive integer) – Word bit width

  • F (integer) – Fractional bit width

static vRangeInt(S, W)#

Range of the integer number (disregarding F).

Parameters:
  • S (boolean) – Sign bit (True for signed, False for unsigned)

  • W (positive integer) – Word bit width