COE 405 VHDL Lexical Elements Dr. Aiman H. El-Maleh Computer Engineering Department King Fahd University of Petroleum & Minerals Dr. Aiman H. El-Maleh.

Slides:



Advertisements
Similar presentations
Types and Variables. Computer Programming 2 C++ in one page!
Advertisements

1 Lecture 2  Input-Process-Output  The Hello-world program  A Feet-to-inches program  Variables, expressions, assignments & initialization  printf()
1 Lexical Elements Chapter 2 in ABC. 2 Tokens Token = word / symbol, does not contain white spaces. Tokens in C are either: –keywords –identifiers –constants.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Adrian Ilie COMP 14 Introduction to Programming Adrian Ilie June 27, 2005.
JavaScript, Fourth Edition
Chapter 2: Introduction to C++.
JavaScript, Third Edition
1 Lecture 3  Lexical elements  Some operators:  /, %, =, +=, ++, --  precedence and associativity  #define  Readings: Chapter 2 Section 1 to 10.
Introduction to Programming Prof. Rommel Anthony Palomino Department of Computer Science and Information Technology Spring 2011.
Chapter 2: C Fundamentals Dr. Ameer Ali. Overview C Character set Identifiers and Keywords Data Types Constants Variables and Arrays Declarations Expressions.
Syntax of C Programming Language #Lesson 2 Sen Zhang.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
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.
Java Primitives The Smallest Building Blocks of the Language (corresponds with Chapter 2)
Input & Output: Console
2440: 211 Interactive Web Programming Expressions & Operators.
C Tokens Identifiers Keywords Constants Operators Special symbols.
C-Language Keywords(C99)
Constants in C A Presentation On Department of Computer & Information Technology, M.S.P.V.L. Polytechnic College, Pavoorchatram.
CSE 1301 Lecture 2 Data Types Figures from Lewis, “C# Software Solutions”, Addison Wesley Richard Gesick.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 2-1 Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
Lecture #5 Introduction to C++
Chapter 2. C++ Program Structure C++ program is a collection of subprograms Subprograms in C++ are called FUNCTIONS Each function performs a specific.
C++ Programming: Basic Elements of C++.
Copyright © 2012 Pearson Education, Inc. Chapter 2: Introduction to C++
Characters and tokens Characters are the basic building blocks in C program, equivalent to ‘letters’ in English language Includes every printable character.
Module 1.2 Verilog Simulator.  A Verilog program for a particular application consists of two blocks : ◦ Design Block (Module) ◦ Testing Block (Stimulus.
RTL Hardware Design by P. Chu Chapter Basic VHDL program 2. Lexical elements and program format 3. Objects 4. Data type and operators RTL Hardware.
BASICS CONCEPTS OF ‘C’.  C Character Set C Character Set  Tokens in C Tokens in C  Constants Constants  Variables Variables  Global Variables Global.
Recognizing PL/SQL Lexical Units. 2 home back first prev next last What Will I Learn? List and define the different types of lexical units available in.
These notes were originally developed for CpSc 210 (C version) by Dr. Mike Westall in the Department of Computer Science at Clemson.
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.
Slide 1 2. Verilog Elements. Slide 2 Why (V)HDL? (VHDL, Verilog etc.), Karen Parnell, Nick Mehta, “Programmable Logic Design Quick Start Handbook”, Xilinx.
CHAPTER 2 C++ SYNTAX & SEMANTICS #include using namespace std; int main() { cout
C++ Basics Tutorial 5 Constants. Topics Covered Literal Constants Defined Constants Declared Constants.
Chapter 5 Introduction to VHDL. 2 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits.
A Simple Java Program //This program prints Welcome to Java! public class Welcome { public static void main(String[] args) { public static void main(String[]
Topics to be covered  Introduction to C Introduction to C  Characterstics of C Characterstics of C  Characterset Characterset  Keywords Keywords 
Ajmer Singh PGT(IP) Programming Fundamentals. Ajmer Singh PGT(IP) Java Character Set Character set is a set of valid characters that a language can recognize.
Chapter2 Constants, Variables, and Data Types. 2.1 Introduction In this chapter, we will discuss –constants (integer, real, character, string, enum),symbolic.
BASIC VHDL LANGUAGE ELEMENTS Digital Design for Instrumentation with VHDL 1.
Module B - Computation1/61 Module-B-Computation Variables Basic Memory Operations Expressions.
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.
CEC 220 Digital Circuit Design Introduction to VHDL Friday, February 21 CEC 220 Digital Circuit Design Slide 1 of 10.
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.
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.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 2 Introduction to C++
Sudeshna Sarkar, IIT Kharagpur 1 Programming and Data Structure Sudeshna Sarkar Lecture 3.
1 ENERGY 211 / CME 211 Lecture 3 September 26, 2008.
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
C++ First Steps.
The Machine Model Memory
Java Variables and Types
BASIC ELEMENTS OF A COMPUTER PROGRAM
Tokens in C Keywords Identifiers Constants
Wel come.
Section 3.2c Strings and Method Signatures
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.
C++ Basics.
2.1 Parts of a C++ Program.
WEB PROGRAMMING JavaScript.
Basics of ‘C’.
Lecture 4: Lexical Analysis & Chomsky Hierarchy
Lectures on Numerical Methods
Chapter 2: Introduction to C++.
ECE 103 Engineering Programming Chapter 8 Data Types and Constants
Lexical Elements & Operators
Presentation transcript:

COE 405 VHDL Lexical Elements Dr. Aiman H. El-Maleh Computer Engineering Department King Fahd University of Petroleum & Minerals Dr. Aiman H. El-Maleh Computer Engineering Department King Fahd University of Petroleum & Minerals

2-2 OutlineOutline n VHDL Design File n Delimiters & Identifiers n User Defined Identifiers n Literals Character Literal String Literal Bit String Literal Abstract (Numeric) Literals n VHDL Language Grammar n VHDL Design File n Delimiters & Identifiers n User Defined Identifiers n Literals Character Literal String Literal Bit String Literal Abstract (Numeric) Literals n VHDL Language Grammar

2-3 Design Files n Design file is a sequence of Lexical Elements Separators n Separators Any # of separators allowed between lexical elements Space character Tab Line Feed / Carriage Return (EOL) n Lexical Elements: Delimiters ``meaningful separator characters`` Identifiers Literals Character literal String literal Bit string literal Abstract (numeric) literal n Design file is a sequence of Lexical Elements Separators n Separators Any # of separators allowed between lexical elements Space character Tab Line Feed / Carriage Return (EOL) n Lexical Elements: Delimiters ``meaningful separator characters`` Identifiers Literals Character literal String literal Bit string literal Abstract (numeric) literal

2-4 Delimiters & Identifiers n Delimiters are separators which have meaning n Identifiers Key/Reserved words (No Declaration Required) User-defined n Delimiters are separators which have meaning n Identifiers Key/Reserved words (No Declaration Required) User-defined Simple & ' ( ) * +, -. / : ; | Compound ** := /= >= <> -- Delimiters

2-5 VHDL Reserved Words abs disconnectlabelpackage accessdownto libraryPoll units afterlinkageprocedure until aliaselseloopprocessuse allelsif variable andendmaprange architectureentitymodrecordwait arrayexitnand register when assertnew remwhile attributefilenext reportwith begin fornor return xor block functionnot select bodygeneratenullseverity buffergeneric of signal busguardedon subtype caseifopenthen componentinorto configurationinoutotherstransport constantisout type abs disconnectlabelpackage accessdownto libraryPoll units afterlinkageprocedure until aliaselseloopprocessuse allelsif variable andendmaprange architectureentitymodrecordwait arrayexitnand register when assertnew remwhile attributefilenext reportwith begin fornor return xor block functionnot select bodygeneratenullseverity buffergeneric of signal busguardedon subtype caseifopenthen componentinorto configurationinoutotherstransport constantisout type

2-6 User Defined Identifiers … n Identifier ::= basic_identifier | extended_identifier n basic_identifier ::= Letter { [underline] Letter_or_Digit} Starts with a Letter Followed by any # of Alpha-Numeric characters No 2-consecutive Underscores are allowed Underscore Cannot be the last character in an Identifier Case insensitive No VHDL Keywords n Examples: mySignal_23 -- normal identifier rdy, RDY, Rdy -- identical identifiers vector_&_vector -- X : special character last of Zout -- X : white spaces idle__state -- X : consecutive underscores 24th_signal -- X : begins with a numeral open, register -- X : VHDL keywords n Identifier ::= basic_identifier | extended_identifier n basic_identifier ::= Letter { [underline] Letter_or_Digit} Starts with a Letter Followed by any # of Alpha-Numeric characters No 2-consecutive Underscores are allowed Underscore Cannot be the last character in an Identifier Case insensitive No VHDL Keywords n Examples: mySignal_23 -- normal identifier rdy, RDY, Rdy -- identical identifiers vector_&_vector -- X : special character last of Zout -- X : white spaces idle__state -- X : consecutive underscores 24th_signal -- X : begins with a numeral open, register -- X : VHDL keywords

2-7 … User Defined Identifiers n extended_identifier ::= \ graphic_character {graphic_character} \ Defined in VHDL’93 Enclosed in back slashes Case sensitive Graphical characters allowed May contain spaces and consecutive underscores VHDL keywords allowed n Examples: \mySignal_23\ -- extended identifier \rdy\, \RDY\, \Rdy\ -- different identifiers \vector_&_vector\ -- legal \last of Zout\ -- legal \idle__state\ -- legal \24th_signal\ -- legal \open\, \register\ -- legal n extended_identifier ::= \ graphic_character {graphic_character} \ Defined in VHDL’93 Enclosed in back slashes Case sensitive Graphical characters allowed May contain spaces and consecutive underscores VHDL keywords allowed n Examples: \mySignal_23\ -- extended identifier \rdy\, \RDY\, \Rdy\ -- different identifiers \vector_&_vector\ -- legal \last of Zout\ -- legal \idle__state\ -- legal \24th_signal\ -- legal \open\, \register\ -- legal

2-8 CommentsComments n Start with - - ``2 Consecutive Dashes`` n Comment must be the LAST Lexical Element on the line n IF Line starts with - -, It is a full-line comment. n Examples: - - This is a full-line comment C := A*B; - - This is an in-line comment n Start with - - ``2 Consecutive Dashes`` n Comment must be the LAST Lexical Element on the line n IF Line starts with - -, It is a full-line comment. n Examples: - - This is a full-line comment C := A*B; - - This is an in-line comment

2-9 Literals … n Character Literal Single character enclosed in single quotes Used to define constant values of objects of type Character Literal values are Case Sensitive; ‘z’ NOT SAME as ‘Z’ Examples: `A` `B` `e` ` ` `1` `9` `*` ………….etc. n String Literal Sequence of characters enclosed in double quotes If a quotation char is required, 2 consecutive quotation marks are used Strings must be typed on one line Longer strings are Concatenated from shorter ones using the & operator. n Character Literal Single character enclosed in single quotes Used to define constant values of objects of type Character Literal values are Case Sensitive; ‘z’ NOT SAME as ‘Z’ Examples: `A` `B` `e` ` ` `1` `9` `*` ………….etc. n String Literal Sequence of characters enclosed in double quotes If a quotation char is required, 2 consecutive quotation marks are used Strings must be typed on one line Longer strings are Concatenated from shorter ones using the & operator.

2-10 … Literals … n String Literal Examples: ``A String`` -- 8-Char String ```` -- Empty String `` `` `` `` -- 4-Double Quotes -- String of Length 1 ``A+B=C;#3=$`` -- String with Special Chars ``This is a Very Long String Literal`` & ``Formed By Concatenation`` n Bit String Literal: is a String Literal Preceded by a Base Identifier  {B, O, X} {B for Binary, O for Octal and X for Hex} All Chars are only Digits {in the Base Number System} or Underscores. The length of the string does not include the number of Underscores. Used to specify initial contents of registers Value of bit-string is equivalent to a string of Bits, however, Interpreting this value is a User Choice n String Literal Examples: ``A String`` -- 8-Char String ```` -- Empty String `` `` `` `` -- 4-Double Quotes -- String of Length 1 ``A+B=C;#3=$`` -- String with Special Chars ``This is a Very Long String Literal`` & ``Formed By Concatenation`` n Bit String Literal: is a String Literal Preceded by a Base Identifier  {B, O, X} {B for Binary, O for Octal and X for Hex} All Chars are only Digits {in the Base Number System} or Underscores. The length of the string does not include the number of Underscores. Used to specify initial contents of registers Value of bit-string is equivalent to a string of Bits, however, Interpreting this value is a User Choice

2-11 … Literals … n Bit String Literal Examples: B `` `` -- Length 8 B ``1101_1001`` -- Length 8 X ``D9`` -- Length 8 (Equivalent to above string) O ``331`` -- Length 9 X``A`` -- Represents the String Interpreted as +10 for unsigned representation -- Interpreted as -6 for signed 2`s complement representation n Bit String Literal Examples: B `` `` -- Length 8 B ``1101_1001`` -- Length 8 X ``D9`` -- Length 8 (Equivalent to above string) O ``331`` -- Length 9 X``A`` -- Represents the String Interpreted as +10 for unsigned representation -- Interpreted as -6 for signed 2`s complement representation

2-12 … Literals … Entity Test is end; Architecture T1 of Test is signal x, y, z, w : Bit_Vector(11 downto 0); Begin x <= " "; y <= B"1010_1111_0011"; z <= X"AF3"; w <= O"5363"; End T1; When B symbol is used before a string, as many underscores as needed can be used inside the string.

2-13 … Literals … n Abstract (Numeric) Literals Default is decimal Other bases are possible (Bases between 2 and 16) Underscore char may be used to enhance readability Scientific notations must have integer Exponent Integer literals should not have base point Integer literals should not have -ive Exponents In Real literals, a base point must be followed by AT LEAST ONE DIGIT No spaces are allowed Examples: _987_456 73E13 -- Integer _ E E3 -- Real n Abstract (Numeric) Literals Default is decimal Other bases are possible (Bases between 2 and 16) Underscore char may be used to enhance readability Scientific notations must have integer Exponent Integer literals should not have base point Integer literals should not have -ive Exponents In Real literals, a base point must be followed by AT LEAST ONE DIGIT No spaces are allowed Examples: _987_456 73E13 -- Integer _ E E3 -- Real

2-14 … Literals n Special Case (Based Literals) General Base Abstract Literals (Including Decimal) Based_Literal::=Base#Based_Integer[Based_Integer]#[Expon ent] Based_Integer::=Extd_Digit { [Underline] Extd_Digit } Extd_Digit::=digit | Letters_A-F Both Base and Exponent are expressed in Decimal Base must be between 2 & 16 Digits are extended to use the HEX characters A-F Examples: The following represent integer value of 196 2#1100_0100#,16#C4# 4#301#E1,10#196# The following represent real value of #1.1111_1111_111#E11,16#F.FF#E2 10#4095.0# n Special Case (Based Literals) General Base Abstract Literals (Including Decimal) Based_Literal::=Base#Based_Integer[Based_Integer]#[Expon ent] Based_Integer::=Extd_Digit { [Underline] Extd_Digit } Extd_Digit::=digit | Letters_A-F Both Base and Exponent are expressed in Decimal Base must be between 2 & 16 Digits are extended to use the HEX characters A-F Examples: The following represent integer value of 196 2#1100_0100#,16#C4# 4#301#E1,10#196# The following represent real value of #1.1111_1111_111#E11,16#F.FF#E2 10#4095.0#

2-15 VHDL Language Grammar n Formal grammar of the IEEE Standard VHDL language in BNF format Appendix E ml ml n Formal grammar of the IEEE Standard VHDL language in BNF format Appendix E ml ml