Introduction to VerilogHDL Module 1 Part3 Procedural Assignments
Introduction to VerilogHDL Module 1 Part3 Procedural Assignments
Y V Appa Rao
2024-2025
Outline
Assignments in Verilog
Procedural assignments
w.k.t Concurrent statements are useful in modeling
Combinational logic
Synchronous Sequential logic: Unlike Combinational logic,
Sequential logic circuits are sensitive to events on the clock
signal (Positive edge or Negative edge)
Input changes are sensed by the Sequential logic only at the
specified clock edge and the output and state changes occur
on the respective edge of the clock signal
Modeling Sequential logic: Primitives to model ”selective
activity conditional on clock, Edge triggered elements,
sequence of operations (Setting or Resetting)” etc. are
required
Types of Procedural assignments for modeling Sequential
logic: ”Initial” and ”always” blocks
Y V Appa Rao VLSI Design (Module I)
Procedural assignments
Introduction to Verilog HDL
References
Procedural assignments
Initial block
Initial blocks execute only once at time zero (Simulation time)
All the statements within the block are executed; don’t wait
for an event
Useful in Simulation and Verification
initial blcoks are not synthesizable, i.e., they can’t be
translated into hardware
declaration: initial begin //Sequential-statements end
Procedural assignments
always block
always blocks execute repeatedly
All the statements within the block are executed; based on an
event
Useful in Simulation and Verification (like clock signal or any
other periodic signal generation)
always blcoks are synthesizable, for e.g. a Synchronous counter
can be described in Verilog using Procedual assignments
(if-else or case statement)
declaration: always @(sensitivity-list) begin
//Sequential-statements end
The variables to which values are to be assigned in an always
block should be of type ”reg”, other data tpes are illegal
Procedural assignments
always block
Sequential statements: When an always statement is used, the
statements between the ”begin” and the ”end” are executed
sequentially rather than concurrently
Sensitivity list: The always block gets executed whenever any
signal in the sensitivity list changes
”@” symbol should be used before the sensivity list
Whenever any signal in the sensitivity list changes, the
sequential statements in the always block are executed
sequentially, one time
When an always block finishes executing, it goes back to the
beginning and waits for a signal in the sensitivity list to change
again
Procedural assignments
always block
”*” operator: A ”*” in the sensitivity list causes always block
to execute whenever any one of the signal in the list changes
Assignment operator: Outside the always block the assignment
is a ”Concurrent assignment”
Types of evaluation for Sequential statements in an always
block: (i) Blocking assignment (ii) Non-Blocking assignment
Blocking assignment: A blocking assignment has to be
completed before the next statement gets executed
”=” operator is used for blocking assignments
Non-Blocking assignment: Allows succeedng statements to be
evaluated without blocking the flow
Several assignments can be evaluated at the same time, as
they are non-blocking in nature
Procedural assignments
always block
Statements in the ”always” block can be executed at the same
time if they are non-blocking, otherwise they are executed
sequentially
”always” block can be used for modeling Combinational logic
and Sequential logic
However, ”always” statements are not necessary for modeling
Combinational logic
Procedural assignments
always block
”=” assignment operator is concurrential outside the always
block, while it is sequential in nature inside the always block
(Blocking)
Use non-blocking assignments in ”always” blcok for
”Sequential” logic, while blocking assignments for
”Combinational” logic
Noe: Don’t mix blocking and non-blocking assignments in the
same always block
If the sensitivity list is omitted, delays or time-controlled events
must be specified inside the always block
References