My new and improved CORDIC unit. Much faster than my old one.
Uses Unis awesome 3t CCA with 1t ripple: https://redstonedb.com/schematics/4961b144bbbba1237e00f6a5235e5532
This unit computes the CORDIC algorithm, which is an iterative algorithm for computing trigonometric functions. The unit itself uses signed Q3.37 numbers, i.e.
1 sign bit,
2 integer bits,
37 fractional bits,
using standard twos complement. It can do 39 iterations at most, and should compute the results accurately up to 32 fractional bits.
Inputs
It has an input panel for the three numbers X,Y,Z, and a control panel below that. On the control panel you can choose:
System: Circular, Linear or Hyperbolic
Mode: Rotating, Vectoring
Number of iterations you want to do, given by a 6-bit number. The maximal number of iterations we can do is 39, i.e. 100111. Doing more iterations has no effect on the results
Reset button: Resets the unit, and is needed before doing the next calculation
Clock button: Does one iteration, or keeps automatically iterating if "Keep iterating" Lever is activated
Outputs
Has X,Y,Z output on the other side
Sin & Cos
CIRCULAR & ROTATING
Inputs: Z, ranging from approx. [-1.743] to [1.743]
Outputs: X ≈ cos(Z), Y ≈ sin(Z)
Min Input: Z = [110 . 0100 0001 1011 0111 1111 0111 1101 0001 1001 1]
Max Input: Z = [001 . 1011 1110 0100 1000 0000 1000 0010 1110 0110 1]
Arctan
CIRCULAR & Vectoring
Inputs: X,Y such that X > 0 and sqrt(X^2 + Y^2) < approx. [2.43]
Outputs: Z ≈ arctan(Y/X)
Alternatively:
Inputs: X=1, Y, ranging from approx. [-2.214] to [2.214]
Output: Z ≈ arctan(Y)
Min Input: Y = [101 . 1100 1001 0101 0000 0110 1101 1011 1111 0100 1]
Max Input: Y = [010 . 0011 0110 1010 1111 1001 0010 0100 0000 1011 1]
Sinh & Cosh
HYPERBOLIC & ROTATING
Inputs: Z, ranging from approx. [-1.118] to [1.118]
Outputs: X ≈ cosh(Z), y ≈ sinh(Z)
Min Input: Z = [110 . 1110 0001 1011 1111 0110 1001 1100 1011 0011 0]
Max Input: Z = [001 . 0001 1110 0100 0000 1001 0110 0011 0100 1101 0]
Atanh
HYPERBOLIC & VECTORING
Inputs: X,Y such that X > 0 and |Y/X| < approx. [0.807]
Outputs: Z ≈ atanh(Y/X)
Alternatively:
Inputs: X=1, Y, ranging from approx. [-0.807] to [0.807]
Outputs Z ≈ atanh(Y)
Min Input: Y = [111 . 0011 0001 0110 1100 1101 1111 0100 0001 0000 1]
Max Input: Y = [000 . 1100 1110 1001 0011 0010 0000 1011 1110 1111 1]
Multiplication
LINEAR & ROTATING
Tbh kind of useless, since the range is quite low, e.g. it can't compute 2*2 since it exceeds signed Q3.37 range, but I included it because it doesn't take additional space or time, so why not (same for division).
Inputs: X,Z such that approx. |Z| < 2 and |X*Z| < 4
Outputs Y ≈ X*Z
Min Input: Z = [110 . 0000 0000 0000 0000 0000 0000 0000 0000 0001 0]
Max Input: Z = [001 . 1111 1111 1111 1111 1111 1111 1111 1111 1111 0]
Division
LINEAR & VECTORING
Inputs: X,Y such that X > 0 and approx. |Y| < 2 and |Y/X| < 2
Outputs Z ≈ Y/X
Min Input: Y = [110 . 0000 0000 0000 0000 0000 0000 0000 0000 0001 0]
Max Input: Y = [001 . 1111 1111 1111 1111 1111 1111 1111 1111 1111 0]
Speed
The old unit uses fixed clock speeds, while the new one dynamically changes the speed and slows down for higher iterations. Disregarding overhead,
Old unit:
Rotating: 3.2s per iteration, so 121.6s total
Vectoring: 3.6s per iteration, so 136.8s total
New Unit:
Rotating: Average 1.65s per iteration, 62.8s total (58.8 seconds improvement)
Vectoring: Average 1.69s per iteration, 64.3s total (72.5 seconds improvement)
With overhead, I never measured more than 70 seconds between pressing the "Start" button, doing the full amount of iterations and seeing the final result.
Java only (I think).
97,753
Blocks
323,136
Volume
32 × 99 × 102
Dimensions
schem
Format