Using remotesyn and added NCO

This commit is contained in:
Jojojoppe
2025-10-05 23:20:25 +02:00
parent 639541728f
commit 83cc449c6f
35 changed files with 397 additions and 147990 deletions

21
scripts/gen_sin_lut.py Normal file
View File

@@ -0,0 +1,21 @@
import math
# for i in range(0, 64, 4):
# for j in range(4):
# val = math.sin((i+j) * math.pi/256)
# val = int(val*256*1.4)
# print(f"6'd{i+j}: dout=8'd{val}; ", end='')
# print('')
N = 64 # quarter-wave samples
AMP = 255 # 8-bit max
for i in range(0, N, 4):
line = []
for j in range(4):
k = i + j
theta = k * math.pi / (2*N) # 0 .. (π/2)*(N-1)/N ; never hits 1.0
val = int(math.floor(AMP * math.sin(theta) + 0.5)) # rounded, stays <=254
if val > 255: val = 255
line.append(f"6'd{k}: dout = 8'd{val};")
print(' '.join(line))