verilog lab5

Upload: kashif-mehmood

Post on 06-Jul-2018

247 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/17/2019 Verilog Lab5

    1/27

    22-09-07(LAB#5) National University of Computer and Emerging

    Sciences,Islamabad

    1

    Veriolog

    Furqan Farooq

    [email protected]

    This watermark does not appear in the registered version - http://www.clicktoconvert.com

    http://www.clicktoconvert.com/

  • 8/17/2019 Verilog Lab5

    2/27

    22-09-07(LAB#5) National University of Computer and Emerging

    Sciences,Islamabad

    2

    Introduction to Verilog

    This watermark does not appear in the registered version - http://www.clicktoconvert.com

    http://www.clicktoconvert.com/

  • 8/17/2019 Verilog Lab5

    3/27

    22-09-07(LAB#5) National University of Computer and Emerging

    Sciences,Islamabad

    3

    Hardware Descriptive Languages

    l HDL is used to represent and document

    digital systems in a form that can be read

    by both humans and computers and is

    suitable as an exchange language

    between designers.

    This watermark does not appear in the registered version - http://www.clicktoconvert.com

    http://www.clicktoconvert.com/

  • 8/17/2019 Verilog Lab5

    4/27

    22-09-07(LAB#5) National University of Computer and Emerging

    Sciences,Islamabad

    4

    Hardware Description Language

    Major languages:• Verilog

    • Emphasis on practical use (I/O well-defined, ability to record)• Possibly most widely used

    • VHDL• Department of Defense• Emphasis on abstraction

    • Popular in academic circles, Europe; required of defense contr actors

    • System C• Emphasis is “higher -level” simulation – really just a C++ template library

    This watermark does not appear in the registered version - http://www.clicktoconvert.com

    http://www.clicktoconvert.com/

  • 8/17/2019 Verilog Lab5

    5/27

    22-09-07(LAB#5) National University of Computer and Emerging

    Sciences,Islamabad

    5

    Basic Limitation of Verilog

    l Description of digital systems only

    This watermark does not appear in the registered version - http://www.clicktoconvert.com

    http://www.clicktoconvert.com/

  • 8/17/2019 Verilog Lab5

    6/27

    22-09-07(LAB#5) National University of Computer and Emerging

    Sciences,Islamabad

    6

    Abstraction Levels in Verilog

    Behavioral

    Behavioral

    Data Flow

    Data Flow

    Gate

    Gate

    Switch Level

    Switch Level

    Our focus

    RTL

    This watermark does not appear in the registered version - http://www.clicktoconvert.com

    http://www.clicktoconvert.com/

  • 8/17/2019 Verilog Lab5

    7/27

    22-09-07(LAB#5) National University of Computer and Emerging

    Sciences,Islamabad

    7

    Switch level

    l This is the lowest level of abstraction

    provided by Verilog. A module can beimplemented in terms of switches, storage

    nodes, and the interconnections between

    them. Design at this level requires

    knowledge of switch-level implementationdetails.

    This watermark does not appear in the registered version - http://www.clicktoconvert.com

    http://www.clicktoconvert.com/

  • 8/17/2019 Verilog Lab5

    8/27

    22-09-07(LAB#5) National University of Computer and Emerging

    Sciences,Islamabad

    8

    Gate level

    l The module is implemented in terms of

    logic gates and interconnections betweenthese gates. Design at this level is similar to

    describing a design in terms of a gate-level

    logic diagram.

    This watermark does not appear in the registered version - http://www.clicktoconvert.com

    http://www.clicktoconvert.com/

  • 8/17/2019 Verilog Lab5

    9/27

    22-09-07(LAB#5) National University of Computer and Emerging

    Sciences,Islamabad

    9

    Dataflow level

    l  At this level, the module is designed by

    specifying the data flow. The designer is

    aware of how data flows between hardware

    registers and how the data is processed in

    the design.

    This watermark does not appear in the registered version - http://www.clicktoconvert.com

    http://www.clicktoconvert.com/

  • 8/17/2019 Verilog Lab5

    10/27

    22-09-07(LAB#5) National University of Computer and Emerging

    Sciences,Islamabad

    10

    Behavioral or algorithmic level

    l This is the highest level of abstraction

    provided by Verilog HDL. A module can be

    implemented in terms of the desired designalgorithm without concern for the hardware

    implementation details. Designing at this

    level is very similar to C programming.

    This watermark does not appear in the registered version - http://www.clicktoconvert.com

    http://www.clicktoconvert.com/

  • 8/17/2019 Verilog Lab5

    11/27

    22-09-07(LAB#5) National University of Computer and Emerging

    Sciences,Islamabad

    11

    Principal Features of HDL

    l Structurall Concurrent

    This watermark does not appear in the registered version - http://www.clicktoconvert.com

    http://www.clicktoconvert.com/

  • 8/17/2019 Verilog Lab5

    12/27

    22-09-07(LAB#5) National University of Computer and Emerging

    Sciences,Islamabad

    12

    Structural

    • Structural – describe designs as blocks

    connected by signals

    This watermark does not appear in the registered version - http://www.clicktoconvert.com

    http://www.clicktoconvert.com/

  • 8/17/2019 Verilog Lab5

    13/27

    22-09-07(LAB#5) National University of Computer and Emerging

    Sciences,Islamabad

    13

    Concurrent

    l  Concurrent – blocks execute concurrently

    • Requires a “model of computation” to explain

    concurrent behavior 

    This watermark does not appear in the registered version - http://www.clicktoconvert.com

    http://www.clicktoconvert.com/http://www.clicktoconvert.com/

  • 8/17/2019 Verilog Lab5

    14/27

    22-09-07(LAB#5) National University of Computer and Emerging

    Sciences,Islamabad

    14

    Applications

    l Simulation

    l

    Synthesis

    This watermark does not appear in the registered version - http://www.clicktoconvert.com

    //

    http://www.clicktoconvert.com/http://www.clicktoconvert.com/

  • 8/17/2019 Verilog Lab5

    15/27

    22-09-07(LAB#5) National University of Computer and Emerging

    Sciences,Islamabad

    15

    Simulation vs. Synthesis

    l HDLs are used for both simulation and synthesis

    • Simulation: does the design work?

    • Can also be used for “does the design meet timing?”

    • Synthesis: generate a circuit that is equivalent

    • Recognize state and combinational logic

    • Optimize the circuit

    l Not all valid HDL programs are synthesizable

    This watermark does not appear in the registered version - http://www.clicktoconvert.com

    Thi t k d t i th i t d i htt // li kt t

    http://www.clicktoconvert.com/http://www.clicktoconvert.com/

  • 8/17/2019 Verilog Lab5

    16/27

    22-09-07(LAB#5) National University of Computer and Emerging

    Sciences,Islamabad

    16

    Data Values

    • 4-valued logic: 0, 1, x, z

    • 0, 1 – normal binary 0 and 1

    • z – high-impedance value: this is what tri-state buffers drivewhen they are off 

    • x – simulator doesn’t know; sometimes used as “don’t care”

    • At simulation start, all signals have x’s in every bit

    • Unconnected inputs to a module have value ‘z’.

    This watermark does not appear in the registered version - http://www.clicktoconvert.com

    Thi t k d t i th i t d i htt // li kt t

    http://www.clicktoconvert.com/http://www.clicktoconvert.com/

  • 8/17/2019 Verilog Lab5

    17/27

    22-09-07(LAB#5) National University of Computer and Emerging

    Sciences,Islamabad

    17

    Language Rules• Verilog is a case sensitive language (with a few exceptions)

    • Identifiers (space-free sequence of symbols)upper and lower case letters from the alphabet

    digits (0, 1, ..., 9 )underscore ( _ )

    $ symbol (only for system tasks and functions)

    Max length of 1024 symbols

    • Terminate lines with semicolon

    • Single line comments: // A single-line comment goes here

    • Multi-line comments: /* Do not /* nest multi-line comments*/ likethis */

    This watermark does not appear in the registered version - http://www.clicktoconvert.com

    This watermark does not appear in the registered version http://www clicktoconvert com

    http://www.clicktoconvert.com/http://www.clicktoconvert.com/

  • 8/17/2019 Verilog Lab5

    18/27

    22-09-07(LAB#5) National University of Computer and Emerging

    Sciences,Islamabad

    18

    Gate Level Modeling

    This watermark does not appear in the registered version - http://www.clicktoconvert.com

    This watermark does not appear in the registered version http://www clicktoconvert com

    http://www.clicktoconvert.com/http://www.clicktoconvert.com/

  • 8/17/2019 Verilog Lab5

    19/27

    22-09-07(LAB#5) National University of Computer and Emerging

    Sciences,Islamabad

    19

    Example: AND Gate

    This watermark does not appear in the registered version - http://www.clicktoconvert.com

    This watermark does not appear in the registered version http://www clicktoconvert com

    http://www.clicktoconvert.com/http://www.clicktoconvert.com/

  • 8/17/2019 Verilog Lab5

    20/27

    22-09-07(LAB#5) National University of Computer and Emerging

    Sciences,Islamabad

    20

    Example: Half Adder 

    This watermark does not appear in the registered version - http://www.clicktoconvert.com

    This watermark does not appear in the registered version - http://www clicktoconvert com

    http://www.clicktoconvert.com/http://www.clicktoconvert.com/

  • 8/17/2019 Verilog Lab5

    21/27

    22-09-07(LAB#5) National University of Computer and Emerging

    Sciences,Islamabad

    21

    Primitives

    • Verilog primitives encapsulate

    pre-defined functionality of

    common logic gates

    This watermark does not appear in the registered version - http://www.clicktoconvert.com

    This watermark does not appear in the registered version - http://www clicktoconvert com

    http://www.clicktoconvert.com/http://www.clicktoconvert.com/

  • 8/17/2019 Verilog Lab5

    22/27

    22-09-07(LAB#5) National University of Computer and Emerging

    Sciences,Islamabad

    22

    Primitives (Contd.)

    l Verilog has 26 built-inprimitives

    (combinational)

    This watermark does not appear in the registered version http://www.clicktoconvert.com

    This watermark does not appear in the registered version - http://www clicktoconvert com

    http://www.clicktoconvert.com/http://www.clicktoconvert.com/

  • 8/17/2019 Verilog Lab5

    23/27

    22-09-07(LAB#5) National University of Computer and Emerging

    Sciences,Islamabad

    23

    Structural Modeling

    This watermark does not appear in the registered version http://www.clicktoconvert.com

    This watermark does not appear in the registered version - http://www.clicktoconvert.com

    http://www.clicktoconvert.com/http://www.clicktoconvert.com/

  • 8/17/2019 Verilog Lab5

    24/27

    22-09-07(LAB#5) National University of Computer and Emerging

    Sciences,Islamabad

    24

    Design Encapsulation

    • Encapsulate structural and functional detailsin a module

    module my_design (module_ports);... // Declarations of ports go here

    ... // Structural and functional details go here

    endmodule

    • Encapsulation makes the model availablefor instantiation in other modules

    This watermark does not appear in the registered version http://www.clicktoconvert.com

    This watermark does not appear in the registered version - http://www.clicktoconvert.com

    http://www.clicktoconvert.com/http://www.clicktoconvert.com/

  • 8/17/2019 Verilog Lab5

    25/27

    22-09-07(LAB#5) National University of Computer and Emerging

    Sciences,Islamabad

    25

    Example: AND OR INVERT

    pp g p

    This watermark does not appear in the registered version - http://www.clicktoconvert.com

    http://www.clicktoconvert.com/http://www.clicktoconvert.com/

  • 8/17/2019 Verilog Lab5

    26/27

    22-09-07(LAB#5) National University of Computer and Emerging

    Sciences,Islamabad

    26

    ANY QUESTION?????

    pp g p

    This watermark does not appear in the registered version - http://www.clicktoconvert.com

    http://www.clicktoconvert.com/http://www.clicktoconvert.com/

  • 8/17/2019 Verilog Lab5

    27/27

    22-09-07(LAB#5) National University of Computer and Emerging

    Sciences,Islamabad

    27

    Thanks!!!!

    http://www.clicktoconvert.com/