SlideShare a Scribd company logo
1 of 25
Digital Design Using Verilog -For Absolute Beginners
LECTURE5 : VERILOG DATA TYPES
Introduction
•Verilog is a powerful HDL used to design & verify
the digital systems.
•So, to describe the hardware of a system several
types of data variables are required.
•For ex; to describe a signal, its type must be
specified , like bit type , which means that the signal
can have only either 0 or 1, or type std _ logic, in
which the signal can be assigned a value out of four
possible values which include 0, 1, unknown(x) and
high impedance (z) .
VERILOG-DATA TYPES
• There are two important data types: (i).the variable
data types and (ii). net data types.
• These two groups differ in the way that they are
assigned and hold values.They also represent
different hardware structures.
• The net data types shall represent physical
connections between structural entities, such as
gates.
• A net shall not store a value (except for the trireg
net). Instead, its value shall be determined by the
values of its drivers, such as a continuous
assignment or a gate.21 June 2020 3yayavaram@yahoo.com
Declaration of ‘net’
• Nets are declared by the predefined word ‘wire’.
Nets have values that change continuously by the
circuits that are driving them.
• Verilog supports four values for nets. They are
21 June 2020 4yayavaram@yahoo.com
contd
• Examples of net types are
wire a;
wire sum;
wire S1 = 1’b0; similarly wire S2= 4’b0101
• The second statement declares a net by the name
sum.
• The third statement declares a net by the name of
S1 ; its initial value is 1’b0, which represents 1 bit
with value 0.
• Similarly ,initial value of S2 is 4 bit with value 0101
21 June 2020 5yayavaram@yahoo.com
contd
• A wire does not store its value. It must be driven in
one of two ways:
(i).By connecting the wire to the output of a gate or
module
(ii).By assigning a value to the wire in a continuous
assignment.
wire y :
assign y = a & b;
21 June 2020 6yayavaram@yahoo.com
Contd
• By default Nets are 1-bit values. But it can be a
vector also.
• For ex: wire [31:0]bus ; Here the size of the bus is
32 bit vector and it is a wire type.
• All unconnected nets are set to ‘z’.(High impedance)
• Also wire is always input , for standard
interconnection.
• Nets are used to model connections between
continuous assignments and instantiations.
21 June 2020 7yayavaram@yahoo.com
Example
module mymux2_1(A,B,S,Y);
//Port declaration
output y;
input A,B,S;
//internal variable declarations
Wire S1,A1,B1;
not (S1,S);
and1 (A1,A,S1);
and2 (B1,B,S);
Or(Y,A1,B1);
endmodule21 June 2020 8yayavaram@yahoo.com
contd
• In the example, S, A1,B1 are declared as Wire.
• Because they denote the interconnections and they
are continuously driven by NOT,AND1 and AND2
gates.
• By default they assume bit values.(either o or 1).
21 June 2020 9yayavaram@yahoo.com
Different Net Types
• Verilog supports different net types for synthesis.
They are
i. wire
ii. wor (wired or)
iii.Wand (wired and)
iv.Tri (tristate)
v.supply0 (gnd)
vi.supply1 (Vdd).
• Here wire and Tri state serve the same purpose.
• s.
21 June 2020 10yayavaram@yahoo.com
contd
• The net types wire and tri shall be identical in their
syntax and functions;
• Two names are provided so that the name of a net
can indicate the purpose of the net in that model.
• A wire net can be used for nets that are driven by a
single gate or continuous assignment.
• The tri net type can be used where multiple drivers
drive a net..
21 June 2020 11yayavaram@yahoo.com
Different Types of Nets.
• wor /wand inserts an or/and gate at the connection as
shown below.
• Suppose we have a connection shown below.
• The simulator will give an error .
• So, if we use wand (wired and)
the synthesis tool during synthesis
will add an add gate as shown below.
Similarly ,if wor is used an or gate is added at the
connection,which solves the conflict.
• s.21 June 2020 12yayavaram@yahoo.com
Different Net Types
• wired and(wand circuit) wired or (wor circuit)
• s.
21 June 2020 13yayavaram@yahoo.com
Ex: Supply 0 & Supply1
21 June 2020 14yayavaram@yahoo.com
• Normally, the during the synthesis, the tool will
consider Supply0 as ground and Supply1 as Vdd.
• Let us consider an example.
module supply_ex(A,B,C,Y);
input A,B,C;
output Y;
wire t1,t2;
supply0 gnd;
supply1 Vdd;
contd
21 June 2020 15yayavaram@yahoo.com
nand1(t1,Vdd,A,B);
X-or2(t2,C, gnd);
and3(Y,t1,t2);
endmodule
So, the tool during the synthesis, will treat the
supply0 as ground and Supply1 as Vdd.
REGISTER(Reg)
• Register, in contrast to nets, stores values until they
are updated. Register, as its name suggests,
represents data-storage elements. Register is
declared by the predefined word reg.
• Verilog supports four values shown below, for
register
21 June 2020 16yayavaram@yahoo.com
contd
• Different register types are supported by Verilog for
Synthesis.
• Reg (register)
• integer
• General rule of thumb is,reg is used to model actual
hardware registers such as Counters, Accumulators
etc.
• Integer is used for situations like loop counting.
• By default the size of the register is bit
• Ex: reg x,y21 June 2020 17yayavaram@yahoo.com
VECTORS
• Vectors are multiple bits. A register or a net can be
declared as a vector.
• Vectors are declared by brackets [ ].
• Examples of vectors are:
• wire [31:0] a = 32’b1010;
• reg [7:0] total = 8’d12;
• The first statement declares a net a. It has 32 bits,
and its initial value is 00…1010 (b stands for bit).
The second statement declares a register total.
• Its size is eight bits, and its value is decimal 12 (d
stands for decimal).21 June 2020 18yayavaram@yahoo.com
Real
• Floating point values are denoted by Real.
• These Real (floating-point) numbers are declared
with the predefined word ‘ real ‘.
• Examples of real values are 2.4, 56.3, and 5e12 (
• The value 5e12 is equal to 5 × 1012.
• The following statement declares the register weight
as real:
• real weight;
21 June 2020 19yayavaram@yahoo.com
Parameter
• A parameter represents constant value symbolically.
• The definition for a parameter consists of the
parameter name and the value assigned to it.
• The value can be any constant-valued integer or
Boolean expression.
• If you do not set the size of the parameter with a
range definition or a sized constant, the parameter
is unsized and by default it is a 32-bit quantity
21 June 2020 20yayavaram@yahoo.com
Example
module my_comp1 (X, Y, xgty, xlty, xeqy);
parameter N = 3;
input [N:0] X, Y;
output xgty, xlty, xeqy;
wire [N:0] sum, Y;
To change the size of the inputs x and y, the size of
the nets sum, and the size of net Y to eight bits, the
value of N is changed to seven as:
• parameter N = 7
21 June 2020 21yayavaram@yahoo.com
ARRAYS
Verilog, in contrast to VHDL, does not have a predefined
word for array.
• Registers and integers can be written as arrays. For
example:
• parameter N = 4;
• parameter M = 3;
• reg signed [M:0] carry [0:N];
• The above statements declare an array by the name
carry. The array carry has five elements, and each
element is four bits. The four bits are in two’s
complement form. For example, if the value of a certain
element is 1001, then it is equivalent to decimal –7.21 June 2020 22yayavaram@yahoo.com
Time-variable
21 June 2020 23yayavaram@yahoo.com
• A time variable is used for storing and
manipulating simulation time quantities in
situations where timing checks are required and
for diagnostics and debugging purposes.
• This data type is typically used in conjunction
with the $time system function.
INTEGERS
21 June 2020 24yayavaram@yahoo.com
• An integer is a general-purpose variable used for
manipulating quantities that are not regarded as
hardware registers i.e for loops-indicies,
parameters, and constants.
• They are of implicitly of type reg. However they
store data as signed numbers whereas explicitly
declared reg types store them as unsigned.
• The default size of Integer is 32-bits.
• If they hold constants, the synthesis tool will
adjusts them to the minimum width needed at
compilation.
contd
• An integer declaration uses the integer keyword and
specifies a list of variables.
• integer a, b; //two integers
• integer c [1:10]; // an array of integers.
• integer data; // integer
• integer i, j, k; // multiple integers
• An integer is a general purpose 32-bit variable.
Operations on it are assumed to be two's
complement and the most significant bit indicates
the sign.
21 June 2020 25yayavaram@yahoo.com

More Related Content

What's hot

VHDL- gate level modelling
VHDL- gate level modellingVHDL- gate level modelling
VHDL- gate level modellingVandanaPagar1
 
Verilog Lecture1
Verilog Lecture1Verilog Lecture1
Verilog Lecture1Béo Tú
 
Session 9 advance_verification_features
Session 9 advance_verification_featuresSession 9 advance_verification_features
Session 9 advance_verification_featuresNirav Desai
 
Verilog operators.pptx
Verilog  operators.pptxVerilog  operators.pptx
Verilog operators.pptxVandanaPagar1
 
Sv data types and sv interface usage in uvm
Sv data types and sv interface usage in uvmSv data types and sv interface usage in uvm
Sv data types and sv interface usage in uvmHARINATH REDDY
 
Uvm presentation dac2011_final
Uvm presentation dac2011_finalUvm presentation dac2011_final
Uvm presentation dac2011_finalsean chen
 
Verilog Tutorial - Verilog HDL Tutorial with Examples
Verilog Tutorial - Verilog HDL Tutorial with ExamplesVerilog Tutorial - Verilog HDL Tutorial with Examples
Verilog Tutorial - Verilog HDL Tutorial with ExamplesE2MATRIX
 
UVM Methodology Tutorial
UVM Methodology TutorialUVM Methodology Tutorial
UVM Methodology TutorialArrow Devices
 
Synchronous and asynchronous clock
Synchronous and asynchronous clockSynchronous and asynchronous clock
Synchronous and asynchronous clockNallapati Anindra
 
Introduction to System verilog
Introduction to System verilog Introduction to System verilog
Introduction to System verilog Pushpa Yakkala
 
APB protocol v1.0
APB protocol v1.0APB protocol v1.0
APB protocol v1.0Azad Mishra
 
Verilog Test Bench
Verilog Test BenchVerilog Test Bench
Verilog Test BenchDr.YNM
 
System verilog coverage
System verilog coverageSystem verilog coverage
System verilog coveragePushpa Yakkala
 

What's hot (20)

Verilog HDL
Verilog HDLVerilog HDL
Verilog HDL
 
VHDL- gate level modelling
VHDL- gate level modellingVHDL- gate level modelling
VHDL- gate level modelling
 
UVM TUTORIAL;
UVM TUTORIAL;UVM TUTORIAL;
UVM TUTORIAL;
 
Verilog Lecture1
Verilog Lecture1Verilog Lecture1
Verilog Lecture1
 
AMBA Ahb 2.0
AMBA Ahb 2.0AMBA Ahb 2.0
AMBA Ahb 2.0
 
Session 9 advance_verification_features
Session 9 advance_verification_featuresSession 9 advance_verification_features
Session 9 advance_verification_features
 
Verilog hdl
Verilog hdlVerilog hdl
Verilog hdl
 
Introduction to FPGAs
Introduction to FPGAsIntroduction to FPGAs
Introduction to FPGAs
 
Verilog operators.pptx
Verilog  operators.pptxVerilog  operators.pptx
Verilog operators.pptx
 
Sv data types and sv interface usage in uvm
Sv data types and sv interface usage in uvmSv data types and sv interface usage in uvm
Sv data types and sv interface usage in uvm
 
Uvm presentation dac2011_final
Uvm presentation dac2011_finalUvm presentation dac2011_final
Uvm presentation dac2011_final
 
Verilog Tutorial - Verilog HDL Tutorial with Examples
Verilog Tutorial - Verilog HDL Tutorial with ExamplesVerilog Tutorial - Verilog HDL Tutorial with Examples
Verilog Tutorial - Verilog HDL Tutorial with Examples
 
UVM Methodology Tutorial
UVM Methodology TutorialUVM Methodology Tutorial
UVM Methodology Tutorial
 
Synchronous and asynchronous clock
Synchronous and asynchronous clockSynchronous and asynchronous clock
Synchronous and asynchronous clock
 
Introduction to System verilog
Introduction to System verilog Introduction to System verilog
Introduction to System verilog
 
I2C Protocol
I2C ProtocolI2C Protocol
I2C Protocol
 
APB protocol v1.0
APB protocol v1.0APB protocol v1.0
APB protocol v1.0
 
Verilog Test Bench
Verilog Test BenchVerilog Test Bench
Verilog Test Bench
 
dual-port RAM (DPRAM)
dual-port RAM (DPRAM)dual-port RAM (DPRAM)
dual-port RAM (DPRAM)
 
System verilog coverage
System verilog coverageSystem verilog coverage
System verilog coverage
 

Similar to Verilog data types -For beginners

Verilog Final Probe'22.pptx
Verilog Final Probe'22.pptxVerilog Final Probe'22.pptx
Verilog Final Probe'22.pptxSyedAzim6
 
Data flow model -Lecture-4
Data flow model -Lecture-4Data flow model -Lecture-4
Data flow model -Lecture-4Dr.YNM
 
Chapter 4:Object-Oriented Basic Concepts
Chapter 4:Object-Oriented Basic ConceptsChapter 4:Object-Oriented Basic Concepts
Chapter 4:Object-Oriented Basic ConceptsIt Academy
 
System Verilog Tutorial - VHDL
System Verilog Tutorial - VHDLSystem Verilog Tutorial - VHDL
System Verilog Tutorial - VHDLE2MATRIX
 
Identifiers, keywords and types
Identifiers, keywords and typesIdentifiers, keywords and types
Identifiers, keywords and typesDaman Toor
 
Pj01 3-java-variable and data types
Pj01 3-java-variable and data typesPj01 3-java-variable and data types
Pj01 3-java-variable and data typesSasidharaRaoMarrapu
 
Basic elements of java
Basic elements of java Basic elements of java
Basic elements of java Ahmad Idrees
 
FP 201 Unit 2 - Part 2
FP 201 Unit 2 - Part 2FP 201 Unit 2 - Part 2
FP 201 Unit 2 - Part 2rohassanie
 
Core Java Basics
Core Java BasicsCore Java Basics
Core Java Basicsmhtspvtltd
 
PRESENTATION ON DATA STRUCTURE AND THEIR TYPE
PRESENTATION ON DATA STRUCTURE AND THEIR TYPEPRESENTATION ON DATA STRUCTURE AND THEIR TYPE
PRESENTATION ON DATA STRUCTURE AND THEIR TYPEnikhilcse1
 
456589.-Compiler-Design-Code-Generation (1).ppt
456589.-Compiler-Design-Code-Generation (1).ppt456589.-Compiler-Design-Code-Generation (1).ppt
456589.-Compiler-Design-Code-Generation (1).pptMohibKhan79
 

Similar to Verilog data types -For beginners (20)

C programming
C programming C programming
C programming
 
Verilog Final Probe'22.pptx
Verilog Final Probe'22.pptxVerilog Final Probe'22.pptx
Verilog Final Probe'22.pptx
 
Verilog
VerilogVerilog
Verilog
 
Aspdot
AspdotAspdot
Aspdot
 
Data flow model -Lecture-4
Data flow model -Lecture-4Data flow model -Lecture-4
Data flow model -Lecture-4
 
Chapter 4:Object-Oriented Basic Concepts
Chapter 4:Object-Oriented Basic ConceptsChapter 4:Object-Oriented Basic Concepts
Chapter 4:Object-Oriented Basic Concepts
 
Verilog HDL
Verilog HDL Verilog HDL
Verilog HDL
 
System Verilog Tutorial - VHDL
System Verilog Tutorial - VHDLSystem Verilog Tutorial - VHDL
System Verilog Tutorial - VHDL
 
Identifiers, keywords and types
Identifiers, keywords and typesIdentifiers, keywords and types
Identifiers, keywords and types
 
DDUV.pdf
DDUV.pdfDDUV.pdf
DDUV.pdf
 
Chapter 2 java
Chapter 2 javaChapter 2 java
Chapter 2 java
 
DLD5.pdf
DLD5.pdfDLD5.pdf
DLD5.pdf
 
Pj01 3-java-variable and data types
Pj01 3-java-variable and data typesPj01 3-java-variable and data types
Pj01 3-java-variable and data types
 
Basic elements of java
Basic elements of java Basic elements of java
Basic elements of java
 
FP 201 Unit 2 - Part 2
FP 201 Unit 2 - Part 2FP 201 Unit 2 - Part 2
FP 201 Unit 2 - Part 2
 
Core Java Basics
Core Java BasicsCore Java Basics
Core Java Basics
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
PRESENTATION ON DATA STRUCTURE AND THEIR TYPE
PRESENTATION ON DATA STRUCTURE AND THEIR TYPEPRESENTATION ON DATA STRUCTURE AND THEIR TYPE
PRESENTATION ON DATA STRUCTURE AND THEIR TYPE
 
456589.-Compiler-Design-Code-Generation (1).ppt
456589.-Compiler-Design-Code-Generation (1).ppt456589.-Compiler-Design-Code-Generation (1).ppt
456589.-Compiler-Design-Code-Generation (1).ppt
 
C++ ch2
C++ ch2C++ ch2
C++ ch2
 

More from Dr.YNM

Introduction to DSP.ppt
Introduction to DSP.pptIntroduction to DSP.ppt
Introduction to DSP.pptDr.YNM
 
Atmel.ppt
Atmel.pptAtmel.ppt
Atmel.pptDr.YNM
 
PIC Microcontrollers.ppt
PIC Microcontrollers.pptPIC Microcontrollers.ppt
PIC Microcontrollers.pptDr.YNM
 
Crystalstructure-.ppt
Crystalstructure-.pptCrystalstructure-.ppt
Crystalstructure-.pptDr.YNM
 
Basics of OS & RTOS.ppt
Basics of OS & RTOS.pptBasics of OS & RTOS.ppt
Basics of OS & RTOS.pptDr.YNM
 
Introducion to MSP430 Microcontroller.pptx
Introducion to MSP430 Microcontroller.pptxIntroducion to MSP430 Microcontroller.pptx
Introducion to MSP430 Microcontroller.pptxDr.YNM
 
Microcontroller-8051.ppt
Microcontroller-8051.pptMicrocontroller-8051.ppt
Microcontroller-8051.pptDr.YNM
 
Introduction to ASICs.pptx
Introduction to ASICs.pptxIntroduction to ASICs.pptx
Introduction to ASICs.pptxDr.YNM
 
VHDL-PRESENTATION.ppt
VHDL-PRESENTATION.pptVHDL-PRESENTATION.ppt
VHDL-PRESENTATION.pptDr.YNM
 
Basics of data communications.pptx
Basics of data communications.pptxBasics of data communications.pptx
Basics of data communications.pptxDr.YNM
 
CPLD & FPGA Architectures and applictionsplications.pptx
CPLD & FPGA Architectures and applictionsplications.pptxCPLD & FPGA Architectures and applictionsplications.pptx
CPLD & FPGA Architectures and applictionsplications.pptxDr.YNM
 
Transient response of RC , RL circuits with step input
Transient response of RC , RL circuits  with step inputTransient response of RC , RL circuits  with step input
Transient response of RC , RL circuits with step inputDr.YNM
 
CISC & RISC ARCHITECTURES
CISC & RISC ARCHITECTURESCISC & RISC ARCHITECTURES
CISC & RISC ARCHITECTURESDr.YNM
 
Lect 4 ARM PROCESSOR ARCHITECTURE
Lect 4 ARM PROCESSOR ARCHITECTURELect 4 ARM PROCESSOR ARCHITECTURE
Lect 4 ARM PROCESSOR ARCHITECTUREDr.YNM
 
Lect 3 ARM PROCESSOR ARCHITECTURE
Lect 3  ARM PROCESSOR ARCHITECTURE Lect 3  ARM PROCESSOR ARCHITECTURE
Lect 3 ARM PROCESSOR ARCHITECTURE Dr.YNM
 
Microprocessor Architecture 4
Microprocessor Architecture  4Microprocessor Architecture  4
Microprocessor Architecture 4Dr.YNM
 
Lect 2 ARM processor architecture
Lect 2 ARM processor architectureLect 2 ARM processor architecture
Lect 2 ARM processor architectureDr.YNM
 
Microprocessor Architecture-III
Microprocessor Architecture-IIIMicroprocessor Architecture-III
Microprocessor Architecture-IIIDr.YNM
 
LECT 1: ARM PROCESSORS
LECT 1: ARM PROCESSORSLECT 1: ARM PROCESSORS
LECT 1: ARM PROCESSORSDr.YNM
 
Microprocessor architecture II
Microprocessor architecture   IIMicroprocessor architecture   II
Microprocessor architecture IIDr.YNM
 

More from Dr.YNM (20)

Introduction to DSP.ppt
Introduction to DSP.pptIntroduction to DSP.ppt
Introduction to DSP.ppt
 
Atmel.ppt
Atmel.pptAtmel.ppt
Atmel.ppt
 
PIC Microcontrollers.ppt
PIC Microcontrollers.pptPIC Microcontrollers.ppt
PIC Microcontrollers.ppt
 
Crystalstructure-.ppt
Crystalstructure-.pptCrystalstructure-.ppt
Crystalstructure-.ppt
 
Basics of OS & RTOS.ppt
Basics of OS & RTOS.pptBasics of OS & RTOS.ppt
Basics of OS & RTOS.ppt
 
Introducion to MSP430 Microcontroller.pptx
Introducion to MSP430 Microcontroller.pptxIntroducion to MSP430 Microcontroller.pptx
Introducion to MSP430 Microcontroller.pptx
 
Microcontroller-8051.ppt
Microcontroller-8051.pptMicrocontroller-8051.ppt
Microcontroller-8051.ppt
 
Introduction to ASICs.pptx
Introduction to ASICs.pptxIntroduction to ASICs.pptx
Introduction to ASICs.pptx
 
VHDL-PRESENTATION.ppt
VHDL-PRESENTATION.pptVHDL-PRESENTATION.ppt
VHDL-PRESENTATION.ppt
 
Basics of data communications.pptx
Basics of data communications.pptxBasics of data communications.pptx
Basics of data communications.pptx
 
CPLD & FPGA Architectures and applictionsplications.pptx
CPLD & FPGA Architectures and applictionsplications.pptxCPLD & FPGA Architectures and applictionsplications.pptx
CPLD & FPGA Architectures and applictionsplications.pptx
 
Transient response of RC , RL circuits with step input
Transient response of RC , RL circuits  with step inputTransient response of RC , RL circuits  with step input
Transient response of RC , RL circuits with step input
 
CISC & RISC ARCHITECTURES
CISC & RISC ARCHITECTURESCISC & RISC ARCHITECTURES
CISC & RISC ARCHITECTURES
 
Lect 4 ARM PROCESSOR ARCHITECTURE
Lect 4 ARM PROCESSOR ARCHITECTURELect 4 ARM PROCESSOR ARCHITECTURE
Lect 4 ARM PROCESSOR ARCHITECTURE
 
Lect 3 ARM PROCESSOR ARCHITECTURE
Lect 3  ARM PROCESSOR ARCHITECTURE Lect 3  ARM PROCESSOR ARCHITECTURE
Lect 3 ARM PROCESSOR ARCHITECTURE
 
Microprocessor Architecture 4
Microprocessor Architecture  4Microprocessor Architecture  4
Microprocessor Architecture 4
 
Lect 2 ARM processor architecture
Lect 2 ARM processor architectureLect 2 ARM processor architecture
Lect 2 ARM processor architecture
 
Microprocessor Architecture-III
Microprocessor Architecture-IIIMicroprocessor Architecture-III
Microprocessor Architecture-III
 
LECT 1: ARM PROCESSORS
LECT 1: ARM PROCESSORSLECT 1: ARM PROCESSORS
LECT 1: ARM PROCESSORS
 
Microprocessor architecture II
Microprocessor architecture   IIMicroprocessor architecture   II
Microprocessor architecture II
 

Recently uploaded

Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...121011101441
 
Vishratwadi & Ghorpadi Bridge Tender documents
Vishratwadi & Ghorpadi Bridge Tender documentsVishratwadi & Ghorpadi Bridge Tender documents
Vishratwadi & Ghorpadi Bridge Tender documentsSachinPawar510423
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catcherssdickerson1
 
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgUnit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgsaravananr517913
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)Dr SOUNDIRARAJ N
 
Industrial Safety Unit-I SAFETY TERMINOLOGIES
Industrial Safety Unit-I SAFETY TERMINOLOGIESIndustrial Safety Unit-I SAFETY TERMINOLOGIES
Industrial Safety Unit-I SAFETY TERMINOLOGIESNarmatha D
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
home automation using Arduino by Aditya Prasad
home automation using Arduino by Aditya Prasadhome automation using Arduino by Aditya Prasad
home automation using Arduino by Aditya Prasadaditya806802
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
The SRE Report 2024 - Great Findings for the teams
The SRE Report 2024 - Great Findings for the teamsThe SRE Report 2024 - Great Findings for the teams
The SRE Report 2024 - Great Findings for the teamsDILIPKUMARMONDAL6
 
Research Methodology for Engineering pdf
Research Methodology for Engineering pdfResearch Methodology for Engineering pdf
Research Methodology for Engineering pdfCaalaaAbdulkerim
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating SystemRashmi Bhat
 
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONTHE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONjhunlian
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptSAURABHKUMAR892774
 
Energy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxEnergy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxsiddharthjain2303
 

Recently uploaded (20)

Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...
 
Vishratwadi & Ghorpadi Bridge Tender documents
Vishratwadi & Ghorpadi Bridge Tender documentsVishratwadi & Ghorpadi Bridge Tender documents
Vishratwadi & Ghorpadi Bridge Tender documents
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
 
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgUnit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
 
Industrial Safety Unit-I SAFETY TERMINOLOGIES
Industrial Safety Unit-I SAFETY TERMINOLOGIESIndustrial Safety Unit-I SAFETY TERMINOLOGIES
Industrial Safety Unit-I SAFETY TERMINOLOGIES
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
home automation using Arduino by Aditya Prasad
home automation using Arduino by Aditya Prasadhome automation using Arduino by Aditya Prasad
home automation using Arduino by Aditya Prasad
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
The SRE Report 2024 - Great Findings for the teams
The SRE Report 2024 - Great Findings for the teamsThe SRE Report 2024 - Great Findings for the teams
The SRE Report 2024 - Great Findings for the teams
 
Research Methodology for Engineering pdf
Research Methodology for Engineering pdfResearch Methodology for Engineering pdf
Research Methodology for Engineering pdf
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating System
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONTHE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
 
Energy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxEnergy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptx
 

Verilog data types -For beginners

  • 1. Digital Design Using Verilog -For Absolute Beginners LECTURE5 : VERILOG DATA TYPES
  • 2. Introduction •Verilog is a powerful HDL used to design & verify the digital systems. •So, to describe the hardware of a system several types of data variables are required. •For ex; to describe a signal, its type must be specified , like bit type , which means that the signal can have only either 0 or 1, or type std _ logic, in which the signal can be assigned a value out of four possible values which include 0, 1, unknown(x) and high impedance (z) .
  • 3. VERILOG-DATA TYPES • There are two important data types: (i).the variable data types and (ii). net data types. • These two groups differ in the way that they are assigned and hold values.They also represent different hardware structures. • The net data types shall represent physical connections between structural entities, such as gates. • A net shall not store a value (except for the trireg net). Instead, its value shall be determined by the values of its drivers, such as a continuous assignment or a gate.21 June 2020 3yayavaram@yahoo.com
  • 4. Declaration of ‘net’ • Nets are declared by the predefined word ‘wire’. Nets have values that change continuously by the circuits that are driving them. • Verilog supports four values for nets. They are 21 June 2020 4yayavaram@yahoo.com
  • 5. contd • Examples of net types are wire a; wire sum; wire S1 = 1’b0; similarly wire S2= 4’b0101 • The second statement declares a net by the name sum. • The third statement declares a net by the name of S1 ; its initial value is 1’b0, which represents 1 bit with value 0. • Similarly ,initial value of S2 is 4 bit with value 0101 21 June 2020 5yayavaram@yahoo.com
  • 6. contd • A wire does not store its value. It must be driven in one of two ways: (i).By connecting the wire to the output of a gate or module (ii).By assigning a value to the wire in a continuous assignment. wire y : assign y = a & b; 21 June 2020 6yayavaram@yahoo.com
  • 7. Contd • By default Nets are 1-bit values. But it can be a vector also. • For ex: wire [31:0]bus ; Here the size of the bus is 32 bit vector and it is a wire type. • All unconnected nets are set to ‘z’.(High impedance) • Also wire is always input , for standard interconnection. • Nets are used to model connections between continuous assignments and instantiations. 21 June 2020 7yayavaram@yahoo.com
  • 8. Example module mymux2_1(A,B,S,Y); //Port declaration output y; input A,B,S; //internal variable declarations Wire S1,A1,B1; not (S1,S); and1 (A1,A,S1); and2 (B1,B,S); Or(Y,A1,B1); endmodule21 June 2020 8yayavaram@yahoo.com
  • 9. contd • In the example, S, A1,B1 are declared as Wire. • Because they denote the interconnections and they are continuously driven by NOT,AND1 and AND2 gates. • By default they assume bit values.(either o or 1). 21 June 2020 9yayavaram@yahoo.com
  • 10. Different Net Types • Verilog supports different net types for synthesis. They are i. wire ii. wor (wired or) iii.Wand (wired and) iv.Tri (tristate) v.supply0 (gnd) vi.supply1 (Vdd). • Here wire and Tri state serve the same purpose. • s. 21 June 2020 10yayavaram@yahoo.com
  • 11. contd • The net types wire and tri shall be identical in their syntax and functions; • Two names are provided so that the name of a net can indicate the purpose of the net in that model. • A wire net can be used for nets that are driven by a single gate or continuous assignment. • The tri net type can be used where multiple drivers drive a net.. 21 June 2020 11yayavaram@yahoo.com
  • 12. Different Types of Nets. • wor /wand inserts an or/and gate at the connection as shown below. • Suppose we have a connection shown below. • The simulator will give an error . • So, if we use wand (wired and) the synthesis tool during synthesis will add an add gate as shown below. Similarly ,if wor is used an or gate is added at the connection,which solves the conflict. • s.21 June 2020 12yayavaram@yahoo.com
  • 13. Different Net Types • wired and(wand circuit) wired or (wor circuit) • s. 21 June 2020 13yayavaram@yahoo.com
  • 14. Ex: Supply 0 & Supply1 21 June 2020 14yayavaram@yahoo.com • Normally, the during the synthesis, the tool will consider Supply0 as ground and Supply1 as Vdd. • Let us consider an example. module supply_ex(A,B,C,Y); input A,B,C; output Y; wire t1,t2; supply0 gnd; supply1 Vdd;
  • 15. contd 21 June 2020 15yayavaram@yahoo.com nand1(t1,Vdd,A,B); X-or2(t2,C, gnd); and3(Y,t1,t2); endmodule So, the tool during the synthesis, will treat the supply0 as ground and Supply1 as Vdd.
  • 16. REGISTER(Reg) • Register, in contrast to nets, stores values until they are updated. Register, as its name suggests, represents data-storage elements. Register is declared by the predefined word reg. • Verilog supports four values shown below, for register 21 June 2020 16yayavaram@yahoo.com
  • 17. contd • Different register types are supported by Verilog for Synthesis. • Reg (register) • integer • General rule of thumb is,reg is used to model actual hardware registers such as Counters, Accumulators etc. • Integer is used for situations like loop counting. • By default the size of the register is bit • Ex: reg x,y21 June 2020 17yayavaram@yahoo.com
  • 18. VECTORS • Vectors are multiple bits. A register or a net can be declared as a vector. • Vectors are declared by brackets [ ]. • Examples of vectors are: • wire [31:0] a = 32’b1010; • reg [7:0] total = 8’d12; • The first statement declares a net a. It has 32 bits, and its initial value is 00…1010 (b stands for bit). The second statement declares a register total. • Its size is eight bits, and its value is decimal 12 (d stands for decimal).21 June 2020 18yayavaram@yahoo.com
  • 19. Real • Floating point values are denoted by Real. • These Real (floating-point) numbers are declared with the predefined word ‘ real ‘. • Examples of real values are 2.4, 56.3, and 5e12 ( • The value 5e12 is equal to 5 × 1012. • The following statement declares the register weight as real: • real weight; 21 June 2020 19yayavaram@yahoo.com
  • 20. Parameter • A parameter represents constant value symbolically. • The definition for a parameter consists of the parameter name and the value assigned to it. • The value can be any constant-valued integer or Boolean expression. • If you do not set the size of the parameter with a range definition or a sized constant, the parameter is unsized and by default it is a 32-bit quantity 21 June 2020 20yayavaram@yahoo.com
  • 21. Example module my_comp1 (X, Y, xgty, xlty, xeqy); parameter N = 3; input [N:0] X, Y; output xgty, xlty, xeqy; wire [N:0] sum, Y; To change the size of the inputs x and y, the size of the nets sum, and the size of net Y to eight bits, the value of N is changed to seven as: • parameter N = 7 21 June 2020 21yayavaram@yahoo.com
  • 22. ARRAYS Verilog, in contrast to VHDL, does not have a predefined word for array. • Registers and integers can be written as arrays. For example: • parameter N = 4; • parameter M = 3; • reg signed [M:0] carry [0:N]; • The above statements declare an array by the name carry. The array carry has five elements, and each element is four bits. The four bits are in two’s complement form. For example, if the value of a certain element is 1001, then it is equivalent to decimal –7.21 June 2020 22yayavaram@yahoo.com
  • 23. Time-variable 21 June 2020 23yayavaram@yahoo.com • A time variable is used for storing and manipulating simulation time quantities in situations where timing checks are required and for diagnostics and debugging purposes. • This data type is typically used in conjunction with the $time system function.
  • 24. INTEGERS 21 June 2020 24yayavaram@yahoo.com • An integer is a general-purpose variable used for manipulating quantities that are not regarded as hardware registers i.e for loops-indicies, parameters, and constants. • They are of implicitly of type reg. However they store data as signed numbers whereas explicitly declared reg types store them as unsigned. • The default size of Integer is 32-bits. • If they hold constants, the synthesis tool will adjusts them to the minimum width needed at compilation.
  • 25. contd • An integer declaration uses the integer keyword and specifies a list of variables. • integer a, b; //two integers • integer c [1:10]; // an array of integers. • integer data; // integer • integer i, j, k; // multiple integers • An integer is a general purpose 32-bit variable. Operations on it are assumed to be two's complement and the most significant bit indicates the sign. 21 June 2020 25yayavaram@yahoo.com