CSE241 R1 Verilog.1Kahng & Cichy, UCSD ©2003 CSE241 VLSI Digital Circuits Winter 2003 Recitation 1: Verilog Introduction.

Slides:



Advertisements
Similar presentations
Verilog.
Advertisements

Simulation executable (simv)
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)
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.
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 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.
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 Hardware description languages: introduction intellectual property (IP) introduction to VHDL and Verilog entities and architectural bodies behavioral,
CSE241 R1 Verilog.1Kahng & Cichy, UCSD ©2003 CSE241 VLSI Digital Circuits Winter 2003 Recitation 1: Verilog Introduction.
CSE241 R1 Verilog.1Kahng & Cichy, UCSD ©2003 CSE241 VLSI Digital Circuits Winter 2003 Recitation 1: RTL Coding in Verilog.
Silicon Programming--Intro. to HDLs1 Hardware description languages: introduction intellectual property (IP) introduction to VHDL and Verilog entities.
CSE241 RTL Performance.1Kahng & Cichy, UCSD ©2003 CSE241A VLSI Digital Circuits Winter 2003 Recitation 2.5: Performance Coding.
Computer Organization Lecture Set – 03 Introduction to Verilog Huei-Yung Lin.
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.
Lecture Note on Verilog, Course # , EE, NTU, C.H Tsai Basic Logic Design with Verilog TA: Chen-han Tsai.
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
A VHDL Tutorial ENG2410. ENG241/VHDL Tutorial2 Goals Introduce the students to the following: –VHDL as Hardware description language. –How to describe.
CS 3850 Lecture 3 The Verilog Language. 3.1 Lexical Conventions The lexical conventions are close to the programming language C++. Comments are designated.
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.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
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.
Module 1.2 Introduction to Verilog
Introduction to VHDL Spring EENG 2920 Digital Systems Design Introduction VHDL – VHSIC (Very high speed integrated circuit) Hardware Description.
Fall 2004EE 3563 Digital Systems Design EE 3563 VHSIC Hardware Description Language  Required Reading: –These Slides –VHDL Tutorial  Very High Speed.
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.
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.
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
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.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust.
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,
1 University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
SYEN 3330 Digital SystemsJung H. Kim Chapter SYEN 3330 Digital Systems Chapters 4 – Part4: Verilog – Part 2.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
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.
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
KARTHIK.S Lecturer/ECE S.N.G.C.E
Hardware Description Languages: Verilog
Introduction to DIGITAL CIRCUITS MODELING & VERIFICATION using VERILOG [Part-I]
Introduction to Verilog
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.
Supplement on Verilog adder examples
The Verilog Hardware Description Language
Introduction to Digital IC Design
Introduction to Verilog – Part-2 Procedural Statements
COE 202 Introduction to Verilog
Presentation transcript:

CSE241 R1 Verilog.1Kahng & Cichy, UCSD ©2003 CSE241 VLSI Digital Circuits Winter 2003 Recitation 1: Verilog Introduction

CSE241 R1 Verilog.2Kahng & Cichy, UCSD ©2003 Topic Outline  Introduction  Verilog Background  Signals  Connections  Modules  Procedures  Structural  Behavioral  Testbenches  Simulation

CSE241 R1 Verilog.3Kahng & Cichy, UCSD ©2003 Introduction  Learn Verilog basics l Hardware Description Language Semantics l Verilog Syntax l Features  How to use Verilog for behavioral design  How to use Verilog for structural design  How to write Verilog for synthesis (brief)  Examples!

CSE241 R1 Verilog.4Kahng & Cichy, UCSD ©2003 Topic Outline  Introduction  General  Signals  Connections  Modules  Procedures  Structural  Behavioral  Testbenches  Simulation

CSE241 R1 Verilog.5Kahng & Cichy, UCSD ©2003 Introduction - Motivation  Generic HDL uses: l Simulation -Test without build l Synthesis -Real hardware (gates) l Documentation -Self documenting -Portable

CSE241 R1 Verilog.6Kahng & Cichy, UCSD ©2003 HDL vs High Level Languages  HDLs represent: l Electricity -Ultimately a physical entity l Parallelism - Concurrency l Time

CSE241 R1 Verilog.7Kahng & Cichy, UCSD ©2003 Hardware Description Languages  Need a description level up from logic gates.  Work at the level of functional blocks, not logic gates l Complexity of the functional blocks is up to the designer l A functional unit could be an ALU, or could be a microprocessor  The description consists of functions blocks and their interconnections l Describe functional block (not predefined) l Support hierarchical description (function block nesting)  To make sure the specification is correct, make it executable. l Run the functional specification and check what it does Slide courtesy of Ken Yang, UCLA

CSE241 R1 Verilog.8Kahng & Cichy, UCSD ©2003 Topic Outline  Introduction  Verilog Background  Syntax  Signals  Connections  Modules  Procedures  Structural  Behavioral  Testbenches  Simulation  Examples

CSE241 R1 Verilog.9Kahng & Cichy, UCSD ©2003 Verilog Naming Conventions  The following must be used in all code: l Two slashes “//” are used to begin single line comments l A slash and asterisk “/*” are used to begin a multiple line comment and an asterisk and slash “*/” are used to end a multiple line comment. l Names can use alphanumeric characters, the underscore “_” character, and the dollar “$” character l Names must begin with an alphabetic letter or the underscore. l Spaces are not allowed within names

CSE241 R1 Verilog.10Kahng & Cichy, UCSD ©2003 Reserved Keywords  The following is a list of the Verilog reserved keywords:

CSE241 R1 Verilog.11Kahng & Cichy, UCSD ©2003 Topic Outline  Introduction  Verilog Background  Signals  Connections  Modules  Procedures  Structural  Behavioral  Testbenches  Simulation  Examples

CSE241 R1 Verilog.12Kahng & Cichy, UCSD ©2003 Procedural Statements  Control statements l This type of control statement implies sequential ordering keyword always provides functionality of a tiny program that executes sequentially  Inside an always block, can use standard control flow statements: l if ( ) then else ; case ( ) : ; … default: l Case statements are prioritized -The second case entry can’t happen unless the first does not match. -May not be what the actual hardware implies – especially when cases are mutually exclusive. -Need additional directives (parallel-case) to indicate this -Statements can be compound (use begin and end to form blocks)  Example: (Activation List) begin // more than 1 statement allowed inside here if (x==y) then out= in1 else out = in2; end

CSE241 R1 Verilog.13Kahng & Cichy, UCSD ©2003 Module vs. Procedure  Module is a method of building structural hierarchy  Procedure (function) is a method of building behavioral hierarchy

CSE241 R1 Verilog.14Kahng & Cichy, UCSD ©2003 Topic Outline  Introduction  Verilog Background  Signals  Connections  Modules  Procedures  Structural  Behavioral  Testbenches  Simulation  Examples

CSE241 R1 Verilog.15Kahng & Cichy, UCSD ©2003 Structural Description  Modules l Represent macros l Simulate some wanted function l Can contain hierarchy

CSE241 R1 Verilog.16Kahng & Cichy, UCSD ©2003 Topic Outline  Introduction  Verilog Background  Signals  Connections  Modules  Procedures  Structural  Behavioral  Testbenches  Simulation  Examples

CSE241 R1 Verilog.17Kahng & Cichy, UCSD ©2003 Behavioral Statements  if-then-else l What you would expect, except that it’s doing 4-valued logic. 1 is interpreted as True; 0, x, and z are interpreted as False  case l What you would expect, except that it’s doing 4-valued logic l If “selector” is 2 bits, there are 4 2 possible case-items to select between l There is no break statement — it is assumed.  Funny constants? l Verilog allows for sized, 4-valued constants l The first number is the number of bits, the letter is the base of the following number that will be converted into the bits. 8’b00x0zx10 if (select == 1) f = in1; elsef = in0; case (selector) 2’b00: a = b + c; 2’b01: q = r + s; 2’bx1: r = 5; default: r = 0; endcase assume f, a, q, and r are registers for this slide Slide courtesy of Don Thomas, Carnegie Mellon

CSE241 R1 Verilog.18Kahng & Cichy, UCSD ©2003 Behavioral Statements  Loops l There are restrictions on using these for synthesis — don’t. l They are mentioned here for use in test modules  Two main ones — for and while l Just like in C l There is also repeat and forever — see the book reg[3:0]testOutput, i; … for (i = 0; i <= 15; i = i + 1) begin testOutput = i; #20; end reg[3:0]testOutput, i; … i = 0; while (i <= 15)) begin testOutput = i; #20 i = i + 1; end Important: Loops must have a delay operator (or as we’ll see later, or wait(FALSE)). Otherwise, the simulator never stops executing them. Slide courtesy of Don Thomas, Carnegie Mellon

CSE241 R1 Verilog.19Kahng & Cichy, UCSD ©2003 Topic Outline  Introduction  Verilog Background  Signals  Connections  Modules  Procedures  Structural  Behavioral  Testbenches  Simulation  Examples

CSE241 R1 Verilog.20Kahng & Cichy, UCSD ©2003 How to build and test a module  Construct a “test bench” for your design l Develop your hierarchical system within a module that has input and output ports (called “design” here) l Develop a separate module to generate tests for the module (“test”) l Connect these together within another module (“testbench”) module design (a, b, c); input a, b; outputc; … module test (q, r); output q, r; initial begin //drive the outputs with signals … module testbench (); wirel, m, n; designd (l, m, n); test t (l, m); initial begin //monitor and display … Slide courtesy of Don Thomas, Carnegie Mellon

CSE241 R1 Verilog.21Kahng & Cichy, UCSD ©2003 Topic Outline  Introduction  Verilog Background  Signals  Connections  Modules  Procedures  Structural  Behavioral  Testbenches  Simulation  Example  Coding Style

CSE241 R1 Verilog.22Kahng & Cichy, UCSD ©2003 Creating Code  Example: l Given a specification – “build full adder” l Name signals: -Carry in, carry out, A, B

CSE241 R1 Verilog.23Kahng & Cichy, UCSD ©2003 Full-adder Code module full_adder (a1, a2, ci, s, co); //  lists full input/output signal list input a1, a2, ci; //input declaration output sum, co; //output declaration assign s = a1 ^ a2 ^ ci; assign co = (a1 & a2) | (a1 & ci) | (a2 & ci); endmodule Sensitivity List

CSE241 R1 Verilog.24Kahng & Cichy, UCSD ©2003 Another Verilog Example module a (…); reg e; task b; reg c; begin : d reg e; e = 1; a.e = 0; end endtask always begin : f reg g; a.b.d.e = 2; g = q.a.b.d.e; e = 3; end endmodule e’s hierarchical name is …a.b.d.e g’s hierarchical name is …a.f.g named begin-end block some ugliness here… Chapter 2.6 assumes a is instantiated in q Slide courtesy of Don Thomas, Carnegie Mellon