verilog objective. verilog and hdl.structural-level modeling and simulation behavioral modeling and...

59
Verilog Objective . Verilog and HDL .Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control specification Response generation and verification Interactive debugging Achieving optimal performance issues Verilog environment

Upload: kathleen-owens

Post on 18-Jan-2016

248 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control

Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control specification Response generation and verification Interactive debugging Achieving optimal performance issues Verilog environment

Page 2: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control

Verilog Verilog is one of the two major Hardware

Description Languages(HDL) used by hardware designers in industry and academia.

VHDL is another one Verilog is easier to learn and use than VHDL Verilog is C-like . VHDL is very Aad-like. Verilog HDL allows a hardware designer to

describer designs at a high level of abstraction such as at the architectural or behavioral level as well as the lower implementation levels(i.e., gate and switch levels).

Page 3: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control

Why use Verilog HDL Digital system are highly complex. Verilog language provides the digital

designer a software platform. Verilog allow user to express their

design with BEHAVIORAL CONSTRUCTS. A program tool can convert the verilog

program to a description that was used to make exactly chip, like VLSI.

Page 4: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control

Using Verilogger Pro V9.0 Evaluation Version. enter the window of Verilogger

StartProgramSynaptiCadVerilogger Pro..

Page 5: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control

How to build a new project Click Menu [ Project]Project] [New [New

Project]Project]enter the conversation window. Enter the Project Name. default: untitled.hpj. *.hpj Enter the Project Directory C:\SynaptiCAD\project\ Or others..Click the [Finish] to close the window.

Page 6: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control

Other menus of [Project] [Open Project][Open Project] [Close Project][Close Project] [Save Project][Save Project] [Save Project as][Save Project as] [Add User Source Files][Add User Source Files]

all the user source used by this project.all the user source used by this project. Project settingProject setting Print Project HierarchyPrint Project Hierarchy

Page 7: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control

Verilogger Editor Use the Verilogger Editor to build a

program. In the Verilogger Window: click [Editor][New HDL

file]pop up a editor window for you.

. Others Menu in the [Editor] same as Menu[Project]

Page 8: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control

Lexical Convention Lexical convention are close to C+

+. Comment // to the end of the line. /* to */ across several lines. Keywords are lower case letter. the language is case sensitive

Page 9: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control

Lexical Convention Numbers are specified in the traditional form or

below . <size><base format><number> Size: contains decimal digitals that specify the size

of the constant in the number of bits. Base format: is the single character ‘ followed by

one of the following characters b(binary),d(decimal),o(octal),h(hex).

Number: legal digital.

Page 10: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control

Lexical Convention Example : 347 // decimal number 4’b101 // 4- bit binary number 0101 2’o12 // 2-bit octal number 5’h87f7 // 5-bit hex number h87f7 2’d83 // 2-bit decimal number String in double quotes “ this is a introduction”

Page 11: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control

Lexical Convention Operator are one, two, or three characters

and are use in the expressions.just like C++.

Identifier: specified by a letter or underscore followed by more letter or digits, or signs.

identifier can up to 1024 characters

Page 12: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control

Program structure Structure module <module name> (< port list>); < declares> <module items> endmodule. Module name an identifier that uniquely names the module.. Port list a list of input, inout and output ports which are

used to other modules.

Page 13: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control

Program structure. Declares section specifies data objects as registers,

memories and wires as well as procedural constructs such as functions and tasks.

. Module items initial constructs always constructs assignment

……………….

Page 14: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control

Test Module structure module <test module name> ; // Data type declaration// Data type declaration // Instantiate module ( call the module that is// Instantiate module ( call the module that is

going to be tested)going to be tested) // Apply the stimulus// Apply the stimulus // Display results// Display results

endmodule

Page 15: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control

Example of gate NAND Truth Table

in1 in2 out

0 0 1

0 1 1

1 0 1

1 1 0

Page 16: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control

Example of gate NAND Behavioral model of a Nand gate //Behavioral model of a Nand gate

// program nand1.v module NAND(in1, in2, out);

input in1,in2; output out;

assign out=~(in1&in2);endmodule

Page 17: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control

Example of gate NAND Test module test_nand for the nand1.v module

test_nand; // high level module to test nand, test_nand1.v reg a,b; wire out1; NAND test_nand1(a,b,out1); // call the module NAND.

initial begin // apply the stimulus, test dataa=0; b=0; // initial value

#1 a=1; // delay one simulation cycle, then change a=1. #1 b=1; #1 a=0; #1; end initial begin // setup monitoring $monitor(“Time=%0d a=%b b=%b out1=%b”, $time,a,b,out1); end endmodule

Page 18: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control

Example of gate NAND Save the HDL files as nand1.v in

menu [Editor] [Save HDL File As] and

save another HDL file as test_nand1.v Attach these two HDL files to a new

project test.hpj in [project window] Run the simulation program run/resume simulation button or

in the [simulate].

Page 19: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control

How to build a new project?

Page 20: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control
Page 21: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control
Page 22: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control
Page 23: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control
Page 24: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control

How to create a HDL file?

Page 25: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control
Page 26: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control
Page 27: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control
Page 28: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control

How to save the HDL file?

Page 29: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control
Page 30: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control
Page 31: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control
Page 32: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control
Page 33: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control

How to add a source HDL file to a Project(project1)

Page 34: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control
Page 35: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control
Page 36: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control
Page 37: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control
Page 38: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control
Page 39: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control

Now, Ready to run the program!

Page 40: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control
Page 41: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control
Page 42: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control

The Report Window of Verilogger.(all the simulation information is in this window)

Page 43: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control
Page 44: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control

Example of gate NAND Simulation report from Verilog-Report

window.Running...

Time=0 a=0 b=0 out1=1Time=1 a=1 b=0 out1=1Time=2 a=1 b=1 out1=0Time=3 a=0 b=1 out1=10 Errors, 0 WarningsCompile time = 0.00000, Load time = 0.00000,

Execution time = 0.06000

Normal exit

Page 45: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control

Diagram window of Simulation result

Page 46: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control
Page 47: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control
Page 48: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control
Page 49: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control

How to copy the diagram to Microsoft Word!

Page 50: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control

Example of gate NAND Wave from Verilog diagram. Verilog windows click the diagram windowsclick

[edit]copy to clipboardselect “wave form, name and time line”select “ok”

then you can paste the diagram to anywhere you want.

Page 51: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control
Page 52: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control
Page 53: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control
Page 54: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control

You can paste the diagram here!

Page 55: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control

Examples 2 NAND Structural model //structural model of a Nand gate // program nand2.v module NAND(in1, in2, out2);

input in1,in2; output out2;

nand nand2(out2,in1,in2);// first port must be output.

endmodule

Page 56: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control

Examples 2 NAND Test module same as the behavioral model

. Save the HDL Editor program as nand2.v , another as test_nand2.v Attach these two HDL files to a new project

test.hpj Run the simulation program run/resume simulation button or in the

[simulate].

Page 57: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control

Examples 2 NAND Nand2 simulation report.

Running...Time=0 a=0 b=0 out1=1Time=1 a=1 b=0 out1=1Time=2 a=1 b=1 out1=0Time=3 a=0 b=1 out1=10 Errors, 0 WarningsCompile time = 0.00000, Load time = 0.11000,

Execution time = 0.00000

Normal exit

Page 58: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control

Examples 2 NAND Wave of Nand2

Page 59: Verilog Objective. Verilog and HDL.Structural-level modeling and simulation Behavioral modeling and simulation Timing specification Stimulus and control

Example 3 Run the additional program in the

verilogger to understand the detail of programming.

MUX2_1. OR gate NOT gate Fulladder