Advanced Digital Design Using FPGA. Dr. Shahrokh Abadi

Similar documents
Introduction to Verilog design. Design flow (from the book)

Verilog Tutorial (Structure, Test)

Introduction to Verilog design. Design flow (from the book) Hierarchical Design. Lecture 2

Verilog. Like VHDL, Verilog HDL is like a programming language but:

Speaker: Kayting Adviser: Prof. An-Yeu Wu Date: 2009/11/23

Verilog. What is Verilog? VHDL vs. Verilog. Hardware description language: Two major languages. Many EDA tools support HDL-based design

Online Verilog Resources

Introduction to Verilog HDL. Verilog 1

14:332:231 DIGITAL LOGIC DESIGN. Hardware Description Languages

CSE241 VLSI Digital Circuits Winter Recitation 1: RTL Coding in Verilog

Schematic design. Gate level design. 0 EDA (Electronic Design Assistance) 0 Classical design. 0 Computer based language

Tutorial on Verilog HDL

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

Design Using Verilog

Computer Aided Design Basic Syntax Gate Level Modeling Behavioral Modeling. Verilog

EECS 427 Lecture 14: Verilog HDL Reading: Many handouts/references. EECS 427 W07 Lecture 14 1

Verilog. Verilog for Synthesis

EEL 4783: Hardware/Software Co-design with FPGAs

Verilog Design Principles

Verilog Design Principles

What is Verilog HDL? Lecture 1: Verilog HDL Introduction. Basic Design Methodology. What is VHDL? Requirements

Introduction to Digital Design with Verilog HDL

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

This Lecture. Some components (useful for the homework) Verilog HDL (will continue next lecture)

Graduate Institute of Electronics Engineering, NTU. Lecturer: Chihhao Chao Date:

UNIT V: SPECIFICATION USING VERILOG HDL

Digital Design with FPGAs. By Neeraj Kulkarni

Introduction to Verilog/System Verilog

Contents. Appendix D Verilog Summary Page 1 of 16

Introduction. Why Use HDL? Simulation output. Explanation

VERILOG QUICKSTART. Second Edition. A Practical Guide to Simulation and Synthesis in Verilog

Hardware description languages

Lecture #2: Verilog HDL

Verilog Module 1 Introduction and Combinational Logic

Programmable Logic Devices Verilog VII CMPE 415

Verilog Hardware Description Language ROOM: B405

Verilog HDL Introduction

Why Should I Learn This Language? VLSI HDL. Verilog-2

Lecture 15: System Modeling and Verilog

Federal Urdu University of Arts, Science and Technology, Islamabad VLSI SYSTEM DESIGN. Prepared By: Engr. Yousaf Hameed.

101-1 Under-Graduate Project Digital IC Design Flow

Combinational Logic II

Lecture 2: Data Types, Modeling Combinational Logic in Verilog HDL. Variables and Logic Value Set. Data Types. Why use an HDL?

CSE140L: Components and Design Techniques for Digital Systems Lab. Verilog HDL. Instructor: Mohsen Imani UC San Diego. Source: Eric Crabill, Xilinx

N-input EX-NOR gate. N-output inverter. N-input NOR gate

Verilog Fundamentals. Shubham Singh. Junior Undergrad. Electrical Engineering

Speaker: Shao-Wei Feng Adviser: Prof. An-Yeu Wu Date: 2010/09/28

Verilog Tutorial. Introduction. T. A.: Hsueh-Yi Lin. 2008/3/12 VLSI Digital Signal Processing 2

A Brief Introduction to Verilog Hardware Definition Language (HDL)

Advanced Digital Design with the Verilog HDL

Verilog Coding Guideline

Introduction to Verilog. Garrison W. Greenwood, Ph.D, P.E.

A Verilog Primer. An Overview of Verilog for Digital Design and Simulation

Verilog introduction. Embedded and Ambient Systems Lab

LANGUAGE CONSTRUCTS AND CONVENTIONS IN VERILOG

RIZALAFANDE CHE ISMAIL TKT. 3, BLOK A, PPK MIKRO-e KOMPLEKS PENGAJIAN KUKUM. SYNTHESIS OF COMBINATIONAL LOGIC (Chapter 8)

structure syntax different levels of abstraction

Here is a list of lecture objectives. They are provided for you to reflect on what you are supposed to learn, rather than an introduction to this

Synthesizable Verilog

ECEN 468 Advanced Digital System Design

C-Based Hardware Design

Lecture 7. Summary of two-level combinational-logic. Ways of specifying circuits. Solving combinational design problems. Verilog versus VHDL

Verilog Dataflow Modeling

Introduction to Verilog HDL

VERILOG QUICKSTART. James M. Lee Cadence Design Systems, Inc. SPRINGER SCIENCE+BUSINESS MEDIA, LLC

Spring 2017 EE 3613: Computer Organization Chapter 5: Processor: Datapath & Control - 2 Verilog Tutorial

register:a group of binary cells suitable for holding binary information flip-flops + gates

Lecture 8: Combinational Verilog. CSE 370, Autumn 2007 Benjamin Ylvisaker. Where We Are. Last lecture: Minimization with K!maps

Chapter 3: Dataflow Modeling

VERILOG 2: LANGUAGE BASICS

Introduction to Verilog. Mitch Trope EECS 240 Spring 2004

Introduce some of the data types that are part of the Verilog language. These are known as the intrinsic (or built-in) types.

Spiral 1 / Unit 4 Verilog HDL. Digital Circuit Design Steps. Digital Circuit Design OVERVIEW. Mark Redekopp. Description. Verification.

FPGA: FIELD PROGRAMMABLE GATE ARRAY Verilog: a hardware description language. Reference: [1]

a, b sum module add32 sum vector bus sum[31:0] sum[0] sum[31]. sum[7:0] sum sum overflow module add32_carry assign

EN2911X: Reconfigurable Computing Topic 02: Hardware Definition Languages

Arithmetic Operators There are two types of operators: binary and unary Binary operators:

Introduction to Verilog

HDLs and SystemVerilog. Digital Computer Design

Hardware Description Language VHDL (1) Introduction

The Verilog Language COMS W Prof. Stephen A. Edwards Fall 2002 Columbia University Department of Computer Science

ENGIN 241 Digital Systems with Lab

Digital Design with SystemVerilog

CSE140L: Components and Design Techniques for Digital Systems Lab

Synthesis of Combinational and Sequential Circuits with Verilog

Introduction to Verilog

ECE 353 Lab 4. Verilog Review. Professor Daniel Holcomb With material by Professor Moritz and Kundu UMass Amherst Fall 2016

Lecture 1: Introduction Course arrangements Recap of basic digital design concepts EDA tool demonstration

ENGN1640: Design of Computing Systems Topic 02: Design/Lab Foundations

Announcements. Midterm 2 next Thursday, 6-7:30pm, 277 Cory Review session on Tuesday, 6-7:30pm, 277 Cory Homework 8 due next Tuesday Labs: project

ECE Digital System Design & Synthesis Exercise 1 - Logic Values, Data Types & Operators - With Answers

Brief Introduction of Cell-based Design. Ching-Da Chan CIC/DSD

Date Performed: Marks Obtained: /10. Group Members (ID):. Experiment # 11. Introduction to Verilog II Sequential Circuits

DIGITAL SYSTEM DESIGN

EECE-4740/5740 Advanced VHDL and FPGA Design. Lecture 3 Concurrent and sequential statements

ECEN 468 Advanced Logic Design

Introduction. Purpose. Intended Audience. Conventions. Close

St.MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad

Chapter 2a: Structural Modeling

Chapter 2 Using Hardware Description Language Verilog. Overview

Transcription:

Advanced Digital Design Using FPGA Dr. Shahrokh Abadi 1

Venue Computer Lab: Tuesdays 10 12 am (Fixed) Computer Lab: Wednesday 10-12 am (Every other odd weeks) Note: Due to some unpredicted problems with the lab systems, you d better to have your own Laptop with already installed Qii 14.1 web edition (get it from Altera website) with you. 2

References Advanced Digital Design with the Verilog HDL, Michael D. Ciletti, Pearson publisher, 2011. Some other extra notes that will be given during the term 3

Midterm Exam(s)**: Evaluation 1st ME: 5th Week 10 Marks 2nd ME: 10th Week 10 Marks Or only one ME: 8th Week 20 Marks Final Exam: Homework/Labwork: Mini Project based-on Verilog: Total: 20 Marks 45 Marks 20 Marks 20 Marks 105 Marks Projects are teamwork based, will be given at 10 th week and should be submitted one week before the final exam. ** The mark of ME can goes to the HW/LW+Project 4

Project Submission Deadline Your project must be submitted up to one week after the final exam. 1 min. to 24 hours after deadline: 50% > 24 hours after deadline: 0% No copy, No cheat, Collaboration s OK You need to submit your project including: Your name and a brief description on the procedure (MS Word) Your results; codes, diagrams, calculations, figures, altogether into a zipped file under your name must be sent to mhshahrokh@ieee.org Type FPGA-Project in the email subject line Make sure you ve received a confirmation upon your submission 5

Chapter 02 Design using Verilog HDL Part 1 6

1. Introduction to HDL Hardware Description Language or HDL is any language from a class of computer languages for formal description and design of electronic circuits and digital logic HDL can describe the circuit's operation (behavior), its design and organization (structure), and tests to verify its operation by means of simulation Schematics describe only circuit structure C Language describes only behaviors Provide high level abstraction to speed up design HDL can be automatically transformed to circuits by EAD tools synthesis and optimization Can t verify the operation Enable rapid prototyping Independent of technology: support different hardware styles 7

1. Introduction to HDL Two most popular HDLs: Verilog and VHDL Recently, Cadence has come up with a HDL using mixed analog and digital design, called Verilog AMS. Can implement ADC, DAC, PLLs and the rest of analog circuits, and mix them with digital circuits. Verilog and VHDL can be used in circuit design ranging from SSI to VLSI: 50 transistors or less as SSI below 500 as MSIs below 5000 as LSIs beyond that as VLSIs/ULSIs Roughly, 4 or 5 transistors are considered as a 2-input NAND gate. We will be using Verilog in this course 8

1. Introduction to Verilog-HDL AHPL (A Hardware Programming Language) was developed to model data paths in the 70s at U. of Arizona. During the 80s, VHSIC HDL (VHDL) was jointly developed by IBM and TI under the sponsorship of DOD. IEEE standard 1076-1987 was published for VHDL. In 2000 and 2002, the standard was revised to enhance VHDL. Original version of Verilog developed by Gateway Design Automation in 1984. Cadence popularized it later on. In 1990, Verilog was put into public domain. In 1995, IEEE standard 1364-1995 for Verilog. In 2001, IEEE standard 1364-2001 for an enhanced version of Verilog. 9

1. Introduction to Verilog-HDL Verilog has become an industry standard because of its simplicity: Quick to learn Verilog (easier than learning VHDL) It has C like structure and very fast design cycle times; i.e. you can use if, else statements, case statements, etc., and of course, there are small differences Verilog Slightly better at gate/transistor level Language style close to C/C++ Pre-defined data type, easy to use Commonly used in industry VHDL Slightly better at system level Language style close to Pascal User-defined data type, more flexible Commonly used in academic and military institutions 10

1. Introduction to Verilog-HDL Overall design SYSTEM + MODULE GATE CIRCUIT S n+ G DEVICE n+ D 11

1. Introduction to Verilog-HDL Different levels of abstraction in Verilog: System level RTL level Gate level Transistor level Physical level 12

1.1 Describing Logic Systems in Verilog Data-Flow Style Behavioral Style Assignments Style 13

2. Hardware Molding in Verilog In Verilog HDL, the basic unit of hardware is known as a module. Cannot contain definitions of other modules A module can be instantiated within another module, i.e. can be called to provide the basic mechanism for the creation of design hierarchy in a Verilog description. The hardware description is enclosed by the keywords module and endmodule All other parallel statements are fallen between these two keywords Any module has to have a name based-on some criteria List shows the basic layout of a module: 14

2. Hardware Molding in Verilog The BNF syntax in the Verilog is normative, which means that the syntax is part of the definition of the language. Along with this lecturer you are given an Alphabetical Reference Section of Verilog Keywords entitled a document called: Verilog Reference Guide. Please check all the keywords including: Syntax Rules Synthesis and the related Example During the course we use some of the keywords occasionally 15

3. Keywords in Verilog Comments (green color) // to the end of the line. /* to */ across several lines Keywords are lower case letter Verilog language is case sensitive Identifiers (names) Must begin with alphabetic or underscore characters a-z A-Z _ May contain the characters a-z A-Z 0-9 _ and $ Should not be a Verilog Keyword Identifier Notes adder legal identifier name XOR uppercase identifier, differes from xor keyword 1adder illegal identifier!!! _adder legal identifier name wire illegal identifier; preserved Verilog keyword!!! 16

Logic Values 3. Keywords in Verilog The Verilog HDL does have 4 logic values: Logic Value Description 0 zero, low, or false 1 one, high, or true Z or z high impedance (tri-stated or floating) X or x unknown or uninitialized 17

3. Keywords in Verilog Numbers in Verilog are specified as below: <size><base format><number> Size: contains decimal digitals that specify the size of the constant in the number of bits Base format: is the single character followed by one of the following characters b or B (binary),d or D (decimal),o or O (octal),h or H (hex) Number: legal digital Example : 347 // decimal number 4 b101 // 4- bit binary number 0101 2 o12 // 2-bit octal number 5 h87f7 // 5-bit hex number h87f7 2 d83 // 2-bit decimal number 18

3. Keywords in Verilog Numbers in Verilog (Classwork: 30 sec): Determine the Size, the Base, and the Binary Equivalent of the following numbers: Number Size (bits) Base Binary Equivalent 10 unsized decimal 0...01010 (32-bits) 'o7 unsized octal 0...00111 (32-bits) 1'b1 1 binary 1 8'Hc5 8 hex 11000101 6hF0 6 hex 110000 (truncated) 7'hF 7 hex 0001111 (zero filled) 5'hZ 5 hex ZZZZZ (Z filled) Note: There are Literal Real Numbers but beyond the scope of this course. 19

3. Keywords in Verilog Numbers in Verilog (Classwork: 30 sec): Determine the Binary Equivalent of the following numbers: Number 8 b1x0 8 h0z 8 hzx 8 bx0 Binary Equivalent 000001x0 0000zzzz zzzzxxxx 000000x0 Note: There are Literal Real Numbers but beyond the scope of this course. 20

3. Keywords in Verilog Arithmetic Operators +, -, *, /, % (the modulus operator) Relational Operators: Operator a < b a > b a <= b a >= b Description a less than b a greater than b a less than or equal to b a greater than or equal to b The result is a scalar value (example a < b) 0 if the relation is false (a is bigger then b) 1 if the relation is true ( a is smaller then b) x if any of the operands has unknown x bits (if a or b contains x) 21

Equality Operators: Case Equality Logical Equality 3. Keywords in Verilog Operator a===b a!==b a==b a!=b Description a equal to b, including x and z (Case equality) a not equal to b, including x and z (Case inequality) a equal to b, result may be unknown (logical equality) a not equal to b, result may be unknown (logical equality) 22

4. Structural Modeling in Verilog Logical Operators: Operator Description! logic negation && logical and logical or Expressions connected by && and are evaluated from left to right Evaluation stops as soon as the result is known The result is a scalar value: 0 if the relation is false 1 if the relation is true x if any of the operands has x (unknown) bits 23

4. Structural Modeling in Verilog Bit-wise Operators: Operator Description ~ negation & and inclusive or ^ exclusive or ^~ or ~^ exclusive nor (equivalence) 24

3. Keywords in Verilog Module Port Declarations: <port direction> [port size] <port name>, <port name>,... ; port direction: input for scalar or vector input ports. output for scalar or vector output ports. inout for scalar or vector bi-directional ports. Examples input a,b,sel; output [7:0] result; inout [0:15] data_bus; input [15:12] addr; parameter word = 32; input [word-1:0] addr; Notes 3 scalar ports little endian convention big endian convention msb:lsb may be any integer constant expressions may be used 25

4. Structural Modeling in Verilog Primitives: Due to technology dependence and synthesis limitation, Transistor Level is not cover in this course Logic Gates and or xor nand nor xnor Buffers buf bufif0 bufif1 not notif0 notif1 pulldown pullup Transistors nmos pmos cmos rnmos rpmos rcmos tran tranif0 tranif1 rtran rtranif0 rtranif1 26

4. Structural Modeling in Verilog wire vs reg wire is used to two points it s used for designing combinational logic therefore cannot store a value. reg can store values If a value is assigned to reg type of signal, value will retain until a new value is assigned. it can be used for modeling both combinational and sequential logic reg data type can be driven from initial and always block (we will be covered later) 27

4. Structural Modeling in Verilog A half adder Module name Module ports module Add_half ( sum, c_out, a, b ); input a, b; output sum, c_out; wire c_out_bar; xor Gate1 (sum, a, b); nand (c_out_bar, a, b); not (c_out, c_out_bar); endmodule Instance name Declaration of port modes Declaration of internal signal Instantiation of primitive gates a b sum c_out_bar Verilog keywords c_out 28

5. Continuous Assignment in Verilog Half Adder: module Add_half ( sum, c_out, a, b ); input a, b; output sum, c_out; assign { c_out, sum } = a + b; // Continuous assignment endmodule a b Add_half sum c_out 29

6. Data Flow Behavioral Description Half Adder: module Add_half ( sum, c_out, a, b ); input a, b; output sum, c_out; reg sum, c_out; always @ ( a or b ) begin sum = a ^ b; // Exclusive or c_out = a & b; // And end endmodule 30

7. Hierarchical Design Start from building primitives pmos, nmos, NOT, DFF, AND, OR, etc. Then building small blocks 4-1 MUX, 3-8 Decode, Half Add, etc. Then building small modules 8-bit adders, register file, multiplier, etc. Then building units fixed-point unit, router, etc. Finally put units into a chip 31

8. Examples D Type Flip Flop module Flip_flop ( q, data_in, clk, rst ); input data_in, clk, rst; output q; reg q; data_in clk rst q always @ ( posedge clk ) begin if ( rst == 1) q = 0; else q = data_in; end endmodule Declaration of synchronous behavior Procedural statement 32

9. Homeworks Can you realize Schmitt trigger and open collector buffers/inverters using Verilog? If so, explain how. If not, what do you suggest for their implementation? What are the possible applications for them? 33

9. Homeworks Tristate buffers can be implemented in Verilog using primitive gates. Write Verilog codes for circuits given below: (i) Octal tristate buffers (ii) Octal tristate inverters (iii) Octal tristate bi-directional buffers 34

9. Homeworks Parity generator/checker is commonly used to detect errors in high-speed serial data communication. Even parity output, OP, goes high when an even number of data inputs among I0 through I7 are high. Write a Verilog code to implement such an even parity generator using primitive gates. 35

Next Session How Does Quartus II work?!! Design Flow of Behavioral Model Continue Design and Simulation with Combinational and Sequential using ALTERA, Quartus II First Development on the Developer Board 36