### Don't have a Xilinx account yet?

• Choose to receive important news and product information
• Personalize your web experience on Xilinx.com

Create Account

XClose Panel

## DSP Tools

Visitor
Posts: 4
Registered: ‎06-26-2012

# Implement tanh using cordic block

Can anybody teach me how to generate a tanh function by using cordic 4.0 block? Act, I want to implement this function y(x)=1/2 tanh(x/2)+ 1/2 for sigmoid function approximation. But how can I model this function using Xilinx System Generator's cordic block? Thx

Expert Contributor
Posts: 2,059
Registered: ‎08-14-2007

# Re: Implement tanh using cordic block

Hi,

the straightforward method would be to use two cordic blocks, one for sinh the other for cosh.

So your system would be like:

tanh_x=sinh(shr(x))/cosh((shr(x))   --(where shr acts as a division by 2)

y= shr(tanh_x) + 0.5                          --(where shr acts as a division by 2)

In any case you should carefully study the cores datasheet about the numerical input and output margins of the cordic core.

Also, you need a well designed interface that ensures that you only process matching valid data pairs.

However, there might be some more clever solution than that.

If nothing else helps, try to create a (good enough) lookup table for the equation.

Have a nice synthesis

Eilert

Xilinx Employee
Posts: 1,005
Registered: ‎08-02-2011

# Re: Implement tanh using cordic block

The latest issue of the Xcell journal (issue 79) has a pretty good article on the cordic which may be helpful as well:

http://www.xilinx.com/publications/xcellonline/

www.xilinx.com
Visitor
Posts: 4
Registered: ‎06-26-2012

# Re: Implement tanh using cordic block

thx for yor help

Visitor
Posts: 4
Registered: ‎06-26-2012

# Re: Implement tanh using cordic block

thx for your help. Is there any issue of Xcell journal that have discussion on Xilinx System Generator?

Xilinx Employee
Posts: 2,861
Registered: ‎11-28-2007

# Re: Implement tanh using cordic block

I would recommend you read the post below:

http://forums.xilinx.com/t5/DSP-Tools/Available-System-Generator-Documentation/td-p/52551

allanet wrote:

thx for your help. Is there any issue of Xcell journal that have discussion on Xilinx System Generator?

Cheers,
Jim