• Embed Doc
  • Readcast
  • Collections
  • CommentGo Back
Download
 
library ieee;use ieee.std_logic_1164.all;use ieee.numeric_std.all;-- This is for the fixed point librariesuse work.std_logic_1164_additions.all;use work.numeric_std_additions.all;use work.math_utility_pkg.all;use work.fixed_pkg.all;entity cordic_trig isport (rads : in sfixed (5 downto -15);clk : in std_logic;aclr : in std_logic;sine, cosine : out sfixed(0 downto -15));end entity cordic_trig;architecture rtl of cordic_trig is-- Build a 2-D array type for the RoMsubtype word_t is sfixed(0 downto -15);type memory_t is array(15 downto 0) of word_t;function create_atan_tblreturn memory_t isvariable tmp : memory_t := (others => (others => '0'));begintmp(0) := to_sfixed(0.785398163397, tmp(0));tmp(1) := to_sfixed(0.463647609001, tmp(0));tmp(2) := to_sfixed(0.244978663127, tmp(0));tmp(3) := to_sfixed(0.124354994547, tmp(0));tmp(4) := to_sfixed(0.062418809996, tmp(0));tmp(5) := to_sfixed(0.0312398334303, tmp(0));tmp(6) := to_sfixed(0.0156237286205, tmp(0));tmp(7) := to_sfixed(0.0078123410601, tmp(0));tmp(8) := to_sfixed(0.00390623013197, tmp(0));tmp(9) := to_sfixed(0.00195312251648, tmp(0));tmp(10) := to_sfixed(0.000976562189559, tmp(0));tmp(11) := to_sfixed(0.000488281211195, tmp(0));tmp(12) := to_sfixed(0.000244140620149, tmp(0));-- tmp(13) := to_sfixed(0.000122070311894, tmp(0));-- tmp(14) := to_sfixed(6.10351561742e-005, tmp(0));-- tmp(15) := to_sfixed(3.05175781155e-005, tmp(0));return tmp;end create_atan_tbl;-- Declare the ROM signal and specify a default value. Quartus II-- will create a memory initialization file (.mif) based on the-- default value.signal atan_tbl : memory_t := create_atan_tbl; begin process (clk,aclr)-- Too many variables?
of 00

Leave a Comment

You must be to leave a comment.
Submit
Characters: ...
You must be to leave a comment.
Submit
Characters: ...