There are two parts to the In-Lab assignment: a simpler version
(Robbie) to be done in schematic and HDL form as well as a more complex
version (Renee) to be done only in HDL (the schematic version would be
very complex).
Robbie is the simpler robot which is attempting to drive to the beacon and stop. Robbie has three sensors and two independently controlled wheels. The sensors are mounted on the front, front-right and front-left of the robot, as seen in Figure 1. These sensors detect if the beacon is in a certain area (the cones indicated in Figure 1). If the sensor does detect the beacon it outputs a "1", otherwise it will output a "0".
The two wheels are driven independently. If a "1" is sent to the wheel it turns forward, but if a "0" is sent to the the wheel it doesn't turn. Robbie will go straight if both wheels are turning forward, and will stop if both wheels are stopped. In addition, Robbie turns right if the left wheel is going forward while the right wheel isn't turning, and would turn left in the symmetric case (the left wheel stooped and the right wheel going forward).
Robbie should follow the following rules:
Schematic version
For your schematic design, you are to use dip switches 2, 1 and 0 as the left, forward, and right sensor inputs respectively. You are to turn on the red LED #1 to indicate that the left wheel is going forward, and turn on red LED #0 if the right wheel is going forward. Otherwise those LEDs should be off.Verilog version
For this part of the assignment, you will implement Robbie entirely in Verilog. As with schematic based projects (i.e. the ripple carry adder of lab2), you can have a top-level-component and several sub-level-components. In Verilog we will refer to the components as top-level-modules and submodules. For a detailed explanation and example of Verilog modules, the hierarchical relations and connection, see the combinational Verilog reference listed with this lab (pages 1-2), which shows how a full adder is implemented in verilog with submodules.
For this part of the assignment, you will use the HEX display instead of the LEDs for your output. You should display a capital "F" on HEX0 if the right wheel is going forward, and a capital "S" if the right wheel is stopped. You should do the same on HEX1 for the left wheel. Recall that the HEX segments are active low.
Your Verilog design should be organized into a top-level-module and submodules. The top-level-module will contain Robbie's control logic, and the submodules will be used to generate the "S" and "F" patterns from the wheel control signals. The HEX display submodules should be controlled by a single bit control. For example, control bit on means display "F", control bit off means display "S". You may use the same submodule more than once if necessary. The top-level-module and submodules will have the general form:
module robbie(ls,fs,rs,lwd,rwd); //top level module declarationAs with schematic-based projects, the top-level-module must have the same name as the project. Also, the file name should have the same name as the top-level-module. The top-level-module and submodules may be placed in the same file, in this case robbie.v. FPGA pin assignments are made to the top-level-module's input and output names.
input ls,fs,rs; //input declarations
output [6:0]lwd,rwd; //output declarations. The notation [6:0]lwd, rwd means lwd and rwd consist of a set of
//7 connections, 6 thru 0. Each connection can be refered to individually or as a set. For example,
//assign lwd[6] = 0 sets this connection to logical 0. assign lwd = 7'h11 sets lwd[0] to logical 1,
//lwd[4] to logical 1, and all other bits to logical 0.
//For more on this, see the combinational verilog reference.
//Robbie's control logic goes here
outputSF sf1(inputs to submodule, outputs from submodule); //submodule instantiation
endmodule
module outputSF(inputs, outputs); //submodule declaration
//submodule's input and output declarations go here
//HEX display logic goes here
endmodule
Renee is similar to Robbie, but there are some significant differences. First, she has only two beacon sensors (left and right), but those sensors provide information about distance. Secondly, she has four bumper sensors (which tell her if she has hit something). Lastly, her wheels can go in reverse in addition to going forward. These changes are detailed below:
Action | Left Wheel | Right Wheel |
---|---|---|
Forward | F | F |
Left | S | F |
Right | F | S |
Stop | S | S |
Left Back | S | R |
Right Back | R | S |
Reverse | R | R |
module renee(ls,rs,fb,rb,lb,bb,lwd,rwd);You should use the DE2 board inputs as follows:
input [2:0] ls,rs; //Beacon sensors
input fb, rb, lb, bb; //Bumper sensors
output [6:0]lwd,rwd; //wheel outputs
Sensors | Board inputs |
---|---|
Right beacon sensor | SW2-SW0 (SW2 is MSB) |
Left beacon sensor | SW6-SW4 (SW6 is MSB) |
Left bumper sensor | Key3 (SW17 Labsland) |
Front bumper sensor | Key2 (SW16 Labsland) |
Back bumper sensor | Key1 (SW15 Labsland) |
Right bumper sensor | Key0 (Sw14 Labsland) |
Notes:
ls | rs | fb | lb | rb | bb |
---|---|---|---|---|---|
001 | 010 | 1 |
1 |
1 |
1 |
001 | 001 | 1 |
1 |
1 |
1 |
101 | 101 | 0 |
1 |
1 |
0 |