keysymbols: *, /, +, -, %
The binary operators are multiply, divide, add, subtract and modulus used as shown in the examples below.
module arithTest; reg [3:0] a, b; initial begin a = 4'b1100; // 12 b = 4'b0011; // 3 $displayb(a * b); // multiplication, evaluates to 4'b1000 // the four least significant bits of 36 $display(a / b); // division, evaluates to 4 $display(a + b); // addition, evaluates to 15 $display(a - b); // subtraction, evaluates to 9 $display((a + 1'b1) % b); // modulus, evaluates to 1 end endmodule // arithTest
Note If any bit of an operand is unknown: x, then the result of any arithmetic operation is also unknown.