Borrar filtros
Borrar filtros

Reference to non-existent field 'inVals'.

1 visualización (últimos 30 días)
Guilherme Moitas
Guilherme Moitas el 17 de Jun. de 2016
Comentada: Tim McBrayer el 20 de Jun. de 2016
Hi everyone, I'm having a problem with the HDL Code Generation. I'm trying to convert Matlab to VHDL. So I could make the Fixed-Point Conversion but when I try to Run the HDL Code Generation, it gives me this error : Reference to non-existent field 'inVals'. I don't know where is this 'inVals' and i used 'E = lasterror' to identify, however just told me that:
message: ''
identifier: 'emlc:compilationError'
stack: [0x1 struct]
This is my project:
function [pulse] = pwm ()
F2=1;
F1=10;
A=5;
t=0:0.001:1;
x=(2*pi*F1*t);
c=0;
c=A.*(sin(x));%Carrier sawtooth
subplot(3,1,1);
plot(t,c);
xlabel('Time');
ylabel('Amplitude');
title('Carrier sawtooth wave');
grid on;
m=0.75*A.*sin(2*pi*F2*t);%Message amplitude must be less than Sawtooth
subplot(3,1,2);
plot(t,m);
xlabel('Time');
ylabel('Amplitude');
title('Message Signal');
grid on;
n=length(c);%Length of carrier sawtooth is stored to ‘n’
pulse=0;
for i=1:n%Comparing Message and Sawtooth amplitudes
if (m(i)>=c(i))
pulse(i)=1;
else
pulse(i)=0;
end
end
subplot(3,1,3);
plot(t,pulse);
xlabel('Time');
ylabel('Amplitude');
title('plot of PWM');
axis([0 1 0 2]);%X-Axis varies from 0 to 1 & Y-Axis from 0 to 2
grid on;
Can someone help me please? Thank for your help already!

Respuestas (1)

Tim McBrayer
Tim McBrayer el 17 de Jun. de 2016
Your code contains a lot of code unsuitable for code generation; specifically, all the plot related functions are not supported for HDL code generation. You also have no data coming in our out of your function; this implies that you will have no input or output ports .
You need to figure out what of your code is to be converted into HDL and what part is your test bench/stimulus framework. Your code for HDL code generation will in general receive input from and return results to the test bench code. Once you have divided your code up like this, try HDL Coder again, explicitly specifying what function contains your code to convert to HDL and what file is your test bench.
  2 comentarios
Guilherme Moitas
Guilherme Moitas el 20 de Jun. de 2016
Hey Tim, could you be more explicit? I'm not a common user of MatLab and I never used a HDL Coder before.
Tim McBrayer
Tim McBrayer el 20 de Jun. de 2016
Your best option is to take advantage of the documentation. It is pretty explicit about the difference between your test bench and your design. There is a lot to learn about preparing MATLAB code for HDL code generation, starting with defining what is the code that you want to be in your hardware design.

Iniciar sesión para comentar.

Categorías

Más información sobre HDL Coder en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by