# Modify verilog CORDIC code for -360 to 360 degrees

I am learning about CORDIC and implementing it in Verilog. I found this example which can calculate sin and cos for angles in the first quadrant (0-90). https://github.com/freecores/verilog_cordic_core/blob/master/cordic.v

How would I modify this code to calculate sin and cos for -360 to 360 degrees. Would it be with if-else statements on the angle input? Where would that be placed for this code?

I understand I need to subtract or add a multiple of 90degrees to get the angle into the first quadrant. Depending on which quadrant I rotated from I flip the value of sin & cos and/or change the sign of the result

• why would you want todo+-360? that is two rotations? +-180 I could understand but +-360? either way you only need 0-90 to reconstruct. Look at the sign of sin & cos to determine whether to add 90,180 or 270 to the result
– user16222
Jul 30, 2017 at 21:13

You want to use the identities

$$\sin -\theta = -\sin \theta$$ $$\cos -\theta = \cos \theta$$ $$\sin(\theta + 90^\circ)=\cos \theta$$ $$\cos(\theta + 90^\circ)=-\sin \theta$$ $$\sin(\theta + 180^\circ)=-\sin \theta$$ $$\cos(\theta + 180^\circ)=-\cos \theta$$

This code is for the first quadrant, but is easily extended to the full