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

von itay (Guest)

Rate this post
0 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 
if anyone has examples of such thing it will be very helpfull (VHDL).

von Lothar M. (lkmiller) (Moderator)

Rate this post
0 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.


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [vhdl]VHDL code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.