EXPERIMENT 1

85 downloads 154 Views 492KB Size Report
DIGITAL ELECTRONICS LABORATORY- LAB2 ... RT-level Combinational Circuit Design ... Digilent Basys2 FPGA Board, Xilinx ISE WebPack, Mentor Graphics ... Using the editor of ISE, write a Verilog module such that LEDs on Basys2.
YEDITEPE UNIVERSITY DEPARTMENT OF COMPUTER ENGINEERING DIGITAL ELECTRONICS LABORATORY- LAB2 2011 – 2012 Fall Objective: RT-level Combinational Circuit Design General Information: Before coming to the lab. read and study Chapters 1-3 of the textbook (FPGA prototyping by Verilog Examples.) Throughout the course, we will be using Digilent Basys2 FPGA boards. In lab2, the focus will be on Register Transfer (RT) level combinational circuit design.

Lab Equipment : Digilent Basys2 FPGA Board, Xilinx ISE WebPack, Mentor Graphics ModelSim, Digilent Adept. Procedure :

Design#1: LEDS & SWITCHES 1. Invoke Xilinx ISE. 2. Create a new Project (lab1_1).

1-1

3. Next you need to fill out Project Settings. For this, you will need the reference manual of Basys2. Download the reference manual of Digilent Basys2 from http://www.digilentinc.com/Products/Detail.cfm?Prod=BASYS2. Fill out Project Settings shown as below. Note that you can simulate your designs with ISim which is also part of Xilinx ISE.

4. Once you create the project, add a new source (a verilog module) to your Project.

1-2

5. Using the editor of ISE, write a Verilog module such that LEDs on Basys2 board are controlled by the switches (there are 8) i.e. SW0 turns ON/OFF LED0. 6. Download Basys2 general UCF http://www.digilentinc.com/Products/Detail.cfm?Prod=BASYS2.

from

7. Make a copy of the User Constraints File (UCF), modify according to your inputs and outputs. Bind your inputs and outputs to the dedicated pins for the leds and switches.

8. Add your ucf to your project. 9. Double click “Generate Programming File”

1-3

10. Look at the project directory and locate the bitstream file (ledswitch.bit).

11. Create a testbench (ledswitch_tb.v) for your design. You can either write your testbench outside ISE or automatically create the template for it by choosing Add New Source/ Verilog Test Fixture. Then add the stimulus block to your testbench. Select simulation in Design View of Xilinx ISE. Select the testbench in the Simulation Design View. Then double click Simulate Behavioral Model. This will pop up the ISim window.

1-4

12. In the ISim Instance/Process window select the “Design Under Test” instance. Click the right mouse button and select “Add to Wave Window” from the popped window. To show signals in hexadecimal in the wave, change the radix to hex. Then simulate your design. “Eye-ball” the wave. If it looks correct, then go to the next step.

13. Download the bitstream (that you generated in step 9) to configure Basys2 board using Digilent Adept. Invoke Digilent Adept software. Plug the Digilent JTAG-USB cable to your PC. Turn on the Basys2 board. Choose Basys2 from 1-5

“Connect” from Adept Window. Then select FPGA (becomes green when you select), browse your bitstream and program your FPGA.

Design#2: PRIORITY ENCODER 1. Close the previous project. Create a new one call it lab1_2. 2. Follow the steps for lab1_1 to design, verify, implement, and download a priority encoder. To implement the priority encoder on the board, use the switches as inputs and leds as the outputs. The truth table for the priority encoder is shown below.

SW7 1 0 0 0 0 0 0 0 0

SW6 X 1 0 0 0 0 0 0 0

SW5 X X 1 0 0 0 0 0 0

SW4 X X X 1 0 0 0 0 0

SW3 X X X X 1 0 0 0 0

SW2 X X X X X 1 0 0 0

SW1 X X X X X X 1 0 0

1-6

SW0 X X X X X X X 1 0

LD7 1 0 0 0 0 0 0 0 0

LD6 0 1 0 0 0 0 0 0 0

LD5 0 0 1 0 0 0 0 0 0

LD4 0 0 0 1 0 0 0 0 0

LD3 0 0 0 0 1 0 0 0 0

LD2 0 0 0 0 0 1 0 0 0

LD1 0 0 0 0 0 0 1 0 0

LD0 0 0 0 0 0 0 0 1 0