variable di: std_logic;
variable z : std_logic_vector (PA_RES DOWNTO 0) := (others => '0');
variable sin_temp, cos_temp,sin_tempn, cos_tempn : sfixed (1 downto -14);
begin
if(rising_edge(clk) and (enable_cordic='1')) then
z := phase;
sin_temp := sin_init;
cos_temp := cos_init;
sin_tempn := (others => '0');
FOR i in 0 to 12 LOOP
if (z(PA_RES)='1') then
cos_tempn := cos_temp + (sin_temp srl i);
sin_tempn := sin_temp - (cos_temp srl i);
z := std_logic_vector(signed(z) + signed(my_Rom(i)));
else
cos_tempn := cos_temp - (sin_temp srl i);
sin_tempn := sin_temp + (cos_temp srl i);
z := std_logic_vector(signed(z) - signed(my_Rom(i)));
end if;
cos_temp := cos_tempn;
sin_temp := sin_tempn;
END LOOP;
cos <= std_logic_vector(cos_temp);
sin <= std_logic_vector(sin_temp);
end if;
end process cordic;