Unformatted text preview:

Digital System Design (CS 278) Lab Session #4 Overview In this lab you will learn how to translate word descriptions or specifications into a working logic design. You will be presented with two design problems. The first will be fairly simple and you will implement it in both schematic and HDL (Hardware Description Language) forms. The second is significantly more complex and is to be done solely in the HDL. This lab has two in-labs due in successive lab periods. In the first period you will demonstrate your solution to the first design problem, and in the second, you will demonstrate your solution to the more complex problem. Preparation • The combinational Verilog reference, which can be found on the lab webpage, will be helpful. • You may find reviewing the slides and sections of the text related to combinational logic (Chapter 4) to be useful. Verilog issues For this lab you will be creating two different designs, both of which will be in a Hardware Description Language (HDL) named Verilog. In this lab we will be using a small subset of the language. Specifically your modules may only consist of: • Module declarations. • Declaring parameters as input or output. • Declaring variables as wires. • Instantiating other modules. • Using assign statements. These assign statements may only include AND (&), OR (|), XOR (^), and NOT(~). You may not use any other operators (such as ">", "<, and "?:"). The purpose of these rules is to keep things at a level where you could easily replace your Verilog code with a schematic that just uses standard gates.Design Specification For this lab there are two different design specifications. In both cases, you will be designing control logic for a robot which is trying to drive to a beacon and stop. 1. Robbie the Robot Robbie is the simpler robot which attempts 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 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:  He is to go straight if the forward sensor detects the beacon and/or both the left and the right sensors detect the beacon.  Otherwise, if either the right or the left sensor detects the beacon, he is to go in that direction.  Otherwise, he is to stop. Figure 1: Robbie the robot, with sensors and wheels.Implementation details For the Verilog design, you are to use the FLEX dip switches 1, 2 and 3 as the left, forward, and right sensor inputs respectively. For your outputs, you will use the seven-segment displays. You should display a capital "F" on the least significant digit (right-most digit) if the right wheel is going forward, and a capital "S" if the right wheel is stopped. You should do the same on the left-most digit for the left wheel. Recall that the HEX segments are active low. For the Verilog design, you must use the following module declaration as your top-level module (which should be named robbie.v): module robbie(ls,fs,rs,lwd,rwd); input ls,fs,rs; output [6:0]lwd,rwd; Further, you must make a second module (it can be in the same file) which handles the display of a "S" or "F" to hex display. It should take one input, which indicates if it is to display an S or an F, and should generate a bus of 7 wires as output. You can then instantiate that module twice, once for each hex digit. See the Verilog combinational reference for examples of doing this. 2. Renee the Robot 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 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: 1. Beacon sensors: Renee uses two more sophisticated sensors in place of Robbie's three sensors. The one on the front is removed. The sensors provide information about how strong of a signal they are getting from the beacon. The sensors return a 3-bit unsigned number. The closer the beacon (and more toward the center of the cone of a given sensor) the higher the value they return. 2. Bumper sensors: Renee has four of these, one on the front, left, right and back. They return a "0" if Renee has bumped into something in that direction, and a "1" if she has not. 3. Wheels: Renee's wheels can go forward and backwards as well as stopping. She can now do the following actions:Action Left Wheel Right Wheel Forward F F Left S F Right F S Stop S S Hard Left R F Hard Right F R Left Back S R Right Back R S Reverse R R Table 1: How Renee uses her wheels to perform her actions. 4. Renee's interactions with the world Renee should head in the direction of the sensor which indicates it has the strongest signal. If both signals are zero Renee should stop. If the two signals are the same, Renee should go forward. However, the beacon sensors are ignored if Renee has hit something: in that case her first priority is to move away from the thing she hit. If any of her bumpers detect a collision, she should follow these rules: • If her front bumper sensor is the only one detecting a collision she should move in reverse. • If her back bumper sensor is the only one detecting a collision she should move forward. • If her left bumper sensor is the only one detecting a collision she should move right back. • If her left and front bumper sensors are detecting a collision she should move right back. • If her right bumper sensor is the only one detecting a collision she should move left back. • If her right and front bumper sensors are detecting a collision she should move left back. • If her left and back bumper sensors are detecting a


View Full Document

UWEC CS 278 - CS 278 Lab Session 4

Download CS 278 Lab Session 4
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view CS 278 Lab Session 4 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view CS 278 Lab Session 4 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?