Home Verilog Tutorial Data Types
Main Menu
System Verilog
    - Tutorial
        -- Introduction
        -- Lexical Tokens
        -- Gate-Level Modelling
        -- Data Types
        -- Operators
        -- Operands
        -- Modules
        -- Behavioral Modeling
        -- Timing Controls
        -- Procedures
        -- Functions
        -- Tasks
        -- Component Inference
        -- Finite State Machines
        -- Compiler Directives
        -- System Tasks and Functions
        -- Test Benches
    - Examples
    - Tools
    - Links
    - Books
    - Interview Questions
Open Vera
Digital Concepts
Verification Basics
Interview Questions
Computer Architechture
C and C++
AsicGuru Blog
Tags Cloud
Usefull Sites
Know Your IP/Location
Local Information India
Buy Car/Inverter Batteries
Real Estate India
Sports Accessories India
Verilog : Data Types
Share This Articale:

Data Types

Value Set

Verilog consists of only four basic values. Almost all Verilog data types store all these values:
  0 (logic zero, or false condition)
  1 (logic one, or true condition)
  x (unknown logic value)                x and z have limited use for synthesis.
  z (high impedance state)

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. See “Functions” on p. 19, and “Procedures: Always and Initial Blocks” on p. 18. 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. Other specific types of wires include:
  wand (wired-AND);:the value of a wand depend on logical AND of all the drivers connected to it.
  wor (wired-OR);: the value of a wor depend on logical OR of all the drivers connected to it.
  tri (three-state;): all drivers connected to a tri must be z, except one (which determines the value of the tri).

wire [msb:lsb] wire_variable_list;
wand [msb:lsb] wand_variable_list;
wor [msb:lsb] wor_variable_list;

tri [msb:lsb] tri_variable_list;

Verilog Datatype Example 1

A reg (register) is a data object that holds its value from one procedural assignment to the next. They are used only in functions and procedural blocks. See “Wire” on p. 4 above. A reg is a Verilog variable type and does not necessarily imply a physical register. In multi-bit registers, data is stored as unsigned numbers and no sign extension is done for what the user might have thought were two’s complement numbers.


reg [msb:lsb] reg_variable_list;

Verilog Datatype Example 2

Input, Output, Inout
These keywords declare input, output and bidirectional ports of a module or task. Input and inout ports are of type wire. An output port can be configured to be of type wire, reg, wand, wor or tri. The default is wire.


input [msb:lsb] input_port_list;

output [msb:lsb] output_port_list;

inout [msb:lsb] inout_port_list;

Verilog Datatype Example 3

Integers are general-purpose variables. For synthesois they are used mainly loops-indicies, parameters, and constants. See“Parameter” on p. 5. They are of implicitly of type reg. However they store data as signed numbers whereas explicitly declared reg types store them as unsigned. If they hold numbers which are not defined at compile time, their size will default to 32-bits. If they hold constants, the synthesizer adjusts them to the minimum width needed at compilation.


integer integer_variable_list;
... integer_constant ... ;


Verilog Datatype Example Integer

Supply0, Supply1
Supply0 and supply1 define wires tied to logic 0 (ground) and logic 1 (power), respectively.


supply0 logic_0_wires;
supply1 logic_1_wires;


Verilog Datatype supply0, supply1 Example

Time is a 64-bit quantity that can be used in conjunction with the $time system task to hold simulation time. Time is not supported for synthesis and hence is used only for simulation purposes.


time time_variable_list;


Verilog Datatype Time Example

A parameter defines a constant that can be set when you instantiate a module. This allows customization of a module during instantiation.


parameter par_1 = value,
           par_2 = value, .....;
parameter [range] parm_3 = value


Verilog Datatype Parameter Example

This Articles is written/submitted by puneet (Puneet Aggarwal). You can also contribute to Asicguru.com. Click here to start

Prev << Gate-Level Modelling

Next >> Operators

Sign In
Login with :-
| | |  
  • Bookmark