Verilog Operators

(1 vote, average 5.00 out of 5)

Operators in Verilog are the same as operators in programming languages. They take two values and compare or operate on them to yield a new result. Nearly all the operators in Verilog are exactly the same as the ones in the C programming language.

Operator Type Operator Symbol Operation Performed
Arithmetic * Multiply
/ Division
+ Addition
- Subtraction
% Modulus
+ Unary plus
i Unary minus
Relational > Greater than
< Less Than
>= Greater than or equal to
<= Less than or equal to
Equality == Equality
!= Inequality
Logical ! Logical Negation
&& Logical And
|| Logical Or
Shift >> Right Shift
<< Left Shift
Conditional ? Conditional
Reduction ~ Bitwise negation
~& Bitwise nand
| Bitwise or
~| Bitwise nor
^ Bitwise xor
^~ Bitwise xnor
~^ Bitwise xnor
Concatenation
{} Concatenation

 

Examples:

x = y + z;  //x will get the value of y added to the value of z

x = 1 >> 6;   //x will get the value of 1 shifted right by 5 positions

x = !y    //x will get the value of y inverted. If y is 1, x is 0 and vise versa

Partner Links:
Last Updated on Monday, 19 July 2010 11:26  
Related Articles

» For Loops in Python

For loops in Python are a bit different than most languages.  You may not iterate over some integer and increment as you go.  Rather, python uses for loops to iterate over lists or strings (represented as lists).  Python also does not use brackets to determine scope, but rather indentation.  Example below.  123>>> x = [1, 2, 3]>>> for value in x: #begin for loop, note the colon>>> print x #part of the loop, indented in In some cases, you want to know the where in...

» How To Take a Screenshot On Mac OS X

To take a screenshot on an Apple computer running Mac OS X, you simply use the 'Grab' application. You can open the 'Grab' application by searching for its title in the spotlight menu.Once the application is open, select 'Capture' from the menu bar and select the type of screenshot you would like to take.The four different types of screenshots are:Selection - This allows you to take a screenshot of part of the screen defined by you.Window - This allows you to take a screenshot of a single...

» How to Undo a File Move, Copy, or Delete with a Hotkey

As long as you have not permanently deleted a file by emptying the recycling bin or deleting the file with shift + delete, you can easily undo a file move, copy, or deletion using the control + z hotkey.