1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.

Slides:



Advertisements
Similar presentations
Verilog Overview. University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
Advertisements

Verilog Intro: Part 1.
Hardware Description Language (HDL)
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.
Types and Variables. Computer Programming 2 C++ in one page!
1 Lecture 2  Input-Process-Output  The Hello-world program  A Feet-to-inches program  Variables, expressions, assignments & initialization  printf()
Chapter 9 Formatted Input/Output Acknowledgment The notes are adapted from those provided by Deitel & Associates, Inc. and Pearson Education Inc.
Chapter 2 Data Types, Declarations, and Displays
Chapter 2: Introduction to C++.
String Escape Sequences
Introduction to Programming Prof. Rommel Anthony Palomino Department of Computer Science and Information Technology Spring 2011.
CSC 125 Introduction to C++ Programming Chapter 2 Introduction to C++
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 2: Introduction to C++ Starting Out with C++ Early Objects Seventh.
Digital System Design Verilog ® HDL Basic Concepts Maziar Goudarzi.
A Variable is symbolic name that can be given different values. Variables are stored in particular places in the computer ‘s memory. When a variable is.
ECE 2372 Modern Digital System Design
Input & Output: Console
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.
Workshop Topics - Outline
EX_01.1/46 Numeric Systems. EX_01.2/46 Overview Numeric systems – general, Binary numbers, Octal numbers, Hexadecimal system, Data units, ASCII code,
C Tokens Identifiers Keywords Constants Operators Special symbols.
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.
Data & Data Types & Simple Math Operation 1 Data and Data Type Standard I/O Simple Math operation.
The Fundamentals of C++ Chapter 2: Basic programming elements and concepts JPC and JWD © 2002 McGraw-Hill, Inc. Modified by S. Sudarshan.
Week 1 Algorithmization and Programming Languages.
Copyright © 2012 Pearson Education, Inc. Chapter 2: Introduction to C++
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.
BASICS CONCEPTS OF ‘C’.  C Character Set C Character Set  Tokens in C Tokens in C  Constants Constants  Variables Variables  Global Variables Global.
Copyright © 2015, 2012, 2009 Pearson Education, Inc., Publishing as Addison-Wesley All rights reserved. Chapter 2: Introduction to C++
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
Chapter 3 – Variables and Arithmetic Operations. Variable Rules u Must declare all variable names –List name and type u Keep length to 31 characters –Older.
Copyright © 2014, 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 2: Introduction to C++ Starting Out with C++ Early Objects.
1 Verilog Digital System Design Z. Navabi, 2006 Verilog Language Concepts.
1 COMS 261 Computer Science I Title: C++ Fundamentals Date: September 9, 2005 Lecture Number: 6.
Chapter 4 Literals, Variables and Constants. #Page2 4.1 Literals Any numeric literal starting with 0x specifies that the following is a hexadecimal value.
Operators and Expressions. 2 String Concatenation  The plus operator (+) is also used for arithmetic addition  The function that the + operator performs.
CHAPTER 2 PROBLEM SOLVING USING C++ 1 C++ Programming PEG200/Saidatul Rahah.
NUMBER SYSTEMS AND CODES. CS Digital LogicNumber Systems and Codes2 Outline Number systems –Number notations –Arithmetic –Base conversions –Signed.
Tokens in C  Keywords  These are reserved words of the C language. For example int, float, if, else, for, while etc.  Identifiers  An Identifier is.
Types Chapter 2. C++ An Introduction to Computing, 3rd ed. 2 Objectives Observe types provided by C++ Literals of these types Explain syntax rules for.
© 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,
1 Objects Types, Variables, and Constants Chapter 3.
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI Dale Roberts, Lecturer Computer Science, IUPUI
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 2-1 Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
2.1 The Part of a C++ Program. The Parts of a C++ Program // sample C++ program #include using namespace std; int main() { cout
Chapter 2: Introduction to C++
ECE Application Programming
TMF1414 Introduction to Programming
Verilog-HDL-3 by Dr. Amin Danial Asham.
Chapter 2: Introduction to C++
INTRODUCTION c is a general purpose language which is very closely associated with UNIX for which it was developed in Bell Laboratories. Most of the programs.
Chapter 2: Introduction to C++
Behavioral Modeling in Verilog
Chapter 3: Dataflow Modeling
2.1 Parts of a C++ Program.
Introduction to C++ Programming
Introduction to Verilog® HDL
Introduction to C++ Programming
Chapter 2: Introduction to C++.
Introduction to Verilog® HDL
Lexical Elements & Operators
Presentation transcript:

1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System Workshop 5 - Data types A Workshop 6 - Data types B Workshop 7 - Operators Workshop 8 - Signed arithmetic Workshop 9 - Behavioral modeling A Workshop 10 - Behavioral modeling B Workshop 11 - Behavioral modeling C Workshop 12 - Data flow modeling Workshop 13 - Coding Styles

2 Lexical conventions The basic lexical conventions used by Verilog HDL are similar to those in the C programming language. Verilog HDL is a case-sensitive language. All keywords are in lowercase. White space characters are: Blank spaces, Tabs, New-line Statement Terminator: Verilog models consist of a list of statements declaring relationships between a model and its environment, and between signals within a model. Statements are terminated by a semicolon( ; ) module full_addr (A, B, Cin, S, Cout) ; input A, B, Cin ; output wire S, Cout ; assign {Cout, S} = A + B + Cin ; // Concatenation endmodule

3 Identifiers Identifiers are names given to an object, such as a register or a function or a module, so that it can be referenced from other places in a description Identifiers must begin with an alphabetic character or the underscore character (a-z A-Z _ ) Identifiers may contain alphabetic characters, numeric characters, underscore, and dollar sign (a-z A-Z 0-9 _ $ ) Identifiers can be up to 1024 characters long Identifier cannot start with a number or dollar sign ($) Escaped Identifiers begin with backslash (\) and end with white space (space, tab or new line)

4 Identifiers cont., Comments All characters within the Escape Identifier, are processed literally. Any printable ASCII character can be included. Identifiers examples: wire a1 ; // wire is a keyword, a1 is an identifier reg sum ; // reg is a keyword, sum is an identifier Escaped Identifier examples: \a+b-c \**my_name** Comments: There are two forms to introduce comments. Single line comments begin with “// “ and end with a carriage return. // This is a one line comment Multi Line comments begin with the “/*” and end with “*/” /* This is a multiple lines comments */

5 Integer Numbers Verilog HDL allows integer numbers to be specified as: Sized or Unsized numbers ( Unsized size is 32 bits ) In a radix of binary, octal, decimal, or hexadecimal Radix and hex digits (a, b, c, d, e, f) are case insensitive Spaces are allowed between the size, radix and value Syntax: ' size in bits, radix in b, d, o, h

6 Number Representation 549 // unsized decimal number ‘h 8FF // unsized hex number ‘o765 // unsized octal number 4 ’b11 // 4-bit binary number ’b10x // 3-bit binary number with LSB unknown 5 ’d3 // 5-bit decimal number -4 ’b11 // 4-bit two’s complement of 0011 = 1101 = 4’hd

7 Integer Numbers - Examples Unsized Numbers: 792 // a decimal number 8d9 // Illegal, hexadecimal must be specified with ‘h ‘h 7d9 // an unsized hexadecimal number d9 ‘o 7746 // an unsized octal number // stored as Sized Numbers: 12 ‘h x // a 12 bit unknown number 10 ‘d 17 // a 10 bit constant with the value 17 4‘b 110z // a 4 bit binary number with LSB in Hi-Z state 8’hAA // stored as

8 Integer Numbers (2) If size is ommitted:  It is inferred from the value or  It takes the simulation specific number of bits or  It takes the machine specific number of bits (32/64b) If radix is ommitted too, decimal is assumed  15 = ’d 15

9 Integer Numbers (3) One can insert “_” to improve readability, 12 ’b 000_111_010_ ’b ’o 07_24 “?” question mark – substitutes z in numbers for better readability: 8 `b111? // == 8 `b111Z Zero fill / bit extension: If a numeric value does not contain enough digits to fill the specified number of bits, the high order bits are filled with zeros. If the specified MSB is an x or z, the x/z is left extended to fill the bit field. 16 ’h39  16 ’h0039  16 ’b ’hz  8 ’hzz  16 ’bzzzz zzzz

10 Signed and Unsigned Numbers Verilog Supports both types of numbers, but with certain restrictions. Any number that does not have negative sign prefix is a positive number. Or indirect way would be "Unsigned" Negative numbers can be specified by putting a minus sign (-) before the size for a constant number, thus become signed numbers. Verilog internally represents negative numbers in 2's compliment format.

11 Signed and Unsigned Numbers Examples Negative numbers (- sign before the size) are represented in 2's complement form. Any number without a – sign is an unsigned number -4’d7 // stored as sd3 // used for performing signed integer math 4’d-2 // Illegal specification -5’ha // stored as ’b101 // stored as 1011 wire signed [N-1:0] din ; // a net that holds a signed value reg signed [M-1:0] dout ; /* a variable that holds a signed value */

12 Real Numbers Verilog supports real constants and variables Real Numbers can not contain 'Z' and 'X' Real numbers may be specified in either decimal or scientific notation: .  E Verilog converts real numbers to integers by rounding. Real numbers are rounded off to the nearest integer when assigning to integer. Examples:Real NumberDecimal Number E

13 String A sequence of characters enclosed in double quotes. Must be contained in a single line (w/o carriage return). String is treated as a sequence of one-byte ASCII values. Example: “Verilog HDL Concepts” Verilog strings are implemented with regs. The reg holds the ASCII values of each character of the string. reg [8*12:0] string_val ; // can hold up to 13 chars string_val = “Hello Verilog”; string_val = “hello”; // MS Bytes are filled with 0 string_val = “I am overflowed”; // “I ” is truncated Accept C-like escape characters: \n = newline, \t = tab, \b = backslash, \” = quote mark (“), % = % sign