Graham, and others The name compiler directive does not clearly indicate when a certain item is processed. However, it should be processed by the time a module that needs it is parsed, or it should be lazy evaluated at compile time. This is actually an implementers issue that should not be resolved in the language definition. What I do think is important is what kind of expression is allowable here. To prevent all kinds of nastiness I think the restrictions posed in the syntax I described would fit most uses: make it evaluate to a numerical value. This allows processing at parse time, as well as lazy evaluation at compile time. Does this answer your concern? By the way, the syntax was not complete, as the nesting using parentheses was missing, and there was an error in the same rule. The following rules should fix that. compiler_directive_constant_primary ::= decimal_number | real_number | compiler_directive_constant_expression_macro_call | '(' compiler_directive_constant_expression ')' compiler_directive_constant_expression_macro_definition ::= '`define' compiler_directive_constant_expression_macro_name compiler_directive_constant_expression compiler_directive_constant_expression_macro_call ::= '`' compiler_directive_constant_expression_macro_name I find the whole section on compiler directives rather vague - it implicitly seems to assume familiarity with the C preprocessor, but whereas cpp is a (completely) separate pass over the input text, the `default_discipline, `default_transition and `timescale directives make a similar approach extremely hard to impossible. As a result, the definitions should be more rigorous, and the syntax should definitely appear in the Annex A of the LRM. As another example, the LRM does not state when macro calls inside macro text should be expanded, so: `define A 2 `define B (`A + `A) `define A 1 module x; parameter value = `B; endmodule Will x.value have an initil value of 4 or 2? Regards, Marq Marq Kole Competence Leader Analog Simulation, Philips ED&T Helwig Graham-A11558 <Graham.Helwig@freescale.com> 12-05-2005 10:15 To: Tamhankar Prasanna-A14507 <Prasanna.Tamhankar@freescale.com> Marq Kole/EHV/RESEARCH/PHILIPS@PHILIPS cc: verilog-ams@eda.org Subject: RE: `default_transition Classification: Hello Marq, Prasanna and others, After thinking about it a little further, the following `default_transition directive can be either correct or incorrect. It just depends when the directive argument is applied w.r.t. parsing of the file. `define SCALE (3.112) `default_transition (timescale*`SCALE) module example (); electrical net; parameter real timescale = 1n; real value; analog begin .... V(net) <+ transition(value, 0.0); end endmodule If this is done during parsing, then the directive argument can be treated as macro_text syntax. If the directive is applied after parsing, then the directive argument would have to be treated as expression syntax. The LRM is not clear when this directive should be applied. Regards Graham -----Original Message----- From: owner-verilog-ams@eda.org [mailto:owner-verilog-ams@eda.org]On Behalf Of Tamhankar Prasanna-A14507 Sent: Thursday, 12 May 2005 4:40 PM To: 'Marq Kole' Cc: verilog-ams@eda.org Subject: RE: `default_transition Hi Marq, Glad you raised it, I agree, reducing it to a single real number is too harsh, Graham Helwig and I were discussing this issue few days ago to allow things like `default_transition (`SCALE*`TIMESCALE) i.e. allow operators and expressions as long as they can be reduced to a single real number pre-simulation. Graham will forward you the syntax snippet we were discussing regarding the transition_time. Regards, Prasanna ------------------------------------------------------ Prasanna Tamhankar Freescale Semiconductors, Adelaide +61 8 81683585 ------------------------------------------------------ -----Original Message----- From: Marq Kole [mailto:marq.kole@philips.com] Sent: Wednesday, 11 May 2005 5:24 PM To: Tamhankar Prasanna-A14507 Cc: 'verilog-ams@eda.org' Subject: Re: `default_transition Prasanna and others, I think reducing the constant_expression in this case to a single real number is a bit too harsh. What is needed is the concept of a compiler directive constant expression, that can only contain integers, reals, arithmetic operators, and macros (in a limited form). This would allow such things as: `default_transition 1.2 * `MY_DEFAULT_TRANSITION_TIME So the syntax would become: default_transition_compiler_directive ::= `default_transition transition_time transition_time ::= compiler_directive_constant_expression compiler_directive_constant_expression ::= compiler_directive_constant_primary | unary_operator compiler_directive_constant_primary | compiler_directive_constant_expression binary_operator compiler_directive_constant_expression compiler_directive_constant_primary ::= decimal_number | real_number | compiler_directive_constant_expression_macro compiler_directive_constant_expression_macro ::= `define text_macro_name compiler_directive_constant_expression On the other hand, if the only actual use of the default transition compiler directive is with numbers only, I have no problem with reducing the constant expression to a real number. I do think that it is useful to have access to macros as that would allow more control over this compiler directive, for instance from the command line -- assuming the simulator/compiler supports the definition of macros from the command line (which is not in the standard). Regards, Marq Marq Kole Competence Leader Analog Simulation, Philips ED&T Tamhankar Prasanna-A14507 <Prasanna.Tamhankar@freescale.com> Sent by: owner-verilog-ams@eda.org 03-05-2005 09:48 To: "'verilog-ams@eda.org'" <verilog-ams@eda.org> cc: (bcc: Marq Kole/EHV/RESEARCH/PHILIPS) Subject: `default_transition Classification: Hi all, Currently, the syntax for `default_transition is default_transition_compiler_directive ::= `default_transition transition_time transition_time ::= constant_expression Because `default_transition can *only* be outside a module scope, one cannot have any constant_expression for the transition_time (because constant_expression includes module specific things too, like parameter_identifier) , this should be changed to transition_time ::= real_number Thanks, Prasanna ------------------------------------------------------ Prasanna Tamhankar Freescale Semiconductors, Adelaide +61 8 81683585 ------------------------------------------------------Received on Thu May 12 02:57:52 2005
This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 02:57:54 PDT