Verilog OperatorsOperators perform an operation on one or more operands within an expression. An expression combines operands with appropriate operators to produce the desired functional expression. 1. Arithmetic OperatorsFor the FPGA, division and multiplication are very expensive, and sometimes we cannot synthesize division. If we use Z or X for values, the result is unknown. The operations treat the values as unsigned.
2. Bitwise OperatorsEach bit is operated, the result is the size of the largest operand, and the smaller operand is left extended with zeroes to the bigger operand's size.
3. Reduction OperatorsThese operators reduce the vectors to only one bit. If there are the characters z and x, the result can be a known value.
4. Relational OperatorsThese operators compare operands and results in a 1bit scalar Boolean value. The case equality and inequality operators can be used for unknown or high impedance values (z or x), and if the two operands are unknown, the result is a 1.
5. Logical OperatorsThese operators compare operands and results in a 1bit scalar Boolean value.
6. Shift OperatorsThese operators shift operands to the right or left, the size is kept constant, shifted bits are lost, and the vector is filled with zeroes.
7. Assignment OperatorsThere are three assignment operators, each of which performs different tasks, and are used with different data types:
8. Other OperatorsThese are operators used for condition testing and to create vectors.
9. Operators PrecedenceThe order of the table tells what operation is made first. The first one has the highest priority. The () can be used to override the default.
Next TopicVerilog always Block
