Lab 3
Model of elevator controller
During this lab you are going to design a model of elevator controller.
For this task you get “empty entity” elevator.vhd, which you need to fill with behavioral design of elevator controller. To test if your design is correct or not, ready simple testbench t_elevator_fnc.vhd is given to you.
Specification of elevator
controller:
General block scheme of the task is given in the figure bellow:
The elevator controller design entity has 2 inputs: BUTTONS_IN and BUTTONS_OUT – each is of type bit_vector. The length of the vector equals to the number of floors in the building. The number of floors is specified as generic, therefore it is assigned a value only during the use of the component. These signals are constructed the way that every bit in vector represents button of the certain floor. BUTTONS_IN represents buttons inside the lift car. BUTTONS_OUT represents buttons outside the lift car on the floors near the lift doors. For example,
BUTTONS_IN<=”1000” denotes that the button for first floor is pressed inside the lift car (lift works for 4 floors).
BUTTONS_OUT<=”0101” denotes that buttons on the second and fourth floor are pressed.
Inputs are pulses, this means that active only for one second and then back to null.
The elevator controller design entity has 5 outputs: DOORS_OPENED, DIR_UP, DIR_DN, MOTOR, FLOOR_NUM.
DOORS_OPENED is of type bit_vector with length equals to number of floors in the building. Every bit represents whether doors are opened on that particular floor (the bit is ‘1’) or closed (the bit is ‘0’). Doors can be opened only on one floor. For example,
DOORS_OPENED<=”0100” denotes that doors are opened on the second floor.
DIR_UP, DIR_DN are signals of type bit, which represent up/down indicators outside the lift car. These indicators show established direction of the elevator. If elevator moved up and there are more calls for up floors, then even when it stops indicator shows “up”; the same is true for moving down. Forbidden situation when DIR_UP is ’1’ and DIR_DN is ‘1’.
MOTOR is of type bit_vector with length 2. It represents the state of the motor at certain moment of time. It could be “00”-stop, “10”- goes up, “01” – goes down, “11” – forbidden.
FLOOR_NUM is of type integer. It represents floor number, where elevator is at particular moment of time.
Description of the
behaviour:
According to the pressed buttons either in the lift car or outside it, elevator must go either up or down. Output MOTOR depicts the state of the elevator. Output FLOOR_NUM depicts floor, where elevator is. Time of moving from one floor to another is 1 sec. On the asked floor elevator must stop and open doors for 5 seconds, then close the doors. If more than one buttons are pressed (more than one floor are asked) then elevator must memorize where to stop and correspondingly stop on every asked floor. In case several floors are asked at the moment of time, the elevator should continue movement in the direction that it was previously.
Task:
Write the behavioral model of elevator according to given specification. Elevator.vhd and t_elevator_func.vhd is given to you. Simulate your design in order to get right behavior of the elevator. Try to optimize your design. The beautiful effective solution would be evaluated with extra plus, which gives you an advantage at the exam.
It is allowed to make this lab in pairs.
Requirements:
·
Code with comments added to the report;
·
Waveform picture added to the report;
·
Description of the solution;
·
Answers to the questions.
Questions:
Possible solution on
waveform:
run
130 sec