Introduction to Verilog. Mitch Trope EECS 240 Spring 2004

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

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

Digital Design with FPGAs. By Neeraj Kulkarni

Verilog Design Entry, Synthesis, and Behavioral Simulation

CSE P567 - Winter 2010 Lab 1 Introduction to FGPA CAD Tools

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

Where We Are. Quick History Lesson. Lecture 8: Combinational Verilog. Specifying Circuits. Last lecture: Minimization with K!maps

VHDL. Chapter 1 Introduction to VHDL. Course Objectives Affected. Outline

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

C-Based Hardware Design

Experiment 3 Introduction to Verilog Programming using Quartus II software Prepared by: Eng. Shatha Awawdeh, Eng.Eman Abu_Zaitoun

Advanced Digital Design Using FPGA. Dr. Shahrokh Abadi

Unit 5. Hardware description languages

EECS150, Fall 2004, Midterm 1, Prof. Culler. Problem 1 (15 points) 1.a. Circle the gate-level circuits that DO NOT implement a Boolean AND function.

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

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

Introduction to VHDL. Module #5 Digilent Inc. Course

Board-Data Processing. VHDL Exercises. Exercise 1: Basics of VHDL Programming. Stages of the Development process using FPGA s in Xilinx ISE.

CSE140L: Components and Design Techniques for Digital Systems Lab

Field Programmable Gate Array

Lab 2: Barrel Shifter Design

ECE 152A LABORATORY 2

Hardware description languages

CSE140L: Components and Design

Verilog Fundamentals. Shubham Singh. Junior Undergrad. Electrical Engineering

EECS150 - Digital Design Lecture 8 - Hardware Description Languages

101-1 Under-Graduate Project Digital IC Design Flow

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

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

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

ISE Design Suite Software Manuals and Help

Hardware Description Language VHDL (1) Introduction

EECS150 - Digital Design Lecture 10 Logic Synthesis

EN2911X: Reconfigurable Computing Topic 02: Hardware Definition Languages

EE183 LAB TUTORIAL. Introduction. Projects. Design Entry

Lab 1: Introduction to Verilog HDL and the Xilinx ISE

Building Combinatorial Circuit Using Behavioral Modeling Lab

EEL 4783: Hardware/Software Co-design with FPGAs

Synthesis of Combinational and Sequential Circuits with Verilog

Introduction to Verilog

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

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

Lecture #2: Verilog HDL

PREFACE. Changes to the SOPC Edition

The board is powered by the USB connection, so to turn it on or off you plug it in or unplug it, respectively.

Laboratory Exercise 1

Abi Farsoni, Department of Nuclear Engineering and Radiation Health Physics, Oregon State University

Logic Synthesis. EECS150 - Digital Design Lecture 6 - Synthesis

EECS150 - Digital Design Lecture 10 Logic Synthesis

CSE370 TUTORIAL 3 - INTRODUCTION TO USING VERILOG IN ACTIVE-HDL

EE 231 Fall Lab 1: Introduction to Verilog HDL and Altera IDE

HDLs and SystemVerilog. Digital Computer Design

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

Physics 364, Fall 2012, reading due your answers to before the end of Wednesday s lab.

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

Lab 6 : Introduction to Verilog

ELEC 204 Digital System Design LABORATORY MANUAL

VHDL for Synthesis. Course Description. Course Duration. Goals

Physics 364, Fall 2014, reading due your answers to by 11pm on Sunday

LAB #3: ADDERS and COMPARATORS using 3 types of Verilog Modeling

Introduction to Verilog HDL

Tutorial: Working with the Xilinx tools 14.4

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

MODELING LANGUAGES AND ABSTRACT MODELS. Giovanni De Micheli Stanford University. Chapter 3 in book, please read it.

Nikhil Gupta. FPGA Challenge Takneek 2012

Hardware Description Languages (HDLs) Verilog

CPLD Experiment 4. XOR and XNOR Gates with Applications

Verilog Design Principles

Lecture 15: System Modeling and Verilog

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

LAB 5 Implementing an ALU

Lecture 3 Introduction to VHDL

Workshop on Digital Circuit Design in FPGA

PRELAB! Read the entire lab, and complete the prelab questions (Q1-Q3) on the answer sheet before coming to the laboratory.

Last Name Student Number. Last Name Student Number

A3 A2 A1 A0 Sum4 Sum3 Sum2 Sum1 Sum

Verilog Module 1 Introduction and Combinational Logic

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

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

After opening the Programs> Xilinx ISE 8.2i > Project Navigator, you will come to this screen as start-up.

EEL 4783: HDL in Digital System Design

Synthesis vs. Compilation Descriptions mapped to hardware Verilog design patterns for best synthesis. Spring 2007 Lec #8 -- HW Synthesis 1

Verilog Hardware Description Language ROOM: B405

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

Laboratory Exercise #6 Introduction to Logic Simulation and Verilog

Verilog Tutorial (Structure, Test)

EECS150 - Digital Design Lecture 5 - Verilog Logic Synthesis

Week 4 Tutorial: Verilog Primer Part 2. By Steve Engels

Don t expect to be able to write and debug your code during the lab session.

ECE241 - Digital Systems. University of Toronto. Lab #2 - Fall Introduction Computer-Aided Design Software, the DE2 Board and Simple Logic

Lecture 2 Hardware Description Language (HDL): VHSIC HDL (VHDL)

Software Engineering 2DA4. Slides 2: Introduction to Logic Circuits

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

CECS LAB 1 Introduction to Xilinx EDA Tools

Online Verilog Resources

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

ECSE-323 Digital System Design. Lab #1 Using the Altera Quartus II Software Fall 2008

Evolution of CAD Tools & Verilog HDL Definition

Transcription:

Introduction to Verilog Mitch Trope mtrope@ittc.ku.edu EECS 240 Spring 2004

Overview What is Verilog? Verilog History Max+Plus II Schematic entry Verilog entry System Design Using Verilog: Sum of Products Define the System Define the Relationships Use Verilog Primitives Behavioral Design System Design Using Verilog: Multiplexer Other Verilog Syntax Submitting Verilog for Homework

What is Verilog? Hardware description language Used to develop simulations and implementations of hardware systems Syntax is similar to Pascal or C It s not VHDL.

Verilog History Originally developed for simulating gate-level design in 1984 Synopsis developed a synthesis tool that used Verilog as an input for register-level design Used for timing certification starting in 1989 Open Verilog Initiative created in 1990 to respond to VHDL IEEE standard in 1995

Verilog Competitor: VHDL Very High Speed Integrated Circuit Hardware Description Language Another hardware description language Originally developed by DARPA to provide standard descriptions of military hardware Syntax is like C

What do we use Verilog for? Circuit design Circuit simulation Circuit synthesis Timing analysis Power analysis Just about anything in the hardware design path

How is Verilog used today? Design ASICs Design FPGA implementations Xilinx ISE and Altera Max+Plus II software suites support both VHDL and Verilog Verify system characteristics Teaching digital design.

Max+Plus II Altera s system design software Installed on EECS 240 lab machines, department Windows machines Tutorial in the book in Appendix B You will need to learn schematic entry and Verilog entry methods

Schematic Entry Specify gates or components to be used in block diagram format Draw out physical connections between components Directly route off-chip input pins to the circuit Floorplan - Specify logic resources used by each component

Verilog Entry Describe system in terms of Verilog statements Compiler translates Verilog into sequences of gates Several black box layers available Describe a hardware system like a software system Floorplan editor still available, but extra abstraction layer increases difficulty of use

What Else is There? Simulation See how your design will perform with a given set of inputs Evaluate the correctness of your design Timing Analysis Adjust gate delays to mimic actual hardware, and see if your system is still correct Synthesis Drop your design in to hardware and watch it go All this is covered in Appendix B

Introduction to Verilog Systems Design Concepts Node analysis Gate-level design Component Design Comes-in-to Goes-out-of Your book is an excellent syntax guide Some syntax will be presented

Start With What We Know A B OUT1 OUT3 C D OUT2

Change the Format A B NODE1 OUT1 OUT3 C D NODE2 OUT2 NODE3

What does this buy us? In the first figure, we used discrete gates In the second figure, we abstracted the signal path to data flow They really are the same thing Now, we can express connections in terms of node relationships

Let s Define the Relationships A B NODE1(OUT1, A, B) OUT1 OUT3 C D OUT2 NODE2(OUT2, C, D) NODE3(OUT3, OUT1, OUT2)

Let s Define the Relationships Each node has an output parameter and input parameters listed in that order NODE1(OUT1, A, B) has an output of OUT1 and inputs of A and B Remember, this was the top AND gate in our original design NODE2(OUT2, C, D) has an output of OUT2 and inputs of C and D This was the bottom AND gate in our original design NODE3(OUT3, OUT1, OUT2) has an output of OUT3 and inputs of OUT1 and OUT2 This was the OR gate in our original design

Using Verilog Primitives Verilog primitives include AND, OR, NAND, NOR, XOR, XNOR Any system can be built using these primitives The primitives have the format: PRIM(OUTPUT, INPUT, INPUT) Let s go back to our diagrams, and see if we can describe our system with Verilog

Look Back at our System A B OUT1 OUT3 C D OUT2 A B NODE1(OUT1, A, B) OUT1 OUT3 C D OUT2 NODE2(OUT2, C, D) NODE3(OUT3, OUT1, OUT2)

Describe it in Verilog A B C D NODE1(OUT1, A, B) OUT1 OUT3 OUT2 NODE3(OUT3, OUT1, OUT2) A B C D OUT1 OUT2 OUT3 NODE2(OUT2, C, D) and(out1, A, B); and(out2, C, D); or(out3, OUT1, OUT2);

Make it a Module We need to add some syntax in order to compile this module gate_logic (OUT3, A, B, C, D) output OUT3; input A, B, C, D; and(out1, A, B); and(out2, C, D); or(out3, OUT1, OUT2); endmodule

What did we add? The module and endmodule keywords allow us to form building blocks of code that can be instantiated elsewhere The parameter list after the module keyword specifies the outputs and inputs Note: module definitions cannot be nested A module must have its outputs and inputs declared in the body of the module Use the output and input keywords for this

Structural vs. Behavioral Verilog can describe the behavior of signals as well as the structure Different symbols are used to define behavioral Verilog Structural Verilog can always be synthesized, but writing it is much more involved Behavioral Verilog is more concise and easier to write, but less deterministic when you synthesize it

Behavioral Symbols AND: & (ampersand) OR: (pipe) NOT: ~ (tilde) XOR: ^ (carat)

Describe it in Behavioral Verilog A B OUT1 OUT3 C D OUT2 OUT3 = (A & B) (C & D);

What Else Do We Need? Behavioral logic cannot be constantly evaluated by a simulator You must include an always block that references a sensitivity list Sensitivity List a group of signals watched by the simulator for changes when one changes, the expression is re-evaluated. Syntax: always @(SIG1 or SIG2 or SIG3 or.) begin <expressions with SIG1, SIG2 and SIG3 and.> end

Behavioral Verilog This code will re-evaluate the expression when any of the input signals change module gate_logic (OUT3, A, B, C, D) output OUT3; input A, B, C, D; always @(A or B or C or D) begin OUT3 = (A & B) (C & D); end endmodule

2-Input Multiplexer Example A OUT1 OUT3 S B OUT2

Multiplexer in Verilog Structural NOT(NOTS, S); AND(OUT1, A, NOTS); AND(OUT2, B, S); OR(OUT3, OUT1, OUT2); Behavioral OUT3 = (A & ~S) (B & S);

Full Verilog Multiplexer Implementations module(out3,a,b,s) output OUT3; input A,B,S; NOT(NOTS,S); AND(OUT1,A,NOTS); AND(OUT2,B,S); OR(OUT3,OUT1,OUT2); endmodule module(out3,a,b,s) output OUT3; input A,B,S; always @(A,B,S) begin OUT3 = (A & ~S) (B & S); end endmodule

Other Bits of Syntax if-else conditional if <condition> <statement1>; else <statement2>; case statement case <vector> <case_1>: <statement1>; <case_2>: <statement2>; default: <statement3>; endcase

Comments in Verilog Comments in any code are very important often more important than the code itself Comment Syntax: // this is a single line comment /* Hello, I am a multi-line comment. */

Submitting Verilog for Homework - Guidelines Source code MUST be typed. No handwritten code will be accepted. All source code must be accompanied by simulation output. All source code must include your name, KUID, assigned problems and the assignment date at the top of the file (use comments to put this in) All source code must be commented. Describe the inputs and outputs, and what your component does. All submissions must be YOUR OWN WORK.

Submitting Verilog for Homework - Tips Don t wait until the last minute to learn the software Learning the tool chain is often the hardest part of learning a new language When you have an assignment, start on it as soon as possible Use your textbook as a language reference Ask for help if you need it!

Questions? mtrope@ittc.ku.edu