from myhdl import *
import matplotlib.pyplot as plt
from mmm import sig_square,sig_triag
@block
def sin_1( sel,out):
sig1=tuple([(sig_square(x//100)) for x in range(1000)])
sig2=tuple([(sig_triag(x//100)) for x in range(200)])
@always_comb
def hdl_1():
if sel==0:
conv=(len(str(sig1))-len(str(sig2)))*[0]
for l in range (len(str(conv))):
for i in range(len(str(sig2))):
conv[l] +=(sig1[l-i+len(str(sig2))]*sig2[i])
conv[l]/=(len(str(sig2)))
out.next=conv[l]
#plt.plot(conv)
#plt.show()
return hdl_1
def convert_1(hdl):
m=32
sel=Signal(intbv(0)[1:])
out=Signal(modbv(0)[m:])
inc= sin_1( sel,out)
inc.convert(hdl=hdl)
convert_1(hdl='Verilog')
convert_1(hdl='VHDL')
![Capture|690x479](upload://gT92jGPASWkdMxJQRZ5MK0Ql5fE.png)
These functions are missing:
from mmm import sig_square,sig_triag
I had a short look at the code, but this is far away from being ‘convertible’ at all.