HI David, Hi Geoffrey,
Thank you for the quick answers.
My initial concern was to know if the following (dummy because
over-simplified) mixed module is legal
module test_real ;
real r = 1.0 ;
analog begin end
always @(r) $display("r has changed (r=%f)",r) ;
endmodule
If 'r' has analog domain '@(r)' is illegal ('r' is not a digital
expression). The rule suggested by both of you
make the module legal (with 'r' having a digital domain).
Regards,
Luc
Geoffrey.Coram wrote:
> I remember this was brought up when we were talking about variable
> declarations
> with initializations. It used to be that you could only do
> real x;
> at module scope, and any assignments had to be done in a digital or
> analog block,
> so then you'd know the domain.
>
> I agree with David's reading of 7.2.2 -- since it's not in the analog
> block,
> everything else is said to be in the digital context.
>
> I also wonder why it matters, if there's only that one assignment --
> effectively, x is a constant for your module. It's not changing, so you
> don't care whether the changes are computed on the `timescale or
> otherwise.
>
> -Geoffrey
>
>
>
>
> David Miller wrote:
>> Hi Luc,
>>
>> This is not clearly defined. My take on this is since the statement
>> appears outside of an analog block the context of the assignment is
>> in the digital domain, hence this is a digital variable (refer
>> Section 7.2.2 Contexts - LRM 2.3.1)
>> But some may also argue that since default domain for variables is
>> analog (is that even explicitly stated?) it is just as valid to treat
>> 'x' in your case as analog.
>>
>> To clear up this ambiguity we have added the "analog initial" block
>> (similar to the digital "initial") to allow users to initialise
>> variables etc. in the analog context prior to simulation (so before
>> initial_step blocks fire).
>>
>> Hope this helps
>>
>> Cheers...
>> Dave
>>
>> On 05/06/2010 07:53 AM, Luc Rebillard wrote:
>>> Hello,
>>>
>>> According to the LRM, the domain of a variable (integer, real) is
>>> determinated by the context in which this variable
>>> is assigned. This recalled, I wonder what is the domain of the variable
>>> 'x' is the following module
>>>
>>> module test ;
>>>
>>> real x = 1.0 ;
>>>
>>> analog @(initial_step) $display("x=%f",x) ;
>>>
>>> initial $display("x=%f",x) ;
>>>
>>> endmodule
>>>
>>> Thanks,
>>>
>>> Regards,
>>>
>>> Luc
>>>
>>
>
-- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Fri May 7 08:58:41 2010
This archive was generated by hypermail 2.1.8 : Fri May 07 2010 - 08:58:52 PDT