question on AND

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' ;

Reply to
FPGA
Loading thread data ...

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

Reply to
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.

Reply to
FPGA

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.

Reply to
KJ

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

Reply to
KJ

Reply to
FPGA

Reply to
pdudley1

"
Reply to
FPGA

Reply to
Andy

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.