if i have a array of 0 to M ot std_logic in vhdl and i want to test if it is set having all bits 1, is it advised to use "and gate" or should i use an if statement. what is the difference in hardware?
will probably just create an and gate anyway. and its easier to read. Unless you have some really old device where LUT count is important, readible code is better than smaller implementation.
- - - Updated - - -
if you want to just and all the bits, there is the and_reduce function in the std_logic_misc library:
Do that: try coding both implementations and then look at the synthetized blocks, it's more easy than just try to guess how it's implemented in hardware by the compiler.