question on AND

Jan 04, 2008 8 Replies

I have 2 inputs x : unsigned bw : integer



when x>bw I want to check if x(x'length downto bw) = "1111111......"



How do i write this in VHDL since my length of x is unknown at this point. Normally if x was 4 bits, i would check if x(3) and x(2) and x(1) and x(0) = '1' ;


A vector of unknown length could be an entity port or a subprogram parameter.

These are usually handled using the array attributes 'length or 'range. and a for loop like this:

for i in x'range loop result := some_function(result, x(i)); end loop;

-- Mike Treseler

I actually want to AND all the bits of the x vector whole length is unknown. I want to check if all the bits of the vector x are "1111...." . How would I do it, since the length is unknown. I want to check is x(x'length-1) AND x(x'length-2) AND x(x'length-3) AND .... x(0) =3D '1' -- which checks if all bits of the input are one.

I actually want to AND all the bits of the x vector whole length is unknown. I want to check if all the bits of the vector x are "1111...." . How would I do it, since the length is unknown. I want to check is x(x'length-1) AND x(x'length-2) AND x(x'length-3) AND .... x(0) = '1' -- which checks if all bits of the input are one.

I actually want to AND all the bits of the x vector whole length is unknown. I want to check if all the bits of the vector x are "1111...." . How would I do it, since the length is unknown. I want to check is x(x'length-1) AND x(x'length-2) AND x(x'length-3) AND .... x(0) = '1' -- which checks if all bits of the input are one.

All_Bits_Equal_1

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required