You are on page 1of 12

VERILOG-DATA TYPES

INTRODUCTION
• Data types used to represent the data storage and transmission
elements found in digital hardware
• Verilog consists of only four basic values

  0 (logic zero, or false condition)


  1 (logic one, or true condition)
  x (unknown logic value)
  z (high impedance state)
• In addition to logic values strength levels are used to solve
conflicts between drivers of different strengths.
STRENGTH LEVEL
CLASSIFICATION

NET DATATYPE REGISTER DATATYPE


The nets variables represent the physical  The register variables are used in procedural blocks
connection between structural entities. which store values from one assignment to the next.
do not store values (except trireg); have the value  Some register data types are: reg, integer, time and
of their drivers which changes continuously by the real.
driving circuit.  reg is the most frequently used type.
Some net data types are wire, tri, wor, trior, wand,
 Reg is used for describing integer for loop variables
triand, tri0, tri1, supply0, supply1 and trireg and calculations, real in system modules,
• wire is the most frequently used type. A net data and time and realtime for storing simulation times in
type must be used when a signal is: test benches.
• driven by the output of some device.
• declared as an input or in-out port.
• on the left-hand side of a continuous assignment .
NET DATATYPES
• The net variables represent the physical connection between structural entities such as logic gates.
• Default value of net is z(except trireg whose value is x)

wiret1

Wire t2
Net datatypes

1. Wire
A wire represents a physical wire in a circuit and is used to connect gates or
modules. The value of a wire can be read, but not assigned to, in a function or
block.
 A wire does not store its value but must be driven by a continuous
assignment statement or by connecting it to the output of a gate or module.
 Wire and tri have same syntax and function
 Keyword wire denotes single drivers
 Keyword tri denotes nets that have multiple drivers
NET DATATYPES
 Trireg
 Used to model nets having capacitance that stores values.
 Nets of type trireg are in one of the 2 states
 Driven state:atleast one driver has values 0,1,x and value is continuosly stored in the trireg net
 Capacitive state: all drivers have high impedence and the net hold the last driven value
 Tri0 and tri 1
 Used to model pull up and pull down devices
 Tri0 =0 if nothing is driving the net
 Tri1=1 if nothing is driving the network
Net datatypes

 Supply 0 and suppply1


 Supply 0 used to model a power supply
 Supply 1 used to model ground
 Nets declared as supply0 and supply 1 has constant logic values
 Wor,wand,trior and triand
 Used to resolve conflicts between different drivers without using strength leves.
 Nets wand perform AND operation on multiple drivers
 If any value is 0 wand value will be 0
 Nets wor perform OR operation
 If any value is 1 wor value will be 1
 Trior and triand performs same operation as that of wand and wor
REGISTERS

 They are data storage elements


 They retain their value until replaced by another value
 Its not identical to hardware registers
 Here its just a variable that can hold a value and also no need for a driver
 Default value of reg is x
REGISTERS

 Integer
 It is used to declare integers.
 Example :- integer count ; //assume that count is an integer value.
 It is signed.
 It is synthesizable .
 Default size is 32 bit.
 Real
 Used to declare the floating point values.
 Default size is 64 bit.
 Not synthesizable .
REGISTERS

 Time
 This is used to record the simulation time .
 Default size is 64 bit .
 Not synthesizable .
 Example :- time snapshot ;
THANK YOU

You might also like