Marq - My simulator gives the correct answer, which is zero. If you are expecting a non-zero answer, then you probably need to re-read the postings on "integer division" started by Arpad a short while ago. :) (ii-16) is an integer, 2 is an integer, so (ii-16)/2 is integer division and yields 0. Now, since `M_PI is a real, the 0 is coerced to a real to perform the multiplication. -Geoffrey Marq Kole wrote: > > All, > > I've found a piece of very simple looking Verilog-A code which nevertheless produces some very interesting results without giving a compilation error/warning or a run-time error/warning. Just try performing a DC simulation with the following model: > > `include "constants.h" > `include "discipline.h" > > module arith (a, b); > inout a, b; > electrical a, b; > > integer ii; > > analog begin > > @(initial_step) begin > ii = 15; > $display("ii = %d, (ii-16)/2*`M_PI = %g", ii, (ii-16)/2*`M_PI); > end > > end > > endmodule // arith > > I have found erroneous answers with at least two simulators: is this something that needs attention in the standard? > > Regards, > MarqReceived on Thu Jan 26 10:35:44 2006
This archive was generated by hypermail 2.1.8 : Thu Jan 26 2006 - 10:36:23 PST