Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Arithmetic operations in vhdl

Status
Not open for further replies.

mohit1108

Newbie level 2
Joined
Mar 31, 2012
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,295
I have made a program for PI controller and the excerpts are as follows-
v1<= v_prev + (k1*iq_error)+(k2*f_prev1)+(k3*f_prev2);
All the variables are std logic vector ( 7 downto 0)
but there is an error in execution of this code-

* can not have such operands in this context.

I have also included IEEE.NUMERIC_STD.ALL; but still error persists.

please help me out
 

try casting the std_logic_vectors to unsigned/signed, or better yet, just use unsigned/signed in the first place.

v1<= v_prev + (unsigned(k1)*unsigned(iq_error))+(unsigned(k2)*unsigned(f_prev1))+(unsigned(k3)*unsigned(f_prev2));

what would you do for a slv if you had a 'X' * 'H'?

https://www.synthworks.com/papers/vhdl_math_tricks_mapld_2003.pdf
 
Last edited:

what would you do for a slv if you had a 'X' * 'H'?

remember that signed/unsigned are arrays of std_logic too, so you could have 'x' * 'h'. you should just get 'x' as the result.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top