Forum: FPGA, VHDL & Verilog definition of "and" operator using boolean arguments

von jon (Guest)

Rate this post
0 useful
not useful
if you have an if statement with a condition:

  use ieee.std_logic_1164.all;
  signal x, y : std_logic;
  if(x = '1' AND y = '1') then

The "=" operator will return a boolean value, which simplifies the 
matter to any case with:

  if([boolean] AND [boolean]) then

Since VHDL is a strong-typed language, I assumed that the 
ieee.std_logic_1164 library would contain a definition for the "and" 
function with boolean arguments, but I cannot find it.  The only 
arguments are for std_logic_vector, signed, and unsigned types.  I don't 
think that VHDL would automatically cast TRUE as '1' and FALSE as '0' 
either, as that is not always the case.  Does anyone have some insight 
as to how this issue is resolved in VHDL during compilation?


von Br i. (brian_w17)

Rate this post
0 useful
not useful
I don't have a certain answer for you... just a guess.

Many VHDL operators are overloaded in different libraries. Perhaps the 
"AND" operator is overloaded to handle boolean values as well...

von Br i. (brian_w17)

Rate this post
0 useful
not useful
Yup, see:

Logical operators are defined for boolean AND (pun intended) std_logic 
(among others)


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]
  • [avrasm]AVR assembler code[/avrasm]
  • [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.