exp generator uses a Taylor series approximation to calculate the fixed point value of the natural
e^x. The Maclaurin series
for the function can be written as:
e^x = 1 + x + x^2/2! + x^3/3! + ... + x^n/n!
n is the nth degree or order of the polynomial.
For signed values, we can take the reciprocal value:
e^(-x) = 1/e^x
gen_exp.py file can generate an entire Calyx program for testing purposes.
main component contains memories
x (for the input) and
ret for the result of
In order to generate an example program with degree
4, bit width
32, integer bit width
x interpreted as a signed value:
./calyx-py/calyx/gen_exp.py -d 4 -w 32 -i 16 -s true
Similarly, it provides a function to produce only the necessary components to be dropped into other Calyx programs.
Install the calyx-py library.
The command line options configure the degree (or order) of the taylor series, bit width, integer bit width, and sign.
--degree: The degree of the Taylor polynomial.
--width: The bit width of the value
--int_width: The integer bit width of the value
x. The fractional bit width is then inferred as
width - int_width.
--is_signed: The signed interpretation of the value
xis a signed value, this should be