SystemVerilog for Design: A Guide to Using SystemVerilog for Hardware Design and Modeling, Second Edition

Chapter 7: SystemVerilog Procedural Statements

Overview

SystemVerilog adds several new operators and procedural statements to the Verilog language that allow modeling more concise synthesizable RTL code. Additional enhancements convey the designer s intent, helping to ensure that all software tools interpret the procedural statements in the same way. This chapter covers the operators and procedural statements that are synthesizable, and offers guidelines on how to properly use these new constructs.

This SystemVerilog features presented in this chapter include:

  • New operators

  • Enhanced for loop

  • New do while bottom testing loop

  • New foreach loop

  • New jump statements

  • Enhanced block names

  • Statement labels

  • Unique and priority decisions

7.1 New Operators

7.1.1 Increment and decrement operators

++ and -- operators

SystemVerilog adds the ++ increment operator and the -- decrement operator to the Verilog language. These operators are used in the same way as in C. For example:

<b class="bold">for</b> (i = 0; i <= 31; i++ ) <b class="bold">begin</b>  ...<b class="bold">end</b>

Post-increment and pre-increment

As in C, the increment and decrement operators can be used to either pre-increment/pre-decrement a variable, or to post-increment/post-decrement a variable. Table 7-1 shows the four ways in which the increment and decrement operators can be used.

Table 7-1: Increment and decrement operations

Statement

Operation

Description

j = i++;

post-increment

j is assigned the value of i, and then i is incremented by 1

j = ++i;

pre-increment

i is incremented by 1, and j is...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Fire Alarm Control Panels
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.