Module 4 -21ec32
Module 4 -21ec32
Introduction to Verilog
&
Verilog Data Flow Description
Dr.Zahira Tabassum
Associate Professor,
Dept of ECE,HKBKCE
Course Objectives
ii. Register
• Register, in contrast to nets, stores values until they are
updated.
• Register is declared by the predefined word reg.
Ex: reg Sum_total;
iii. Vector
• Vectors are multiple bits.
• A register or a net can be declared as a vector.
• Vectors are declared by brackets [ ].
Ex : wire [3:0] a = 4’b1010;
reg [7:0] total = 8’d12;
iv. Integers
• Integers are declared by the predefined word integer.
Ex: integer no_bits;
v. Real
• Real (floating-point) numbers are declared with the predefined
word real.
Ex: 2.4, 56.3, and 5e12.
real weight;
vi. Parameter
• Parameter represents a global constant.
• It is declared by the predefined word parameter.
Ex: module compr_genr (X, Y, xgty, xlty, xeqy);
parameter N = 3;
input [N:0] X, Y;
output xgty, xlty, xeqy;
wire [N:0] sum, Yb;
vii. Arrays
• Verilog, in contrast to VHDL, does not have a predefined word
for array.
• Registers and integers can be written as array.
Ex: reg marks [0:3];
In the above ex, marks is defined as array with four elements in
it namely marks[0], marks[1], marks[2], marks[3].
parameter N = 4;
parameter M = 3;
reg signed [M:0] carry [0:N];
In the above example carry is declared as an array of 5
elements, each element is 4 bits each.
Styles of Descriptions
Behavioral Description
• A behavioural description models the system as to how the
outputs behave with the inputs.
• Module includes predefined word always or initial.
Data-Flow Description
• Describes how the system flows from the inputs to the
outputs.
• Description is written using boolean function of the outputs.
• Data flow statements are concurrent, their execution is
controlled by events.
Structural Description
• They model the system as components or gates.
Data Flow description
• Signal Declaration And Assignment Statement