COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.

Slides:



Advertisements
Similar presentations
Verilog HDL -Introduction
Advertisements

Verilog Section 3.10 Section 4.5. Keywords Keywords are predefined lowercase identifiers that define the language constructs – Key example of keywords:
Verilog.
Supplement on Verilog adder examples
ELEN 468 Lecture 21 ELEN 468 Advanced Logic Design Lecture 2 Hardware Modeling.
Chapter 11 Verilog HDL Application-Specific Integrated Circuits Michael John Sebastian Smith Addison Wesley, 1997.
Verilog Intro: Part 1.
Hardware Description Language (HDL)
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.
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.
CSE 341 Verilog HDL An Introduction. Hardware Specification Languages Verilog  Similar syntax to C  Commonly used in  Industry (USA & Japan) VHDL 
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
 HDLs – Verilog and Very High Speed Integrated Circuit (VHSIC) HDL  „ Widely used in logic design  „ Describe hardware  „ Document logic functions.
Lecture 1 Design Hierarchy Chapter 1. Digital System Design Flow 1.Register-Transfer Levl (RTL) – e.g. VHDL/Verilog 2.Gate Level Design 3.Circuit Level.
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,
ENEE 408C Lab Capstone Project: Digital System Design Verilog Tutorial Class Web Site:
ECE 353 Computer Systems Lab I Verilog Hardware Description Language.
CSE241 R1 Verilog.1Kahng & Cichy, UCSD ©2003 CSE241 VLSI Digital Circuits Winter 2003 Recitation 1: Verilog Introduction.
Hardware Description Language HDL. 2 Hardware Description Language HDL  Describes circuits and systems in text. −As a software program.  Can be processed.
ENEE 408C Lab Capstone Project: Digital System Design Spring 2006 Class Web Site:
ECEN ECEN475 Introduction to VLSI System Design Verilog HDL.
VHDL. What is VHDL? VHDL: VHSIC Hardware Description Language  VHSIC: Very High Speed Integrated Circuit 7/2/ R.H.Khade.
Computer Organization Lecture Set – 03 Introduction to Verilog Huei-Yung Lin.
Digital System Design EEE344 Lecture 2 Introduction to Verilog HDL Prepared by: Engr. Qazi Zia, Assistant Professor EED, COMSATS Attock1.
ECE 2372 Modern Digital System Design
ECE/CS 352 Digital Systems Fundamentals
COE 405 Introduction to Logic Design with Verilog
CS 3850 Lecture 3 The Verilog Language. 3.1 Lexical Conventions The lexical conventions are close to the programming language C++. Comments are designated.
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.
CEC 220 Digital Circuit Design Introduction to VHDL Wed, February 25 CEC 220 Digital Circuit Design Slide 1 of 19.
ELEE 4303 Digital II Introduction to Verilog. ELEE 4303 Digital II Learning Objectives Get familiar with background of HDLs Basic concepts of Verilog.
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
04/26/20031 ECE 551: Digital System Design & Synthesis Lecture Set : Introduction to VHDL 12.2: VHDL versus Verilog (Separate File)
Introduction to Verilog
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,
CEC 220 Digital Circuit Design Introduction to VHDL Wed, Oct 14 CEC 220 Digital Circuit Design Slide 1 of 19.
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
1 Lecture 1: Verilog HDL Introduction. 2 What is Verilog HDL? Verilog Hardware Description Language(HDL)? –A high-level computer language can model, represent.
Exp#5 & 6 Introduction to Verilog COE203 Digital Logic Laboratory Dr. Ahmad Almulhem KFUPM Spring 2009.
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.
Hardware Description Languages: Verilog
Reg and Wire:.
Discussion 2: More to discuss
Verilog Introduction Fall
Verilog-HDL-1 by Dr. Amin Danial Asham.
KARTHIK.S Lecturer/ECE S.N.G.C.E
Behavioral Modeling Structural modeling Behavioral modeling
Hardware Description Languages: Verilog
Introduction to DIGITAL CIRCUITS MODELING & VERIFICATION using VERILOG [Part-I]
Hardware Descriptive Languages these notes are taken from Mano’s book
Behavioral Modeling in Verilog
Introduction to Verilog
COE 202 Introduction to Verilog
Hardware Descriptive Languages these notes are taken from Mano’s book
Supplement on Verilog adder examples
Chapters 4 – Part3: Verilog – Part 1
The Verilog Hardware Description Language
COE 202 Introduction to Verilog
Presentation transcript:

COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals

Outline  Introduction  Verilog Syntax  Definition of a Module  Gate Level Modeling  Module Instantiation  Propagation Delay  Boolean Equation-Based Behavioral Models of Combinational Logic  Test Bench Example

Introduction  Verilog is one of the hardware description languages (HDL) available in the industry for hardware modeling, simulation and design.  It allows designers to describe their hardware at different levels of detail (e.g. gate-level, behavioral lavel)  Parallel not serial like programming languages.  Verilog can describe everything from single gate to full computer system.

Verilog  A digital system can be described at several levels of details (more details means more design entry time!): e.g.  Gate-level  Net-list similar to schematic or breadboarding  Behavioral description: programming-like structures (if-then- else, case, loops …etc) to describe what the circuit does (i.e. behavior) rather than how  requires some additional (synthesis) software to actually obtain the logic design  A digital system is described as a set of modules  The module is the basic unit of design

Verilog Syntax  Identifiers:  composed of letters, digits, the underscore character (_), and the dollar sign ($). $ is usually used with a system task or function  The first character of an identifier must be a letter or underscore  Verilog is a case-sensitive language D_BUS is different from D_Bus  Keywords: predefined identifiers that are used to describe language constructs. E.g. module, wire …etc.  Can not be used as user-defined identifiers  White space: space, tab, and newline characters are used to separate identifiers and can be used freely in the Verilog code  Comments: two forms; one-line comment starts with // and multiple-line comment is encapsulated between /* and */

Verilog Data Types  Two groups of Data Types: net and variable.  Net like wire; could be 1-bit or array (e.g. wire a; wire [3:0] sum)  Variable group like reg; The most commonly used data type in this group  Also integer

Module and Ports declaration module [module-name] ( [mode] [ d a t a - t y p e ] [ p o r t - n a m e s ],... [mode] [ d a t a - t y p e ] [ p o r t - n a m e s ] ) ;  Data-type could be wire, reg, integer, real …etc. Ex1.: module eq2 ( input wire [1:0] a, b, output wire aeqb ); Ex2.: module eq1( input i0, il, // no data type declaration output eq // all will be wires );

Gate Level Modeling  Net-list description  built-in primitives gates module my_gate( output OUT1, input IN1, IN2); wire X; // optional and (X, IN1, IN2); not (OUT1, X); endmodule Internal Signal X OUT1 IN2 IN1

Verilog Primitives  Basic logic gates only  and  or  not  buf  xorThese gates are expandable: 1st node  nand is O/P node, followed by 1, 2, 3 …  nor number of input nodes  xnor

Primitive Pins Are Expandable nand (y, in1, in2) ; nand (y, in1, in2, in3) ; nand (y, in1, in2, in3, in4) ;

A Half Adder module Add_half ( output c_out, sum, input a, b); xor (sum, a, b); and (c_out, a, b); endmodule

A Full Adder module fadd ( output co, s, input a, b, c); wire n1, n2, n3; // optional xor (n1, a, b) ; xor (s, n1, c) ; nand (n2, a, b) ; nand (n3,n1, c) ; nand (co, n3,n2) ; endmodule

Module Instantiation  Two ways to connect the ports of the instantiated module to the signals in the instantiating module:  1. By name: [module-name] [instance-name] (. [port-name] ( [signal-name] ), );  2. By order: Add_half M1 (.c_out(Cout),.sum(Sum),.a(A),.b(B)); Add_half M2 (Cout, Sum, A, B); module Add_half ( output c_out, sum, input a, b); xor (sum, a, b); and (c_out, a, b); endmodule

Module Instantiation

Propagation Delay module Add_full_unit_delay(output c_out, sum, input a, b, c_in); wire w1, w2, w3; // optional Add_half_unit_delay M1 (w2, w1, a, b); Add_half_unit_delay M2 (w3, sum, c_in, w1); or #2 (c_out, w2, w3); endmodule module Add_half_unit_delay (output c_out, sum, input a, b); xor #3 (sum, a, b); and #2 (c_out, a, b); endmodule Propagation Delay

Assign Statement  The keyword assign declares a continuous assignment.  It associates the Boolean expression on the RHS (right hand side) with the variable on the LHS (left hand side).  The assignment is sensitive to the variables in the RHS.  Any time an event occurs on any of the variables on the RHS, the RHS expression is revaluated and the result is used to update the LHS.

Boolean Equation-Based Behavioral Models of Combinational Logic  A Boolean equation describes combinational logic by an expression of operations on variables.  In Verilog, this is done by continuous assignment statement.  Example: module AOI_5_CA0 ( input x_in1, x_in2, x_in3, x_in4, x_in5, output y_out); assign y_out = ~( (x_in1 & x_in2) | (x_in3 & x_in4 & x_in5) ); endmodule

Full Adder module fadd (output Cout, S, input A, B, Cin); assign S = A ^(B ^ Cin); assign Cout = (A & B) | (A & Cin) | (B & Cin) ; endmodule

Propagation Delay & Continuous Assignment  Propagation delay can be associated with a continuous assignment so that its implicit logic has same functionality and timing characteristics as its gate level implementation. module fadd (output Cout, S, input A, B, Cin); assign #6 S = A ^(B ^ Cin); assign #5 Cout = (A & B) | (A & Cin) | (B & Cin); endmodule

Testbench Example module t_Add(); wire Sum, Cout; reg a, b, cin; Add_full_unit_delay M1 (Cout, Sum, a, b, cin); initial begin a=0; b=0; cin=0; #10b=1; #10a=1; cin=1; #10b=0; end endmodule

Testbench Example  The keyword initial declares a single-pass behavior that begins executing when the simulator is activated.  Statements within begin and end block keywords are called procedural statements.  Procedural statements execute sequentially  # is a delay control operator  A delay control operator preceding procedural assignment statement suspends its execution and the execution of subsequent statements for specified delay time  reg declaration ensures that variables will keep their value until the next procedural assignment statement