>-----Original Message----- >From: owner-verilog-ams@eda.org [mailto:owner-verilog-ams@eda.org] On Behalf Of Geoffrey.Coram >Sent: Wednesday, December 20, 2006 10:16 AM >To: Marq Kole >Cc: verilog-ams >Subject: Re: multiple analog blocks > >.... > >If the analog initial block is provided, I think there will be some compilers that are lazy and don't look for >other calculations to pull into the initialization. >Having the analog initial block in the LRM will give the vendors an excuse to be lazy. And when evaluating >models, if someone says "model X runs 2x slower than model Y on simulator A" then this will be held against >model X, even if the problem is simulator A. So then the authors of model X will have to do the work of >collecting all their initialization code. > > -Geoffrey > Geoffrey, relying on compiler optimization to extract the initialization statements does lead to other issues (beyond work for the compiler implementator!). In some situations it is not possible for the optimizer to figure out what the user wants. Putting once off calculations in some kind of initial block makes the intent much clearer to compiler (and probably to others who read the model as well). Two examples to consider are; Example 1: module foo; parameter h = 6; real y; analog begin y = h^2; if (y > 12.3) $strobe ("warning y is out-of-range"); ... endmodule The LRM requires that the warning would be printed every timestep but this may not be what the user intends, because y is just dependent on a parameter and maybe the user just wants the calculation of y and the warning to be printed just once. Example 2: module foo; // lots of parameter declarations real out; ... // lots of other declarations ... analog begin // initialization section ... // lots of variable initializations out = $random(); .... // equations ... // lots of statements, probes, contributions endmodule In this example 'out' will calculated to a new random value every time. However this may not be what the user intends. They may want it to be just calculated once. The user will have to rewrite his/her model to; @(initial_step) out = $random; However it does seem kind of awkward that users have to be aware of special cases like and consider what the optimizer can do and cannot do when they write their models. These are similar to the dilemmas that c-code compilers face as well. Often getting code to run faster is a matter of making the intent more clear to the c-code compiler. Thanks, --MartinReceived on Thu Dec 21 08:55:53 2006
This archive was generated by hypermail 2.1.8 : Thu Dec 21 2006 - 08:55:57 PST