ieee754.fpcommon.test package¶
Submodules¶
ieee754.fpcommon.test.case_gen module¶
FP Unit Test Infrastructure
allows testing of:
- random range against random range
* +/- 0, +/- inf, +/- NaN permutations, all tested against all permutations * all of those permutations (+/- 0/inf/NaN) against the following: - nearly zero (random variations) - minimum non-zero exponent (random variations) - nearly infinite (random variations) - random versions of NaN (noncanonical NaN) - random numbers (at the full range)
inversion of permutations also done, where appropriate (A,B and B,A)
single-operand version also supported
-
class
ieee754.fpcommon.test.case_gen.
PipeFPCase
(dut, name, mod, fmod, width, fpfn, count, single_op, opcode)¶ Bases:
object
-
run
(name, fn)¶
-
run_cornercases
()¶
-
run_random
()¶
-
run_regressions
(regressions_fn)¶
-
-
ieee754.fpcommon.test.case_gen.
corner_cases
(mod)¶
-
ieee754.fpcommon.test.case_gen.
get_corner_cases
(mod, single_op=False)¶
-
ieee754.fpcommon.test.case_gen.
get_corner_rand
(mod, fixed_num, maxcount, width, single_op=False)¶
-
ieee754.fpcommon.test.case_gen.
get_n127
(mod, fixed_num, maxcount, width, single_op=False)¶
-
ieee754.fpcommon.test.case_gen.
get_nan_noncan
(mod, fixed_num, maxcount, width, single_op=False)¶
-
ieee754.fpcommon.test.case_gen.
get_nearly_inf
(mod, fixed_num, maxcount, width, single_op=False)¶
-
ieee754.fpcommon.test.case_gen.
get_nearly_zero
(mod, fixed_num, maxcount, width, single_op=False)¶
-
ieee754.fpcommon.test.case_gen.
get_rand1
(mod, fixed_num, maxcount, width, single_op=False)¶
-
ieee754.fpcommon.test.case_gen.
get_rval
(width)¶
-
ieee754.fpcommon.test.case_gen.
replicate
(fixed_num, maxcount)¶
-
ieee754.fpcommon.test.case_gen.
run_pipe_fp
(dut, width, name, mod, fmod, regressions, fpfn, count, single_op=False, opcode=None)¶
ieee754.fpcommon.test.feedbackmux module¶
ieee754.fpcommon.test.fpmux module¶
key strategic example showing how to do multi-input fan-in into a multi-stage pipeline, then multi-output fanout.
the multiplex ID from the fan-in is passed in to the pipeline, preserved, and used as a routing ID on the fanout.
-
class
ieee754.fpcommon.test.fpmux.
MuxInOut
(dut, width, fpkls, fpop, vals, single_op, opcode, cancel=False, feedback_width=None)¶ Bases:
object
-
rcv
(muxid)¶
-
send
(muxid)¶
-
-
ieee754.fpcommon.test.fpmux.
create_random
(num_rows, width, single_op=False, n_vals=10)¶
-
ieee754.fpcommon.test.fpmux.
pipe_cornercases_repeat
(dut, name, mod, fmod, width, fn, cc, fpfn, count, single_op=False, opcode=None)¶
-
ieee754.fpcommon.test.fpmux.
repeat
(num_rows, vals)¶ bit of a hack: repeats the last value to create a list that will be accepted by the muxer, all mux lists to be of equal length
-
ieee754.fpcommon.test.fpmux.
runfp
(dut, width, name, fpkls, fpop, single_op=False, n_vals=10, vals=None, opcode=None, cancel=False, feedback_width=None)¶
ieee754.fpcommon.test.test_fsm_experiment module¶
-
class
ieee754.fpcommon.test.test_fsm_experiment.
FPDIV
(width)¶ Bases:
ieee754.fpcommon.fpbase.FPBase
,nmigen.hdl.ir.Elaboratable
-
add_state
(state)¶
-
elaborate
(platform=None)¶ creates the HDL code-fragment for FPDiv
-
ispec
()¶
-
ospec
()¶
-
process
(i)¶
-
setup
(m, i)¶
-
-
class
ieee754.fpcommon.test.test_fsm_experiment.
FPDIVPipe
(width)¶ Bases:
nmutil.singlepipe.ControlBase
-
elaborate
(platform)¶ handles case where stage has dynamic ready/valid functions
-
-
ieee754.fpcommon.test.test_fsm_experiment.
resultfn
(data_o, expected, i, o)¶
ieee754.fpcommon.test.unit_test_double module¶
-
ieee754.fpcommon.test.unit_test_double.
check_case
(dut, a, b, z, mid=None)¶
-
ieee754.fpcommon.test.unit_test_double.
create
(s, e, m)¶
-
ieee754.fpcommon.test.unit_test_double.
get_case
(dut, a, b, mid)¶
-
ieee754.fpcommon.test.unit_test_double.
get_exponent
(x)¶
-
ieee754.fpcommon.test.unit_test_double.
get_mantissa
(x)¶
-
ieee754.fpcommon.test.unit_test_double.
get_sign
(x)¶
-
ieee754.fpcommon.test.unit_test_double.
inf
(s)¶
-
ieee754.fpcommon.test.unit_test_double.
is_inf
(x)¶
-
ieee754.fpcommon.test.unit_test_double.
is_nan
(x)¶
-
ieee754.fpcommon.test.unit_test_double.
is_neg_inf
(x)¶
-
ieee754.fpcommon.test.unit_test_double.
is_pos_inf
(x)¶
-
ieee754.fpcommon.test.unit_test_double.
match
(x, y)¶
-
ieee754.fpcommon.test.unit_test_double.
nan
(s)¶
-
ieee754.fpcommon.test.unit_test_double.
run_corner_cases
(dut, count, op, get_case_fn)¶
-
ieee754.fpcommon.test.unit_test_double.
run_edge_cases
(dut, count, op, get_case_fn, maxcount=1000, num_loops=1000)¶
-
ieee754.fpcommon.test.unit_test_double.
run_fpunit
(dut, stimulus_a, stimulus_b, op, get_case_fn)¶
-
ieee754.fpcommon.test.unit_test_double.
set_exponent
(x, e)¶
-
ieee754.fpcommon.test.unit_test_double.
zero
(s)¶
ieee754.fpcommon.test.unit_test_half module¶
-
ieee754.fpcommon.test.unit_test_half.
check_case
(dut, a, b, z)¶
-
ieee754.fpcommon.test.unit_test_half.
create
(s, e, m)¶
-
ieee754.fpcommon.test.unit_test_half.
get_case
(dut, a, b)¶
-
ieee754.fpcommon.test.unit_test_half.
get_exponent
(x)¶
-
ieee754.fpcommon.test.unit_test_half.
get_mantissa
(x)¶
-
ieee754.fpcommon.test.unit_test_half.
get_sign
(x)¶
-
ieee754.fpcommon.test.unit_test_half.
inf
(s)¶
-
ieee754.fpcommon.test.unit_test_half.
is_inf
(x)¶
-
ieee754.fpcommon.test.unit_test_half.
is_nan
(x)¶
-
ieee754.fpcommon.test.unit_test_half.
is_neg_inf
(x)¶
-
ieee754.fpcommon.test.unit_test_half.
is_pos_inf
(x)¶
-
ieee754.fpcommon.test.unit_test_half.
match
(x, y)¶
-
ieee754.fpcommon.test.unit_test_half.
nan
(s)¶
-
ieee754.fpcommon.test.unit_test_half.
run_corner_cases
(dut, count, op)¶
-
ieee754.fpcommon.test.unit_test_half.
run_edge_cases
(dut, count, op, maxcount=10, num_loops=1000)¶
-
ieee754.fpcommon.test.unit_test_half.
run_fpunit
(dut, stimulus_a, stimulus_b, op)¶
-
ieee754.fpcommon.test.unit_test_half.
set_exponent
(x, e)¶
-
ieee754.fpcommon.test.unit_test_half.
zero
(s)¶
ieee754.fpcommon.test.unit_test_single module¶
-
ieee754.fpcommon.test.unit_test_single.
check_case
(dut, a, b, z, mid=None)¶
-
ieee754.fpcommon.test.unit_test_single.
check_rs_case
(dut, a, b, z, mid=None)¶
-
ieee754.fpcommon.test.unit_test_single.
create
(s, e, m)¶
-
ieee754.fpcommon.test.unit_test_single.
get_case
(dut, a, b, mid)¶
-
ieee754.fpcommon.test.unit_test_single.
get_exponent
(x)¶
-
ieee754.fpcommon.test.unit_test_single.
get_mantissa
(x)¶
-
ieee754.fpcommon.test.unit_test_single.
get_rs_case
(dut, a, b, mid)¶
-
ieee754.fpcommon.test.unit_test_single.
get_sign
(x)¶
-
ieee754.fpcommon.test.unit_test_single.
inf
(s)¶
-
ieee754.fpcommon.test.unit_test_single.
is_inf
(x)¶
-
ieee754.fpcommon.test.unit_test_single.
is_nan
(x)¶
-
ieee754.fpcommon.test.unit_test_single.
is_neg_inf
(x)¶
-
ieee754.fpcommon.test.unit_test_single.
is_pos_inf
(x)¶
-
ieee754.fpcommon.test.unit_test_single.
match
(x, y)¶
-
ieee754.fpcommon.test.unit_test_single.
nan
(s)¶
-
ieee754.fpcommon.test.unit_test_single.
run_cases
(dut, count, op, fixed_num, maxcount, get_case_fn)¶
-
ieee754.fpcommon.test.unit_test_single.
run_corner_cases
(dut, count, op, get_case_fn)¶
-
ieee754.fpcommon.test.unit_test_single.
run_edge_cases
(dut, count, op, get_case_fn, maxcount=10, num_loops=1000)¶
-
ieee754.fpcommon.test.unit_test_single.
run_fpunit
(dut, stimulus_a, stimulus_b, op, get_case_fn)¶
-
ieee754.fpcommon.test.unit_test_single.
run_fpunit_2
(dut, stimulus_a, stimulus_b, op, get_case_fn)¶
-
ieee754.fpcommon.test.unit_test_single.
set_exponent
(x, e)¶
-
ieee754.fpcommon.test.unit_test_single.
zero
(s)¶