EmbDev.net

Forum: FPGA, VHDL & Verilog arithmetic operations between logic vectors and constants


von itay (Guest)


Rate this post
useful
not useful
what is the prefered option of arithmetic operations using  logic 
vectors and constant? convert logic vector to integer and do the 
operation or to convert the constant to logic vector?

I have samples from A/D as logic vectors with some resolution and 
constants. I want to do arithmetic operations between them according to 
formula?
if anyone has examples of such thing it will be very helpfull (VHDL).

von Lothar M. (Company: Titel) (lkmiller) (Moderator)


Rate this post
useful
not useful
Never ever do an arithmetic calculation on a unconstrained vector. For 
calculating you have signed, unsigned and integer data types.

Why? When calculating with std_logic_vectors you cannot determine 
whether its an unsigned or a signed operation. And if you simply copy 
the few lines with the calculation you discard this information.

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.