Sep 30, 2009 #1 T 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 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)?
Sep 30, 2009 #2 FvM Super Moderator Staff member Joined Jan 22, 2008 Messages 52,485 Helped 14,756 Reputation 29,794 Reaction score 14,121 Trophy points 1,393 Location Bochum, Germany Activity points 298,363 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;
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;
Sep 30, 2009 #3 T 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 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.
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.