1 University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.

Slides:



Advertisements
Similar presentations
Simulation executable (simv)
Advertisements

Verilog Overview. University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
Combinational Logic.
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.
Table 7.1 Verilog Operators.
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.
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 
 HDLs – Verilog and Very High Speed Integrated Circuit (VHSIC) HDL  „ Widely used in logic design  „ Describe hardware  „ Document logic functions.
Verilog-HDL Reference: Verilog HDL: a guide to digital design and synthesis, Palnitkar, Samir Some of slides in this lecture are supported by Prof. An-Yeu.
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.
ECE 4680 Computer Architecture Verilog Presentation I. Verilog HDL.
Verilog Lab This presentation includes some material that is selected from BUCKNELL VERILOG HANDBOOK. Instructor: Dr. Charles Liu Prepared by John Ren.
Silicon Programming--Intro. to HDLs1 Hardware description languages: introduction intellectual property (IP) introduction to VHDL and Verilog entities.
Reconfigurable Computing (EN2911X, Fall07) Lecture 05: Verilog (1/3) Prof. Sherief Reda Division of Engineering, Brown University
Kazi Fall 2006 EEGN 4941 EEGN-494 HDL Design Principles for VLSI/FPGAs Khurram Kazi.
Verilog Intro: Part 2. Procedural Blocks There are two types of procedural blocks in Verilog. – initial for single-pass behavior : initial blocks execute.
University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
Spring 2002EECS150 - Lec0-intro Page 1 EECS150 - Digital Design Lecture 8 - Hardware Description Languages February 14, 2002 John Wawrzynek.
Overview Logistics Last lecture Today HW5 due today
Verilog Basics Nattha Jindapetch November Agenda Logic design review Verilog HDL basics LABs.
INTRODUCTION TO VERILOG HDL Presented by m.vinoth.
1 Verilog Digital System Design Z. Navabi, 2006 Digital Design Flow  Digital Design Flow begins with specification of the design at various levels of.
Introduction to FPGA AVI SINGH. Prerequisites Digital Circuit Design - Logic Gates, FlipFlops, Counters, Mux-Demux Familiarity with a procedural programming.
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.
Verilog Language Concepts
ECE 551 Digital System Design & Synthesis Fall 2011 Midterm Exam Overview.
CS 3850 Lecture 3 The Verilog Language. 3.1 Lexical Conventions The lexical conventions are close to the programming language C++. Comments are designated.
Chapter 11: System Design Methodology Digital System Designs and Practices Using Verilog HDL and 2008, John Wiley11-1 Ders 8: FSM Gerçekleme ve.
1 An Update on Verilog Ξ – Computer Architecture Lab 28/06/2005 Kypros Constantinides.
CH71 Chapter 7 Hardware Description Language (HDL) By Taweesak Reungpeerakul.
ECE/CS 352 Digital System Fundamentals© 2001 C. Kime 1 ECE/CS 352 Digital Systems Fundamentals Spring 2001 Chapters 3 and 4: Verilog – Part 2 Charles R.
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
1 COMP541 Sequential Circuits Montek Singh Feb 1, 2012.
Anurag Dwivedi. Basic Block - Gates Gates -> Flip Flops.
Slide 1 2. Verilog Elements. Slide 2 Why (V)HDL? (VHDL, Verilog etc.), Karen Parnell, Nick Mehta, “Programmable Logic Design Quick Start Handbook”, Xilinx.
3/4/20031 ECE 551: Digital System Design * & Synthesis Lecture Set 3 3.1: Verilog - User-Defined Primitives (UDPs) (In separate file) 3.2: Verilog – Operators,
1 Hardware description languages: introduction intellectual property (IP) introduction to VHDL and Verilog entities and architectural bodies behavioral,
Behavioral Modelling - 1. Verilog Behavioral Modelling Behavioral Models represent functionality of the digital hardware. It describes how the circuit.
1 Verilog Digital System Design Z. Navabi, 2006 Verilog Language Concepts.
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.
Introduction to ASIC flow and Verilog HDL
Introduction to Verilog
Verilog Intro: Part 1. Hardware Description Languages A Hardware Description Language (HDL) is a language used to describe a digital system, for example,
SYEN 3330 Digital SystemsJung H. Kim Chapter SYEN 3330 Digital Systems Chapters 4 – Part4: Verilog – Part 2.
Verilog-HDL Reference: Verilog HDL: a guide to digital design and synthesis, Palnitkar, Samir Some of slides in this lecture are supported by Prof. An-Yeu.
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.
Overview Logistics Last lecture Today HW5 due today
Hardware Description Languages: Verilog
Verilog-HDL Reference: Verilog HDL: a guide to digital design and synthesis, Palnitkar, Samir Some of slides in this lecture are supported by Prof. An-Yeu.
Discussion 2: More to discuss
Verilog Coding Guideline
Hardware Description Languages: Verilog
Introduction to DIGITAL CIRCUITS MODELING & VERIFICATION using VERILOG [Part-I]
Introduction to Digital System and Microprocessor Design
Verilog-HDL Reference: Verilog HDL: a guide to digital design and synthesis, Palnitkar, Samir Some of slides in this lecture are supported by Prof. An-Yeu.
The Verilog Hardware Description Language
Introduction to Digital IC Design
COE 202 Introduction to Verilog
Reconfigurable Computing (EN2911X, Fall07)
Presentation transcript:

1 University of Jordan Computer Engineering Department CPE 439: Computer Design Lab

2 Verilog Overview

3 What is Verilog? It is a Hardware Description Language ( HDL ). Two major HDL languages: - Verilog - VHDL Verilog is easier to learn and use (It is like the C language).

4 Cont. Introduced in 1985 by (Gateway Design Systems) Now, part of (Cadence Design Systems). 1990: OVI (Open Verilog International). 1995: IEEE Standard. Simulator: Verilogger Pro, from Synapticad INC.

5 Why Use Verilog? Digital systems are highly complex.  schematic is useless (just connectivity, not functionality) Describe the system at wide ranges of levels of abstraction. Behavioral Constructs: - Hide implementation details. - Arch. Alternatives through simulations. - Detect design bottlenecks. ( BEFORE DETAILED DESIGN BEGINS ) Automated Tools compile behavioral models to actual circuits.

6 Lexical Conventions Close to C / C++. Comments: // Single line comment /* multiple lines comments */ Case Sensitive Keywords: - Reserved. - lower case. - Examples: module, case, initial, always.

7 Numbers: ’ -Size: No. of bits (optional). -Base format:  b: binary  d : decimal  o : octal  h : hexadecimal (DEFAULT IS DECIMAL) Examples:

8 Identifiers: - start with letter or ( _ ). - a combination of letters, digits, ( $ ), and( _ ). - up to 1024 characters.

9 Program Structure Verilog describes a system as a set of modules. Each module has an interface to other modules. Usually: - Each module is put in a separate file. - One top level module that contains:  Instances of hardware modules.  Test data. Modules can be specified: - Behaviorally. - Structurally. Modules are different from subroutines in other languages (never called).

10 Physical Data Types Registers (reg): - store values reg [7:0] A; // 8-bit register reg X; // 1-bit register Wires ( wire ): - do not store a value - represent physical connections between entities. wire [7:0] A; wire X;

11 reg and wire data objects may have a value of: - 0 : logical zero - 1 : logical one - x : unknown - z : high impedance Registers are initialized to x at the start of simulation. Any wire not connected to something has the value x. How to declare a memory in verilog? reg [7:0] A [1023:0]; // A is 1K words each 8-bits

12 Operators Binary Arithmetic Operators:

13 Relational Operators:

14 Logical Operators:

15 Bitwise Operators:

16 Other operators: Unary Reduction Operators Unary reduction operators produce a single bit result from applying the operator to all of the bits of the operand. For example, &A will AND all the bits of A. Concatenation: {A[0], B[1:7]} Shift Left: A = A > Conditional: A = C > D ? B + 3 : B – 2 ;

17 IF Statement Similar to C/C++. Instead of { }, use begin and end. if (A == 4) begin B = 2; end else begin B = 4; end

18 Case Statement Similar to C/ C++ No break statements are needed. case ( A ) 1’bz: $display) “A is high impedance“); 1’bx: $display) “A is unknown“); default: $display(“A = %b”, A); endcase

19 Repetition for, while and repeat Statements The for statement is very close to C's for statement except that the ++ and -- operators do not exist in Verilog. Therefore, we need to use i = i + 1. for(i = 0; i < 10; i = i + 1) begin $display("i= %0d", i); end The while statement acts in the normal fashion. i = 0; while(i < 10) begin $display("i= %0d", i); i = i + 1; end

20 The repeat statement repeats the following block a fixed number of times, in this example, five times. repeat (5) begin $display("i= %0d", i); i = i + 1; end

21 Example: NAND Gate module NAND (out, in1, in2); input in1, in2; output out; assign out = ~(in1 & in2) ; // continuous // assignment endmodule

22 AND Gate module AND (out,in1, in2); input in1, in2; output out; wire w1; NAND NAND1( w1,in1, in2); NAND NAND2 ( out,w1, w1) ; endmodule

23 Test module TestAND; reg in1,in2; wire out; AND a1(out,in1,in2); initial begin :init in1=0;in2=0; #5 in2=0;in1=1; #5 in2=1;in1=0; #5 in2=1;in1=1; end initial begin $display("Time in1 in2 out"); $monitor("%0d %b %b %b",$time,in1,in2,out); end endmodule

24 Output

25 4-to-1 Multiplexor

26 Structural Gate-level model module MUX_4x1 (out, in1, in2, in3, in4, cntrl1, cntrl2); output out; input in1, in2, in3, in4, cntrl1, cntrl2; wire notcntlr1, notcntrl2, w, x, y, z; INV n1 (notcntrl1, cntrl1); INV n2 (notcntrl2, cntrl2); AND3 a1 (w, in1, notcntrl1, notcntrl2); AND3 a2(x, in2, notcntrl1, cntrl2); AND3 a3(y, in3, cntrl1, notcntrl2); AND3 a4(z, in4, cntrl1, cntrl2); OR4 o1 (out, w, x, y, z); endmodule

27 RTL (dataflow) model module MUX_4x1 (out, in1, in2, in3,in4, cntrl1, cntrl2); output out; input in1, in2, in3, in4, cntrl1, cntrl2; assign out = (in1 & ~cntrl1 & ~cntrl2) | (in2 & ~cntrl1 & cntrl2) | (in3 & cntrl1 & ~cntrl2) | (in4 & cntrl1 & cntrl2); endmodule

28 Behavioral Model module MUX_4x1 (out, in1, in2, in3, in4, cntrl1, cntrl2); output out; input in1, in2, in3, in4, cntrl1, cntrl2; reg out; or in2 or in3 or in4 or cntrl1 or cntrl2) case ({cntrl1, cntrl2}) 2'b00 : out = in1; 2'b01 : out = in2; 2'b10 : out = in3; 2'b11 : out = in4; endcase endmodule Behavioral code: output out must now be of reg type as it is assigned values in a procedural block.

29 Test Module

30 T - Flip Flop // Synchronous T Flip-flop with reset (Negitive-edge trigger) module TFF (Q, T, clk, reset); input T, clk, reset; output Q; reg Q; clk or posedge reset) if (reset == 1) #2 Q = 0; else if (T == 1) #2 Q = ~Q; endmodule

31 2-bit Counter module counter2bit (Q, clk, reset); output [1:0]Q; input clk, reset; //TFF (Q, T, clk, reset); TFF t1(Q[0], 1'b1, clk, reset); TFF t2(Q[1], 1'b1, Q[0], reset); endmodule

32 module project_test ; reg reset, clk ; wire [1:0]Q; counter2bit f1(Q,clk,reset ); initial #250 $finish; initial begin : init clk = 1'b0; #5 reset = 1'b1 ; #10 reset = 1'b0 ; $display ("Time Q "); $monitor ("%0t %0d ", $time, Q); end always begin #10 clk = ~clk; end endmodule