SlideShare a Scribd company logo
1 of 23
Verilog HDL
Gookyi Dennis A. N.
(dennisgookyi@gmail.com)
May.27.2014
Contents
 Module Modeling Styles
 Modules
 Structural Modeling
 Dataflow Modeling
 Behavioral Modeling
 Mixed-Style Modeling
 Simulation
 Basic Simulation Constructs
 Related Compiler Directive and System Tasks
2
Modules
 A Verilog HDL module consist of two major parts:
The interface
The internal (body)
 Block diagram of a full adder is shown below
3
The Interface: Port Declaration
 The interface signals can be grouped into one of the
following three types: input, output or inout
 A complete interface can be divided into three parts: port
list, port declaration and data type declaration
4
Port Declaration
 The declaration of a port and its associated data type can
be combined into a single line as below:
 Port list, port declaration and their associated data types
can be put into a single list. This is called port list
declaration or ANSI C style
5
Port Connections
 Two methods are used to connect ports to external
signals:
Named association: ports to be connected to external signals
are specified by listing their names. The order of the ports is
not important
Positional association: the signals to be connected must have
the same order as in the port list. All unconnected ports are
left blank
 The two methods cannot be mixed
6
Port Connections
7
Modeling the Internal of a Module
 The internal or body can be modeled using one of the
following styles:
Structural Style
Gate level
Switch level
Dataflow Style
Behavioral Style
Mixed Style
RTL = Behavioral + Dataflow Styles
8
Structural Modeling
 Structural modeling of a design is by connecting required
instantiations of built-in primitives, user defined primitives
or other modules through nets
 Structural style is one way to model a complex digital
system in a hierarchical manner
9
Structural Modeling
10
Dataflow Modeling
 The module is described by specifying the data flow
between registers and how the data is processed
 This is done through a set of continuous assignment
statements
 A continuous assignment starts with the keyword assign
and has a syntax as below:
assign [delay] l_value = expression;
11
Dataflow Modeling
 The block diagram of a full adder is shown below:
12
Waveform
13
Behavioral Modeling
 The module is described in terms of the desired design
algorithm without concerning the hardware
implementation details
 The module uses procedural constructs: initial and always
14
Mixed modeling
 The design is described in terms of the mixing of the
previous styles
 It is most commonly used in modeling large designs
 Register-Transfer level (RTL) is usually used in industry to
mean the combination of behavioral and dataflow
constructs
 Below is a full adder constructed with basic logic gates:
15
Mixed modeling
16
Simulation
 For a design to be useful, it must be verified to make sure
that it can operate according to the requirement
 Two basic simulation structures are available in Verilog:
The first is to take the UUT as an instantiated module in the
stimulus module
The second considers both stimulus block and UUT as the
separate instantiated module at the top-level module
17
Related Compiler Directives:
`timescale Directive
 In simulations, we need to specify the physical unit of
measure
 This is accomplished using:
`timescale time_unit/time_precision
 time unit : This is the time to be used as one unit for all
the delays used in the design.
 time precision : This represents the minimum delay which
needs to be considered during simulation or it decides
that how many decimal point would be used with the time
unit.
18
`timescale Directive
 Code
 Waveform
19
`timescale Directive
 Code
 Waveform
20
A Complete Testbench
 Block diagram
21
A Complete Testbench
22
Waveform
23

More Related Content

What's hot

Decoder for digital electronics
Decoder for digital electronicsDecoder for digital electronics
Decoder for digital electronics
IIT, KANPUR INDIA
 
Verilog tutorial
Verilog tutorialVerilog tutorial
Verilog tutorial
Abhiraj Bohra
 
Decoders
DecodersDecoders
Decoders
Re Man
 
Memory interfacing
Memory interfacingMemory interfacing
Memory interfacing
mahalakshmimalini
 

What's hot (20)

Verilog operators.pptx
Verilog  operators.pptxVerilog  operators.pptx
Verilog operators.pptx
 
Combinational circuit
Combinational circuitCombinational circuit
Combinational circuit
 
Verilog data types -For beginners
Verilog data types -For beginnersVerilog data types -For beginners
Verilog data types -For beginners
 
Multiplexers
MultiplexersMultiplexers
Multiplexers
 
Combinational Logic with MSI and LSI
Combinational Logic with MSI and LSICombinational Logic with MSI and LSI
Combinational Logic with MSI and LSI
 
VHDL- gate level modelling
VHDL- gate level modellingVHDL- gate level modelling
VHDL- gate level modelling
 
Latches and flip flop
Latches and flip flopLatches and flip flop
Latches and flip flop
 
Verilog VHDL code Decoder and Encoder
Verilog VHDL code Decoder and EncoderVerilog VHDL code Decoder and Encoder
Verilog VHDL code Decoder and Encoder
 
Decoder for digital electronics
Decoder for digital electronicsDecoder for digital electronics
Decoder for digital electronics
 
Encoder & Decoder
Encoder & DecoderEncoder & Decoder
Encoder & Decoder
 
Ripple Carry Adder
Ripple Carry AdderRipple Carry Adder
Ripple Carry Adder
 
Combinational Circuits & Sequential Circuits
Combinational Circuits & Sequential CircuitsCombinational Circuits & Sequential Circuits
Combinational Circuits & Sequential Circuits
 
Verilog tutorial
Verilog tutorialVerilog tutorial
Verilog tutorial
 
Switch level modeling
Switch level modelingSwitch level modeling
Switch level modeling
 
Encoders and decoders
Encoders and decodersEncoders and decoders
Encoders and decoders
 
Decoders
DecodersDecoders
Decoders
 
Encoder
EncoderEncoder
Encoder
 
4 bit uni shift reg
4 bit uni shift reg4 bit uni shift reg
4 bit uni shift reg
 
Modules and ports in Verilog HDL
Modules and ports in Verilog HDLModules and ports in Verilog HDL
Modules and ports in Verilog HDL
 
Memory interfacing
Memory interfacingMemory interfacing
Memory interfacing
 

Viewers also liked

Lecture 2 verilog
Lecture 2   verilogLecture 2   verilog
Lecture 2 verilog
venravi10
 
Verilog Lecture5 hust 2014
Verilog Lecture5 hust 2014Verilog Lecture5 hust 2014
Verilog Lecture5 hust 2014
Béo Tú
 
Experiment write-vhdl-code-for-realize-all-logic-gates
Experiment write-vhdl-code-for-realize-all-logic-gatesExperiment write-vhdl-code-for-realize-all-logic-gates
Experiment write-vhdl-code-for-realize-all-logic-gates
Ricardo Castro
 

Viewers also liked (20)

Verilog Lecture1
Verilog Lecture1Verilog Lecture1
Verilog Lecture1
 
Lecture 2 verilog
Lecture 2   verilogLecture 2   verilog
Lecture 2 verilog
 
Verilog
VerilogVerilog
Verilog
 
Verilog tutorial
Verilog tutorialVerilog tutorial
Verilog tutorial
 
Verilog Lecture5 hust 2014
Verilog Lecture5 hust 2014Verilog Lecture5 hust 2014
Verilog Lecture5 hust 2014
 
Short.course.introduction.to.vhdl for beginners
Short.course.introduction.to.vhdl for beginners Short.course.introduction.to.vhdl for beginners
Short.course.introduction.to.vhdl for beginners
 
Description
DescriptionDescription
Description
 
vhdl
vhdlvhdl
vhdl
 
Tutorial: Formal Methods for Hardware Verification - Overview and Application...
Tutorial: Formal Methods for Hardware Verification - Overview and Application...Tutorial: Formal Methods for Hardware Verification - Overview and Application...
Tutorial: Formal Methods for Hardware Verification - Overview and Application...
 
Fpga
FpgaFpga
Fpga
 
Delays in verilog
Delays in verilogDelays in verilog
Delays in verilog
 
Verilog
VerilogVerilog
Verilog
 
Verilogforlab
VerilogforlabVerilogforlab
Verilogforlab
 
Synthesizing HDL using LeonardoSpectrum
Synthesizing HDL using LeonardoSpectrumSynthesizing HDL using LeonardoSpectrum
Synthesizing HDL using LeonardoSpectrum
 
verilog code for logic gates
verilog code for logic gatesverilog code for logic gates
verilog code for logic gates
 
Verilog overview
Verilog overviewVerilog overview
Verilog overview
 
Verilog hdl
Verilog hdlVerilog hdl
Verilog hdl
 
Experiment write-vhdl-code-for-realize-all-logic-gates
Experiment write-vhdl-code-for-realize-all-logic-gatesExperiment write-vhdl-code-for-realize-all-logic-gates
Experiment write-vhdl-code-for-realize-all-logic-gates
 
Verilog 語法教學
Verilog 語法教學 Verilog 語法教學
Verilog 語法教學
 
What is FPGA?
What is FPGA?What is FPGA?
What is FPGA?
 

Similar to Verilog hdl

Ece iv-fundamentals of hdl [10 ec45]-notes
Ece iv-fundamentals of hdl [10 ec45]-notesEce iv-fundamentals of hdl [10 ec45]-notes
Ece iv-fundamentals of hdl [10 ec45]-notes
siddu kadiwal
 
2004 snug-boston-presentation system-verilog_fifo_channel
2004 snug-boston-presentation system-verilog_fifo_channel2004 snug-boston-presentation system-verilog_fifo_channel
2004 snug-boston-presentation system-verilog_fifo_channel
AkhilReddy Sankati
 
Chapter 04 the processor
Chapter 04   the processorChapter 04   the processor
Chapter 04 the processor
Bảo Hoang
 
Hierachical structural modeling
Hierachical structural modelingHierachical structural modeling
Hierachical structural modeling
dennis gookyi
 

Similar to Verilog hdl (20)

Ece iv-fundamentals of hdl [10 ec45]-notes
Ece iv-fundamentals of hdl [10 ec45]-notesEce iv-fundamentals of hdl [10 ec45]-notes
Ece iv-fundamentals of hdl [10 ec45]-notes
 
Chapter 01
Chapter 01Chapter 01
Chapter 01
 
Designmethodology1
Designmethodology1Designmethodology1
Designmethodology1
 
VHDL lecture 1.ppt
VHDL lecture 1.pptVHDL lecture 1.ppt
VHDL lecture 1.ppt
 
DSD
DSDDSD
DSD
 
Introduction to iec 61131 3
Introduction to iec 61131 3Introduction to iec 61131 3
Introduction to iec 61131 3
 
slide8.ppt
slide8.pptslide8.ppt
slide8.ppt
 
Hardware Description Language
Hardware Description Language Hardware Description Language
Hardware Description Language
 
2004 snug-boston-presentation system-verilog_fifo_channel
2004 snug-boston-presentation system-verilog_fifo_channel2004 snug-boston-presentation system-verilog_fifo_channel
2004 snug-boston-presentation system-verilog_fifo_channel
 
Chapter 04 the processor
Chapter 04   the processorChapter 04   the processor
Chapter 04 the processor
 
Floating point ALU using VHDL implemented on FPGA
Floating point ALU using VHDL implemented on FPGAFloating point ALU using VHDL implemented on FPGA
Floating point ALU using VHDL implemented on FPGA
 
03 Synthesis (1).ppt
03 Synthesis  (1).ppt03 Synthesis  (1).ppt
03 Synthesis (1).ppt
 
Wi Fi documantation
Wi Fi documantationWi Fi documantation
Wi Fi documantation
 
Design and Implementation of HDLC Controller by Using Crc-16
Design and Implementation of HDLC Controller by Using Crc-16Design and Implementation of HDLC Controller by Using Crc-16
Design and Implementation of HDLC Controller by Using Crc-16
 
Mini Project- ROM Based Sine Wave Generator
Mini Project- ROM Based Sine Wave GeneratorMini Project- ROM Based Sine Wave Generator
Mini Project- ROM Based Sine Wave Generator
 
SE2018_Lec 16_ Architectural Design
SE2018_Lec 16_ Architectural DesignSE2018_Lec 16_ Architectural Design
SE2018_Lec 16_ Architectural Design
 
IMPLEMENTATION OF USER INTERFACE FOR MICROPROCESSOR TRAINER
IMPLEMENTATION OF USER INTERFACE FOR MICROPROCESSOR TRAINER IMPLEMENTATION OF USER INTERFACE FOR MICROPROCESSOR TRAINER
IMPLEMENTATION OF USER INTERFACE FOR MICROPROCESSOR TRAINER
 
Short.course.introduction.to.vhdl
Short.course.introduction.to.vhdlShort.course.introduction.to.vhdl
Short.course.introduction.to.vhdl
 
Hierachical structural modeling
Hierachical structural modelingHierachical structural modeling
Hierachical structural modeling
 
Fpga implementation of a functional microcontroller
Fpga implementation of a functional microcontrollerFpga implementation of a functional microcontroller
Fpga implementation of a functional microcontroller
 

More from dennis gookyi

Finite state machines
Finite state machinesFinite state machines
Finite state machines
dennis gookyi
 

More from dennis gookyi (18)

Verilog hdl design examples
Verilog hdl design examplesVerilog hdl design examples
Verilog hdl design examples
 
Wishbone tutorials
Wishbone tutorialsWishbone tutorials
Wishbone tutorials
 
Verilog HDL Verification
Verilog HDL VerificationVerilog HDL Verification
Verilog HDL Verification
 
Synthesis
SynthesisSynthesis
Synthesis
 
System design methodology
System design methodologySystem design methodology
System design methodology
 
Wishbone classic bus cycle
Wishbone classic bus cycleWishbone classic bus cycle
Wishbone classic bus cycle
 
Design options for digital systems
Design options for digital systemsDesign options for digital systems
Design options for digital systems
 
Wishbone interface and bus cycles
Wishbone interface and bus cyclesWishbone interface and bus cycles
Wishbone interface and bus cycles
 
Encoder decoder
Encoder decoderEncoder decoder
Encoder decoder
 
Advanced modeling techniques
Advanced modeling techniquesAdvanced modeling techniques
Advanced modeling techniques
 
4 bit add sub
4 bit add sub4 bit add sub
4 bit add sub
 
Behavioral modeling
Behavioral modelingBehavioral modeling
Behavioral modeling
 
Biosensors
BiosensorsBiosensors
Biosensors
 
structural modeling, hazards
structural modeling, hazardsstructural modeling, hazards
structural modeling, hazards
 
Finite state machines
Finite state machinesFinite state machines
Finite state machines
 
test generation
test generationtest generation
test generation
 
faults in digital systems
faults in digital systemsfaults in digital systems
faults in digital systems
 
basic concepts of reliability
basic concepts of reliabilitybasic concepts of reliability
basic concepts of reliability
 

Recently uploaded

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

Recently uploaded (20)

SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 

Verilog hdl

  • 1. Verilog HDL Gookyi Dennis A. N. (dennisgookyi@gmail.com) May.27.2014
  • 2. Contents  Module Modeling Styles  Modules  Structural Modeling  Dataflow Modeling  Behavioral Modeling  Mixed-Style Modeling  Simulation  Basic Simulation Constructs  Related Compiler Directive and System Tasks 2
  • 3. Modules  A Verilog HDL module consist of two major parts: The interface The internal (body)  Block diagram of a full adder is shown below 3
  • 4. The Interface: Port Declaration  The interface signals can be grouped into one of the following three types: input, output or inout  A complete interface can be divided into three parts: port list, port declaration and data type declaration 4
  • 5. Port Declaration  The declaration of a port and its associated data type can be combined into a single line as below:  Port list, port declaration and their associated data types can be put into a single list. This is called port list declaration or ANSI C style 5
  • 6. Port Connections  Two methods are used to connect ports to external signals: Named association: ports to be connected to external signals are specified by listing their names. The order of the ports is not important Positional association: the signals to be connected must have the same order as in the port list. All unconnected ports are left blank  The two methods cannot be mixed 6
  • 8. Modeling the Internal of a Module  The internal or body can be modeled using one of the following styles: Structural Style Gate level Switch level Dataflow Style Behavioral Style Mixed Style RTL = Behavioral + Dataflow Styles 8
  • 9. Structural Modeling  Structural modeling of a design is by connecting required instantiations of built-in primitives, user defined primitives or other modules through nets  Structural style is one way to model a complex digital system in a hierarchical manner 9
  • 11. Dataflow Modeling  The module is described by specifying the data flow between registers and how the data is processed  This is done through a set of continuous assignment statements  A continuous assignment starts with the keyword assign and has a syntax as below: assign [delay] l_value = expression; 11
  • 12. Dataflow Modeling  The block diagram of a full adder is shown below: 12
  • 14. Behavioral Modeling  The module is described in terms of the desired design algorithm without concerning the hardware implementation details  The module uses procedural constructs: initial and always 14
  • 15. Mixed modeling  The design is described in terms of the mixing of the previous styles  It is most commonly used in modeling large designs  Register-Transfer level (RTL) is usually used in industry to mean the combination of behavioral and dataflow constructs  Below is a full adder constructed with basic logic gates: 15
  • 17. Simulation  For a design to be useful, it must be verified to make sure that it can operate according to the requirement  Two basic simulation structures are available in Verilog: The first is to take the UUT as an instantiated module in the stimulus module The second considers both stimulus block and UUT as the separate instantiated module at the top-level module 17
  • 18. Related Compiler Directives: `timescale Directive  In simulations, we need to specify the physical unit of measure  This is accomplished using: `timescale time_unit/time_precision  time unit : This is the time to be used as one unit for all the delays used in the design.  time precision : This represents the minimum delay which needs to be considered during simulation or it decides that how many decimal point would be used with the time unit. 18
  • 21. A Complete Testbench  Block diagram 21