Chap. 3 Basic Concepts. 2 Basic Concepts Lexical Conventions Data Types System Tasks and Compiler Directives Summary.

Slides:



Advertisements
Similar presentations
Simulation executable (simv)
Advertisements

Verilog Overview. University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
Chap. 6 Dataflow Modeling
Chapter 11 Verilog HDL Application-Specific Integrated Circuits Michael John Sebastian Smith Addison Wesley, 1997.
Verilog Intro: Part 1.
Logic Values 0:logic 0 / false 1:logic 1 / true X:unknown logic value Z:high-impedance.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
1 Chapter 2 Introduction to Java Applications Introduction Java application programming Display ____________________ Obtain information from the.
ELEN 468 Lecture 41 ELEN 468 Advanced Logic Design Lecture 4 Data Types and Operators.
CS 3850 Lecture 4 Data Type. Physical Data Types The primary data types are for modeling registers (reg) and wires (wire). The reg variables store the.
Logic Values 0:logic 0 / false 1:logic 1 / true X:unknown logic value Z:high-impedance.
Verilog Lab This presentation includes some material that is selected from BUCKNELL VERILOG HANDBOOK. Instructor: Dr. Charles Liu Prepared by John Ren.
Reconfigurable Computing (EN2911X, Fall07) Lecture 05: Verilog (1/3) Prof. Sherief Reda Division of Engineering, Brown University
Chapter 2: Introduction to C++.
Today’s Lecture Process model –initial & always statements Assignments –Continuous & procedural assignments Timing Control System tasks.
CSC 125 Introduction to C++ Programming Chapter 2 Introduction to C++
Digital System Design Verilog ® HDL Basic Concepts Maziar Goudarzi.
Programmable Logic Architecture Verilog HDL FPGA Design Jason Tseng Week 2-3.
Lecture Note on Verilog, Course # , EE, NTU, C.H Tsai Basic Logic Design with Verilog TA: Chen-han Tsai.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
ECE 2372 Modern Digital System Design
Spring 2009W. Rhett DavisNC State UniversityECE 406Slide 1 ECE 406 – Design of Complex Digital Systems Lecture 2: Introduction to Verilog Syntax Spring.
Spring 2007W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 1 ECE 406 – Design of Complex Digital Systems Lecture 2: Introduction.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
Workshop Topics - Outline
MODULE 1.3 VERILOG BASICS UNIT 1 : INTRODUCTION TO VERILOG TOPIC : System Tasks and Compiler directive.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
CS1 Lesson 2 Introduction to C++ CS1 Lesson 2 -- John Cole1.
Introduction to Java Applications Part II. In this chapter you will learn:  Different data types( Primitive data types).  How to declare variables?
CSE 1301 Lecture 2 Data Types Figures from Lewis, “C# Software Solutions”, Addison Wesley Richard Gesick.
Verilog Language Concepts
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 2-1 Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
CS 3850 Lecture 3 The Verilog Language. 3.1 Lexical Conventions The lexical conventions are close to the programming language C++. Comments are designated.
Topics to be covered : How to model memory in Verilog RAM modeling Register Bank.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
Digital System Design Introduction to Verilog ® HDL Maziar Goudarzi.
Module 1.2 Verilog Simulator.  A Verilog program for a particular application consists of two blocks : ◦ Design Block (Module) ◦ Testing Block (Stimulus.
 Pearson Education, Inc. All rights reserved Introduction to Java Applications.
CH71 Chapter 7 Hardware Description Language (HDL) By Taweesak Reungpeerakul.
Module 1.3 Verilog Basics UNIT 1 : Introduction to Verilog Data Types.
Digital System Design Verilog ® HDL Parameters, and Generate Blocks Maziar Goudarzi.
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
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.
Sharif University of Technology Department of Computer Engineering Verilog ® HDL Basic Concepts Alireza Ejlali.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust.
Chapter 3: Dataflow Modeling Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 3-1 Chapter 3: Dataflow Modeling.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 2 Introduction to C++
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,
Sudeshna Sarkar, IIT Kharagpur 1 Programming and Data Structure Sudeshna Sarkar Lecture 3.
1 University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
Sharif University of Technology Department of Computer Engineering Digital System Design Verilog ® HDL Basic Concepts Digital System Design Verilog ® HDL.
2.1 The Part of a C++ Program. The Parts of a C++ Program // sample C++ program #include using namespace std; int main() { cout
Structural Description
Publisher: Prentice Hall PTR Pub Date: February 21, 2003 ISBN:
SystemVerilog for Verification
Verilog Introduction Fall
Verilog® HDL -Parameters -Strings -System tasks
Chapter 3: Dataflow Modeling
Logic Values 0:logic 0 / false 1:logic 1 / true X:unknown logic value
2.1 Parts of a C++ Program.
Introduction to Verilog® HDL
Logic Values 0:logic 0 / false 1:logic 1 / true X:unknown logic value
Logic Values 0:logic 0 / false 1:logic 1 / true X:unknown logic value
The Verilog Hardware Description Language
Introduction to Verilog® HDL
Lexical Elements & Operators
Reconfigurable Computing (EN2911X, Fall07)
Presentation transcript:

Chap. 3 Basic Concepts

2 Basic Concepts Lexical Conventions Data Types System Tasks and Compiler Directives Summary

3 Lexical Conventions - I Whitespace  Blank space (\b)  Tabs (\t)  Newlines (\n) Comments  //: single line  /* … */ : multiple line Operators  Unary: ~ 、 !  Binary: + 、 - 、 &&  Ternary: a = b ? c : d;

4 Lexical Conventions - II Number Specification  Sized numbers: ’ 4’b ’habc 16’d255  Unsized numbers ‘hc3 ‘o21  X (unknown) and Z (high impedance) 12’h13x 6’hx 32’bz  Negative numbers -8’d3  Underscore characters and Question marks 12’b1111_0000_1010 equals to 12’b ’b10?? equals to 4’b10zz

5 Lexical Conventions - III String  “Hello Verilog World”  “a/b” Identifiers and Keywords  reg value;  input clk;

6 Basic Concepts Lexical Conventions Data Types System Tasks and Compiler Directives Summary

7 Data Types Value set and strength Nets Registers Vectors Integer 、 Real and Time Register Data Types Arrays Memories Parameters Strings

8 Value Set and Strength

9 a, b, c are wires (nets). Nets Declare a physical wire Keyword: wire 、 wand 、 wor 、 tri 、 trior 、 trireg  wire a;  wire b, c;  wire d = 1’b0;

10 Registers Storage element for data Do not equal to “hardware register” Similar to variables in C reg reset; initial begin reset = 1’b1; #100 reset = 1’b0; end

11 Vectors - I wire and register can be defined as “vector” form format  [high#:low#] or [low#:high#] wre a; wire [7:0] bus; wire [31:0] busA, busB, busC; reg clock; reg [0:40] virtual_addr;

12 Vectors - II Subset of vector  Partial bits of vector busA[7] Bus[2:0] Virtual_addr[0:1]

13 Vectors - III Fixed width subset  [ +:width] or [ -:width] reg [255:0] data1; reg [0:255] data2; reg [7:0] byte; byte = data1[31-:8]; // data1[31:24] byte = data1[24+:8]; // data1[31:24] byte = data2[31-:8]; // data2[24:31] byte = data2[24+:8]; // data2[24:31] for (j=0; j<=31; j=j+1) // [7:0], [15:8]…[255:248] byte = data[(j*8)+:8]; data1[(byteNum*8)+:8] = 8’b0;

14 Integer, Real, and Time Register Data Types – I Integer can represent “signed” number Real integer counter; initial counter = -1; real dalta; initial begin delta = 4e10; delta = 2.13; end integer i; initial i = delta; // rounded value of 2.13

15 Integer, Real, and Time Register Data Types – II Time  Storing simulation time time save_sim_time; initial save_sim_time = $time;

16 Arrays - I Type: integer, register, time, real, or vector. Dimension: no limit, but dimension must be constant Format  [ ] integer count[0:7]; reg bool[31:0]; time chk_point[1:100]; reg [4:0] port_id[0:7]; integer matrix[4:0][0:255]; reg [63:0] array_4d [15:0][7:0][7:0][255:0]; wire [7:0] w_array2 [5:0]; wire w_array1[7:0][5:0];

17 Array - II count[5] = 0; chk_point[100] = 0; port_id[3] = 0; matrix[1][0] = 33559; araay_4d[0][0][0][0][15:0] = 0;fff port_id = 0; // error usage matrix[1] = 0; // error usage

18 Memories Array of register reg mem1bit [0:1023]; reg [7:0] membyte [0:1023]; membyte[511]

19 Parameters Define a constant Can be re-defined at topper level using “defparam” localparam (Verilog 2001 new feature)  Can not be re-defined by “defparam” parameter port_id = 5; parameter cache_line_width = 256; parameter signed [15:0] WIDTH;

20 Strings Can be assigned to register reg [8*18:1] string_value; initial string_value = “Hello Verilog World”;

21 表 3-3 特殊字元

22 Basic Concepts Lexical Conventions Data Types System Tasks and Compiler Directives Summary

23 System Tasks Displaying information Monitoring information Stopping and finishing

24 Displaying information - I $display (p1, p2, p3,…, pn);  Like “printf” in C  Format specification list

25 Displaying information - II

26 Displaying information - III

27 Displaying information - IV

28 Monitoring Information $monitor(p1,p2,…, pn);  Monitor signal change and output the change

29 Stopping and finishing $stop: stop simulation and enter interactive mode to debug $finish: end of simulation

30 Compiler Directives `define  Define text macro, like #define in C `include  Include the context of another file, like #include in C

31 Usage of `define

32 Usage of `include

33 Basic Concepts Lexical Conventions Data Types System Tasks and Compiler Directives Summary

34 Summary Verilog is similar to C Lexical conventions Data Types  Value set, wire, register, vector, integer, real, time, array, memory, parameter, string… System Tasks  $display, $monitor, $stop, $finish Compiler Directives  `define and `include