ENEE 408C Lab Capstone Project: Digital System Design Verilog Tutorial Class Web Site:

Slides:



Advertisements
Similar presentations
Verilog in transistor level using Microwind
Advertisements

//HDL Example 4-10 // //Gate-level description of circuit of Fig. 4-2 module analysis (A,B,C,F1,F2); input.
Verilog.
The Verilog Hardware Description Language
Verilog Overview. University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
Supplement on Verilog adder examples
Combinational Logic.
Verilog Intro: Part 1.
Hardware Description Language (HDL)
VERILOG EXAMPLES. //example 1.1 module ffNand; wireq, qBar; regpreset, clear; nand #1 g1 (q, qBar, preset), g2 (qBar, q, clear); endmodule.
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.
 HDLs – Verilog and Very High Speed Integrated Circuit (VHSIC) HDL  „ Widely used in logic design  „ Describe hardware  „ Document logic functions.
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.
ENEE 408C Lab Capstone Project: Digital System Design Verilog Tutorial Class Web Site:
Verilog Sequential Circuits Ibrahim Korpeoglu. Verilog can be used to describe storage elements and sequential circuits as well. So far continuous assignment.
ENEE 408C Lab Capstone Project: Digital System Design Spring 2005 Class Web Site: e408c.
ENEE 408C Lab Capstone Project: Digital System Design Spring 2006 Class Web Site:
ECEN ECEN475 Introduction to VLSI System Design Verilog HDL.
Computer Organization Lecture Set – 03 Introduction to Verilog Huei-Yung Lin.
Lecture 7 Verilog Additional references Structural constructs
Verilog Basics Nattha Jindapetch November Agenda Logic design review Verilog HDL basics LABs.
INTRODUCTION TO VERILOG HDL Presented by m.vinoth.
Verilog Intro: Part 2. Procedural Blocks There are two types of procedural blocks in Verilog. – initial for single-pass behavior: initial blocks execute.
ECE 2372 Modern Digital System Design
ECE/CS 352 Digital Systems Fundamentals
Figure 5.1. Conversion from decimal to binary.. Table 5.1. Numbers in different systems.
Figure 5.1. Conversion from decimal to binary.. Table 5.1. Numbers in different systems.
CS 61C L4.2.2 Verilog II (1) K. Meinz, Summer 2004 © UCB CS61C : Machine Structures Lecture Verilog II Kurt Meinz inst.eecs.berkeley.edu/~cs61c.
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.
CH71 Chapter 7 Hardware Description Language (HDL) By Taweesak Reungpeerakul.
Module 1.2 Introduction to Verilog
1 CSE-308 Digital System Design (DSD) N-W.F.P. University of Engineering & Technology, Peshawar.
Anurag Dwivedi. Basic Block - Gates Gates -> Flip Flops.
1 Hardware description languages: introduction intellectual property (IP) introduction to VHDL and Verilog entities and architectural bodies behavioral,
The Verilog Hardware Description Language. GUIDELINES How to write HDL code: How to write HDL code:
Brief Verilog.
CSCE 211: Digital Logic Design Chin-Tser Huang University of South Carolina.
Introduction to ASIC flow and Verilog HDL
M.Mohajjel. Objectives Learn How to write synthesizable Verilog code Common mistakes and how to avoid them What is synthesized for what we code Digital.
Verilog hdl – II.
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.
Verilog Intro: Part 1. Hardware Description Languages A Hardware Description Language (HDL) is a language used to describe a digital system, for example,
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
Exp#5 & 6 Introduction to Verilog COE203 Digital Logic Laboratory Dr. Ahmad Almulhem KFUPM Spring 2009.
Hardware Description Languages: Verilog
An Introduction to Verilog: Transitioning from VHDL
Discussion 2: More to discuss
Verilog Introduction Fall
‘if-else’ & ‘case’ Statements
Supplement on Verilog Sequential circuit examples: FSM
Lecture 2 Supplement Verilog-01
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
Verilog HDL Tutorial Winter 2003
Supplement on Verilog Sequential circuit examples: FSM
The Verilog Hardware Description Language
Supplement on Verilog adder examples
Chapters 4 – Part3: Verilog – Part 1
The Verilog Hardware Description Language
The Verilog Hardware Description Language
Introduction to Verilog – Part-2 Procedural Statements
COE 202 Introduction to Verilog
Lecture 7: Verilog Part II
Presentation transcript:

ENEE 408C Lab Capstone Project: Digital System Design Verilog Tutorial Class Web Site:

Structure Description primitive instantiation (AND, NAND, OR, NOR, XOR, XNOR, BUF, NOT, BUFIF, NOTIF) primitive instantiation (AND, NAND, OR, NOR, XOR, XNOR, BUF, NOT, BUFIF, NOTIF) parameter value assignment parameter value assignment

Structural Description Example module weird_logic (a,b,c,d); output a; input b,c,d; wire w; nand g1(w,b,c); nor g2(a,w,d); endmodule primitive don’t forget

Behavioral Description 1 Boolean-Equation-Based Model Boolean-Equation-Based Model module weird_logic (a,b,c,d); output a; input b,c,d; wire w; assign w = ~(b & c); assign a = ~(w | d); endmodule –continuous assignment –level-sensitive –normally used for combinational circuits continuous assignment

Behavioral Description 2 Cyclic Behavior Model Cyclic Behavior Model module weird_logic (a,b,c,d); output a; input b,c,d; reg w,a; or c) w = ~(b & c); or posedge w) a = ~(w | d); endmodule –always block –can be both level and edge sensitive –do not expire after the last statements

Behavioral Description 2 Cyclic Behavior Model Cyclic Behavior Model module weird_logic (a,b,c,d); output a; input b,c,d; wire w; or c) w = ~(b & c); or posedge w) a = ~(w | d); endmodule –always block –can be both level and edge sensitive –do not expire after the last statements

Testbench Example module tb_weird_logic; wire A; reg B, C, D; weird_logic instance1(A, C, D, B); initial // two slashes introduce a single line comment begin $monitor ($time,,, "A = %b B = %b C = %b D = %b", A, B, C, D); //waveform for simulating the binaryToESeg driver //waveform for simulating the binaryToESeg driver #10 B = 0; C = 0; D = 0; #10 D = 1; #10 C = 1; D = 0; #10 $finish; endendmodule

Using vectors to represent multi-bit numbers in Verilog One dimensional: describe data with multiple bits. One dimensional: describe data with multiple bits. e.g. reg [3:0] a; a = 4 ’ b1011; a = 4 ’ d11; a = 4 ’ hb; a = 4 ’ b1011; a = 4 ’ d11; a = 4 ’ hb; Two dimension: describe a register array. Two dimension: describe a register array. e.g. reg [3:0] b [0:2]; b[0] = 4 ’ d11; b[1] = 4 ’ d12; b[2] = 4 ’ d13 represents the width of the data (from MSB to LSB) represents the depth of the array (from address 0)

Module Hierarchy and Module Instantiation A module uses other defined modules to implement a function. A module uses other defined modules to implement a function. Example: Example: module fulladder (sum,cout,a,b,cin); input a, b, cin; output sum, cout; assign sum = a ^ b ^ cin; assign cout = a&b | b&cin | a&cin; endmodule module halfadder (sum, cout, a,b); input a, b; output sum, cout; assign sum = a ^ b; assign cout = a & b; endmodule module fulladder (sum,cout,a,b,cin); input a, b, cin; output sum, cout; halfadder A1(.sum(w1),.cout(w2),.a(a),.b(b)); halfadder A2(.sum(sum),.cout(w3),.a(w1),.b(cin)); assigncout = w2 | w3; endmodule

Representing Logical Conditions if-else statement if-else statement reg n, m, p; reg n, m, p; if (n == m) begin p = 1 ’ b0; end if (n == m) begin p = 1 ’ b0; end else begin p = 1 ’ b1; end else begin p = 1 ’ b1; end case statement case statement case (n) begin case (n) begin 1 ’ b0: begin m= 1 ’ b0; end 1 ’ b1: begin m= 1 ’ b1; end endcase endcase ? in continuous assignment ? in continuous assignment wire w1, w2, w3 wire w1, w2, w3 assign w1 = (w2==1 ’ b1) ? w3: 1 ’ bx; assign w1 = (w2==1 ’ b1) ? w3: 1 ’ bx;

Loop Structure in Verilog while while while ( i < 4 ’ d10) begin … end end for for for ( i = 0; i < 4 ’ d10; i = i+1) forever forever All the loops are used ONLY in procedural assignments