DOI: 10.3390/electronics15214993 ISSN: 2079-9292

A Resource- and Power-Efficient FPGA Implementation of a Segmented Chebyshev Tanh Activation Function Using Single-Precision Floating-Point Arithmetic

Praneeth Vangala, Xingang Fu, Chanakya Hingu, Mahesh Hosur

Artificial intelligence and machine learning workloads increasingly rely on dedicated hardware accelerators, including field-programmable gate arrays (FPGAs), which offer parallelism and reconfigurability. The hyperbolic tangent (tanh) is widely used as a nonlinear activation function yet is costly to evaluate directly in hardware, making efficient approximation essential. This work presents an FPGA implementation of a segmented Chebyshev-polynomial-based tanh core for IEEE-754 single-precision floating-point. The input domain x∈[−6,6] is reduced to |x|∈[0,6] by exploiting tanh’s odd symmetry, and partitioned into three sub-intervals with per-interval Chebyshev degrees selected to achieve the target accuracy. Polynomial evaluation is performed via Clenshaw’s recurrence, with a single recurrence stage reused for all evaluation steps under finite-state-machine control. Implemented and verified on an Altera Cyclone V FPGA, the core uses 1176 adaptive logic modules, 317 registers, and one digital signal processing (DSP) block. It requires 28 clock cycles for inputs within the approximation domain and 3 outside it, and dissipates 6.20 mW of dynamic power at 40 MHz. The mean absolute error is 8.26×10−8 across the tested inputs and 5.74×10−8 over a denser MATLAB sweep. Against exponential-based, continued-fraction-based, and polynomial-based tanh approximations, it achieves the lowest register, DSP, memory, and dynamic power utilization.

More from our Archive