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.

Slides:



Advertisements
Similar presentations
//HDL Example 4-10 // //Gate-level description of circuit of Fig. 4-2 module analysis (A,B,C,F1,F2); input.
Advertisements

Verilog.
The Verilog Hardware Description Language
Verilog Overview. University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
Synchronous Sequential Logic
EE 361 Fall 2003University of Hawaii1 Hardware Design Tips EE 361 University of Hawaii.
Verilog Descriptions of Digital Systems
ELEN 468 Lecture 21 ELEN 468 Advanced Logic Design Lecture 2 Hardware Modeling.
Verilog Intro: Part 1.
Combinational Logic with Verilog Materials taken from: Digital Design and Computer Architecture by David and Sarah Harris & The Essentials of Computer.
16/04/20151 Hardware Descriptive Languages these notes are taken from Mano’s book It can represent: Truth Table Boolean Expression Diagrams of gates and.
Anurag Dwivedi.  Verilog- Hardware Description Language  Modules  Combinational circuits  assign statement  Control statements  Sequential circuits.
SYEN 3330 Digital SystemsJung H. Kim Chapter SYEN 3330 Digital Systems Chapters 4 – Part3: Verilog – Part 1.
CSE 201 Computer Logic Design * * * * * * * Verilog Modeling
CSE 341 Verilog HDL An Introduction. Hardware Specification Languages Verilog  Similar syntax to C  Commonly used in  Industry (USA & Japan) VHDL 
1 Verilog Digital Computer Logic Kashif Bashir WWW: http//:
Lecture 2: Hardware Modeling with Verilog HDL
1 Lecture 1: Verilog HDL Introduction. 2 What is Verilog HDL? Verilog Hardware Description Language(HDL)? –A high-level computer language can model, represent.
1 Brief Introduction to Verilog Weiping Shi. 2 What is Verilog? It is a hardware description language Allows designers to quickly create and debug large.
1 Hardware description languages: introduction intellectual property (IP) introduction to VHDL and Verilog entities and architectural bodies behavioral,
The Multicycle Processor II CPSC 321 Andreas Klappenecker.
The Design Process CPSC 321 Computer Architecture Andreas Klappenecker.
ENEE 408C Lab Capstone Project: Digital System Design Verilog Tutorial Class Web Site:
Verilog Module Module declaration Module instantiation module Add_full (sum, c_out, a, b, c_in); // parent module input a, b, c_in; output c_out, sum;
ENEE 408C Lab Capstone Project: Digital System Design Verilog Tutorial Class Web Site:
Silicon Programming--Intro. to HDLs1 Hardware description languages: introduction intellectual property (IP) introduction to VHDL and Verilog entities.
ENEE 408C Lab Capstone Project: Digital System Design Spring 2005 Class Web Site: e408c.
ECEN ECEN475 Introduction to VLSI System Design Verilog HDL.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE VLSI System Design Lecture 4 - Advanced Verilog.
ELEN468 Lecture 11 ELEN468 Advanced Logic Design Lecture 1Introduction.
Computer Organization Lecture Set – 03 Introduction to Verilog Huei-Yung Lin.
Today’s Lecture Process model –initial & always statements Assignments –Continuous & procedural assignments Timing Control System tasks.
ECE 2372 Modern Digital System Design
Introduction Verilog is a HARDWARE DESCRIPTION LANGUAGE (HDL) A hardware description language is a language or means used to describe or model a digital.
1 An Update on Verilog Ξ – Computer Architecture Lab 28/06/2005 Kypros Constantinides.
Digital System 數位系統 Verilog HDL Ping-Liang Lai (賴秉樑)  
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
Module 1.2 Introduction to Verilog
1 CSE-308 Digital System Design (DSD) N-W.F.P. University of Engineering & Technology, Peshawar.
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
1 Hardware description languages: introduction intellectual property (IP) introduction to VHDL and Verilog entities and architectural bodies behavioral,
Verilog A Hardware Description Language (HDL ) is a machine readable and human readable language for describing hardware. Verilog and VHDL are HDLs.
ELEE 4303 Digital II Introduction to Verilog. ELEE 4303 Digital II Learning Objectives Get familiar with background of HDLs Basic concepts of Verilog.
CSCE 211: Digital Logic Design Chin-Tser Huang University of South Carolina.
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
Introduction to ASIC flow and Verilog HDL
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.
Introduction to Verilog
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
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.
1 Lecture 1: Verilog HDL Introduction. 2 What is Verilog HDL? Verilog Hardware Description Language(HDL)? –A high-level computer language can model, represent.
1 A hardware description language is a computer language that is used to describe hardware. Two HDLs are widely used Verilog HDL VHDL (Very High Speed.
Introduction to Verilog COE 202 Digital Logic Design Dr. Muhamed Mudawar King Fahd University of Petroleum and Minerals.
Reg and Wire:.
University of Maryland Baltimore County Department of Computer Science and Electrical Engineering   CMPE 212 Laboratory (Discussion 2) Hasibul Hasan
Introduction to Verilog
Discussion 2: More to discuss
Verilog Introduction Fall
Introduction to Verilog
Introduction to Verilog
Levels in computer design
332:437 Lecture 8 Verilog and Finite State Machines
Introduction to Verilog
Introduction to Verilog
The Verilog Hardware Description Language
Introduction to Verilog
332:437 Lecture 8 Verilog and Finite State Machines
COE 202 Introduction to Verilog
Presentation transcript:

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 Later became an efficient design entry method Allows designers to quickly create and debug large scale designs Similar to C in syntax Verilog will be used in later labs

3 Sample Half Adder module Add_half (sum, c_out, a, b); inputa, b; outputsum, c_out; wire c_out_bar; xor (sum, a, b); nand (c_out_bar, a, b); not (c_out, c_out_bar); endmodule c_out a b sum c_out_bar

4 Module Hierarchy Modules can be instantiated within other modules Allows for simplicity and regularity in the design Example: Use two half adders to create a full adder

5 Module Hierarchy Example module Add_half ( sum, c_out, a, b ); inputa, b; outputsum, c_out; wire c_out_bar; xor (sum, a, b); nand (c_out_bar, a, b); not (c_out, c_out_bar); endmodule Module Add_full ( sum, c_out, a, b, c_in );// parent module input a, b, c_in; output c_out, sum; wire w1, w2, w3; Add_half M1 ( w1, w2, a, b ); Add_half M2 ( sum, w3, w1, c_in );// child module or ( c_out, w2, w3 );// primitive instantiation endmodule

6 Alternative Half Adders module Add_half ( sum, c_out, a, b ); inputa, b; outputsum, c_out; assign { c_out, sum } = a + b; // Continuous assignment endmodule module Add_half (sum, c_out, a, b ); inputa, b; outputsum, c_out; regsum, c_out; ( a or b)// behavior description begin sum = a ^ b; c_out = a & b; end endmodule

7 Structural v.s. Behavioral Verilog can be structural or behavioral Structural definition specifies the gates and their connections explicitly Behavioral definition specifies the functionality of a design Does not contain any structural information such as transistors or gates Logic synthesis software implements the structural

Behavioral Example 2 Bit Comparator module comparator (a_greater, b_greater, equal, a, b); inputa, b; outputa_greater, b_greater, equal; rega_greater, b_greater, equal; or b)// either a or b changes begin if (a > b) begin a_greater = 1; b_greater = 0; equal = 0; end if (a<b) begin a_greater = 0; b_greater = 1; equal = 0; end if (a==b) begin a_greater = 0; b_greater = 0; equal = 1; end endmodule

9 Alternate comparator module comparator (a_greater, b_greater, equal, a, b); inputa, b; outputa_greater, b_greater, equal; assign a_greater = (a > b) ? 1 : 0; assign b_greater = (a < b) ? 1 : 0; assign equal = (a==b) ? 1 : 0; endmodule Uses a conditional continuous assignment to set the outputs.

10 Clarification Registers are used when an output is updated on an event. The value must be held until a new event updates that value. Assign statements are used when the output is continuously being assigned.

11 Testbench Manipulate the module inputs to observe the circuit reaction Uses module hierarchy Introduces the concept of delay

12 Sample Testbench for a Half Adder module tbench; rega,b;// regs connect to module inputs wiresum,cout;// wires connect to module outputs half_adder M1(cout,sum,a,b);// instantiate the half adder initial begin a = 0, b = 0;//time 0 #5a = 1, b = 0;//time 5 #3a = 1, b = 1;//time 8 #4a = 0, b = 1;//time 12 #52a = 0, b = 0;//time 64 #70$finish;//stops the simulation end initial begin $monitor($time,”a = %b, b=%b cout=%b sum=%b”,a,b,cout,sum);//displays the variable values at each //unit of time that an event occurs end endmodule

13 Testbench Results Compiling source file "ha.v" Compiling source file "tbench.v" Highest level modules: tbench 0a = 0, b=0 cout=0 sum=0 5a = 1, b=0 cout=0 sum=1 8a = 1, b=1 cout=1 sum=0 12a = 0, b=1 cout=0 sum=1 64a = 0, b=0 cout=0 sum=0 "tbench.v": $finish at simulation time 134

14 FSM Example: Car speed accelerator brake clock medium lowstopped high a: accelerator b: brake a = 1, b = 0 b = 1 a = 1, b = 0

15 Behavioral Description module car(speed, a, b, clock); inputa, b, clock; output[1:0] speed; reg[1:0] speed; parameterstopped = 2’b00; parameterfast = 2’b11; clock or b) begin if (b == 1 && speed != stopped) speed = speed – 1; else if (b == 0 && a == 1 && speed != fast) speed = speed + 1; end endmodule

16 Where to Get Verilog CD in the back of the book, if you have Verilog version Icarus Verilog