Therefore, AND of true and false will give you false (0). Hence, Logical value of 3 is true(1) and for 0, it is false(0). Let’s say we have to perform logical and operation between 3 (non-zero) and 0 (zero). Logical operators perform a logical operation on the logical value of the operands and tell you whether it is true or false, i.e., it returns a boolean value. $display ("modulus(data1,data2) = %d", data1 % data2) $display ("divide(data1,data2) = %d", data1 / data2) $display ("multiply(data1,data2) = %d", data1 * data2) $display ("subtract(data1,data2) = %d", data1 - data2) module arithmetic_operations ĭata2 = 9 $display ("add(data1,data2) = %d", data1 + data2) Now that we have an idea of what arithmetic operators are, we can see how they are used in Verilog using a sample program as an example. 32'd10/5 // will yield incorrect result Since Verilog converts negative numbers into 2’s complement internally, writing in ' format will yield incorrect result. Note: It is advisable to write negative numbers in real or integer format.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |