SlideShare a Scribd company logo
1|Page

Notes: Verilog Part 2
4 CHAPTER 4:
4.1 MODULES:



Modules are the basic building blocks of any Verilog code.
A Module in Verilog consists of different parts.
Module Name,
Port List, Port Declarations,
Parameters (Optional),
Declaration of Variables
Instantiation of lower level modules

Data Flow Statements
always and initial blocks.

Tasks and Functions.
endmodule statement.










A Module definition always begins with the keyword module. It should
be duly noted that there must not be any changes in the sequence of
parts mentioned above.
Port List and Port Declarations are present only if the module has any
ports to interact with.
All components except the module, module name and endmodule are
optional.
The five components within the module viz. Declaration of Varibales,
Data Flow Statements, Instantiation of lower level modules, always and
initial blocks and Tasks and Functions can appear in any order.
Verilog allows multiple modules to be defined in any order in a file.
However, nesting of modules (defining one module in another) is
prohibited.

4.2 EXAMPLE: SR LATCH


The SR Latch has S and R as the input ports and Q and Qbar as the
output ports.
The stimulus and the design can be modelled as shown in SR_Latch



Ports provide the interface by which a module can communicate with its
environment. The environment can interact with the module only with
the port.
They are also referred to as terminals.

4.3 PORTS



Notes: Verilog Part-2

Prepared By: Jay Baxi
2|Page

4.4 LIST OF PORTS:






A module definition can optionally have a list of ports. If module does
not need to exchange any signals with the environment, there are no
ports in the list.
In case of a top level module TOP, which has a full adder module
4fulladd. The module 4fulladd takes input a, b, c_in as inputs and
produces sum and c_out as outputs.
The top level module does not need to pass or receive signals. Thus it
does not have a list of ports.

4.5 PORT DECLARATION







All ports in the list of ports must be declared in the module.
They can be input (input port), output (output port) or inout port
(bidirectional port).
By default these ports are declared as wire.
However, if output holds their value, they must be declared as reg.
For example, in D_FF, when q was supposed to retain its value after a
clock edge.
Ports of input and inout cannot be declared as reg because reg variables
are supposed to store values and input ports should not store values but
simply reflect the changes in the external signals they are connected to.
(ERROR)

Internal
External
Inputs
net
reg/net
Outputs
reg/net
reg
Inouts
net
net
 Width Matching: It is legal to connect internal and external items of
different sizes when making inter-module port connections. A warning is
usually displayed that widths do not match.
 Unconnected ports: Verilog allows the ports to remain unconnected. For
ports that are used only for debugging, it can be remained unconnected.
The module, in this case can be instantiated by
4fulladd(SUM, , A, B, C_in) // port C_out is unconnected

4.6 CONNECTING PORTS TO EXTERNAL SIGNALS


Notes: Verilog Part-2

There are two methods to connect ports to external signals
1.) Connecting Ports by ordered lists:
The signals to be connected must appear in the module instantiation in the
same order as the ports in the port list in the module definition
2.) Connecting Ports by name:
For large modules, it is not feasible to remember the order of each port.
Hence, in those cases, Verilog provides connecting external signals to ports
by the port names.

Prepared By: Jay Baxi
3|Page

5 CHAPTER 5:
5.1 TRUTH TABLES OF LOGIC GATES
5.1.1

5.1.2

5.1.3

5.1.4

5.1.5

AND Gate
AND
0
1
X
Z

0
0
0
0
0

1
0
1
X
X

X
0
X
X
X

Z
0
X
X
X

OR Gate
OR
0
1
X
Z

0
0
1
X
X

1
1
1
1
1

X
X
1
X
X

Z
X
1
X
X

NAND Gate
NAND
0
1
X
Z

0
1
1
1
1

1
1
0
X
X

X
1
X
X
X

Z
1
X
X
X

NOR Gate
NOR
0
1
X
Z

0
1
0
X
X

1
0
0
0
0

X
X
0
X
X

Z
X
0
X
X

XOR Gate
XOR
0
1
X
Z

0
0
1
X
X

1
1
0
X
X

X
X
X
X
X

Z
X
X
X
X

Notes: Verilog Part-2

Prepared By: Jay Baxi
4|Page
5.1.6

5.1.7

XNOR Gate
XNOR
0
1
X
Z

0
1
0
X
X

1
0
1
X
X

Z
X
X
X
X

BUF Gate and NOT Gate
In
0
1
X
Z

5.1.8

X
X
X
X
X

BUF
0
1
X
X

NOT
1
0
X
X

BUFif and NOTif



The BUFif and NOTif are the gates that propagate only if their control
signal is asserted. They propagate Z if the signal is deasserted.
These signals are used when a signal is driven only when the control
signal is asserted, this is a case when multiple drivers drive the signal
//Instantiation of gates
bufif1 b1 (out, in, ctrl);
bufif0 b0 (out, in, ctrl);
notif1 n1(out, in, ctrl);
notif0 n0(out, in, ctrl);



The Truth Tables of these gates are given as follows

Bufif1
0
1
X
Z

0
Z
Z
Z
Z

1
0
1
X
X

X
L
H
X
X

Z
L
H
X
X

Bufif0
0
1
X
Z

0
0
1
X
Z

1
Z
Z
Z
Z

X
L
H
X
X

Z
L
H
X
X

Notif1
0
1
X
Z

0
Z
Z
Z
Z

1
1
0
X
X

X
H
L
X
X

Z
H
L
X
X

Notes: Verilog Part-2

Prepared By: Jay Baxi
5|Page
Notif0
0
1
X
Z
5.1.9

0
1
0
X
X

Array of Instances


1
Z
Z
Z
Z

X
H
L
X
X

Z
H
L
X
X

For situations when there are more than one instances required, Verilog
allows us to create array of instances where each instance differs from
other just by the index.

5.1.10 Examples:
5.1.10.1 Gate Level Multiplexer
 We will design a 4-to-1 Mux with 2 select signals. Using the basic logic gates the logic
diagram of a 4-to-1 Mux is given as follows

 The Verilog modules for the same are given in Multiplexer
5.1.10.2 4-bit Ripple Carry Adder
 A 4-bit full adder can be created from four 1-bit FA. The Verilog modules for the same is
given in Full Adder.

5.2 GATE DELAYS




Rise delay is when a delay is experienced while transition from 0, X or Z to 1.
Fall delay is when a delay is experienced while transition from 1, X or Z to 0.
Turn off delay is associated with a gate output transition to high impedance
(Z) value from another value.

Notes: Verilog Part-2

Prepared By: Jay Baxi
6|Page




Notes: Verilog Part-2

Min value: The minimum value of delay, the designer expects to have.
Max value: The maximum value of delay, the designer expects to have.
Typ value: The typical value of delay, the designer expects to have.

Prepared By: Jay Baxi

More Related Content

What's hot

Notes part5
Notes part5Notes part5
C programming session7
C programming  session7C programming  session7
C programming session7
Keroles karam khalil
 
C programming session8
C programming  session8C programming  session8
C programming session8
Keroles karam khalil
 
C programming session3
C programming  session3C programming  session3
C programming session3
Keroles karam khalil
 
C programming session6
C programming  session6C programming  session6
C programming session6
Keroles karam khalil
 
Microcontroller lec 3
Microcontroller  lec 3Microcontroller  lec 3
Microcontroller lec 3
Ibrahim Reda
 
FPGA training session generic package and funtions of VHDL by Digitronix Nepal
FPGA training session generic package and funtions of VHDL by Digitronix NepalFPGA training session generic package and funtions of VHDL by Digitronix Nepal
FPGA training session generic package and funtions of VHDL by Digitronix Nepal
Krishna Gaihre
 
Basic structure of c programming
Basic structure of c programmingBasic structure of c programming
Basic structure of c programming
TejaswiB4
 
C programming session10
C programming  session10C programming  session10
C programming session10
Keroles karam khalil
 
04 control structures 1
04 control structures 104 control structures 1
04 control structures 1Jomel Penalba
 
Operators used in vb.net
Operators used in vb.netOperators used in vb.net
Operators used in vb.net
Jaya Kumari
 
Control structures ii
Control structures ii Control structures ii
Control structures ii
Ahmad Idrees
 
Quiz 9
Quiz 9Quiz 9
Embedded c
Embedded cEmbedded c
Embedded c
Nandan Desai
 
Symbolic Execution (introduction and hands-on)
Symbolic Execution (introduction and hands-on)Symbolic Execution (introduction and hands-on)
Symbolic Execution (introduction and hands-on)
Emilio Coppa
 
Ch10 Program Organization
Ch10 Program OrganizationCh10 Program Organization
Ch10 Program Organization
SzeChingChen
 
Recursive Function
Recursive FunctionRecursive Function
Recursive Function
Harsh Pathak
 
Ch4 Expressions
Ch4 ExpressionsCh4 Expressions
Ch4 Expressions
SzeChingChen
 

What's hot (20)

Notes part5
Notes part5Notes part5
Notes part5
 
C programming session7
C programming  session7C programming  session7
C programming session7
 
PM1
PM1PM1
PM1
 
C programming session8
C programming  session8C programming  session8
C programming session8
 
C programming session3
C programming  session3C programming  session3
C programming session3
 
C programming session6
C programming  session6C programming  session6
C programming session6
 
Hd6
Hd6Hd6
Hd6
 
Microcontroller lec 3
Microcontroller  lec 3Microcontroller  lec 3
Microcontroller lec 3
 
FPGA training session generic package and funtions of VHDL by Digitronix Nepal
FPGA training session generic package and funtions of VHDL by Digitronix NepalFPGA training session generic package and funtions of VHDL by Digitronix Nepal
FPGA training session generic package and funtions of VHDL by Digitronix Nepal
 
Basic structure of c programming
Basic structure of c programmingBasic structure of c programming
Basic structure of c programming
 
C programming session10
C programming  session10C programming  session10
C programming session10
 
04 control structures 1
04 control structures 104 control structures 1
04 control structures 1
 
Operators used in vb.net
Operators used in vb.netOperators used in vb.net
Operators used in vb.net
 
Control structures ii
Control structures ii Control structures ii
Control structures ii
 
Quiz 9
Quiz 9Quiz 9
Quiz 9
 
Embedded c
Embedded cEmbedded c
Embedded c
 
Symbolic Execution (introduction and hands-on)
Symbolic Execution (introduction and hands-on)Symbolic Execution (introduction and hands-on)
Symbolic Execution (introduction and hands-on)
 
Ch10 Program Organization
Ch10 Program OrganizationCh10 Program Organization
Ch10 Program Organization
 
Recursive Function
Recursive FunctionRecursive Function
Recursive Function
 
Ch4 Expressions
Ch4 ExpressionsCh4 Expressions
Ch4 Expressions
 

Viewers also liked

Radiation Hardening by Design
Radiation Hardening by DesignRadiation Hardening by Design
Radiation Hardening by Design
Jay Baxi
 
Functions and tasks in verilog
Functions and tasks in verilogFunctions and tasks in verilog
Functions and tasks in verilog
Nallapati Anindra
 
Seminar: Fabrication and Characteristics of CMOS
Seminar: Fabrication and Characteristics of CMOSSeminar: Fabrication and Characteristics of CMOS
Seminar: Fabrication and Characteristics of CMOSJay Baxi
 
Designing of fifo and serial peripheral interface protocol using Verilog HDL
Designing of fifo and serial peripheral interface protocol using Verilog HDLDesigning of fifo and serial peripheral interface protocol using Verilog HDL
Designing of fifo and serial peripheral interface protocol using Verilog HDL
Jay Baxi
 
First Year Basic Electronics Notes VTU Syllabus 2014 Scheme
First Year Basic Electronics Notes VTU Syllabus 2014 SchemeFirst Year Basic Electronics Notes VTU Syllabus 2014 Scheme
First Year Basic Electronics Notes VTU Syllabus 2014 Scheme
BMS Institute of Technology and Management
 
Web design and development cs506 handouts
Web design and development   cs506 handoutsWeb design and development   cs506 handouts
Web design and development cs506 handouts
Sohaib Danish
 
4Sem VTU-HDL Programming Notes-Unit1-Introduction
4Sem VTU-HDL Programming Notes-Unit1-Introduction4Sem VTU-HDL Programming Notes-Unit1-Introduction
4Sem VTU-HDL Programming Notes-Unit1-Introduction
Dr. Shivananda Koteshwar
 
Fundamentals of HDL (first 4 chapters only) - Godse
Fundamentals of HDL (first 4 chapters only) - GodseFundamentals of HDL (first 4 chapters only) - Godse
Fundamentals of HDL (first 4 chapters only) - Godse
Hammam
 
MOSFETs (10EC63) Notes for Electronics & Communication Engineering Students o...
MOSFETs (10EC63) Notes for Electronics & Communication Engineering Students o...MOSFETs (10EC63) Notes for Electronics & Communication Engineering Students o...
MOSFETs (10EC63) Notes for Electronics & Communication Engineering Students o...
Hanumantha Raju
 
Verilog codes and testbench codes for basic digital electronic circuits.
Verilog codes and testbench codes for basic digital electronic circuits. Verilog codes and testbench codes for basic digital electronic circuits.
Verilog codes and testbench codes for basic digital electronic circuits.
shobhan pujari
 
Microelectronic Circuits Notes (10EC63) by Dr. M. C. Hanumantharaju of BMS In...
Microelectronic Circuits Notes (10EC63) by Dr. M. C. Hanumantharaju of BMS In...Microelectronic Circuits Notes (10EC63) by Dr. M. C. Hanumantharaju of BMS In...
Microelectronic Circuits Notes (10EC63) by Dr. M. C. Hanumantharaju of BMS In...
BMS Institute of Technology and Management
 
Microelectronic Circuits (10EC63) Notes for Visvesvaraya Technological Univer...
Microelectronic Circuits (10EC63) Notes for Visvesvaraya Technological Univer...Microelectronic Circuits (10EC63) Notes for Visvesvaraya Technological Univer...
Microelectronic Circuits (10EC63) Notes for Visvesvaraya Technological Univer...
BMS Institute of Technology and Management
 
Embedded System Design Notes written by Arun Kumar G, Associate Professor, De...
Embedded System Design Notes written by Arun Kumar G, Associate Professor, De...Embedded System Design Notes written by Arun Kumar G, Associate Professor, De...
Embedded System Design Notes written by Arun Kumar G, Associate Professor, De...
Arunkumar Gowdru
 
Operating system concepts (notes)
Operating system concepts (notes)Operating system concepts (notes)
Operating system concepts (notes)Sohaib Danish
 
Embedded systems class notes
Embedded systems  class notes Embedded systems  class notes
Embedded systems class notes
Dr.YNM
 

Viewers also liked (15)

Radiation Hardening by Design
Radiation Hardening by DesignRadiation Hardening by Design
Radiation Hardening by Design
 
Functions and tasks in verilog
Functions and tasks in verilogFunctions and tasks in verilog
Functions and tasks in verilog
 
Seminar: Fabrication and Characteristics of CMOS
Seminar: Fabrication and Characteristics of CMOSSeminar: Fabrication and Characteristics of CMOS
Seminar: Fabrication and Characteristics of CMOS
 
Designing of fifo and serial peripheral interface protocol using Verilog HDL
Designing of fifo and serial peripheral interface protocol using Verilog HDLDesigning of fifo and serial peripheral interface protocol using Verilog HDL
Designing of fifo and serial peripheral interface protocol using Verilog HDL
 
First Year Basic Electronics Notes VTU Syllabus 2014 Scheme
First Year Basic Electronics Notes VTU Syllabus 2014 SchemeFirst Year Basic Electronics Notes VTU Syllabus 2014 Scheme
First Year Basic Electronics Notes VTU Syllabus 2014 Scheme
 
Web design and development cs506 handouts
Web design and development   cs506 handoutsWeb design and development   cs506 handouts
Web design and development cs506 handouts
 
4Sem VTU-HDL Programming Notes-Unit1-Introduction
4Sem VTU-HDL Programming Notes-Unit1-Introduction4Sem VTU-HDL Programming Notes-Unit1-Introduction
4Sem VTU-HDL Programming Notes-Unit1-Introduction
 
Fundamentals of HDL (first 4 chapters only) - Godse
Fundamentals of HDL (first 4 chapters only) - GodseFundamentals of HDL (first 4 chapters only) - Godse
Fundamentals of HDL (first 4 chapters only) - Godse
 
MOSFETs (10EC63) Notes for Electronics & Communication Engineering Students o...
MOSFETs (10EC63) Notes for Electronics & Communication Engineering Students o...MOSFETs (10EC63) Notes for Electronics & Communication Engineering Students o...
MOSFETs (10EC63) Notes for Electronics & Communication Engineering Students o...
 
Verilog codes and testbench codes for basic digital electronic circuits.
Verilog codes and testbench codes for basic digital electronic circuits. Verilog codes and testbench codes for basic digital electronic circuits.
Verilog codes and testbench codes for basic digital electronic circuits.
 
Microelectronic Circuits Notes (10EC63) by Dr. M. C. Hanumantharaju of BMS In...
Microelectronic Circuits Notes (10EC63) by Dr. M. C. Hanumantharaju of BMS In...Microelectronic Circuits Notes (10EC63) by Dr. M. C. Hanumantharaju of BMS In...
Microelectronic Circuits Notes (10EC63) by Dr. M. C. Hanumantharaju of BMS In...
 
Microelectronic Circuits (10EC63) Notes for Visvesvaraya Technological Univer...
Microelectronic Circuits (10EC63) Notes for Visvesvaraya Technological Univer...Microelectronic Circuits (10EC63) Notes for Visvesvaraya Technological Univer...
Microelectronic Circuits (10EC63) Notes for Visvesvaraya Technological Univer...
 
Embedded System Design Notes written by Arun Kumar G, Associate Professor, De...
Embedded System Design Notes written by Arun Kumar G, Associate Professor, De...Embedded System Design Notes written by Arun Kumar G, Associate Professor, De...
Embedded System Design Notes written by Arun Kumar G, Associate Professor, De...
 
Operating system concepts (notes)
Operating system concepts (notes)Operating system concepts (notes)
Operating system concepts (notes)
 
Embedded systems class notes
Embedded systems  class notes Embedded systems  class notes
Embedded systems class notes
 

Similar to Notes: Verilog Part 2 - Modules and Ports - Structural Modeling (Gate-Level Modeling)

Modules and ports in Verilog HDL
Modules and ports in Verilog HDLModules and ports in Verilog HDL
Modules and ports in Verilog HDL
anand hd
 
VHDL- gate level modelling
VHDL- gate level modellingVHDL- gate level modelling
VHDL- gate level modelling
VandanaPagar1
 
1.5 Legal Labels in Verilog areSystem Verilog extends it and al.pdf
1.5 Legal Labels in Verilog areSystem Verilog extends it and al.pdf1.5 Legal Labels in Verilog areSystem Verilog extends it and al.pdf
1.5 Legal Labels in Verilog areSystem Verilog extends it and al.pdf
ankit482504
 
vlsi introduction to hdl and its typesunit-1.pptx
vlsi introduction to hdl and its typesunit-1.pptxvlsi introduction to hdl and its typesunit-1.pptx
vlsi introduction to hdl and its typesunit-1.pptx
iconicyt2
 
Verilog
VerilogVerilog
Verilog
Mohamed Rayan
 
Verilog_ppt.pdf
Verilog_ppt.pdfVerilog_ppt.pdf
Verilog_ppt.pdf
ApurbaDebnath8
 
Fpga 07-port-rules-gate-delay-data-flow-carry-look-ahead-adder
Fpga 07-port-rules-gate-delay-data-flow-carry-look-ahead-adderFpga 07-port-rules-gate-delay-data-flow-carry-look-ahead-adder
Fpga 07-port-rules-gate-delay-data-flow-carry-look-ahead-adderMalik Tauqir Hasan
 
Basics of digital verilog design(alok singh kanpur)
Basics of digital verilog design(alok singh kanpur)Basics of digital verilog design(alok singh kanpur)
Basics of digital verilog design(alok singh kanpur)
Alok Singh
 
VLSI & E-CAD Lab Manual
VLSI & E-CAD Lab ManualVLSI & E-CAD Lab Manual
VLSI & E-CAD Lab Manual
Amairullah Khan Lodhi
 
e CAD lab manual
e CAD lab manuale CAD lab manual
e CAD lab manual
Amairullah Khan Lodhi
 
Gate level design -For beginners
Gate level design -For beginnersGate level design -For beginners
Gate level design -For beginners
Dr.YNM
 
Introduction to VHDL
Introduction to VHDLIntroduction to VHDL
Introduction to VHDL
Yaser Kalifa
 
Ccnp labs
Ccnp labsCcnp labs
Ccnp labs
Marat Makulov
 
verilog
verilogverilog
Ccnp3 lab 3_5_en (hacer)
Ccnp3 lab 3_5_en (hacer)Ccnp3 lab 3_5_en (hacer)
Ccnp3 lab 3_5_en (hacer)
Omar Herrera
 
Practical file
Practical filePractical file
Practical file
rajeevkr35
 
CSCI 2121- Computer Organization and Assembly Language Labor.docx
CSCI 2121- Computer Organization and Assembly Language Labor.docxCSCI 2121- Computer Organization and Assembly Language Labor.docx
CSCI 2121- Computer Organization and Assembly Language Labor.docx
annettsparrow
 
Kroening et al, v2c a verilog to c translator
Kroening et al, v2c   a verilog to c translatorKroening et al, v2c   a verilog to c translator
Kroening et al, v2c a verilog to c translator
sce,bhopal
 
Assic 6th Lecture
Assic 6th LectureAssic 6th Lecture
Assic 6th Lecture
babak danyal
 

Similar to Notes: Verilog Part 2 - Modules and Ports - Structural Modeling (Gate-Level Modeling) (20)

Modules and ports in Verilog HDL
Modules and ports in Verilog HDLModules and ports in Verilog HDL
Modules and ports in Verilog HDL
 
VHDL- gate level modelling
VHDL- gate level modellingVHDL- gate level modelling
VHDL- gate level modelling
 
1.5 Legal Labels in Verilog areSystem Verilog extends it and al.pdf
1.5 Legal Labels in Verilog areSystem Verilog extends it and al.pdf1.5 Legal Labels in Verilog areSystem Verilog extends it and al.pdf
1.5 Legal Labels in Verilog areSystem Verilog extends it and al.pdf
 
vlsi introduction to hdl and its typesunit-1.pptx
vlsi introduction to hdl and its typesunit-1.pptxvlsi introduction to hdl and its typesunit-1.pptx
vlsi introduction to hdl and its typesunit-1.pptx
 
Verilog
VerilogVerilog
Verilog
 
Verilog_ppt.pdf
Verilog_ppt.pdfVerilog_ppt.pdf
Verilog_ppt.pdf
 
Fpga 04-verilog-programming
Fpga 04-verilog-programmingFpga 04-verilog-programming
Fpga 04-verilog-programming
 
Fpga 07-port-rules-gate-delay-data-flow-carry-look-ahead-adder
Fpga 07-port-rules-gate-delay-data-flow-carry-look-ahead-adderFpga 07-port-rules-gate-delay-data-flow-carry-look-ahead-adder
Fpga 07-port-rules-gate-delay-data-flow-carry-look-ahead-adder
 
Basics of digital verilog design(alok singh kanpur)
Basics of digital verilog design(alok singh kanpur)Basics of digital verilog design(alok singh kanpur)
Basics of digital verilog design(alok singh kanpur)
 
VLSI & E-CAD Lab Manual
VLSI & E-CAD Lab ManualVLSI & E-CAD Lab Manual
VLSI & E-CAD Lab Manual
 
e CAD lab manual
e CAD lab manuale CAD lab manual
e CAD lab manual
 
Gate level design -For beginners
Gate level design -For beginnersGate level design -For beginners
Gate level design -For beginners
 
Introduction to VHDL
Introduction to VHDLIntroduction to VHDL
Introduction to VHDL
 
Ccnp labs
Ccnp labsCcnp labs
Ccnp labs
 
verilog
verilogverilog
verilog
 
Ccnp3 lab 3_5_en (hacer)
Ccnp3 lab 3_5_en (hacer)Ccnp3 lab 3_5_en (hacer)
Ccnp3 lab 3_5_en (hacer)
 
Practical file
Practical filePractical file
Practical file
 
CSCI 2121- Computer Organization and Assembly Language Labor.docx
CSCI 2121- Computer Organization and Assembly Language Labor.docxCSCI 2121- Computer Organization and Assembly Language Labor.docx
CSCI 2121- Computer Organization and Assembly Language Labor.docx
 
Kroening et al, v2c a verilog to c translator
Kroening et al, v2c   a verilog to c translatorKroening et al, v2c   a verilog to c translator
Kroening et al, v2c a verilog to c translator
 
Assic 6th Lecture
Assic 6th LectureAssic 6th Lecture
Assic 6th Lecture
 

Recently uploaded

The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 

Recently uploaded (20)

The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 

Notes: Verilog Part 2 - Modules and Ports - Structural Modeling (Gate-Level Modeling)

  • 1. 1|Page Notes: Verilog Part 2 4 CHAPTER 4: 4.1 MODULES:   Modules are the basic building blocks of any Verilog code. A Module in Verilog consists of different parts. Module Name, Port List, Port Declarations, Parameters (Optional), Declaration of Variables Instantiation of lower level modules Data Flow Statements always and initial blocks. Tasks and Functions. endmodule statement.       A Module definition always begins with the keyword module. It should be duly noted that there must not be any changes in the sequence of parts mentioned above. Port List and Port Declarations are present only if the module has any ports to interact with. All components except the module, module name and endmodule are optional. The five components within the module viz. Declaration of Varibales, Data Flow Statements, Instantiation of lower level modules, always and initial blocks and Tasks and Functions can appear in any order. Verilog allows multiple modules to be defined in any order in a file. However, nesting of modules (defining one module in another) is prohibited. 4.2 EXAMPLE: SR LATCH  The SR Latch has S and R as the input ports and Q and Qbar as the output ports. The stimulus and the design can be modelled as shown in SR_Latch  Ports provide the interface by which a module can communicate with its environment. The environment can interact with the module only with the port. They are also referred to as terminals. 4.3 PORTS  Notes: Verilog Part-2 Prepared By: Jay Baxi
  • 2. 2|Page 4.4 LIST OF PORTS:    A module definition can optionally have a list of ports. If module does not need to exchange any signals with the environment, there are no ports in the list. In case of a top level module TOP, which has a full adder module 4fulladd. The module 4fulladd takes input a, b, c_in as inputs and produces sum and c_out as outputs. The top level module does not need to pass or receive signals. Thus it does not have a list of ports. 4.5 PORT DECLARATION       All ports in the list of ports must be declared in the module. They can be input (input port), output (output port) or inout port (bidirectional port). By default these ports are declared as wire. However, if output holds their value, they must be declared as reg. For example, in D_FF, when q was supposed to retain its value after a clock edge. Ports of input and inout cannot be declared as reg because reg variables are supposed to store values and input ports should not store values but simply reflect the changes in the external signals they are connected to. (ERROR) Internal External Inputs net reg/net Outputs reg/net reg Inouts net net  Width Matching: It is legal to connect internal and external items of different sizes when making inter-module port connections. A warning is usually displayed that widths do not match.  Unconnected ports: Verilog allows the ports to remain unconnected. For ports that are used only for debugging, it can be remained unconnected. The module, in this case can be instantiated by 4fulladd(SUM, , A, B, C_in) // port C_out is unconnected 4.6 CONNECTING PORTS TO EXTERNAL SIGNALS  Notes: Verilog Part-2 There are two methods to connect ports to external signals 1.) Connecting Ports by ordered lists: The signals to be connected must appear in the module instantiation in the same order as the ports in the port list in the module definition 2.) Connecting Ports by name: For large modules, it is not feasible to remember the order of each port. Hence, in those cases, Verilog provides connecting external signals to ports by the port names. Prepared By: Jay Baxi
  • 3. 3|Page 5 CHAPTER 5: 5.1 TRUTH TABLES OF LOGIC GATES 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 AND Gate AND 0 1 X Z 0 0 0 0 0 1 0 1 X X X 0 X X X Z 0 X X X OR Gate OR 0 1 X Z 0 0 1 X X 1 1 1 1 1 X X 1 X X Z X 1 X X NAND Gate NAND 0 1 X Z 0 1 1 1 1 1 1 0 X X X 1 X X X Z 1 X X X NOR Gate NOR 0 1 X Z 0 1 0 X X 1 0 0 0 0 X X 0 X X Z X 0 X X XOR Gate XOR 0 1 X Z 0 0 1 X X 1 1 0 X X X X X X X Z X X X X Notes: Verilog Part-2 Prepared By: Jay Baxi
  • 4. 4|Page 5.1.6 5.1.7 XNOR Gate XNOR 0 1 X Z 0 1 0 X X 1 0 1 X X Z X X X X BUF Gate and NOT Gate In 0 1 X Z 5.1.8 X X X X X BUF 0 1 X X NOT 1 0 X X BUFif and NOTif   The BUFif and NOTif are the gates that propagate only if their control signal is asserted. They propagate Z if the signal is deasserted. These signals are used when a signal is driven only when the control signal is asserted, this is a case when multiple drivers drive the signal //Instantiation of gates bufif1 b1 (out, in, ctrl); bufif0 b0 (out, in, ctrl); notif1 n1(out, in, ctrl); notif0 n0(out, in, ctrl);  The Truth Tables of these gates are given as follows Bufif1 0 1 X Z 0 Z Z Z Z 1 0 1 X X X L H X X Z L H X X Bufif0 0 1 X Z 0 0 1 X Z 1 Z Z Z Z X L H X X Z L H X X Notif1 0 1 X Z 0 Z Z Z Z 1 1 0 X X X H L X X Z H L X X Notes: Verilog Part-2 Prepared By: Jay Baxi
  • 5. 5|Page Notif0 0 1 X Z 5.1.9 0 1 0 X X Array of Instances  1 Z Z Z Z X H L X X Z H L X X For situations when there are more than one instances required, Verilog allows us to create array of instances where each instance differs from other just by the index. 5.1.10 Examples: 5.1.10.1 Gate Level Multiplexer  We will design a 4-to-1 Mux with 2 select signals. Using the basic logic gates the logic diagram of a 4-to-1 Mux is given as follows  The Verilog modules for the same are given in Multiplexer 5.1.10.2 4-bit Ripple Carry Adder  A 4-bit full adder can be created from four 1-bit FA. The Verilog modules for the same is given in Full Adder. 5.2 GATE DELAYS    Rise delay is when a delay is experienced while transition from 0, X or Z to 1. Fall delay is when a delay is experienced while transition from 1, X or Z to 0. Turn off delay is associated with a gate output transition to high impedance (Z) value from another value. Notes: Verilog Part-2 Prepared By: Jay Baxi
  • 6. 6|Page    Notes: Verilog Part-2 Min value: The minimum value of delay, the designer expects to have. Max value: The maximum value of delay, the designer expects to have. Typ value: The typical value of delay, the designer expects to have. Prepared By: Jay Baxi