this circuit calculates sinusoidal waves using logic gates. the layout is all squashed cos I made it before the work area got expanded. was a lot of work squeezing in that tight but ended up fitting perfectly, wots the chances of that eh 😅
the algorithm:
x=x+y>>4
y=y-x>>4
google 'minsky circle' for in-depth explanation, it is effectively simple harmonic motion
in the circuit there's 2 x 8bit registers to hold the values of x and y, 16 x full-adders, 2 interleaved clocks to drive each side of the calculations. on initiate y is loaded with value 64. on first clock the top 4 (signed) bits of y is added to the lower bits of register x ( x+=y>>4 or integer divide by 16 ), on second clock x is added to y register in the same way. this loop continues while outputting results through the dac's
the spikes are when the value transitions between positive and negative, the msb of the dac flips just before the value changes. I'll be fixing that
it runs slow even on a fast device. doing 2's compliment on 16 adders is maybe pushing everycircuit a bit being that it's simulating it as an analogue circuit