Introduction to Verilog HDL

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

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

EEL 4783: Hardware/Software Co-design with FPGAs

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

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

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

Introduction to Verilog/System Verilog

Verilog. Verilog for Synthesis

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

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

Introduction. Why Use HDL? Simulation output. Explanation

Hardware description languages

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

ECE 353 Lab 4. Verilog Review. Professor Daniel Holcomb UMass Amherst Fall 2017

Lecture #2: Verilog HDL

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

Verilog Module 1 Introduction and Combinational Logic

Introduction To Verilog Design. Chun-Hung Chou

EN2911X: Reconfigurable Computing Topic 02: Hardware Definition Languages

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

Introduction To HDL. Verilog HDL. Debdeep Mukhopadhyay Dept of CSE, IIT Madras 1

תכן חומרה בשפת VERILOG הפקולטה להנדסה

101-1 Under-Graduate Project Digital IC Design Flow

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

EE 4755 Digital Design Using Hardware Description Languages

Hardware Description Languages: Verilog. Quick History of HDLs. Verilog/VHDL. Design Methodology. Verilog Introduction. Verilog.

EECS150 - Digital Design Lecture 4 - Verilog Introduction. Outline

Hardware Description Languages: Verilog

ELCT 501: Digital System Design

Verilog. Reminder: Lab #1 due tonight! Fall 2008 Lecture 3

A Brief Introduction to Verilog Hardware Definition Language (HDL)

EE 4755 Digital Design Using Hardware Description Languages

ECE 353 Lab 3 (Verilog Design Approach)

Hardware Description Languages (HDLs) Verilog

! ISP (circa 1977) - research project at CMU " Simulation, but no synthesis

Digital Design with FPGAs. By Neeraj Kulkarni

EECS 3201: Digital Logic Design Lecture 4. Ihab Amer, PhD, SMIEEE, P.Eng.

Hardware description language (HDL)

Verilog Design Principles

VERILOG 1: AN OVERVIEW

EN164: Design of Computing Systems Lecture 06: Lab Foundations / Verilog 2

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

Combinational Logic Design with Verilog. ECE 152A Winter 2012

Verilog for Combinational Circuits

Verilog HDL. A Guide to Digital Design and Synthesis. Samir Palnitkar. SunSoft Press A Prentice Hall Title

Synthesizable Verilog

Lab #1. Topics. 3. Introduction to Verilog 2/8/ Programmable logic. 2. Design Flow. 3. Verilog --- A Hardware Description Language

Chap 6 Introduction to HDL (d)

EN2911X: Reconfigurable Computing Lecture 05: Verilog (2)

Introduction To HDL. Verilog HDL. Debdeep Mukhopadhyay How it started!

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

Tutorial on Verilog HDL

Synthesis of Combinational and Sequential Circuits with Verilog

Chapter 2 Using Hardware Description Language Verilog. Overview

EECS150 - Digital Design Lecture 5 - Verilog Logic Synthesis

Introduction. Purpose. Intended Audience. Conventions. Close

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

Verilog for Synthesis Ing. Pullini Antonio

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

Unit 5. Hardware description languages

Introduction to VHDL. Main language concepts

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

Contents. Appendix D Verilog Summary Page 1 of 16

Introduction to Verilog

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

Verilog Essentials Simulation & Synthesis

01 1 Electronic Design Automation (EDA) the correctness, testability, and compliance of a design is checked by software

HW1 Modeling Concepts

Verilog 1 - Fundamentals

Verilog Overview. Verilog Overview. Simple Example. Simple Example. Simple Example. Simple Example

Programmable Logic Devices Verilog VII CMPE 415

Nikhil Gupta. FPGA Challenge Takneek 2012

Hardware Design Environments. Dr. Mahdi Abbasi Computer Engineering Department Bu-Ali Sina University

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

Course Topics - Outline

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

VHDL simulation and synthesis

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

Combinational Logic II

Design Using Verilog

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

Department of Computer Science and Electrical Engineering. Intro to Verilog II

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

Hardware Description Language (HDL)

Course Topics - Outline

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

EECS150 - Digital Design Lecture 8 - Hardware Description Languages

RTL Coding General Concepts

CSE140L: Components and Design Techniques for Digital Systems Lab

CS232 VHDL Lecture. Types

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

Verilog Design Principles

Verilog Design Entry, Synthesis, and Behavioral Simulation

Lab 2 EECE473 Computer Organization & Architecture University of Maine

CSE140L: Components and Design

Two HDLs used today VHDL. Why VHDL? Introduction to Structured VLSI Design

EEL 4783: Hardware/Software Co-design with FPGAs

Lecture 15: System Modeling and Verilog

University of California, Davis Department of Electrical and Computer Engineering. EEC180B DIGITAL SYSTEMS Spring Quarter 2018

Transcription:

Introduction to Verilog HDL Ben Abdallah Abderazek National University of Electro-communications, Tokyo, Graduate School of information Systems May 2004 04/09/08 1

What you will understand after having this lecture? After having this lecture you will be able to: Understand Design Steps with Verilog-HDL Understand main programming technique with Verilog HDL Understand tools for writing and simulating a given design (module(s)). 04/09/08 2

Choice of Hardware Description Languages There are a fair number of HDLs, but two are by far most prevalent in use: Verilog-HDL, the Verilog Hardware Description Language, not to be confused with Verilog-XL, a logic simulator program sold by Cadence. VHDL, or VHSIC Hardware Description Language and VHSIC is Very High Speed Integrated Circuit. Reality: Probably need to know both languages Impossible to say which is better matter of taste!! In this lecture, I will be using only Verilog-HDL. 04/09/08 3

Why use an HDL? Why Verilog? Describe complex designs (millions of gates) Input to synthesis tools (synthesizable subset) Design exploration with simulation Why not use a general purpose language? Support for structure and instantiation (objects?) Support for describing bit-level behavior Support for timing Verilog vs. VHDL Verilog is relatively simple and close to C VHDL is complex and close to Ada Verilog has 60% of the world digital design market Verilog modeling range From gates to processor level We ll focus on RTL (register transfer level) 04/09/08 4

Design Process in Verilog-HDL 04/09/08 5

Design Process in Verilog-HDL Understand problem and generate block diagram of solution Code block diagram in verilog Synthesize verilog Create verification script to test design Run static timing tool to make sure timing is met Design is mapped, placed, routed, and *.bit file is created and download to FPGA 04/09/08 6

Modeling Structure: Modules The module is the basic building block in Verilog Modules can be interconnected to describe the structure of your digital system Modules start with keyword module and end with keyword endmodule 04/09/08 7

Modeling Structure: Ports Module Ports Similar to pins on a chip Provide a way to communicate with outside world Ports can be input, output or inout 04/09/08 8

Modeling Structure: instances Module instances Verilog models consist of a hierarchy of module instances In C++ speak: modules are classes and instances are objects 04/09/08 9

Data Values For our logic design purposes, we ll consider Verilog to have four different bit values: 0, logic zero. 1, logic one. z, high impedance. x, unknown. 04/09/08 10

Data Values When specifying constants, whether they be single bit or multibit, you should use an explicit syntax to avoid confusion: - 4 d14 // 4-bit value, specified in decimal - 4 he // 4-bit value, specified in hex - 4 b1110 // 4-bit value, specified in binary - 4 b10xz // 4-bit value, with x and z, in binary The general syntax is: {bit width} {base}{value} 04/09/08 11

Data Type There are two main data types in Verilog. These data types may be single bit or multi-bit. Wires Wires are physical connections between devices and are continuously assigned. Nets do not remember, or store, information -This behaves much like an electrical wire... Registers Regs are procedurally assigned values and remember, or store, information until the next value assignment is made. Register type is denoted by reg 04/09/08 12

Wire (wire) Definition Data Type Declaration Register (reg) Definition 04/09/08 13

Variable Declaration constants 04/09/08 14

Example Module 04/09/08 15

Arithmetic Verilog Operator Example: Relational Example: Bitwise Example: 04/09/08 16

Verilog Operator Logical Example: Shift Example: Concatenation Example: 04/09/08 17

Lexical Conventions Close to the programming language C++. Comments are designated by // to the end of a line or by /* to */ across several lines. Keywords, e. g., module, are reserved and in all lower case letters. case sensitive, meaning upper and lower case letters are different. 04/09/08 18

Port and Data Types An input port can be driven from outside the module by a wire or a reg, but inside the module it can only drive a wire (implicit wire). An output port can be driven from inside the module by a wire or a reg, but outside the module it can only drive a wire (implicit wire). An inout port, on both sides of a module, may be driven by a wire, and drive a wire. 04/09/08 19

Data type declaration syntax and examples treat these as a wire, or you can add an explicit reg portname; declaration and then treat it as a reg data type Treat these as if they were wires here 04/09/08 20

Continuous Assignment Continuous assignments are made with the assign statement: assign LHS = RHS; Rules: The left hand side, LHS, must be a wire. The right hand side, RHS, may be a wire, a reg, a constant, or expressions with operators using one or more wires, regs, and constants. 04/09/08 21

Continuous Assignment Example 1 Example 2 04/09/08 22

Procedural Constructs Syntax examples: Sensitivity list: 04/09/08 23

Procedural Constructs Combinational logic using operators: 04/09/08 24

Procedural Constructs Combinational logic using if-else: 04/09/08 25

Procedural Constructs Combinational logic using case: 04/09/08 26

Delay Control 04/09/08 27

(. cont ) Delay Control 04/09/08 28

(. cont ) Delay Control 04/09/08 29

System Tasks The $ sign denotes Verilog system tasks, there are a large number of these, most useful being: $display( The value of a is %b, a); Used in procedural blocks for text output. ( case The %b is the value format (binary, in this $finish; Used to finish the simulation. Use when your stimulus and response testing is done. $stop; Similar to $finish, but doesn t exit simulation. 04/09/08 30

Event Control Event Control Edge Triggered Event Control Level Triggered Event Control Edge triggered Event Control Level Triggered Event Control 04/09/08 31

Loop Statement Loop Statement Repeat While For Repeat Loop Example ( count ) repeat sum = sum + 6; If condition is a x or z is treated as o 04/09/08 32

(. cont ) Loop Statement 04/09/08 33

Conditional statement if Statement Format: ( condition ) if procedural_statement else if ( condition) procedural_statement Example 04/09/08 34

(. cont ) Conditional Statement Case Statement 04/09/08 35

An array of registers Memories Example reg [3:0] mem [0:63] // an array of 64 4-bit registers reg mem [4:0]; // an array of 5 1-bit register 04/09/08 36

Compiler Directives include used to include another file Example include./pqp_fetch.v 04/09/08 37

Suggested Coding Style Write one module per file, and name the file the same as the module. Break larger designs into modules on meaningful boundaries. Always use formal port mapping of sub-modules. Use parameters for commonly used constants. Be careful to create correct sensitivity lists. 04/09/08 38

Suggested Coding Style Don t ever just sit down and code. Think about what hardware you want to build, how to describe it, and how you should test it. You are not writing a computer program, you are describing hardware Verilog is not C! Only you know what is in your head. If you need help from others, you need to be able to explain your design -- either verbally, or by detailed comments in your code. 04/09/08 39

PART II Tools you need & Design Example 04/09/08 40

Tools You need two things 1. Editor ( Windows Crimson Editor 3.51 Release (Freeware) (for ( UNIX Emacx (For 2. Simulators Verilog-XL: This is the most standard simulator in the market, as this is the sign off simulator. NCVerilogThis simulator is good when it comes to gate level simulations. Fc2 FPGA compiler for synthesis (net list generation) Simvision for wave form viewing 04/09/08 41

What Editor you may use for your Verilog Code? ( OS Crimson Editor ( for windows Download it from Here: http://www.crimsoneditor.com/ 04/09/08 42

What Editor you can use for your Verilog Code? Emacs (for UNIX OS ) From your UNIX WS at the commend prompt type: mule top.v & 04/09/08 43

Example of one bit Full Adder Behavior model 04/09/08 44

Test bench for fader to output signal variation on the screen 04/09/08 45

Where to FIND and how to RUN the Verilog XL Simulator? To run the Verilog-XL simulator from your UNIX Workstation type: verilog fadder.v testfadder.v 04/09/08 46

04/09/08 47

Test bench for fader for use with Simvision Wave viewer 04/09/08 48

04/09/08 49

04/09/08 50

04/09/08 51

04/09/08 52