There are a variety of operators in Verilog that perform various operations on operands. Arithmatic operators perform arithmatic operations like addition, subtraction, multiplication and modulus. The five arithmatic operators are given in the code snippet below (assume the variables are declared in the module):

`begin`

Y1=A+B;//addition

Y2=A-B;//subtraction

Y3=A*B;//multiplication

Y4=A/B;//division

Y5=A%B;//modulus of A divided by B

end

Relational operators compare two variables/operands and returns whether the relation is true or false. They are used in conditional expressions. These operators are shown below along with one example of their use in an 'if-statement'.

`begin`

Y1=A<B;//less than

Y2=A<=B;//less than or equal to

Y3=A>B;//greater than

if (A>B)

Y4=1;

else

Y4=0;

end

Sign operator can be used to assign a postive (+) or a negative(-) sign to a variable. If no sign is assigned, it is automatically assumed that the variable is positive.

Furthermore, there are equality and inequality operators. These are different from assignment operators. They are used for conditional expressions and compare values of two parameters and return a true or false. For example A==B returns 1 if A is equal to B and 0 otherwise. Similarly A!=B is the inequality operator and this expresssion returns 1 if A is not equal to B.

Conditional expressions sometimes also use logical operations for comparison of two parameters. These logical operators are logical OR and Logical AND. Logical OR is performed by the operator: ||, while logical AND is performed by the operator &&. Notice that the comparison operation is different from bit wise operation, in which case OR is done by a single | and AND operation is performed by single ampersand &. Bit-wise XOR is performed by the operator ^.

If ~ sign preceeds any bitwise operation, it means it is performing the inverting fucntion. NOR is done by ~|, NAND is done by ~& and XNOR is done by ~^.