Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania 18042 ECE 491 - Senior Design I Lecture 2 FPGAs & Verilog.

Slides:



Advertisements
Similar presentations
Verilog Fundamentals Shubham Singh Junior Undergrad. Electrical Engineering.
Advertisements

1/8/ VerilogCopyright Joanne DeGroat, ECE, OSU1 Verilog Overview An overview of the Verilog HDL.
ENEL111 Digital Electronics
Simulation executable (simv)
The Verilog Hardware Description Language
Verilog Overview. University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
Verilog Intro: Part 1.
Hardware Description Language (HDL)
Combinational Logic with Verilog Materials taken from: Digital Design and Computer Architecture by David and Sarah Harris & The Essentials of Computer.
Anurag Dwivedi.  Verilog- Hardware Description Language  Modules  Combinational circuits  assign statement  Control statements  Sequential circuits.
CSE 201 Computer Logic Design * * * * * * * Verilog Modeling
1 Brief Introduction to Verilog Weiping Shi. 2 What is Verilog? It is a hardware description language Originally designed to model and verify a design.
CSE 341 Verilog HDL An Introduction. Hardware Specification Languages Verilog  Similar syntax to C  Commonly used in  Industry (USA & Japan) VHDL 
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
EELE 367 – Logic Design Module 2 – Modern Digital Design Flow Agenda 1.History of Digital Design Approach 2.HDLs 3.Design Abstraction 4.Modern Design Steps.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Senior Design I Lecture 2 - Verilog Fall.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Senior Design I Lecture 4 - Sequential Design.
02/02/20091 Logic devices can be classified into two broad categories Fixed Programmable Programmable Logic Device Introduction Lecture Notes – Lab 2.
1/31/20081 Logic devices can be classified into two broad categories Fixed Programmable Programmable Logic Device Introduction Lecture Notes – Lab 2.
Introduction to Field Programmable Gate Arrays (FPGAs) COE 203 Digital Logic Laboratory Dr. Aiman El-Maleh College of Computer Sciences and Engineering.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Senior Design I Lecture 4 - Verilog 2 (Sequential.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE VLSI System Design Lecture 4 - Advanced Verilog.
Computer Organization Lecture Set – 03 Introduction to Verilog Huei-Yung Lin.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Senior Design I Lecture 6 - Behavioral Modeling.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Senior Design I Lecture 10 - Data Communications.
O VERVIEW OF DIGITAL SYSTEMS Hardware Description Language 1.
Digital System Design EEE344 Lecture 1 INTRODUCTION TO THE COURSE
ECE 448: Spring 12 Lab 4 – Part 2 Finite State Machines Basys2 FPGA Board.
Verilog Basics Nattha Jindapetch November Agenda Logic design review Verilog HDL basics LABs.
Introduction to FPGA AVI SINGH. Prerequisites Digital Circuit Design - Logic Gates, FlipFlops, Counters, Mux-Demux Familiarity with a procedural programming.
Verilog Intro: Part 2. Procedural Blocks There are two types of procedural blocks in Verilog. – initial for single-pass behavior: initial blocks execute.
ECE 2372 Modern Digital System Design
Lecture #3 Page 1 ECE 4110– Sequential Logic Design Lecture #3 Agenda 1.FPGA's 2.Lab Setup Announcements 1.No Class Monday, Labor Day Holiday 2.HW#2 assigned.
1 Keyboard Controller Design By Tamas Kasza Digital System Design 2 (ECE 5572) Summer 2003 A Project Proposal for.
Lecture #3 Page 1 ECE 4110– Sequential Logic Design Lecture #3 Agenda 1.FPGA's 2.Lab Setup Announcements 1.No Class Monday, Labor Day Holiday 2.HW#2 assigned.
ECE 551 Digital System Design & Synthesis Fall 2011 Midterm Exam Overview.
FPGA (Field Programmable Gate Array): CLBs, Slices, and LUTs Each configurable logic block (CLB) in Spartan-6 FPGAs consists of two slices, arranged side-by-side.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Senior Design I Lecture 9 - Coding Guidelines.
1 An Update on Verilog Ξ – Computer Architecture Lab 28/06/2005 Kypros Constantinides.
Digital System 數位系統 Verilog HDL Ping-Liang Lai (賴秉樑)  
Module 2.1 Gate-Level/Structural Modeling UNIT 2: Modeling in Verilog.
Lecture #3 Page 1 ECE 4110–5110 Digital System Design Lecture #3 Agenda 1.FPGA's 2.Lab Setup Announcements 1.HW#2 assigned Due.
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
Fall 2004EE 3563 Digital Systems Design EE 3563 VHSIC Hardware Description Language  Required Reading: –These Slides –VHDL Tutorial  Very High Speed.
displayCtrlr Specification
Anurag Dwivedi. Basic Block - Gates Gates -> Flip Flops.
1 Hardware description languages: introduction intellectual property (IP) introduction to VHDL and Verilog entities and architectural bodies behavioral,
Introduction to Combinational Verilog EECS270 rev 9/25/12.
04/26/20031 ECE 551: Digital System Design & Synthesis Lecture Set : Introduction to VHDL 12.2: VHDL versus Verilog (Separate File)
Introduction to Verilog. Data Types A wire specifies a combinational signal. – Think of it as an actual wire. A reg (register) holds a value. – A reg.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Computer Organization Lecture 12 - Introduction.
Teaching Digital Logic courses with Altera Technology
Introduction to Verilog
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
Chapter 6: Hierarchical Structural Modeling Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 6-1 Chapter 6: Hierarchical.
Chapter1: Introduction Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 1-1 Chapter 1: Introduction Prof. Ming-Bo.
Verilog Intro: Part 1. Hardware Description Languages A Hardware Description Language (HDL) is a language used to describe a digital system, for example,
Introduction to Verilog. Structure of a Verilog Program A Verilog program is structured as a set of modules, which may represent anything from a collection.
Introduction to Field Programmable Gate Arrays (FPGAs) EDL Spring 2016 Johns Hopkins University Electrical and Computer Engineering March 2, 2016.
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
1 Introduction to Engineering Spring 2007 Lecture 18: Digital Tools 2.
Introduction to the FPGA and Labs
Verilog Introduction Fall
Introduction to DIGITAL CIRCUITS MODELING & VERIFICATION using VERILOG [Part-I]
Introduction to Verilog
Behavioral Modeling in Verilog
Lecture 1.3 Hardware Description Languages (HDLs)
COE 202 Introduction to Verilog
The Verilog Hardware Description Language
COE 202 Introduction to Verilog
Presentation transcript:

Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Senior Design I Lecture 2 FPGAs & Verilog (for Lab 1) Fall 2008 Handout: “Structural Design with Verilog” - read Sections 1-5

ECE 491 Fall 2008Lecture 2 - FPGA-Based Design2 Today’s Outline  Overview: Electronic Design with FPGAs  Basic FPGA Structure  FPGA Tradeoffs  The Spartan-3 FPGA  The Spartan-3 Starter Kit Board  Hardware Description Languages  Quick Verilog Overview  What to do in Lab 1

ECE 491 Fall 2008Lecture 2 - FPGA-Based Design3 FPGA Organization - Overview

ECE 491 Fall 2008Lecture 2 - FPGA-Based Design4 FPGA Organization (Simplified) CLB SB CLB SB CLB IOB - Input/Output Block IOB SB IOB CLB - Configurable Logic BlockSB - Switch Block Switch

ECE 491 Fall 2008Lecture 2 - FPGA-Based Design5 FPGA Tradeoffs  Advantages  Very low development cost  Post-manufacturing changes possible  Powerful functions in a small package  Relatively inexpensive  Disadvantages  Inefficient - unused CLBs are still on device  Much slower than ASICs, Custom ICs  Higher power than ASICs, Custom ICs  More expensive than ASICs, Custom ICs in volume

ECE 491 Fall 2008Lecture 2 - FPGA-Based Design6 Spartan-3 Organization

ECE 491 Fall 2008Lecture 2 - FPGA-Based Design7 Spartan 3 CLB Structure

ECE 491 Fall 2008Lecture 2 - FPGA-Based Design8 Spartan 3 Slice Structure

ECE 491 Fall 2008Lecture 2 - FPGA-Based Design9 Spartan-3 XC3S200 Details  24 X 20 = 480 CLBs  12 Block RAMs (18kbits ea.)  12 Multipliers (18bit X 18bit)  Up to 173 User I/O pins

ECE 491 Fall 2008Lecture 2 - FPGA-Based Design10 Starter Kit Board - Overview FT256 BGA Package JTAG Connector (for programming)

ECE 491 Fall 2008Lecture 2 - FPGA-Based Design11 Starter Kit - Block Diagram

ECE 491 Fall 2008Lecture 2 - FPGA-Based Design12 Hardware Description Languages  Verilog  Designed by one person at a startup company  Syntax similar to C  Favored by industrial designers  IEEE Standard 1364 (-1995, -2001, -2005)  VHDL  Designed by committee for the Department of Defense  Syntax similar to Pascal, ADA  Favored by government labs, contractors  IEEE Standard 1076 (-1987, -1993, -2000, -2002, -2004) We’ll use Verilog!

ECE 491 Fall 2008Lecture 2 - FPGA-Based Design13 Verilog Overview  Important Points About Verilog  The module construct  Combinational Logic  Parameters  Module Instantiation  Sequential Logic  Finite State Machines

ECE 491 Fall 2008Lecture 2 - FPGA-Based Design14 Key Point: Verilog is for Hardware!  Verilog code is not like software!  Hardware is parallel  Software is sequential  Think hardware and write code that describes hardware  Follow coding guidelines to avoid pitfalls Zen Master Lin Chi Yi-Sen (note stick) source:

ECE 491 Fall 2008Lecture 2 - FPGA-Based Design15 Verilog Hardware Constructs Combinational Logic Registered Logic General Sequential Logic Finite State Machine (FSM)

ECE 491 Fall 2008Lecture 2 - FPGA-Based Design16 Important Points about Verilog (cont’d)  Verilog is based on event-driven simulation  Signal values change at specific time points  Each model: Activates in response to input events Creates output events to represent output changes A B C A B C delay=4 input event output event

ECE 491 Fall 2008Lecture 2 - FPGA-Based Design17 Important Points about Verilog (cont’d)  Verilog was designed as a simulation language  Synthesis added as an afterthought  Only a subset of the language supported for synthesis  Synthesis must match simulated behavior  Follow coding guidelines to avoid difficulties Image source:

ECE 491 Fall 2008Lecture 2 - FPGA-Based Design18 Important Points about Verilog (cont’d)  Our focus: the synthesizable subset  Structural Descriptions - module instantiations  Behavioral Descriptions assign - continuous assignments always blocks  But, we’ll use simulation capabilities for verification  initial blocks  tasks (subroutines), system tasks, functions  Delay operator

ECE 491 Fall 2008Lecture 2 - FPGA-Based Design19 Verilog module construct  Key building block of language  Interface - input and output ports  Body - specifies contents of "black box" behavior - what it does structure - how it's built from module instances (submodules) Mixed behavior and structure (discouraged)

ECE 491 Fall 2008Lecture 2 - FPGA-Based Design20 First Example: Full Adder module fulladder(a, b, cin, sum, cout); input a, b, cin; output sum, cout; assign sum = a ^ b ^ cin; assign cout = a & b | a & cin | b & cin; endmodule Ports Port Declarations Semicolon NO Semicolon Continuous Assignment Statements (Parallel)

ECE 491 Fall 2008Lecture 2 - FPGA-Based Design21 Comments about First Example  Module interface: input and output ports  Single bit  Multiple bit - array syntax  Module internals:  Internal connections ( wire ) and variables ( reg )  Continuous assignment statements - assign  Concurrent statements - always  Submodule instantiation (hierarchy)  Digital values: (0, 1, X, Z) Only in simulation

ECE 491 Fall 2008Lecture 2 - FPGA-Based Design22 Example: 7-Segment Decoder Part 1 Symbolic Constants Port Declarations Variable (reg) Declaration module seven_seg(data, segments); input [3:0] data; output [6:0] segments; reg [6:0] segments; // Output patterns: abc_defg parameter BLANK= 7'b111_1111; parameter ZERO= 7'b000_0001; parameter ONE = 7'b100_1111; parameter TWO= 7'b001_0010; parameter THREE= 7'b000_0110; parameter FOUR= 7'b100_1100; parameter FIVE= 7'b010_0100; parameter SIX= 7'b010_0000; parameter SEVEN= 7'b000_1111; parameter EIGHT= 7'b000_0000; parameter NINE= 7'b000_0100;

ECE 491 Fall 2008Lecture 2 - FPGA-Based Design23 Example: 7-Segment Decoder Part 2 case (data) 4'd0: segments = ZERO; 4'd1: segments = ONE; 4'd2: segments = TWO; 4'd3: segments = THREE; 4'd4: segments = FOUR; 4'd5: segments = FIVE; 4'd6: segments = SIX; 4'd7: segments = SEVEN; 4'd8: segments = EIGHT; 4'd9: segments = NINE; default: segments = BLANK; endcase endmodule always Statement (Parallel) Case Statement (Sequential) Procedural assignment statements

ECE 491 Fall 2008Lecture 2 - FPGA-Based Design24 Example: Module Instance in “s3board” module s3board( clk, pb_in, sw_in, digit_enable_out, segment_out, segment_dp_out,led_out, rxd_in, txd_out ); input clk; // 50MHz clock from board input [3:0]pb_in; // active-high pushbuttons (BTN3-BTN0) input [7:0] sw_in; // active-high slide switches (SW7-SW0) output [3:0] digit_enable_out; // active-low enable for the four // 7-seg display units (AN3-AN0) output [6:0] segment_out; // active-low segments a (6) - g (0) - // shared between the four displays output segment_dp_out; // active-low segment decimal point - // shared between the four displays output [7:0] led_out; // 8 active-high LEDs (LD7-LD0) input rxd_in; // RS-232 port data in output txd_out; // RS-232 port data out assign segment_dp_out = 1’b1; // turn OFF decimal point seven_seg U_SSEG(.data(sw_in[3:0]),.segments(segment_dp_out) ); endmodule // s3board

ECE 491 Fall 2008Lecture 2 - FPGA-Based Design25 Using the S3 Board with Verilog  Top-level module file: s3board.v  Contains declarations for all input & output pins Switches & pushbuttons LEDs and 7-segment displays RS-232 port(s) Not used (currently): PS/2 port, VGA port  Use as a starting point for your design  Constraint file: s3board.ucf  Contains pin assignments for all inputs & outputs  Uncomment pins that you’re going to use (remove “ # ”)  Download these files from Moodle

ECE 491 Fall 2008Lecture 2 - FPGA-Based Design26 S3 Board: Seven-Segment Display  Segment signals - active low  Digit enables used to “time multiplex” digits

ECE 491 Fall 2008Lecture 2 - FPGA-Based Design27 Lab 1 Goals  Learn about the Spartan-3 Starter Kit Board  Review Combinational Logic Design with Verilog  Learn about Basic FPGA Design with Verilog

ECE 491 Fall 2008Lecture 2 - FPGA-Based Design28 What to Do in Lab 1  Download “ s3board.v ” and “ s3board.ucf ”  Run ISE and create a new project  Add “ s3board.v ” and “ s3board.ucf ”  Add Verilog code for a 4-bit adder  Add Verilog code for a 7-segment decoder with hex digits  Connect slide switches to adder inputs  Connect 7-segment decoder to adder output  Connect 7-segment decoder to display LSB  Compile, download, & debug  Create report & upload to Moodle (see rubric)

ECE 491 Fall 2008Lecture 2 - FPGA-Based Design29 Lab 1 - Block Diagram