Professional Documents
Culture Documents
Veilog HDL Presentation
Veilog HDL Presentation
Veilog HDL Presentation
Presented by
T.Kaliraja M.E, A.P/ECE
C.Sridhar ME, LECT./ECE
Department of Electronics and Communication
Engineering,
S K R Engineering College,
Agarmel.
Veilog HDL definition
In the semiconductor and electronic design industry,
Verilog is a hardware description language (HDL)
used to model electronic systems.
Examples Notes
Adder legal identifier name
The Verilog HDL has 8 logic strengths: 4 driving, 3 capacitive, and high impedance (no
strength).
Syntax
size'base value Sized integer in a specific radix (base)
size (optional) is the number of bits in the number. Unsized integers default to
at least 32-bits.
base (optional) represents the radix. The default base is decimal.
Base Symbol Legal Values
Binary b or B 0, 1, x, X, z, Z, ?, _
Octal o or O 0-7, x, X, z, Z, ?, _
Decimal d or D 0-9, _
Hexadecimal h or H 0-9, a-f, A-F, x, X, z, Z, ?, _
The ? is another way of representing the Z logic value.
When size is less than value, the upper bits are truncated.
When size is larger than value, and the left-most bit of value is 0
or 1, zeros are left-extended to fill the size.
When size is larger than value, and the left-most bit of value is Z or X, the Z or
X is left-extended to fill the size.
Syntax
value.value decimal notation
Base E exponent scientific notation (the E is not case sensitive)
Syntax
module module_name (port_name, port_name, ... );
module_items
Endmodule
module_items are:
module_port_declarations
data_type_declarations
module_instances
primitive_instances
procedural_blocks
continuous_assignments
task_definitions
function_definitions
specify_blocks
Module functionality may be:
Behavioral - modeled with procedural blocks or continuous
assignment statements.
Structural - modeled as a netlist of module instances or
primitive instances.
A combination of behavioral and structural.
Module definitions may not be nested. Instead, modules instantiate other
modules.
Module definitions may be expressed using parameter constants.
Each instance of a module may redefine the parameters to be unique to that
instance.
Module items may appear in any order, but port declarations and data type
declarations should be listed before the ports or signals are referenced.
Module Port Declarations
Syntax
port_direction [port_size] port_name, port_name, ... ;
The msb and lsb must be literal integers, integer parameters, or an expression that
resolves to an integer constant.
Either little-endian convention (the lsb is the smallest bit number) or big-endian
convention (the lsb is the largest bit number) may be used.
The maximum port size may be limited, but will be at least 256 bits.
Examples Notes
delay (optional) may only be specified on net data types. The syntax is the same as
primitive delays.
size is a range from [msb : lsb] (most-significant-bit to least-significant-bit).
The msb and lsb must be integers, integer parameters or an
expression that resolves to an integer constant.
Either little-endian convention (the lsb is the smallest bit number) or
big-endian convention (the lsb is the largest bit number) may be
used.
The maximum vector size is at least 65,536 bits (216).
array_size is from [ first_address : last_address].
first_address and last_address must be integers, integer parameters, or an
expression that resolves to integer.
Either ascending or descending address order may be used.
The maximum array size is at least 16,777,216 words (224).
strength (optional) is specified as (strength1, strength0) or (strength0, strength1).
See Logic Strengths for keywords.
decay_time (optional) specifies the amount of time a trireg net will store a charge
after all drivers turn-off, before decaying to logic X. The syntax is (rise_delay,
fall_delay, decay_time). The default decay is infinite.
Register Data Types
Keyword Functionality
Reg unsigned variable of any bit size
Integer signed 32-bit variable
Time unsigned 64-bit variable
real or realtime double-precision floating point variable
Keyword Functionality
wire or tri Simple interconnecting wire
wor or trior Wired outputs OR together
wand or triand Wired outputs AND together
Tri0 Pulls down when tri-stated
Tri1 Pulls up when tri-stated
Supply0 Constant logic 0 (supply strength)
Supply1 Constant logic 1 (supply strength)
Trireg Stores last value when tri-stated (capacitance strength)
Syntax
Port Order Connections
module_name instance_name [instance_array_range] (signal, signal, ... );
Port Name Connections
module_name instance_name [instance_array_range] (.port_name(signal),
(.port_name(signal), ...);
Port order instantiation lists signal connections in the same order as the port list in the module definition.
Unconnected ports are designated by two commas with no signal listed.
Port name instantiation lists the port name and signal connected to it, in any order.
instance_name (required) is used to make multiple instances of the same module unique from one
another.
instance_array_range (optional) instantiates multiple modules, each instance connected to separate bits
of a vector.