Filter löschen
Filter löschen

write a function to the code i have and i need to have a function file and a main and want to convert it to a verilog HDL ??

5 Ansichten (letzte 30 Tage)
k=1; fc = 180e6; fs = 240e6; tp = 6e-6; N= fs*tp; t=0:1/fs:((1/fs)*1440); for n = 1:1:1440; p3(k)= pi*((k-1)^2)/(N) sig(n)= exp(1j*(2*pi*fc*t(n)+(p3(k)))); if (rem(n,48)==0) k=k+1; end; end;
tx= zeros(1,5000); rx= zeros(1,5000); tx(1:1440)=sig; rx(1463:1440+1462)=sig; figure(1); plot((1:5000)/fs,tx); figure(1);hold on; plot((1:5000)/fs,rx,'r'); fft_tx=fftshift(fft(tx)); figure(3) plot(-0.5+1/N:1/N:0.5,abs(fft_tx(1:N))); fft_rx = fftshift(fft(rx)); figure(4) plot(-0.5+1/N:1/N:0.5,abs(fft_rx(1:N)));
out_mat = ifft((fft_rx).*conj(fft_tx));
figure(5)
plot(1/fs*(1:5000), abs(out_mat)/max(abs(out_mat)));
figure(5);hold on;plot((1463/fs),1,'r*');

Antworten (1)

Tim McBrayer
Tim McBrayer am 30 Mär. 2015
Bearbeitet: Tim McBrayer am 30 Mär. 2015
HDL Coder can take MATLAB code and convert it into Verilog. However, you need to consider your code from the perspective of what tasks can be done in hardware. Two simple function calls in your code that cannot be performed in hardware are the figure() call and the plot() call.
You will need to figure out how to separate your code into design and stimulus/response portions. The design portion can be developed to be convertible to HDL code.

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by