Verifying bit_vector help needed

Status
Not open for further replies.

teteu86

Newbie level 4
Joined
Sep 23, 2009
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,313
Verifying bit_vector

Hi. I have these ports:

up: buffer bit_vector(1 to 11);
floor: buffer integer range 1 to 11;

How can I verify if there is as least one element after up(floor) that is 1?

For example:
up<="00100000001"

If floor is 2, up(floor) = 0.
If floor is 3, up(floor) = 1.

If I'm on 5th, how can I write a code to verify if there is "1" as element since up(floor+1) until up(11)?
 

Verifying bit_vector

Code:
process(up,floor)
begin
variable check: std_logic;
check:='0';
for i in 1 to 11 loop
  if i>floor and up(i) = '1' then
    check:='1';
  end if;
end loop;
result<=check;
end process;
 

Re: Verifying bit_vector

Thanks FvM.

I'm trying to write a code for a controller of elevator.

Until tonight, I'll post the results here.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…