module 1.2 verilog simulator. a verilog program for a particular application consists of two blocks...

14
Verilog Syntax and Design hierarchy Module 1.2 Verilog Simulator

Upload: anne-lambert

Post on 03-Jan-2016

217 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Module 1.2 Verilog Simulator.  A Verilog program for a particular application consists of two blocks : ◦ Design Block (Module) ◦ Testing Block (Stimulus

Verilog Syntax and Design hierarchy

Module 1.2 Verilog Simulator

Page 2: Module 1.2 Verilog Simulator.  A Verilog program for a particular application consists of two blocks : ◦ Design Block (Module) ◦ Testing Block (Stimulus

A Verilog program for a particular application consists of two blocks :

◦ Design Block (Module)

◦ Testing Block (Stimulus)

Verilog Blocks

Page 3: Module 1.2 Verilog Simulator.  A Verilog program for a particular application consists of two blocks : ◦ Design Block (Module) ◦ Testing Block (Stimulus

Design Methodologies:

Two types of design methodologies Top Down Design Bottom Up Design

Design Block

Design Block

inputs

outputs

Page 4: Module 1.2 Verilog Simulator.  A Verilog program for a particular application consists of two blocks : ◦ Design Block (Module) ◦ Testing Block (Stimulus

In Top Down design methodology, we define the top level block and identify the sub-blocks necessary to build the top level block. We further divide the sub-block until we come to the leaf cells, which are the cells which cannot be divided.

Top Down Design

Page 5: Module 1.2 Verilog Simulator.  A Verilog program for a particular application consists of two blocks : ◦ Design Block (Module) ◦ Testing Block (Stimulus

In a Bottom Up design methodology, we first identify the building blocks , we build bigger blocks using these building blocks. These cells are then used for high level block until we build the top level block in the design

Bottom Up Design

Page 6: Module 1.2 Verilog Simulator.  A Verilog program for a particular application consists of two blocks : ◦ Design Block (Module) ◦ Testing Block (Stimulus

EXAMPLE

FOUR BIT ADDER (Ripple carry adder)

Page 7: Module 1.2 Verilog Simulator.  A Verilog program for a particular application consists of two blocks : ◦ Design Block (Module) ◦ Testing Block (Stimulus

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.

Verilog Syntax

Page 8: Module 1.2 Verilog Simulator.  A Verilog program for a particular application consists of two blocks : ◦ Design Block (Module) ◦ Testing Block (Stimulus

White space characters are :◦ Blank spaces◦ Tabs◦ Carriage returns◦ New-line.

These characters are ignored except when they serve to separate other tokens.

However, blanks and tabs are significant in strings.

White Space

Page 9: Module 1.2 Verilog Simulator.  A Verilog program for a particular application consists of two blocks : ◦ Design Block (Module) ◦ Testing Block (Stimulus

Equivalent Code

Page 10: Module 1.2 Verilog Simulator.  A Verilog program for a particular application consists of two blocks : ◦ Design Block (Module) ◦ Testing Block (Stimulus

Comments

There are two forms to introduce comments. Examples of

Comments

Single line comments begin with the token // and end with a carriage return

Multi Line comments begin with the token

/* and end with the token */

Page 11: Module 1.2 Verilog Simulator.  A Verilog program for a particular application consists of two blocks : ◦ Design Block (Module) ◦ Testing Block (Stimulus

Verilog HDL is case sensitive◦ Lower case letters are unique from upper case

letters◦ All Verilog keywords are lower case

Examples of Unique names : input // a Verilog Keywordwire // a Verilog KeywordWIRE // a unique name ( not a keyword)Wire // a unique name (not a keyword)NOTE : Never use the Verilog keywords as unique name, even if

the case is different.

Case Sensitivity

Page 12: Module 1.2 Verilog Simulator.  A Verilog program for a particular application consists of two blocks : ◦ Design Block (Module) ◦ Testing Block (Stimulus

Identifiers are names used to give an object, such as a register or a module, a name 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, the underscore, and the dollar sign ( a-z ; A-Z ; 0-9 ; _ $ )

◦ Identifiers can be up to 1024 characters long.

Identifiers

Page 13: Module 1.2 Verilog Simulator.  A Verilog program for a particular application consists of two blocks : ◦ Design Block (Module) ◦ Testing Block (Stimulus

Examples of legal identifiersdata_input clk_input my$clki386 A

Escaped Identifiers : Verilog HDL allows any character to be used in an identifier by escaping the identifier. Escaped identifiers provide a means of including any of the printable ASCII characters in an identifier.

Examples of escape identifiers:\486_up \Q~ \1,2,3 \reset*

Identifier

Page 14: Module 1.2 Verilog Simulator.  A Verilog program for a particular application consists of two blocks : ◦ Design Block (Module) ◦ Testing Block (Stimulus

You can specify constant numbers in decimal, hexadecimal, octal, or binary format.

Negative numbers are represented in 2's complement form.

When used in a number, the question mark (?) character is the Verilog alternative for the z character.

Numbers in Verilog