Phoenixminer 5 3 b

Comment

Author: Admin | 2025-04-28

Arithmetic Operators Binary: +, -, *, /, % (the modulus operator) Unary: +, - (This is used to specify the sign) Integer division truncates any fractional part The result of a modulus operation takes the sign of the first operand If any operand bit value is the unknown value x, then the entire result value is x Register data types are used as unsigned values (Negative numbers are stored in two's complement form) Example 1 module arithmetic_operators(); 2 3 initial begin 4 $display (" 5 + 10 = %d", 5 + 10); 5 $display (" 5 - 10 = %d", 5 - 10); 6 $display (" 10 - 5 = %d", 10 - 5); 7 $display (" 10 * 5 = %d", 10 * 5); 8 $display (" 10 / 5 = %d", 10 / 5); 9 $display (" 10 / -5 = %d", 10 / -5); 10 $display (" 10 %s 3 = %d","%", 10 % 3); 11 $display (" +5 = %d", +5); 12 $display (" -5 = %d", -5); 13 #10 $finish; 14 end 15 16 endmoduleYou could download file arithmetic_operators.v here 5 + 10 = 15 5 - 10 = -5 10 - 5 = 5 10 * 5 = 50 10 / 5 = 2 10 / -5 = -2 10 % 3 = 1 +5 = 5 -5 = -5 Relational Operators OperatorDescriptiona a less than ba > b a greater than ba a less than or equal to ba >= b a greater than or equal to b The result is a scalar value (example a 0 if the relation is false (a is bigger then b) 1 if the relation is true ( a is smaller then b) x if any of the operands has unknown x bits (if a or b

Add Comment