How to represent 45 degree and 26.565 degree angle in 32 bit binary form?

424 views Asked by At

I am writing the verilog code for CORDIC (COordinate Rotation DIgital Computer) in xilinx vivado. For that I need 45, 26.565 degree rotation angle in 32-bit binary form. After searching in the internet I got 45 degree angle can be represented as

assign z[00] = 'b00100000000000000000000000000000;

and 26.565 degree angle can be represented as

assign z[01] = 'b00010010111001000000010100011101;

Can anybody explain to me how they are representing the 45 degree and 26.565 degree angle in binary form? Is there any formula behind it?

1

There are 1 answers

0
ToTamire On BEST ANSWER

round((45 / 360) * 2 ** 32) is equal to 'b00100000000000000000000000000000 (exacly your number)

round((26.565 / 360) * 2 ** 32) is equal to 'b00010010111001000000001010111011 (almost your number, difference 0.00005 degree)

Formula propably is equal to (angle / 360) * 2 ** 32.