Data that cannot be processed is quite useless, there'll always be some form calculation required in digital circuits and computer systems. Let's look at some of the operators in Verilog that would enable synthesis tools realize appropriate hardware elements.

Arithmetic

If the second operand of a division or modulus operator is zero, then the result will be X. If either operand of the power operator is real, then the result will also be real. The result will be 1 if the second operand of a power operator is 0 (a^{0}).

Operator

Description

a + b

a plus b

a - b

a minus b

a * b

a multiplied by b

a / b

a divided by b

a % b

a modulo b

a ** b

a to the power of b

An example of how arithmetic operators are used is given below.

ncsim> run
Add + = 54
Sub - = 36
Mul * = 149
Div / = 5
Mod % = 0
Pow ** = 81
ncsim: *W,RNQUIE: Simulation is complete.

Relational

An expression with the relational operator will result in a 1 if the expression is evaluated to be true, and 0 if it is false. If either of the operands is X or Z, then the result will be X. Relational operators have a lower precedence than arithmetic operators and all relational operators have the same precedence.