Lexical Conventions in Verilog HDL. (1) - PowerPoint PPT Presentation

About This Presentation
Title:

Lexical Conventions in Verilog HDL. (1)

Description:

The attached narrated power point presentation attempts to explain the lexical conventions in Verilog HDL. – PowerPoint PPT presentation

Number of Views:18
Slides: 34
Provided by: sunith.cheriyil
Tags:

less

Transcript and Presenter's Notes

Title: Lexical Conventions in Verilog HDL. (1)


1
Verilog HDL Lexical Conventions
  • CEC

2
Contents
  • Operators.
  • Number Specifications.
  • Identifiers and Keywords.
  • Special Characters.
  • Data Types, Strings and Arrays.
  • System Tasks and Compiler Directives.
  • Ports.

3
Tokens
  • Verilog contains tokens.
  • Can be comments, delimiters, numbers, strings,
    identifiers and keywords.
  • Case Sensitive - all keywords in lower case.

4
Operators
  • Unary operators precede the operand.
  • Binary operators appear between two operands.
  • Ternary operators have two separate operators
    that separate three operands.

5
White Space
  • Blank spaces (\b), tabs (\t), newlines (\n).
  • Normally ignored by Verilog.
  • Not ignored in strings.
  • Not ignored when it separates tokens.

6
Number Specifications
  • Sized and unsized numbers.
  • Sized numbers specified as
  • ltsizegt ltbase formatgt ltnumbergt
  • Legal base formats are decimal, hexadecimal,
    binary and octal.

7
Number Specifications
  • Unsized numbers specified without a base format.
  • Default number of bits is machine or simulator
    specific (at least 32 bits).

8
Number Specifications
  • Negative numbers minus sign before the size of
    a constant number.
  • Underscore allowed anywhere except the first
    number.

9
Number Specifications
  • Unknown number denoted by x.
  • High impedance number denoted by z.
  • ? as alternative for z.

10
Strings
  • Treated as a sequence of one-byte ASCII values.
  • Enclosed in double quotes.
  • Contained on a single line, no carriage return.

11
Identifiers and Keywords
  • Keywords are special identifiers to define
    language constructs.
  • Lower case, identifiers are case sensitive.
  • Alphanumeric characters, dollar sign, underscore.
  • Escaped identifiers begin with \, end with white
    space.

12
Special Characters
13
Data Types
  • Integer, Real and Time Register Data types.
  • Integer general purpose register data type for
    manipulating quantities.

14
Data Types
  • Real
  • specified in decimal or scientific notation.
  • - default value is 0.
  • - cannot have range declaration.

15
Data Types
  • Time
  • - Verilog simulation done with respect to
    simulation time, measured in simulation seconds.
  • - Time register data type used to store
    simulation time.
  • - time to get current simulation time.

16
Arrays
  • Allowed for reg, integer, time and vector
    register data types.
  • Accessed by ltarray namegt, ltsubscriptgt.

17
Memories
  • Memories modelled as array of registers.
  • Each element of the array is called word.

18
Strings
  • Stored in reg, each character takes up 8 bits.
  • Truncates leftmost bits of the string if register
    width smaller than string width.

19
System Tasks
  • Appear in the form of ltkeywordgt.
  • display displaying values of variables or
    strings or expressions, inserts a new line at the
    end of the string by default.
  • display without argument produces a new line.

20
System Tasks
21
System Tasks
22
System Tasks
  • monitor to monitor a signal when its value
    changes.
  • Need to be invoked once.
  • If more than one monitor statement, the last
    monitor statement will be the active statement.
  • monitoron enable monitoring.
  • monitoroff disable monitoring.

.
23
System Tasks
24
System Tasks
  • stop to stop during (suspend) simulation.
  • finish - to terminate simulation.

25
String Formats
26
Compiler Directives
  • define to define text macros in Verilog.

27
Compiler Directives
  • include include a Verilog file into another
    Verilog file.

28
Components of a Verilog Module
29
Ports
  • Interface by which a module interacts with
    external world.
  • Input, Output ports.
  • Top no list of ports.
  • module Top means top level module.

30
Ports
31
Port Connection/Declaration Rules
32
(No Transcript)
33
Thank You
Write a Comment
User Comments (0)
About PowerShow.com