introduction to verilog hdl

46
Introduction to Verilog HDL

Upload: terry

Post on 09-Feb-2016

179 views

Category:

Documents


4 download

DESCRIPTION

Introduction to Verilog HDL. Hardware Description Language (HDL). What is the need for Hardware Description Language? Basic idea is a programming language to describe hardware Model, Represent, And Simulate Digital Hardware Hardware Concurrency Edge Transitions Propagation Delays - PowerPoint PPT Presentation

TRANSCRIPT

Introduction to VerilogHDL

Introduction to Verilog HDLHardware Description Language (HDL)What is the need for Hardware Description Language?Basic idea is a programming language to describe hardwareModel, Represent, And Simulate Digital HardwareHardware ConcurrencyEdge TransitionsPropagation DelaysTiming ChecksThere are many different HDLsVerilog HDLVHDLABEL

Comparison Between VHDL and VerilogVHDLADA-like verbose syntax.Extensible types and simulation engine Design is composed of entities each of which can have multiple architectures Gate-level, dataflow, and behavioral modeling. Synthesizable subset. Harder to learn and use.

Verilog C-like concise syntax Built-in types and logic representations Design is composed of modules which have just one implementation Gate-level, dataflow, and behavioral modeling. Synthesizable subset. Easy to learn and use, fast simulation.ModuleThe basic unit of description in the Verilog is the module.A module describes the functionality of the design and states the input and output ports.Basic syntax of a module: module module_name(port_list); Declarations: reg,wire,parameter, input,output,inout. Statements: Initial , Always statement Module , Gate instantiation Continuous assignment endmodule

Code FormatVerilog code is free format.Spaces and new lines are served as separators.It is case sensitive.Language keywords use lowercase characters.A comment designator start with // makes the rest of line comment.The symbols /* */ bracket the section of code which is in between as a comment.Operators Logical operators:&& logical AND|| logical OR! logical NOTOperands evaluated to ONE bit value: 0, 1 or xResult is ONE bit value: 0, 1 or xA = 6;A && B 1 && 0 0B = 0;A || !B 1 || 1 1C = x;C || B x || 0 xbut C&&B=0Lexical ConventionsBitwise Operators:

& bitwise AND| bitwise OR~ bitwise NOT^ bitwise XOR~^ or ^~ bitwise XNOROperation on bit by bit basisReduction Operators:

& AND| OR^ XOR~& NAND~| NOR~^ or ^~ XNOROne multi-bit operand One single-bit resulta = 4b1001; ..c = |a; // c = 1|0|0|1 = 1Shift Operators:

>> shift right> 2;// d = 0010c = a greater than< less than>= greater or equal than 0 1b1x1