Introduction to Verilog and XILINX

Similar documents
Lab 6 : Introduction to Verilog

ECT 224: Digital Computer Fundamentals Using Xilinx StateCAD

ENGN 1630: CPLD Simulation Fall ENGN 1630 Fall Simulating XC9572XLs on the ENGN1630 CPLD-II Board Using Xilinx ISim

University of Hawaii EE 361L. Getting Started with Spartan 3E Digilent Basys2 Board. Lab 4.1

CECS LAB 1 Introduction to Xilinx EDA Tools

Xilinx ISE Simulation Tutorial

Tutorial: Working with the Xilinx tools 14.4

Verilog Design Entry, Synthesis, and Behavioral Simulation

Circuit Design and Simulation with VHDL 2nd edition Volnei A. Pedroni MIT Press, 2010 Book web:

Digital Circuit Design Using Xilinx ISE Tools

Simple Computer 2010 (CS2010)

Xilinx Schematic Entry Tutorial

Getting Started with Xilinx WebPack 13.1

Adding the ILA Core to an Existing Design Lab

Xilinx ChipScope ICON/VIO/ILA Tutorial

EITF35 - Introduction to the Structured VLSI Design (Fall 2016) Interfacing Keyboard with FPGA Board. (FPGA Interfacing) Teacher: Dr.

Digital design laboratory 5

ISim In-Depth Tutorial. UG682 (v13.4) January 18, 2012

CPEN 230L: Introduction to Digital Logic Laboratory Lab #6: Verilog and ModelSim

Contents. Appendix B HDL Entry Tutorial 2 Page 1 of 14

Commas and Data Alignment Lab

Simulation Lab 7 Use ISE to Auto-Generate Testbench Simulations

UNIVERSITY OF CALIFORNIA, DAVIS Department of Electrical and Computer Engineering. EEC180A DIGITAL SYSTEMS I Winter 2015

and 32 bit for 32 bit. If you don t pay attention to this, there will be unexpected behavior in the ISE software and thing may not work properly!

EE 367 Logic Design Lab #1 Introduction to Xilinx ISE and the ML40X Eval Board Date: 1/21/09 Due: 1/28/09

Design a three-input, two-output sequential digital circuit which functions as a digital locking mechanism. LOCK ALARM

Laboratory of Digital Circuits Design: Design, Implementation and Simulation of Digital Circuits Using Programmable Devices

Using Synplify Pro, ISE and ModelSim

Lab 3: Xilinx PicoBlaze Flow Lab Targeting Spartan-3E Starter Kit

ECE 4305 Computer Architecture Lab #1

CSE 591: Advanced Hardware Design and Verification (2012 Spring) LAB #0

Lab 3 Sequential Logic for Synthesis. FPGA Design Flow.

ECE 491 Laboratory 1 Introducing FPGA Design with Verilog September 6, 2004

Building Combinatorial Circuit Using Behavioral Modeling Lab

Circuit design with configurable devices (FPGA)

University of California, Davis Department of Electrical and Computer Engineering. Lab 1: Implementing Combinational Logic in the MAX10 FPGA

In the previous lecture, we examined how to analyse a FSM using state table, state diagram and waveforms. In this lecture we will learn how to design

In the previous lecture, we examined how to analyse a FSM using state table, state diagram and waveforms. In this lecture we will learn how to design

Tutorial on FPGA Design Flow based on Xilinx ISE Webpack andisim. ver. 1.0

ISim Hardware Co-Simulation Tutorial: Accelerating Floating Point FFT Simulation

Programmable Logic Design I

EE 1315 DIGITAL LOGIC LAB EE Dept, UMD

PlanAhead Software Tutorial

Xilinx Tutorial Basic Walk-through

Lab 2: Barrel Shifter Design

COS/ELE 375 Verilog & Design Tools Tutorial

University of Massachusetts Amherst Computer Systems Lab 1 (ECE 354) LAB 1 Reference Manual

ECE2029: Introduction to Digital Circuit Design Lab 4 Building a Sequential Logic Circuit A Four Digit 7-Segment Display Driver

Practical 4: RTC on FPGA

Lab Assignment 2. Implementing Combinational and Sequential Logic in VHDL

Nikhil Gupta. FPGA Challenge Takneek 2012

Lab 1: Introduction to Verilog HDL and the Xilinx ISE

ISim Hardware Co-Simulation Tutorial: Accelerating Floating Point Fast Fourier Transform Simulation

Laboratory Exercise #6 Introduction to Logic Simulation and Verilog

Tutorial 3. Appendix D. D.1 Design Using Verilog Code. The Ripple-Carry Adder Code. Functional Simulation

Laboratory Memory Components

Digital Logic Design Lab

Verilog Simulation Mapping

Digital Systems EEE4084F FPGA Introduction Verilog and Xilinx ISE [30 Marks]

Using ChipScope. Overview. Detailed Instructions: Step 1 Creating a new Project

Vivado Tutorial. Introduction. Objectives. Procedure. Lab Workbook. Vivado Tutorial

EE183 LAB TUTORIAL. Introduction. Projects. Design Entry

ISE Simulator (ISim) In-Depth Tutorial. UG682 (v 13.1) March 1, 2011

Chip Design with FPGA Design Tools

Lab Assignment 1. Developing and Using Testbenches

ECE 2300 Digital Logic & Computer Organization. More Sequential Logic Verilog

Verilog Module Tutorial By TA Brian W. Stevens CMPE415 UMBC Spring 2015 Dr. Tinoosh Mohsenin

Logic Implementation on a Xilinx FPGA using VHDL WWU Linux platform assumed. rev 10/25/16

University of Massachusetts Amherst Computer Systems Lab 2 (ECE 354) Spring Lab 1: Using Nios 2 processor for code execution on FPGA

FPGA Design Challenge :Techkriti 14 Digital Design using Verilog Part 1

Quick Front-to-Back Overview Tutorial

Using the ChipScope Pro for Testing HDL Designs on FPGAs

Lab 7 (Sections 300, 301 and 302) Prelab: Introduction to Verilog

EITF35 - Introduction to Structured VLSI Design (Fall ) 7. Assignment 3 - Arithmetic Logic Unit (ALU)

HW1 Modeling Concepts

Hardware Description Languages (HDLs) Verilog

Logic Implementation on a Xilinx FPGA using VHDL WWU Linux platform assumed. rev 11/01/17

Getting started with the Xilinx Project Navigator and the Digilent BASYS 2 board.

Introduction. In this exercise you will:

CPE 200L LABORATORY 4: INTRODUCTION TO DE2 BOARD UNIVERSITY OF NEVADA, LAS VEGAS GOALS: BACKGROUND:

AN INTRODUCTION TO VERILOG HDL

Verilog Fundamentals. Shubham Singh. Junior Undergrad. Electrical Engineering

CSCB58 - Lab 3. Prelab /3 Part I (in-lab) /2 Part II (in-lab) /2 TOTAL /8

ARM 64-bit Register File

Xilinx ISE Synthesis Tutorial

MANUAL XILINX ISE PROJECT NAVIGATOR

Actel Libero TM Integrated Design Environment v2.3 Structural Schematic Flow Design Tutorial

Revision: February 26, E Main Suite D Pullman, WA (509) Voice and Fax

ELEC 204 Digital System Design LABORATORY MANUAL

Using ModelSim to Simulate Logic Circuits for Altera FPGA Devices

Tutorial: Working with Verilog and the Xilinx FPGA in ISE 9.2i

Introduction to WebPACK 3.1. Using XILINX WebPACK Software to Create CPLD Designs

DESIGN AND IMPLEMENTATION OF MOD-6 SYNCHRONOUS COUNTER USING VHDL

ANADOLU UNIVERSITY DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING. EEM Digital Systems II

Lab 7 (All Sections) Prelab: Introduction to Verilog

EE 109L Final Review

ChipScope Demo Instructions

2IN35 VLSI Programming Lab Work Assignment 1: Hardware design using Verilog

Verilog Module 1 Introduction and Combinational Logic

Engineering 303 Digital Logic Design Fall 2018

Transcription:

DEPARTAMENTO DE TECNOLOGÍA ELECTRÓNICA ESCUELA TÉCNICA SUPERIOR DE INGENIERÍA INFORMÁTICA Introduction to Verilog and XILINX Lab Session Computer Structure WARNING: A written solution of the preliminary work is required to carry out the laboratory session. A written solution will be presented per person and given to the instructor during the session. The solution must answer all the issues and must be detailed, complete, clear and well presented. The teacher can ask questions or seek clarification on the solution. Each student must bring a hard copy of this document. 1. Introduction One of the main goals of this subject is learning the design methodology of digital systems at register transfer level. We will apply the methodology learned at class in this session in order to: get used to the Verilog-HDL language. learn an FPGA based design environment. We will use the environment provided by XILINX 1. learn the design verification tools. carry out the design and simulation of circuits. One of them will be combinational (a code converter) and the other one will be sequential (a counter). 2. Preliminary work You must describe the following components using Verilog: 1. A converter from binary to seven-segment 2. A rising 4-bit counter Code templates have been prepared for both circuits. The following text files will be available to carry 1 Xilinx Inc.: a technology company supplier of programmable logic devices (www.xilinx.com) rev. 248

Computer Structure 2 out the session: File name Content Description convertidor.v convertidor_tb.v contador.v Module describing the sevensegment converter Testbench for the seven-segment converter Module describing the 4-bit counter You must complete this before the lab session. You will use this to simulate the converter. You must complete this before the lab session. contador_tb.v Testbench for the 4-bit counter You will use this to simulate the counter. lab2.v lab2_tb.v Structural description of a system using the previous modules Testbench of the whole system You must complete this during the lab session. You will use this to simulate the whole system. Table 1. Files to be used during the lab session The circuits to be described in Verilog are detailed below: 2.1. Designing the seven-segment converter Seven-segment displays are used to display decimal digits and some letters. This displays have seven inputs, one for each of it segments. The signals controls which segments are highlighted. By selecting which segments are highlighted several characters can be displayed. For example, every decimal digit can be displayed as shown in fig. 1. Figure 1. Decimal digits in a seven-segment display The truth table of the combinational circuit to be described is shown at table 2. The names of the segments in the table are the same of those in fig. 1. A segment will be highlighted if an only if the corresponding control signal is low. The displayed character will be the hexadecimal representation of the input.

Computer Structure 3 bin 3 bin 2 bin 1 bin 0 A B C D E F G 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 1 0 0 1 1 1 1 0 0 1 0 0 0 1 0 0 1 0 0 0 1 1 0 0 0 0 1 1 0 0 1 0 0 1 0 0 1 1 0 0 0 1 0 1 0 1 0 0 1 0 0 0 1 1 0 0 1 0 0 0 0 0 0 1 1 1 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 1 0 0 1 0 1 0 0 0 0 1 0 0 0 1 0 1 1 1 1 0 0 0 0 0 1 1 0 0 0 1 1 0 0 0 1 1 1 0 1 1 0 0 0 0 1 0 1 1 1 0 0 1 1 0 0 0 0 1 1 1 1 0 1 1 1 0 0 0 Table 2: Truth table for the binary to seven-segment converter The circuit can be described with a case statement. Complete the following template to make the Verilog description (file convertidor.v): module convertidor_bin7seg( input [3:0] bin_in, // entrada binaria 4 bits output reg a,b,c,d,e,f,g); // salida 7-segmentos // Write your code here. // You are advised to use procedural description // containing a case statement. endmodule Code 1. File convertidor.v: Verilog code template for the converter 2.2. Designing the four-bit counter The counter will be triggered by the rising edge of the clock signal. It will a synchronous input RESET signal and a terminal count signal (CY). Its behaviour is detailed in fig. 2b. Complete the template code 2 (file contador.v) to make the Verilog description.

Computer Structure 4 CLK RESET UP CONT 1 X CONT 0 UP RESET CONT MOD 16 CY 0 1 CONT CONT+1 0 0 CONT CONT CY CLK q3 q2 q1 q0 0 [CONT] 1111 1 [CONT] = 1111 (a) (b) Figura 2. Description of the four-bit counter: (a) structural description, (b) functional description module contador_mod16( input clk,up,reset, output reg [3:0] q, output cy); // Write your code here. // Remember: cy must be equal to one if and // only if the counter is in the last state endmodule Code 2. File contador.v: Verilog code template for the counter 3. Lab work In this session you will use Xilinx ISE tools to simulate the system you have designed. You will use the provided testbench files. To do so do the following: 1. Follow the Xilinx ISE tutorial of the next section to create a project called PracticaEdC2 including the files of the preliminary work. 2. Use the provided testbench (file convertidor_tb.v) to simulate the converter as described in the appendix. Check if the converter works as expected. 3. Use the provided testbench (file contador_tb.v) to simulate the counter as described in the appendix. Check if the counter works as expected. 4. Note that in the counter simulation the terminal count signal is never activated. Change the testbench file so at least a complete count cycle is simulated and check it. 5. Complete the template code 3 (file lab2.v) to make the Verilog description of a system containing an instance of both circuits interconnected. 6. Use the provided testbench (file lab2_tb.v) to simulate the previous system as described in

Computer Structure 5 the appendix. Check if it works as expected. module lab2( input clk, up, reset, output [0:6] seg, output cy); // Declare a bus to connect the counter // output and the converter input // instantiate the counter and // connect its i/o signals // instantiate the converter and // connect its i/o signals endmodule // lab2 Code 3. File lab2.v: Verilog code template for the whole system. 4. Xilinx ISE tutorial This section describes the XILINX ISE environment. The environment includes a Verilog logic analyzer that we will use in this session. 4.1. Creating a project After launching the ISE environment you must select the option New Project of the File menu. The window depicted at fig. 3 will pop-up. Fill in the name of the project (PracticaEdC2 for example). A folder with that name will be created. Every file related to the project will be saved there. Now press the Next button. The dialogue box depicted in fig. 4 will pop up. Set every option displayed as follows: Family: Spartan 3E Device: XC3S100E Package: CP132 Preferred Language: Verilog Left the remaining options with their default value as shown in fig 4. Press the Next button and a new window will pop-up. Click on the Finish button to create the project. Fig. 5 depicts the environment window after creating the project.

Computer Structure 6 Figure 3. Figure 4. Figure 5. Note the view options above the project name, Implementation and Simulation (fig. 5). You must choose the simulation view. If the frames or controls are not properly displayed click on Layout Restore Default Layout. 4.2. Adding files to the project After creating the project you must add the Verilog files (design and testbenchs). To do so you can use the corresponding option of the Project menu or rigth-click on the empty frame of the project view.

Computer Structure 7 You must choose between the Add copy of source and the Add Source options. If the first option is selected, ISE will create within the project folder a copy of the selected file so the original file will not be modified. If the second one is selected, the original selected file will be added to the project, and it could edited within the ISE framework. The New source just create a new empty file. You are advised to choose the Add Source option to add files to the project. You will have to specify witch files are used for the implementation and which are just used for simulation (the supplied testbench files). Fig. 6 shows how the files must be associated in order to carry out the simulation successfully. Figure 6. Once the files have been added they are shown in a hierarchical tree showing their dependences as depicted in fig. 7. To edit or watch any of the project file you just have to double left-click on its name. 4.3. Simulating and verifying a design Testbench files make it possible to verify the functionality of a design by simulating its behaviour. The testbench files of a project are displayed in the simulation view, not in the implementation view, since they are just used to carry out simulations. The hierarchical file tree is not the same in both views, as shown in fig. 7.

Computer Structure 8 Figure 7. Figure 8. In order to simulate a design you must select the file containing its testbech. Then you must double-click the Simulate Behavioural Model option hanging from ISim Simulator in the lower frame entitled Processes as shown in fig. 8. If there are no errors the ISim simulator window will pop up and the

Computer Structure 9 simulation will be carried out for a short time (usually 1 s). The simulation will stop if a $finish sentence in the testbench file is executed. To see the waveforms click on DEFAULT.WCFG. You can click on the icon to get a full view of the waveforms. Fig. 9 shows the window displaying the waveforms. If you click on the waveforms a yellow will result the corresponding simulation instant and the line values at that instant will be displayed. The notation used for the values of a bus (binary, hexadecimal, decimal..) can be changed by right-clicking on its name and selecting the RADIX option of the floating menu. Figure 9. Simulation of the converter using ISim The frames on the left of the ISim window make it possible to select any signal of any component of the design and add then to the simulation view. We can then display their waveforms, but this requires to relaunch the simulation again. In the top there are several icons to zoom in and zoom out on the chronogram. There are also green icons to navigate along the waveforms. For example, Previous Transition and Next Transition will led us to the previous/next edge of the selected signal. The blue icons are used to control the simulation process with the following actions: clean up the current simulation and go back to simulation zero ( Restart), continue the simulation till finish it ( Run All), continue for a selected time and stop ( Run), execute the Verilog testbench step by step ( Step) and stop the simulation ( Break).