bitprolix
Junior Member level 2
- Joined
- Sep 19, 2013
- Messages
- 24
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 235
Hi All,
I'm working on modelling of elevator control and I'm trying to come up with two separate process for tackling the different requirements for this particular elevator control. The main idea that I have is that One process will continuously snoop for the requested floor by ORing the buttons pressed from inside(B_IN) or from outside of the cart (B_OUT), and another process will take action on such requests. So far so good but considering B_IN and B_OUT, both are bit vectors (say both B_IN and B_OUT 8 bit wide, and after ORing to form a final requested floors, i get something as "0100 1000" representing that the requested floors are floor 2 and 5 ), how should i write a loop in my "take-action" process so that it checks the bits which are set from the request vector(01001000 in this case) and take further action, such as opening the door on only such floors, one at at time. i..e only one bit from the door vector should be set at a time.
psuedo code:
I'm working on modelling of elevator control and I'm trying to come up with two separate process for tackling the different requirements for this particular elevator control. The main idea that I have is that One process will continuously snoop for the requested floor by ORing the buttons pressed from inside(B_IN) or from outside of the cart (B_OUT), and another process will take action on such requests. So far so good but considering B_IN and B_OUT, both are bit vectors (say both B_IN and B_OUT 8 bit wide, and after ORing to form a final requested floors, i get something as "0100 1000" representing that the requested floors are floor 2 and 5 ), how should i write a loop in my "take-action" process so that it checks the bits which are set from the request vector(01001000 in this case) and take further action, such as opening the door on only such floors, one at at time. i..e only one bit from the door vector should be set at a time.
psuedo code:
Code:
while (some bits are set in request)
{
extract the bits from the right in the request vector;
door(ith bit) = '1'; -- open the door on that particular floor
}