Error that i can't fix T.T

OP #7453757
Rate this post
useful
not useful

Goodmorning my dear friends, it's me again. I started to code the PI controller for my project to calculate the error between the PWM and the motor's encoder and the GHDL gives me an error that i can't fix( or better, i have no idea of how should i fix it). I'll attach the code and put the error down here:
PI.vhd:30:30: no function declarations for operator "-"
PI.vhd:36:72: no function declarations for operator "*"

what that means? what i did wrong?
thanks a lot in advantage <3

Attached files:
#7453942
Rate this post
useful
not useful

If you change the code to

1
  process(reference_signal, encoder_signal)is 
2
  begin
3
    -- Calcolo dell'errore tra velocità di riferimento e velocità effettiva
4
    error <= ref - to_integer(feed);
5

6
    -- Calcolo del termine integrativo
7
    integral_term <= integral_term + error;
8

9
    -- Calcolo del segnale di controllo
10
    pwm_output <= resize( encoder_signal + natural(Kp) * error + natural(Ki) * integral_term, pwm_output'length); -- è l'equivalenente di (7 downto 0) ma più skillato
11
  end process;

It will compile, but you need to check with a testbench if it will work.

Moderator (Company: Titel) #7454910
Rate this post
useful
not useful

Marco wrote:

If i don't need a process here, where do i need a process?

You don't need the process here because inside it are only 3 statements which are calculated without any relation to each other.

Or in other words: a concurrent statement has an implicit process with an implicit sensitivity list.

This concurrent statement here:

1
a <= b + c;

Is the very same like that chatty process:

1
process (b,c) is
2
begin
3
  a <= b + c;
4
end process;

Marco wrote:

IT COMPILES!!! but why?

Hint: look as said for the defined functions of the operators.

E.g. for the - operator there is no overloaded functions for integer-integer with a signed as a result. This would work also:

error <= to_signed(to_integer(ref) - to_integer(feed)),8);

Reply

Please log in before posting.

or

Log in with Google account

Registration is free and takes only a minute.

Register now