starting wfg

This commit is contained in:
2025-09-28 08:55:19 -05:00
parent 498c02cf18
commit 086c5dd9f3
8 changed files with 920 additions and 9 deletions

View File

@@ -0,0 +1,36 @@
from matplotlib import pyplot as plt
from ctypes import *
import numpy as np
def read_sim_output(filename, is_float=False):
fid = open(filename, "r")
lines = fid.readlines()
fid.close()
data = [int(line) for line in lines]
data = np.array(data)
if is_float:
as_floats = c_float * data.size
data = as_floats.from_buffer(data.astype(np.int32))
data = np.array(data)
return data
def main():
data = read_sim_output("sim_out.bin")
data[data >= 2**15] -= 2**16
data = data[0::2] + 1j * data[1::2]
plt.figure()
plt.plot(data.real)
plt.plot(data.imag)
plt.title('Sim Output')
plt.grid()
plt.show()
if __name__ == '__main__':
main()

View File

@@ -0,0 +1,14 @@
def main():
fs = 750e6
f = 10e6
n = 4096
freq = f/fs * 2**31
print(freq)
if __name__ == '__main__':
main()