0% found this document useful (0 votes)
22 views

Timing Controls1

This document discusses different types of timing controls and conditional statements in Verilog. It covers regular and intra-segment delays, zero delays, event-based timing using regular, named and level-sensitive events. Conditional statements include if-else, case, casex, casez. Looping statements include while, for, repeat and forever loops.

Uploaded by

sruthi
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

Timing Controls1

This document discusses different types of timing controls and conditional statements in Verilog. It covers regular and intra-segment delays, zero delays, event-based timing using regular, named and level-sensitive events. Conditional statements include if-else, case, casex, casez. Looping statements include while, for, repeat and forever loops.

Uploaded by

sruthi
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 23

Blocking And Non-blocking

Statements.
PROCESSING OF NON-BLOCKING
STATEMENTS
TIMING CONTROLS
Delay based timing control
• Specifies the duration between when the
statement is encountered and when it is
executed.
• Delays are specified by a symbol #.
• Three types of delay control:
 Regular delay
 Intra segment
 Zero delay
Regular delay
• Used when a non zero delay is specified to
the left of a procedural statement.
Intra segment delay
• Specifying the delay to the left of the assignment, it is possible
to assign a delay to the right of the assignment.
Difference between regular and intra segment

Regular Intra Segment


• Defer the • Delays compute the right hand side
expression at the current time and
execution of the
defer the assignment of the
entire assignment. computed value to the left hand side
• #5 c=a+b; • These delays are like regular delays
with a temporary variable to store the
current value.
• C=#5 a+b;
• Temp = a+b;
• #5 c= temp
Zero delay
• Different always –
initial blocks evaluated
at the same simulation
time.
• The order of execution
of these blocks is
nondeterministic.
• This is a method to
ensure, that a statement
is executed last.
EVENT BASED DELAY
• An event is the change in the value on a
register/net.
• Utilized to trigger execution of a statement or a
block of statements.
• Four types of event-based timing control:
 Regular event control
 Named event control
 Event OR control
 Level-sensitive timing control
REGULAR EVENT CONTROL

• The @ symbol is used to specify an event control.


• Statements can be executed on changes in signal
value or at a positive or negative transition.
NAMED EVENT CONTROL
• It can declare an event and then trigger and recognize the occurrence of that event.
• Event doesn’t hold any data.
• Declared by keyword event.
• Event triggered by symbol ->
• Recognized by symbol @.
Event OR Control
• A transition on any one of multiple signals or events can
trigger the execution of a statement or a block of statements.
• Expressed as an OR of events or signals.
• List of events or signals expressed as an OR is also known as
sensitivity list.
Level-sensitive Timing Control

• The symbol @ provided edge-sensitive control.


• It also allows level-sensitive, ability to wait for
a certain condition to be true before a statement
or a block of statements is executed.
• The keyword is wait is used for level-sensitive.
Conditional Statements
• Used for making decisions upon conditions
• Conditions decide the execution of the
statement or not.
• Keywords if and else are used for conditional
statements.
• Three types of conditional statements:
IF and ELSE
Multi-way Branching
• The nested if-else can become large if there
are too many alternatives.
• Same result is achieved by using case
statement.
• The keywords case, end case and default are
used.
Example for 4 to 1 MUX
Casex, casez keywords
• Two variations of the case statement, denoted
by:
• Casez: treats all z values in the case
alternatives or case expressions as don’t cares.
• Casex: treats all z values in the case
alternatives or case expressions as don’t cares.
Loops
• Four types of looping statements
1. While
2. For
3. Repeat
4. Forever
• All looping statements can appear only
inside an initial and always block.
While Loop
• Executes until the while expression is not true.
• If the loop is entered when the while
expression is not true, the loop is not
executed at all.
For loop
• The for loop contains three parts:
1. An initial condition
2. Terminating condition is true
3. Procedural assignment to change value of the
control variable
Repeat loop
• Executes the loop a fixed number of times.
Forever loop
• The loop doesn’t contain any expression and
executes forever until the $finish task is
encountered.

You might also like