5. Code Docs

5.1. Generator-Module

5.2. Constants-Module

riscv_ctg.constants.gen_sign_dataset(bit_width)[source]
Function to generate the signed data set with datapoints from the following patterns.
  • alternating ones

  • alternating zeros

  • walking ones

  • walking zeros

  • max val

  • min val

  • max val/2

  • min val/2

  • [-10,10]

param bit_width

integer defining the size of the input

type bit_width

int

return

a list of integers

riscv_ctg.constants.gen_sp_dataset(bit_width, sign=True)[source]
Function generates a special dataset of interesting values:
  • [3*1/3,3*2/3,5,5*1/5,5*2/5]

  • sqrt (bit_width<<1)

  • +/-1 variants of the above

param bit_width

Integer defining the size of the input

param sign

Boolen value specifying whether the dataset should be interpreted as signed numbers or not.

type sign

bool

type bit_width

int

return

a list of integers

riscv_ctg.constants.gen_usign_dataset(bit_width)[source]
Function to generate the unsigned dataset
  • alternating ones

  • alternating zeros

  • walking ones

  • walking zeros

  • max val

  • min val

  • max val/2

  • min val/2

  • [0,20]

param bit_width

integer defining the size of the input

type bit_width

int

return

a list of integers

riscv_ctg.constants.twos(val, bits)[source]

A function to generate the two’s complement of a number which is of arbitrary width

Parameters
  • val (Union[int, str]) – the input which can be either a hexadecimal string or integer

  • bits (int) – size of the input in terms of bits.

Returns

integer value in 2’s complement representation