Verilog supports two main data types, which are converted into hardware during synthesis.
Prior to discussing Data Types in detail, let us discus about the values assigned to these data types.
Verilog supports four types of values for modelling the hardware.
Value | Description |
---|---|
0 | Logic high (True Value) |
1 | Logic low (False Value) |
X | Unknown Logic Value (Don’t Care Value) |
Z | High Impedance (Floating pin) |
Nets represents the actual connections between the hardware elements or signals. Nets are inferred as actual wires in real hardware implementation. Nets can only be driven using continuous assignment and not in procedural assignment.
Nets are defined using wire keyword in Verilog code.
For example,
If a wire is left uninitialized after declaration, it will take a high impedance value (Z), i.e. it will be in floating state as its default value.
Register data type represent a storage element. Data is stored in the registers only in the Procedural assignment blocks in Verilog.
Registers are defined using reg keyword in Verilog code.
For example,
Whenever a register is defined, it takes a don’t care value (X), as its default state.
Verilog support other data types, namely – integer, real and time data types.
These can be referred to as derived register data types.
Integer:
Real:
Time:
We can declare some user-defined constant values using the keyword parameter. These parameters can be overridden while simulation. This can facilitate us to develop a more generalised Verilog code.
Travel New York London IKEA NORWAY DIY Ideas Baby Family News Clothing Shopping Sports Games