Altera_Forum
Honored Contributor
14 years agoHow can i use CORDIC ?
Hello i am trying to use the cordic core { http://opencores.org/project,cordic }
with no sucess. Say i have a complex number of 4 + 5i. I have inserted 1000 as the Xi input and 1001 as the Yi input But the r2p_corproc is returning me wrong R and A values. It should be r = 6.4031 angle = 0.8961 {matlab} but instead i get r= 103 a= 146811 My test bench is :SIGNAL real_i : signed(15 downto 0) := "00000000"& "00000100" ;
SIGNAL imag_i : signed(15 downto 0) := "00000000"& "00000101" ;
SIGNAL ena_r_i : std_logic := '1';
SIGNAL rst_negado : std_logic := '1';
SIGNAL result_ang_o : unsigned(19 downto 0);
SIGNAL result_mag_o : signed(19 downto 0) ;
SIGNAL test_clk: std_logic := '0';
-- component instatiation
component rl131 is
port(
clk_i : in std_logic;
rst_i_n : in std_logic;
ena_i : in std_logic;
Real_i : in signed(15 downto 0);
Imag_i : in signed(15 downto 0);
Rout_o : out unsigned(19 downto 0);
Aout_o : out signed(19 downto 0)
);
end component;
BEGIN
dut : rl131
port map(
clk_i => test_clk,
ena_i => ena_r_i,
rst_i_n => rst_negado,
Real_i => real_i,
Imag_i => imag_i,
Rout_o => result_ang_o,
Aout_o => result_mag_o);
test_clk <= not test_clk after clkperiod/2;