module cordic_test0(
);
real cordic_iter[15:0];
real angle;
integer i = 0;
real xi;
real yi;
real zi;
initial begin
cordic_iter[0] = 45.0;
cordic_iter[1] = 26.56505118;
cordic_iter[2] = 14.03624347;
cordic_iter[3] = 7.125016349;
cordic_iter[4] = 3.576334375;
cordic_iter[5] = 1.789910608;
cordic_iter[6] = 0.89517371;
cordic_iter[7] = 0.447614171;
cordic_iter[8] = 0.2238105;
cordic_iter[9] = 0.111905677;
cordic_iter[10] = 0.055952892;
cordic_iter[11] = 0.027976453;
cordic_iter[12] = 0.013988227;
cordic_iter[13] = 0.006994114;
cordic_iter[14] = 0.003497057;
cordic_iter[15] = 0.001748528;
#100;
angle = 45.0;
zi = angle;
xi = 0.6071;
yi = 0.0;
for(i = 0; i < 16; i = i + 1)
begin
if(zi > 0)
begin
zi = zi - cordic_iter[i];
xi = xi - (yi / 2.0**i);//cos
yi = yi + (xi / 2.0**i);//sin
end
else
begin
zi = zi + cordic_iter[i];
xi = xi + (yi / 2.0**i);
yi = yi - (xi / 2.0**i);
end
$display(i," ", zi);
$display(xi," ", yi);
end
$display("Cos angle is ", xi);
$display("Sin angle is ", yi);
$display("Cos angle is ", xi*0.6071);
$display("Sin angle is ", yi*0.6071);
#100;
$stop;
end
endmodule