EmbDev.net

Forum: FPGA, VHDL & Verilog cordic sincos output usage


Author: Harsha Gowda (Company: panacea) (harshaep)
Posted on:

Rate this post
0 useful
not useful
Hi all,



I m using cordic ip core in spartan 6 device,futher im getting the 
correct outputs too, but facing problem in multiplying tat output to 
some number( like pwm ontime).



For Example



Input: Pin(phase): 0001100100011110



Output: cos(theta):Xout: 0010110101000111



Output: Sin(theta):Yout: 0010110100111011





from above example,



Phase in = 45 degrees or 0.785 in radians in 2QN format.



Xout: 11591 in decimal format, 0.7071067 in 1QN format

Yout : 11579 in decimal format, 0.7071 in 1QN format



Now consider ,

I want to multiply 50 * Xout



     = 50 * 11591  is what im able to do,but actually i need to do this 
= 50 * 0.7071067





Please can any one help me out!!!!





Thanks in Advance

Author: experto (Guest)
Posted on:

Rate this post
0 useful
not useful
what is "xout" in your design?

Author: Martin (Guest)
Posted on:

Rate this post
1 useful
not useful
Actually,
as long  as you do not have a floating point unit
instantiated, all you can do is integer arithmetics.

So, you do

 50 * 11591

and then right shift  the result to avoid overflow, keeping the number
of right shifts  in memory.

Author: Harsha Gowda (Company: panacea) (harshaep)
Posted on:

Rate this post
0 useful
not useful
Thank u ,it helped a lot.But how to handle wit floating points?,is der 
any keyword for it?.

Author: Martin (Guest)
Posted on:

Rate this post
0 useful
not useful
look at opencores.org,  guess you get a floating
point unit  from there.

Author: Martin (Guest)
Posted on:

Rate this post
0 useful
not useful
sorry: opencores.com

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [vhdl]VHDL code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.