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

Similar documents
101-1 Under-Graduate Project Digital IC Design Flow

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

VLSI II E. Özgür ATES

Introduction to Verilog HDL

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

Synthesizable Verilog

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

Chap 6 Introduction to HDL (d)

VHDL VS VERILOG.

Synthesis of Combinational and Sequential Circuits with Verilog

Introduction to Verilog

A Brief Introduction to Verilog Hardware Definition Language (HDL)

RTL Coding General Concepts

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

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

Introduction to Verilog HDL. Verilog 1

Verilog Design Principles

Tutorial on VHDL and Verilog Applications

Verilog Design Principles

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

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

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

CAD for VLSI Design - I. Lecture 21 V. Kamakoti and Shankar Balachandran

Lecture 15: System Modeling and Verilog

Digital System Design Lecture 2: Design. Amir Masoud Gharehbaghi

Digital Design with FPGAs. By Neeraj Kulkarni

EECS150 - Digital Design Lecture 5 - Verilog Logic Synthesis

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

Verilog HDL [As per Choice Based Credit System (CBCS) scheme]

LSN 1 Digital Design Flow for PLDs

EN2911X: Reconfigurable Computing Topic 02: Hardware Definition Languages

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

P-1/26. Samir Palnitkar. Prentice-Hall, Inc. INSTRUCTOR : CHING-LUNG SU.

EECS150 - Digital Design Lecture 10 Logic Synthesis

St.MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad

EECS150 - Digital Design Lecture 10 Logic Synthesis

Hardware Description Languages (HDLs) Verilog

Chap 3. Modeling structure & basic concept of Verilog HDL

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

EECS150 - Digital Design Lecture 8 - Hardware Description Languages

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

EEL 4783: HDL in Digital System Design

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

Overview of Digital Design with Verilog HDL 1

Evolution of CAD Tools & Verilog HDL Definition

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

Verilog Fundamentals. Shubham Singh. Junior Undergrad. Electrical Engineering

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

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

Chapter 2 Using Hardware Description Language Verilog. Overview

INSTITUTE OF AERONAUTICAL ENGINEERING Dundigal, Hyderabad ELECTRONICS AND COMMUNICATIONS ENGINEERING

Introduction to Verilog/System Verilog

EEL 4783: Hardware/Software Co-design with FPGAs

Midterm Exam Thursday, October 24, :00--2:15PM (75 minutes)

EECS150 - Digital Design Lecture 4 - Verilog Introduction. Outline

CSE140L: Components and Design Techniques for Digital Systems Lab

HIERARCHICAL DESIGN. RTL Hardware Design by P. Chu. Chapter 13 1

Outline HIERARCHICAL DESIGN. 1. Introduction. Benefits of hierarchical design

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

MLR Institute of Technology

Hardware Description Language (HDL)

For a long time, programming languages such as FORTRAN, PASCAL, and C Were being used to describe computer programs that were

VERILOG HDL. (and C) 1 ENGN3213: Digital Systems and Microprocessors L#5-6

Logic Verification 13-1

Tutorial on Verilog HDL

CHAPTER 2 INTRODUCTION TO VERILOG 2.1 COMPUTER-AIDED DESIGN. Copyrighted material; Do not copy or circulate. Page 46

Verilog. Verilog for Synthesis

CSE140L: Components and Design

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

Advanced Digital Design Using FPGA. Dr. Shahrokh Abadi

HW1 Modeling Concepts

Verilog 1 - Fundamentals

Logic Synthesis. EECS150 - Digital Design Lecture 6 - Synthesis

Course Topics - Outline

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

Register Transfer Level in Verilog: Part I

ECE 4514 Digital Design II. Spring Lecture 2: Hierarchical Design

Verilog Tutorial (Structure, Test)

Verilog Design Entry, Synthesis, and Behavioral Simulation

ENGN1640: Design of Computing Systems Topic 02: Lab Foundations

Contents. Appendix D Verilog Summary Page 1 of 16

EE 4755 Digital Design Using Hardware Description Languages

Hardware Synthesis. References

Course Topics - Outline

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

Introduction. Purpose. Intended Audience. Conventions. Close

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

1 Controlling complexity

ECE 4514 Digital Design II. Spring Lecture 13: Logic Synthesis

Verilog Essentials Simulation & Synthesis

Lab 7 (All Sections) Prelab: Introduction to Verilog

Verilog Hardware Description Language ROOM: B405

CS232 VHDL Lecture. Types

Hardware description languages

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

Lecture #2: Verilog HDL

Contemporary Design. Traditional Hardware Design. Traditional Hardware Design. HDL Based Hardware Design User Inputs. Requirements.

Digital Design Using VHDL Using Xilinx s Tool for Synthesis and ModelSim for Verification

Modeling Sequential Circuits in Verilog

Transcription:

תכן חומרה בשפת VERILOG סמסטר ב' תשע"ג משה דורון מרצה: מתרגלים: אריאל בורג, חג'ג' חן הפקולטה להנדסה 1

Course Topics - Outline Lecture 1 - Introduction Lecture 2 - Lexical conventions Lecture 3 - Data types Lecture 4 - Operators Lecture 5 - Behavioral modeling Lecture 6 - Data flow modeling Lecture 7 - Gate Level modeling Lecture 8 - Tasks and Functions Lecture 9 - Advanced Modeling Techniques Lecture 10 - System Tasks and Compiler directives Lecture 11 - Switch Level modeling Lecture 12 - Coding Styles and Test Benches Lecture 13 - Synthesis issues 2

3 Lecture 1 - Introduction Course Objectives Evolution of CAD What is HDL What is Verilog Verilog History Design Advantages Language Capabilities Levels of Abstraction Design Flow Design Methodologies Basic Unit module Structural Hierarchy Description Style Module Ports Module Instantiation Exercise 1

Course Objectives Gain thorough understanding of the essential concepts and capabilities of Verilog HW Description Language Gain practical experience in writing Verilog code for Hardware Systems Design, Verification and Synthesis Participants will be able to approach their Verilogbased Digital Design Projects with confidence 4

Evolution of EDA Over 30 years, Integrated Circuits (ICs) scaled up in complexity from hundreds gates to millions gates Electronic Design Automation (EDA) techniques evolved, enabling Chip Designers to cope with the ever increasing design complexity Today, EDA support HW Design Languages, Behavioral Simulation, Functional Verification, Synthesis to Gate- Level Netlist and Automatic ICs Placement and Routing During last 4 years, the hot trend is High Level Synthesis 5

What is Hardware Description Language (HDL) A convenient, powerful, Device-independent representation of Digital Logic (Behavior and Structure) Boosts Design Methodology: Functionality can be verified early in the design process. Simulation at a higher level, enable architectural evaluation and decisions. Coupling HDL Compiler with Logic Synthesis tools, automatically converts a Technology-independent HDL Design description and Functionality to a Gate-Level implementation, in different target Technologies. 6

7 What is Verilog One of the two major HDLs used by Hardware Designers in Industry and Academia. Ada-like VHDL is the other one Advantages: C- based Syntax, easy to master and use Condensed and efficient code Intensively used by Israeli Hi-Tech Industry Disadvantage: Poor constructs self-checking

Verilog History 1985: Introduced as Hardware modeling language by Gateway Design System 1990: Cadence acquired Gateway and became the language owner 1995: Verilog became an IEEE Standard 1364 Verilog 2001 fixed lot of Verilog 1995 problems 8

9 Verilog Design Advantages Single Language for Design & Simulation Increased ability to work with massive HW design HW documentation, Design reuse Verilog Simulator Tools allow you to perform the following tasks in the design process without building a Hardware Prototype: - Determine the feasibility of new design ideas - Try more than one approach to a design problem - Verify Functionality - Identify Design Problems

Language Capabilities Design can be described in a wide range of levels: Switch, Gate, Register Transfer Level (RTL), Algorithmic Design can be modeled in a mixed style Behavioral, Dataflow and Structural At the Behavioral level, Design can be described in RTL, Architecture and Algorithmic levels Hierarchical design can be described, up to any level, using the module instantiation construct A design can be of arbitrary size. No limit imposed 10

Language Capabilities (2) Two data types: net (wire) & variable (reg - abstract data storage element) Primitive Logic Gates and Switch-Level Gates, are built-in Language used for Test Bench - Stimuli & Monitor results Flexibility of creating a Combinational or Sequential, User Defined Primitive (UDP) Programming Language Interface (PLI), allow foreign functions access Verilog module info enables Designer s interaction with the Simulator 11

12 Levels of Abstraction Verilog is a High-level Language, having constructs supporting various Design s Abstraction Levels: (Top-to-Bottom) Behavioral - A module is implemented in terms of desired algorithm, without knowing the HW implementation details. Data Flow- A module is designed by specifying the data flow between registers and how data is a processed. (RTL) Gate Level- A module is implemented in terms of logic gates and the interconnections between them. Switch Level- A module is implemented in terms of switches (transistors), storage nodes, resistors and the interconnections between them.

Design Flow using Verilog Specification Architecture Design Coding in Verilog Simulation & Verification Compilation Function/Performance Definition Structure and Function (Behavior) of the Design Efficient, well-documented coding Design Behave as Required? Timing: Waveform Behavior HDL description into Netlist 13 Synthesis Mapping Logic Optimization Mapping Verified Design to target HW - FPGA or ASIC

14 Design Methodologies

Basic Unit The Module Verilog describes a digital system as a set of modules Element or a collection of lower level design blocks A module can be instantiated in another module Each module has an interface and contents description Modules communicate externally with input, output and bi-directional ports 15

16 Module Structure module module_name (port_list) ; declarations: port declaration (input, output, inout, ) data type declaration (reg, wire, parameter, ) task and function declaration statements: initial block always block Behavioral module instantiation gate instantiation Structural UDP instantiation continuous assignment Data-flow endmodule

Example - AND module (data flow & behavioral) module AND (out, in1, in2) ; // <module name> <ports list> input in1, in2 ; output wire out ; assign out = in1 & in2 ; // data flow - continuous Assignment endmodule in1 out in2 module AND (out, in1, in2) ; // <module name> <ports list> input in1, in2 ; output reg out ; // must be reg type when used as LHS in an always block always @( in1 or in2) // always block (sensitivity list) - behavioral out = in1 & in2 ; /* statements inside always block are executed only when one or more signals in the list changes value */ endmodule 17

Example - NAND (gate level) module a b nand q module Nand (q, a, b) ; // <module name> <ports list> output q ; input a, b ; endmodule nand (q, a, b) ; // Language gate primitive 18

Example D_FF (behavioral) module module D_FF(clk, nrst, d, q) ; input clk, nrst, d ; output reg q ; always @(posedge clk or negedge nrst) if (!nrst) q <= 0 ; else q <= d ; endmodule 19 d q clk nrst // Event-based Timing Control // reset state // normal operation

Structural Hierarchy Description Style Direct instantiation and connections of modules from a separate calling module - From the structural hierarchy of the design A module may be declared anywhere in a design relative to where it is called Signals in the higher calling module, are connected to signals in the lower called module by either: - Named association - Positional association 20

Module interconnections: Ports Within a Verilog system model, module interconnections occur at two levels: Peer to peer: modules interconnect with each other: Module A Module B Hierarchical: one module incorporates the other: Module A Module B 21

22 Module Ports Ports provide interface for the module to communicate with its environment. Declaration: <Port direction> <width> <port_name> ; Port direction can be input, output or inout. Example: module my_module (my_input_port, my_inout_port, my_output_port ) ; input [4:0] my_input_port ; inout my_inout_port ; output wire (or reg) [14:0] my_output_port ; endmodule

Port Specifications An input port specifies an internal name for a vector or scalar, driven by external entity. An output port specifies an internal name for a vector or scalar, driven by internal entity, available external to the module. An inout port specifies an internal name for a vector or scalar driven either by an internal or external entity. bi-directional Input or inout port cannot be declared as of type register. Port is always considered as net, unless declared elsewhere as reg (only for output port) 23

Correct Port Connection net net inout reg or net net input reg or net output net module 24

25 Module Instantiation - Port connections Ports of the instances could be connected by name or by order list. For small # of ports, connect by order list, else, by name. module fa_tb ; module FA4 (sum, cout, a, b, cin) ; reg [3:0] A, B ; output wire [3:0] sum ; reg CIN ; output wire cout ; wire [3:0] SUM ; input [3:0] a, b ; wire COUT ; input cin ; endmodule endmodule // Instantiate/connect by Positional association (order list): FA4 fa_byorder (SUM, COUT, A, B, CIN) ; // Instantiate/connect by Named association (port name): FA4 fa_byname (cout(cout),.sum(sum),.b(b),.cin(cin),.a(a) ;

Test Bench and UUT Instantiation Module Test Bench incorporates, hierarchically, the Unit Under Test (UUT) module Stimuli Unit Under Test Monitor registers inputs wires outputs wires, regs wires 26

27 D_FF Test Bench `include D_FF.v" // include the UUT Verilog file for simulator parsing `timescale 1ns / 100ps /* compiler directive. sets simulation s time unit and precision */ module D_FF_tb () ; reg Clk, Nrst, D ; // Stimuli signals wire Q ; // Monitor signal D_FF UUT(Clk, Nrst, D, Q) ; // instantiation of the D_FF (UUT) initial begin Clk = 1'b0; Nrst = 1'b0, D = 1'b0 ; // System monitoring function $monitor($time,"clk=%b,nrst=%b,d=%b;q=%b",clk,nrst,d,q) ; end always #1 Clk = ~Clk ; // Clock declaration initial begin #2 Nrst = 1'b1 ; // Out of reset #2 D = 1'b1 ; #2 $finish ; // System function - end simulation run end endmodule

General Info תרגולי מעבדה מקומות ישיבה קבועים במעבדה השתתפות חובה ב- 10 מתוך 13 תרגולי מעבדה ציון ציון הקורס ייקבע ע"י ממוצע מיטב ביצועי 10 מעבדות ספרים בספריה Verilog HDL: A Guide to Digital Design and Synthesis Design Through Verilog HDL A Verilog HDL Primer Digital VLSI Design with Verilog http://www.asic-world.com/verilog/intro1.html ספרות 28

29 Exercise 1 4bit Counter 4bit Binary Counter cntr_4b.v Test Bench for the Counter cntr_4b_tb.v Synchronous or Asynchronous Reset Up/Down Counter Decimal Counter - Counts from 0 to 9 Programmable Divider - Preloaded Counter Notes: - Use Notepad++ to write the Verilog code - Use Cadence Incisive Unified Simulator (IUS)